diff options
212 files changed, 17877 insertions, 5654 deletions
diff --git a/.buildbot/install.sh b/.buildbot/install.sh index b22f3aae0..8ddd77ec0 100755 --- a/.buildbot/install.sh +++ b/.buildbot/install.sh | |||
@@ -1,3 +1,5 @@ | |||
1 | #!/bin/bash | 1 | #!/bin/bash |
2 | 2 | ||
3 | cd doc/tutorial; make tutorial.html &> /dev/null; cd - | ||
4 | cd doc/doxygen; make full &> /dev/null; cd - | ||
3 | make install | 5 | make install |
@@ -1,3 +1,180 @@ | |||
1 | Sat, 3 Apr 2021 09:40:46 +0200 (08fe7735b) | ||
2 | handbook: Add section on commit messages and developer branches - Martin Schanzenbach | ||
3 | |||
4 | Thu, 1 Apr 2021 00:41:38 +0200 (9f340d5cc) | ||
5 | SETU: added some more perf messurement point for var message size - Elias Summermatter | ||
6 | |||
7 | Thu, 1 Apr 2021 00:15:43 +0200 (12bb61317) | ||
8 | SETU: fixed some bug in rand element gen and added variable payload for perfmance - Elias Summermatter | ||
9 | |||
10 | Wed, 31 Mar 2021 11:49:10 +0200 (902331756) | ||
11 | SETU: Added new operation parameters for performance tests - Elias Summermatter | ||
12 | |||
13 | Wed, 31 Mar 2021 11:16:38 +0200 (b5660e0a3) | ||
14 | SETU: imporved tests - Elias Summermatter | ||
15 | |||
16 | Tue, 30 Mar 2021 19:26:40 +0200 (ca4c9eae2) | ||
17 | UTIL/SCALARPRODUCT: Do not build ECC dlog or scalarproduct with incompatible libgcrypt versions (>=1.9.0) - Martin Schanzenbach | ||
18 | |||
19 | Mon, 22 Mar 2021 20:06:33 +0100 (a42d7df64) | ||
20 | fix #6808: gnunet-bcd card generation - Martin Schanzenbach | ||
21 | |||
22 | Thu, 18 Mar 2021 18:44:46 +0100 (7d85c27e9) | ||
23 | Fixed setu tests and state maschine - Elias Summermatter | ||
24 | |||
25 | Thu, 18 Mar 2021 17:55:24 +0100 (8cd1e1929) | ||
26 | Fixed some bug in the statemaschin implementation of setu - Elias Summermatter | ||
27 | |||
28 | Thu, 18 Mar 2021 16:07:40 +0100 (c4ccd7550) | ||
29 | Setu tests use gnunet internal functions to generate randum elements - Elias Summermatter | ||
30 | |||
31 | Thu, 18 Mar 2021 11:48:42 +0100 (f9ae0c23c) | ||
32 | Added working test with randum set - Elias Summermatter | ||
33 | |||
34 | Thu, 18 Mar 2021 08:45:31 +0100 (0d6237ae0) | ||
35 | Added some randum elemet generation test for setu - Elias Summermatter | ||
36 | |||
37 | Sun, 14 Mar 2021 14:04:00 +0100 (b47586e76) | ||
38 | add packaging notice; fix #5633 - Martin Schanzenbach | ||
39 | |||
40 | Tue, 9 Mar 2021 18:26:28 +0100 (0b2c0f22f) | ||
41 | IDENTITY: Fix wrong key construction for anonymous ECDSA identity - Martin Schanzenbach | ||
42 | |||
43 | Tue, 2 Mar 2021 17:16:18 +0100 (45ceb4fdf) | ||
44 | add base32 encoder/decoder - Christian Grothoff | ||
45 | |||
46 | Sun, 28 Feb 2021 13:51:25 +0100 (4cffc642c) | ||
47 | build: do not redefine AM_MAKEINFOHTMLFLAGS - Martin Schanzenbach | ||
48 | |||
49 | Sun, 28 Feb 2021 11:15:55 +0100 (eb8ca760c) | ||
50 | GANA: Use GANA generated header for GNS record types. Update handbook - Martin Schanzenbach | ||
51 | |||
52 | Tue, 23 Feb 2021 14:29:47 +0100 (d528f6cfb) | ||
53 | HELLO: Fix netdb.h nonsense with h_addr - Martin Schanzenbach | ||
54 | |||
55 | Tue, 23 Feb 2021 10:42:57 +0100 (74a234f0b) | ||
56 | HANDBOOK: Add some info on TNG - Martin Schanzenbach | ||
57 | |||
58 | Sun, 21 Feb 2021 20:56:47 +0100 (05040a491) | ||
59 | HELLO: Add test for NG API; fix extraction more - Martin Schanzenbach | ||
60 | |||
61 | Sun, 21 Feb 2021 16:44:51 +0100 (783a12b3c) | ||
62 | HELLO-TNG: Fix parsing; sill broken - Martin Schanzenbach | ||
63 | |||
64 | Sun, 21 Feb 2021 11:46:16 +0100 (f5439c229) | ||
65 | TNG: Add queue update handling - Martin Schanzenbach | ||
66 | |||
67 | Sun, 21 Feb 2021 10:53:34 +0100 (a3971a93c) | ||
68 | Add struct names for FS events. #6743 - Martin Schanzenbach | ||
69 | |||
70 | Thu, 18 Feb 2021 16:51:47 +0100 (8095b1a1b) | ||
71 | SetU move check to union - Elias Summermatter | ||
72 | |||
73 | Wed, 17 Feb 2021 18:00:43 +0100 (08adc88b4) | ||
74 | Setu integrated new phase full receiving as described in rfc draft - Elias Summermatter | ||
75 | |||
76 | Wed, 17 Feb 2021 17:32:23 +0100 (d5bf65f2b) | ||
77 | Renamed Phase Expect IBF Cont -> Expect IBF Last - Elias Summermatter | ||
78 | |||
79 | Wed, 17 Feb 2021 17:26:35 +0100 (d852cb5a6) | ||
80 | Renamed Phase Done -> Finished - Elias Summermatter | ||
81 | |||
82 | Wed, 17 Feb 2021 17:04:15 +0100 (be8897e14) | ||
83 | Renamed Phase inventory passive -> passive decoding - Elias Summermatter | ||
84 | |||
85 | Wed, 17 Feb 2021 15:57:46 +0100 (333459251) | ||
86 | Renamed Phase inventory active -> active decoding & Added idea folder to git ignore - Elias Summermatter | ||
87 | |||
88 | Sat, 30 Jan 2021 16:36:14 -0500 (5b152adc0) | ||
89 | use AS_VERSION_COMPARE instead of AX_COMPARE_VERSION - Thien-Thi Nguyen | ||
90 | |||
91 | Sat, 30 Jan 2021 08:37:12 -0500 (de1b87ea3) | ||
92 | fix #6722: use AX_COMPARE_VERSION - Thien-Thi Nguyen | ||
93 | |||
94 | Sat, 30 Jan 2021 12:41:15 +0100 (a5f200d53) | ||
95 | fix #6690 - Christian Grothoff | ||
96 | |||
97 | Thu, 28 Jan 2021 22:28:01 +0100 (a2169368b) | ||
98 | implement #6716 - Christian Grothoff | ||
99 | |||
100 | Thu, 7 Jan 2021 22:22:48 +0100 (4769344a7) | ||
101 | convert to GMT, not localtime in GNUNET_TIME_year_to_time - Christian Grothoff | ||
102 | |||
103 | Thu, 7 Jan 2021 10:26:54 +0100 (5b10ad755) | ||
104 | properly document return value of GNUNET_PROGRAM_run - Christian Grothoff | ||
105 | |||
106 | Sat, 2 Jan 2021 13:47:16 +0100 (eab08cec9) | ||
107 | do not output synthetic paths - Christian Grothoff | ||
108 | |||
109 | Sat, 2 Jan 2021 11:24:26 +0100 (0d4337da2) | ||
110 | fix /proc/PID/maps parser format string - Christian Grothoff | ||
111 | |||
112 | Thu, 31 Dec 2020 09:12:43 +0100 (ebd853c83) | ||
113 | do not use atomic write for configuration file, we may not have permissions to do this, also should not be necessary - Christian Grothoff | ||
114 | |||
115 | Wed, 30 Dec 2020 20:58:55 +0900 (c0465ff92) | ||
116 | RECLAIM: Fix quirky OIDC address handling - Martin Schanzenbach | ||
117 | |||
118 | Sat, 26 Dec 2020 14:15:58 +0900 (75a3a90fb) | ||
119 | RECLAIM: automatically purge dangling references - Martin Schanzenbach | ||
120 | |||
121 | Sat, 19 Dec 2020 18:43:38 +0100 (3636ea628) | ||
122 | change GNUNET_DISK_fn_write() to always do atomic writes and to NOT overwrite existing files; also change the return value to not return the size of the written file but GNUNET_OK on success, and integrate creating the directory if needed; breaks API, hence bumping libgnunetutil version - Christian Grothoff | ||
123 | |||
124 | Tue, 15 Dec 2020 04:54:32 -0500 (407765df1) | ||
125 | include Configuration Handbook in gnunet.info - Thien-Thi Nguyen | ||
126 | |||
127 | Tue, 15 Dec 2020 03:43:27 -0500 (db9d81947) | ||
128 | add pxref to ‘Config file format’ - Thien-Thi Nguyen | ||
129 | |||
130 | Tue, 15 Dec 2020 03:26:26 -0500 (52986bf33) | ||
131 | [doc] Add section "Config file format" - Thien-Thi Nguyen | ||
132 | |||
133 | Wed, 9 Dec 2020 23:00:07 +0100 (7d9592f20) | ||
134 | add GNUNET_CRYPTO_hash_context_copy() function - Christian Grothoff | ||
135 | |||
136 | Tue, 8 Dec 2020 16:50:27 +0900 (7ce054864) | ||
137 | RECLAIM: Return userinfo claims from cache - Martin Schanzenbach | ||
138 | |||
139 | Fri, 4 Dec 2020 17:36:35 +0100 (1346641a1) | ||
140 | gnunet-crypto-tvg: fix bogus label - Florian Dold | ||
141 | |||
142 | Fri, 4 Dec 2020 17:22:38 +0100 (4c10ff3b4) | ||
143 | gnunet-crypto-tvg: add verification mode - Florian Dold | ||
144 | |||
145 | Fri, 4 Dec 2020 14:52:45 +0100 (1a3070b15) | ||
146 | gnunet-crypto-tvg: output JSON, fix memleaks - Florian Dold | ||
147 | |||
148 | Sat, 21 Nov 2020 22:58:44 +0000 (d2e10ef67) | ||
149 | rps: fix another 'format not a string literal' warning - Daniel Golle | ||
150 | |||
151 | Mon, 16 Nov 2020 23:57:08 +0100 (91e8c2ff2) | ||
152 | rps: deal with currently unused code - Julius Bünger | ||
153 | |||
154 | Mon, 16 Nov 2020 23:36:12 +0100 (d30ec0f1f) | ||
155 | rps: comment ill-defined code - Julius Bünger | ||
156 | |||
157 | Mon, 16 Nov 2020 22:59:12 +0100 (0950b1df7) | ||
158 | rps: properly initialise memory - Julius Bünger | ||
159 | |||
160 | Mon, 16 Nov 2020 22:56:47 +0100 (266823196) | ||
161 | rps: use proper signedness - Julius Bünger | ||
162 | |||
163 | Mon, 16 Nov 2020 22:56:27 +0100 (89ea76819) | ||
164 | rps: use correct buffer sizes - Julius Bünger | ||
165 | |||
166 | Mon, 16 Nov 2020 22:55:49 +0100 (607211bb7) | ||
167 | rps: use correct types in format strings - Julius Bünger | ||
168 | |||
169 | Mon, 16 Nov 2020 22:53:30 +0100 (0108f132a) | ||
170 | rps: get rid of warnings about harmless uninitialized variables - Julius Bünger | ||
171 | |||
172 | Mon, 16 Nov 2020 04:54:21 +0100 (41000a00c) | ||
173 | rps: fix sources for multiple warnings - Julius Bünger | ||
174 | |||
175 | Sat, 14 Nov 2020 19:02:01 +0000 (ea18ebde8) | ||
176 | rps: fix format not a string literal and no format arguments - Daniel Golle | ||
177 | |||
1 | Sat, 14 Nov 2020 10:57:31 +0900 (de83cfe23) | 178 | Sat, 14 Nov 2020 10:57:31 +0900 (de83cfe23) |
2 | Updating ChangeLog for 0.14.0 - Martin Schanzenbach | 179 | Updating ChangeLog for 0.14.0 - Martin Schanzenbach |
3 | 180 | ||
@@ -580,6 +580,13 @@ Further Reading | |||
580 | * Using the webbrowser: | 580 | * Using the webbrowser: |
581 | https://bib.gnunet.org/ | 581 | https://bib.gnunet.org/ |
582 | 582 | ||
583 | Notes on Packaging | ||
584 | ================== | ||
585 | |||
586 | * GNUnet installs binaries which should not be called by the user into | ||
587 | $PREFIX/lib/gnunet/libexec. This folder must not be confused with the | ||
588 | $PREFIX/libexec. GNUnet does not install anything into the libexec dir | ||
589 | to compliant with https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html | ||
583 | 590 | ||
584 | Stay tuned | 591 | Stay tuned |
585 | ========== | 592 | ========== |
diff --git a/configure.ac b/configure.ac index 025c4fd0f..bdecddb1d 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -21,7 +21,7 @@ | |||
21 | # | 21 | # |
22 | AC_PREREQ(2.61) | 22 | AC_PREREQ(2.61) |
23 | # Checks for programs. | 23 | # Checks for programs. |
24 | AC_INIT([gnunet], [0.14.0], [bug-gnunet@gnu.org]) | 24 | AC_INIT([gnunet], [0.14.1], [bug-gnunet@gnu.org]) |
25 | AC_CONFIG_AUX_DIR([build-aux]) | 25 | AC_CONFIG_AUX_DIR([build-aux]) |
26 | 26 | ||
27 | # check for legacy option that is no longer supported (#5627) and fail hard | 27 | # check for legacy option that is no longer supported (#5627) and fail hard |
@@ -416,8 +416,16 @@ gcrypt=0 | |||
416 | NEED_LIBGCRYPT_API=1 | 416 | NEED_LIBGCRYPT_API=1 |
417 | NEED_LIBGCRYPT_VERSION=1.6.0 | 417 | NEED_LIBGCRYPT_VERSION=1.6.0 |
418 | 418 | ||
419 | 419 | # Check if we have libgcrypt >= 1.9. Some things do not work with it | |
420 | AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1) | 420 | gcrypt19=0 |
421 | AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:1.9.0", | ||
422 | [AC_MSG_WARN(["Some subsystems do not work with gcrypt >=1.9.0"]) | ||
423 | gcrypt=1 | ||
424 | gcrypt19=1], | ||
425 | [AM_PATH_LIBGCRYPT("$NEED_LIBGCRYPT_API:$NEED_LIBGCRYPT_VERSION", gcrypt=1)] | ||
426 | ) | ||
427 | AM_CONDITIONAL(HAVE_NOLIBGCRYPT19, | ||
428 | [test "$gcrypt19" = 0]) | ||
421 | AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]]) | 429 | AC_CHECK_DECLS([gcry_mpi_set_opaque_copy], [], [], [[#include <gcrypt.h>]]) |
422 | 430 | ||
423 | AS_IF([test $gcrypt = 0], | 431 | AS_IF([test $gcrypt = 0], |
@@ -558,6 +566,18 @@ AS_IF([test "x$include_manpages" = "xyes"], | |||
558 | # texinfo5 switches are used. This comes with no version checks, is | 566 | # texinfo5 switches are used. This comes with no version checks, is |
559 | # enabled only at distributors action (ie defaults to "no"). | 567 | # enabled only at distributors action (ie defaults to "no"). |
560 | # Mantis #3914 for more details (https://bugs.gnunet.org/view.php?id=3914) | 568 | # Mantis #3914 for more details (https://bugs.gnunet.org/view.php?id=3914) |
569 | # While GNU makeinfo 6.5 supports --css-ref=URL, | ||
570 | # makeinfo 4.8 (in NetBSD 8.0, macOS, and maybe other | ||
571 | # base) does only support --css-include=FILE. | ||
572 | # The only difference is a shorter html output and | ||
573 | # in 6.5 the ability to use refs instead of include. | ||
574 | # We prefer not to break builds in this case, so | ||
575 | # we use the include version which is backwards compatible | ||
576 | # and upwards compatible, while the ref variant is neither. | ||
577 | # In the 5.x version they added `--split=chapters|sections` in | ||
578 | # addition to `--split=nodes`. | ||
579 | # Hold on to your hats: In version 6.5 this is already removed, ffs. | ||
580 | # GNU Texinfo, please be more consistent than 1 version in switches. | ||
561 | AC_MSG_CHECKING(whether to enable texinfo4 switches) | 581 | AC_MSG_CHECKING(whether to enable texinfo4 switches) |
562 | AC_ARG_ENABLE([texinfo4], | 582 | AC_ARG_ENABLE([texinfo4], |
563 | [AS_HELP_STRING([--enable-texinfo4], [Use texinfo version 4 specific switches])], | 583 | [AS_HELP_STRING([--enable-texinfo4], [Use texinfo version 4 specific switches])], |
@@ -568,11 +588,15 @@ AS_IF([test "x$activate_texinfo4" = "xyes"], | |||
568 | [ | 588 | [ |
569 | AM_CONDITIONAL([ACTIVATE_TEXINFO4],true) | 589 | AM_CONDITIONAL([ACTIVATE_TEXINFO4],true) |
570 | AC_DEFINE([ACTIVATE_TEXINFO4],[1],[Using texinfo version 4 specific switches]) | 590 | AC_DEFINE([ACTIVATE_TEXINFO4],[1],[Using texinfo version 4 specific switches]) |
591 | TEXINFO_HTMLFLAGS="--no-split --css-include=style.css --css-include=manual.css" | ||
571 | ],[ | 592 | ],[ |
572 | AM_CONDITIONAL([ACTIVATE_TEXINFO4],false) | 593 | AM_CONDITIONAL([ACTIVATE_TEXINFO4],false) |
573 | AC_DEFINE([INCLUDE_MANPAGES],[0],[Using texinfo version 5 or later switches]) | 594 | AC_DEFINE([INCLUDE_MANPAGES],[0],[Using texinfo version 5 or later switches]) |
595 | TEXINFO_HTMLFLAGS="--no-split --css-ref='../style.css' --css-ref='../manual.css'" | ||
596 | |||
574 | ]) | 597 | ]) |
575 | 598 | ||
599 | AC_SUBST([TEXINFO_HTMLFLAGS]) | ||
576 | 600 | ||
577 | # Adam shostack suggests the following for Windows: | 601 | # Adam shostack suggests the following for Windows: |
578 | # -D_FORTIFY_SOURCE=2 -fstack-protector-all | 602 | # -D_FORTIFY_SOURCE=2 -fstack-protector-all |
@@ -1867,7 +1891,7 @@ AC_MSG_CHECKING(for source being under a VCS) | |||
1867 | git_version= | 1891 | git_version= |
1868 | AS_IF([test ! "X$gitcommand" = "X"], | 1892 | AS_IF([test ! "X$gitcommand" = "X"], |
1869 | [ | 1893 | [ |
1870 | git_version=$(cd $srcdir ; git rev-list --full-history --all --abbrev-commit | head -n 1 2>/dev/null) | 1894 | git_version=$(cd $srcdir ; git log -n1 --abbrev-commit | head -n1 | cut -d " " -f2 2>/dev/null) |
1871 | ]) | 1895 | ]) |
1872 | AS_IF([test "X$git_version" = "X"], | 1896 | AS_IF([test "X$git_version" = "X"], |
1873 | [ | 1897 | [ |
diff --git a/debian/changelog b/debian/changelog index bfc6394c1..0572e47fa 100644 --- a/debian/changelog +++ b/debian/changelog | |||
@@ -1,3 +1,9 @@ | |||
1 | gnunet (0.14.1-0) unstable; urgency=low | ||
2 | |||
3 | * New upstream release, bumping version. | ||
4 | |||
5 | -- Christian Grothoff <grothoff@gnu.org> Sun, 18 Apr 2021 14:02:10 +0100 | ||
6 | |||
1 | gnunet (0.14.0-8) unstable; urgency=low | 7 | gnunet (0.14.0-8) unstable; urgency=low |
2 | 8 | ||
3 | * Move libgnunetarm into libgnunet as well. | 9 | * Move libgnunetarm into libgnunet as well. |
diff --git a/debian/libgnunet.install b/debian/libgnunet.install index 7cf63853c..dd216d5ba 100644 --- a/debian/libgnunet.install +++ b/debian/libgnunet.install | |||
@@ -7,6 +7,7 @@ usr/lib/*/libgnunetutil.so.* | |||
7 | usr/share/locale/ | 7 | usr/share/locale/ |
8 | usr/share/gnunet/config.d/util.conf | 8 | usr/share/gnunet/config.d/util.conf |
9 | usr/bin/gnunet-arm | 9 | usr/bin/gnunet-arm |
10 | usr/bin/gnunet-base32 | ||
10 | usr/bin/gnunet-bugreport | 11 | usr/bin/gnunet-bugreport |
11 | usr/bin/gnunet-config | 12 | usr/bin/gnunet-config |
12 | usr/bin/gnunet-ecc | 13 | usr/bin/gnunet-ecc |
diff --git a/doc/Makefile.am b/doc/Makefile.am index eb23b534b..a9ad69954 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am | |||
@@ -1,4 +1,6 @@ | |||
1 | # This Makefile.am is in the public domain | 1 | # This Makefile.am is in the public domain |
2 | |||
3 | |||
2 | if DOCUMENTATION | 4 | if DOCUMENTATION |
3 | SUBDIRS = doxygen handbook tutorial | 5 | SUBDIRS = doxygen handbook tutorial |
4 | endif | 6 | endif |
diff --git a/doc/handbook/Makefile.am b/doc/handbook/Makefile.am index 0435796a9..d7bcab696 100644 --- a/doc/handbook/Makefile.am +++ b/doc/handbook/Makefile.am | |||
@@ -3,25 +3,8 @@ docdir = $(datadir)/doc/gnunet/ | |||
3 | 3 | ||
4 | infoimagedir = $(infodir)/images | 4 | infoimagedir = $(infodir)/images |
5 | 5 | ||
6 | if ACTIVATE_TEXINFO4 | 6 | AM_MAKEINFOHTMLFLAGS = $(TEXINFO_HTMLFLAGS) |
7 | # NOTE: While GNU makeinfo 6.5 supports --css-ref=URL, | 7 | |
8 | # makeinfo 4.8 (in NetBSD 8.0, macOS, and maybe other | ||
9 | # base) does only support --css-include=FILE. | ||
10 | # The only difference is a shorter html output and | ||
11 | # in 6.5 the ability to use refs instead of include. | ||
12 | # We prefer not to break builds in this case, so | ||
13 | # we use the include version which is backwards compatible | ||
14 | # and upwards compatible, while the ref variant is neither. | ||
15 | AM_MAKEINFOHTMLFLAGS = --no-split --css-include=style.css --css-include=manual.css | ||
16 | else | ||
17 | # In the 5.x version they added `--split=chapters|sections` in | ||
18 | # addition to `--split=nodes`. | ||
19 | # Hold on to your hats: In version 6.5 this is already removed, ffs. | ||
20 | # GNU Texinfo, please be more consistent than 1 version in switches. | ||
21 | # This however is compatible to version 5.2. Thanks, I hate it. | ||
22 | # AM_MAKEINFOHTMLFLAGS = --split=sections --css-ref="../style.css" --css-ref="../manual.css" | ||
23 | AM_MAKEINFOHTMLFLAGS = --no-split --css-ref="../style.css" --css-ref="../manual.css" | ||
24 | endif | ||
25 | 8 | ||
26 | dist_infoimage_DATA = \ | 9 | dist_infoimage_DATA = \ |
27 | images/gnunet-gtk-0-10-gns-a-done.png \ | 10 | images/gnunet-gtk-0-10-gns-a-done.png \ |
@@ -78,6 +61,25 @@ gnunet_TEXINFOS = \ | |||
78 | agpl-3.0.texi \ | 61 | agpl-3.0.texi \ |
79 | version.texi | 62 | version.texi |
80 | 63 | ||
64 | #if ACTIVATE_TEXINFO4 | ||
65 | # NOTE: While GNU makeinfo 6.5 supports --css-ref=URL, | ||
66 | # makeinfo 4.8 (in NetBSD 8.0, macOS, and maybe other | ||
67 | # base) does only support --css-include=FILE. | ||
68 | # The only difference is a shorter html output and | ||
69 | # in 6.5 the ability to use refs instead of include. | ||
70 | # We prefer not to break builds in this case, so | ||
71 | # we use the include version which is backwards compatible | ||
72 | # and upwards compatible, while the ref variant is neither. | ||
73 | #AM_MAKEINFOHTMLFLAGS = --no-split --css-include=style.css --css-include=manual.css | ||
74 | #else | ||
75 | # In the 5.x version they added `--split=chapters|sections` in | ||
76 | # addition to `--split=nodes`. | ||
77 | # Hold on to your hats: In version 6.5 this is already removed, ffs. | ||
78 | # GNU Texinfo, please be more consistent than 1 version in switches. | ||
79 | # This however is compatible to version 5.2. Thanks, I hate it. | ||
80 | # AM_MAKEINFOHTMLFLAGS = --split=sections --css-ref="../style.css" --css-ref="../manual.css" | ||
81 | #AM_MAKEINFOHTMLFLAGS = --split --css-ref="../style.css" --css-ref="../manual.css" | ||
82 | #endif | ||
81 | EXTRA_DIST = \ | 83 | EXTRA_DIST = \ |
82 | $(gnunet_TEXINFOS) \ | 84 | $(gnunet_TEXINFOS) \ |
83 | htmlxref.cnf \ | 85 | htmlxref.cnf \ |
diff --git a/doc/handbook/chapters/developer.texi b/doc/handbook/chapters/developer.texi index 369e5327c..9bb74c3de 100644 --- a/doc/handbook/chapters/developer.texi +++ b/doc/handbook/chapters/developer.texi | |||
@@ -82,6 +82,8 @@ new chapters, sections or insightful comments. | |||
82 | * REGEX Subsystem:: | 82 | * REGEX Subsystem:: |
83 | * REST Subsystem:: | 83 | * REST Subsystem:: |
84 | * RPS Subsystem:: | 84 | * RPS Subsystem:: |
85 | * TRANSPORT-NG Subsystem:: | ||
86 | * MESSENGER Subsystem:: | ||
85 | @end menu | 87 | @end menu |
86 | 88 | ||
87 | @node Developer Introduction | 89 | @node Developer Introduction |
@@ -687,6 +689,7 @@ Here you can find some rules to help you write code for GNUnet. | |||
687 | @menu | 689 | @menu |
688 | * Naming conventions:: | 690 | * Naming conventions:: |
689 | * Coding style:: | 691 | * Coding style:: |
692 | * Commit messages and developer branches:: | ||
690 | @end menu | 693 | @end menu |
691 | 694 | ||
692 | @node Naming conventions | 695 | @node Naming conventions |
@@ -1091,6 +1094,75 @@ fun (short i, | |||
1091 | 1094 | ||
1092 | @end itemize | 1095 | @end itemize |
1093 | 1096 | ||
1097 | @cindex Commit messages and developer branches | ||
1098 | @node Commit messages and developer branches | ||
1099 | @subsection Commit messages and developer branches | ||
1100 | |||
1101 | You can find the GNUnet project repositories at @uref{https://git.gnunet.org}. | ||
1102 | For each release, the ChangeLog file is generated from the commit history. | ||
1103 | Hence, commit messages are required to convey what changes were made in | ||
1104 | a self-contained fashion. Commit messages such as "fix" or "cleanup" are | ||
1105 | not acceptable. | ||
1106 | You commit message should ideally start with the subsystem name and be followed | ||
1107 | by a succinct description of the change. Where applicable a reference to | ||
1108 | a bug number in the bugtracker may also be included. | ||
1109 | Example: | ||
1110 | |||
1111 | @example | ||
1112 | # <subsystem>: <description>. (#XXXX) | ||
1113 | IDENTITY: Fix wrong key construction for anonymous ECDSA identity. (Fixes #12344) | ||
1114 | @end example | ||
1115 | |||
1116 | If you need to commit a minor fix you may prefix the commit message with a | ||
1117 | dash. It will then be ignored when generating the ChangeLog entries: | ||
1118 | |||
1119 | @example | ||
1120 | # -<text> | ||
1121 | -fix | ||
1122 | @end example | ||
1123 | |||
1124 | If you need to modify a commit you can do so using: | ||
1125 | |||
1126 | @example | ||
1127 | $ git commit --amend | ||
1128 | @end example | ||
1129 | |||
1130 | If you need to modify a number of successive commits you will have to rebase | ||
1131 | and squash. | ||
1132 | Note that most branches are protected. This means that you can only fix commits | ||
1133 | as long as they are not pushed. You can only modify pushed commits in your own | ||
1134 | developer branches. | ||
1135 | |||
1136 | A developer branch is a branch which matches a developer-specific prefix. | ||
1137 | As a developer with git access, you should have a git username. If you do not | ||
1138 | know it, please ask an admin. | ||
1139 | A developer branch has the format: | ||
1140 | |||
1141 | @example | ||
1142 | dev/<username>/<branchname> | ||
1143 | @end example | ||
1144 | |||
1145 | |||
1146 | Assuming the developer with username "jdoe" wants to create a new branch for an | ||
1147 | i18n fix, the branch name could be: | ||
1148 | |||
1149 | @example | ||
1150 | dev/jdoe/i18n_fx | ||
1151 | @end example | ||
1152 | |||
1153 | The developer will be able to force push to and delete branches under his prefix. | ||
1154 | It is highly recommended to work in your own developer branches. | ||
1155 | Code which conforms to the commit message guidelines and coding style, is tested | ||
1156 | and builds may be merged to the master branch. | ||
1157 | Preferably, you would then... | ||
1158 | |||
1159 | @itemize | ||
1160 | @item ...squash your commits, | ||
1161 | @item rebase to master and then | ||
1162 | @item merge your branch. | ||
1163 | @item (optional) Delete the branch. | ||
1164 | @end itemize | ||
1165 | |||
1094 | @c *********************************************************************** | 1166 | @c *********************************************************************** |
1095 | @node Build-system | 1167 | @node Build-system |
1096 | @section Build-system | 1168 | @section Build-system |
@@ -9474,3 +9546,447 @@ view are sampled through the sampler from the random stream of peer IDs. | |||
9474 | 9546 | ||
9475 | According to the theoretical analysis of Bortnikov et al. this suffices | 9547 | According to the theoretical analysis of Bortnikov et al. this suffices |
9476 | to keep the network connected and having random peers in the view. | 9548 | to keep the network connected and having random peers in the view. |
9549 | |||
9550 | @cindex TRANSPORT-NG Subsystem | ||
9551 | @node TRANSPORT-NG Subsystem | ||
9552 | @section TRANSPORT-NG Subsystem | ||
9553 | |||
9554 | The current GNUnet TRANSPORT architecture is rooted in the GNUnet 0.4 design | ||
9555 | of using plugins for the actual transmission operations and the ATS subsystem | ||
9556 | to select a plugin and allocate bandwidth. The following key issues have been | ||
9557 | identified with this design: | ||
9558 | |||
9559 | @itemize @bullet | ||
9560 | @item Bugs in one plugin can affect the TRANSPORT service and other plugins. | ||
9561 | There is at least one open bug that affects sockets, where the origin is | ||
9562 | difficult to pinpoint due to the large code base. | ||
9563 | @item Relevant operating system default configurations often impose a limit of | ||
9564 | 1024 file descriptors per process. Thus, one plugin may impact other | ||
9565 | plugin's connectivity choices. | ||
9566 | @item Plugins are required to offer bi-directional connectivity. However, | ||
9567 | firewalls (incl. NAT boxes) and physical environments sometimes only | ||
9568 | allow uni-directional connectivity, which then currently cannot be | ||
9569 | utilized at all. | ||
9570 | @item Distance vector routing was implemented in 209 but shortly afterwards | ||
9571 | broken and due to the complexity of implementing it as a plugin and | ||
9572 | dealing with the resource allocation consequences was never useful. | ||
9573 | @item Most existing plugins communicate completely using cleartext, exposing | ||
9574 | metad data (message size) and making it easy to fingerprint and | ||
9575 | possibly block GNUnet traffic. | ||
9576 | @item Various NAT traversal methods are not supported. | ||
9577 | @item The service logic is cluttered with "manipulation" support code for | ||
9578 | TESTBED to enable faking network characteristics like lossy connections | ||
9579 | or firewewalls. | ||
9580 | @item Bandwidth allocation is done in ATS, requiring the duplication of state | ||
9581 | and resulting in much delayed allocation decisions. As a result, | ||
9582 | often available bandwidth goes unused. Users are expected to manually | ||
9583 | configure bandwidth limits, instead of TRANSPORT using congestion control | ||
9584 | to adapt automatically. | ||
9585 | @item TRANSPORT is difficult to test and has bad test coverage. | ||
9586 | @item HELLOs include an absolute expiration time. Nodes with unsynchronized | ||
9587 | clocks cannot connect. | ||
9588 | @item Displaying the contents of a HELLO requires the respective plugin as the | ||
9589 | plugin-specific data is encoded in binary. This also complicates logging. | ||
9590 | @end itemize | ||
9591 | |||
9592 | |||
9593 | @menu | ||
9594 | * Design goals of TNG:: | ||
9595 | * HELLO-NG:: | ||
9596 | * Priorities and preferences:: | ||
9597 | * Communicators:: | ||
9598 | @end menu | ||
9599 | |||
9600 | @node Design goals of TNG | ||
9601 | @subsection Design goals of TNG | ||
9602 | |||
9603 | In order to address the above issues, we want to: | ||
9604 | |||
9605 | @itemize @bullet | ||
9606 | @item Move plugins into separate processes which we shall call | ||
9607 | @emph{communicators}. Communicators connect as clients to the transport | ||
9608 | service. | ||
9609 | @item TRANSPORT should be able to utilize any number of communcators to the | ||
9610 | same peer at the same time. | ||
9611 | @item TRANSPORT should be responsible for fragmentation, retransmission, | ||
9612 | flow- and congestion-control. Users should no longer have to configure | ||
9613 | bandwidth limits: TRANSPORT should detect what is available and use it. | ||
9614 | @item Commnunicators should be allowed to be uni-directional and unreliable. | ||
9615 | TRANSPORT shall create bi-directional channels from this whenever | ||
9616 | possible. | ||
9617 | @item DV should no longer be a plugin, but part of TRANSPORT. | ||
9618 | @item TRANSPORT should provide communicators help communicating (i.e. in the | ||
9619 | case of uni-directional communicators or the need for out-of-band | ||
9620 | signalling for NAT traversal). We call this functionality | ||
9621 | @emph{backchannels}. | ||
9622 | @item Transport manipulation should be signalled to CORE on a per-message basis | ||
9623 | instead of an approximate bandwidth. | ||
9624 | @item CORE should signal performance requirements (reliability, latency, etc.) | ||
9625 | on a per-message basis to TRANSPORT. If possible, TRANSPORT should | ||
9626 | consider those options when scheduling messages for transmission. | ||
9627 | @item HELLOs should be in a humman-readable format with monotonic time | ||
9628 | expirations. | ||
9629 | @end itemize | ||
9630 | |||
9631 | The new architecture is planned as follows: | ||
9632 | |||
9633 | |||
9634 | @image{images/tng,5in,,TNG architecture.} | ||
9635 | |||
9636 | TRANSPORT's main objective is to establish bi-directional virtual links using a | ||
9637 | variety of possibly uni-directional communicators. Links undergo the following | ||
9638 | steps: | ||
9639 | |||
9640 | @enumerate | ||
9641 | @item Communicator informs TRANSPORT A that a queue (direct neighbour) is | ||
9642 | available, or equivalently TRANSPORT A discovers a (DV) path to a target | ||
9643 | B. | ||
9644 | @item TRANSPORT A sends a challenge to the target peer, trying to confirm that | ||
9645 | the peer can receive. FIXME: This is not implemented properly for DV. | ||
9646 | Here we should really take a validated DVH and send a challenge exactly | ||
9647 | down that path! | ||
9648 | @item The other TRANSPORT, TRANSPORT B, receives the challenge, and sends back | ||
9649 | a response, possibly using a dierent path. If TRANSPORT B does not yet | ||
9650 | have a virtual link to A, it must try to establish a virtual link. | ||
9651 | @item Upon receiving the response, TRANSPORT A creates the virtual link. If the | ||
9652 | response included a challenge, TRANSPORT A must respond to this challenge | ||
9653 | as well, eectively re-creating the TCP 3-way handshake (just with longer | ||
9654 | challenge values). | ||
9655 | @end enumerate | ||
9656 | |||
9657 | @node HELLO-NG | ||
9658 | @subsection HELLO-NG | ||
9659 | |||
9660 | HELLOs change in three ways. First of all, communicators encode the respective | ||
9661 | addresses in a human-readable URL-like string. This way, we do no longer | ||
9662 | require the communicator to print the contents of a HELLO. | ||
9663 | Second, HELLOs no longer contain an expiration time, only a creation time. | ||
9664 | The receiver must only compare the respective absolute values. So given a HELLO | ||
9665 | from the same sender with a larger creation time, then the old one is no longer | ||
9666 | valid. This also obsoletes the need for the gnunet-hello binary to set HELLO | ||
9667 | expiration times to never. | ||
9668 | Third, a peer no longer generates one big HELLO that always contains all of the | ||
9669 | addresses. Instead, each address is signed individually and shared only over | ||
9670 | the address scopes where it makes sense to share the address. In particular, | ||
9671 | care should be taken to not share MACs across the Internet and confine their | ||
9672 | use to the LAN. | ||
9673 | As each address is signed separately, having multiple addresses valid at the | ||
9674 | same time (given the new creation time expiration logic) requires that those | ||
9675 | addresses must have exactly the same creation time. | ||
9676 | Whenever that monotonic time is increased, all addresses must be re-signed and | ||
9677 | re-distributed. | ||
9678 | |||
9679 | @node Priorities and preferences | ||
9680 | @subsection Priorities and preferences | ||
9681 | |||
9682 | In the new design, TRANSPORT adopts a feature (which was previously already | ||
9683 | available in CORE) of the MQ API to allow applications to specify priorities and | ||
9684 | preferences per message (or rather, per MQ envelope). | ||
9685 | The (updated) MQ API allows applications to specify one of four priority levels | ||
9686 | as well as desired preferences for transmission by setting options on an | ||
9687 | envelope. These preferences currently are: | ||
9688 | |||
9689 | @itemize @bullet | ||
9690 | @item GNUNET_MQ_PREF_UNRELIABLE: Disables TRANSPORT waiting for ACKS on | ||
9691 | unreliable channels like UDP. Now it is fire and forget. These messages | ||
9692 | then cannot be used for RTT estimates either. | ||
9693 | @item GNUNET_MQ_PREF_LOW_LATENCY: Directs TRANSPORT to select the | ||
9694 | lowest-latency transmission choices possible. | ||
9695 | @item GNUNET_MQ_PREF_CORK_ALLOWED: Allows TRANSPORT to delay transmission to | ||
9696 | group the message with other messages into a larger batch to reduce the | ||
9697 | number of packets sent. | ||
9698 | @item GNUNET_MQ_PREF_GOODPUT: Directs TRANSPORT to select the highest goodput | ||
9699 | channel available. | ||
9700 | @item GNUNET_MQ_PREF_OUT_OF_ORDER: Allows TRANSPORT to reorder the messages as | ||
9701 | it sees fit, otherwise TRANSPORT should attempt to preserve transmission | ||
9702 | order. | ||
9703 | @end itemize | ||
9704 | |||
9705 | Each MQ envelope is always able to store those options (and the priority), and | ||
9706 | in the future this uniform API will be used by TRANSPORT, CORE, CADET and | ||
9707 | possibly other subsystems that send messages (like LAKE). | ||
9708 | When CORE sets preferences and priorities, it is supposed to respect the | ||
9709 | preferences and priorities it is given from higher layers. Similarly, CADET also | ||
9710 | simply passes on the preferences and priorities of the layer above CADET. When a | ||
9711 | layer combines multiple smaller messages into one larger transmission, the | ||
9712 | @code{GNUNET_MQ_env_combine_options()} should be used to calculate options for | ||
9713 | the combined message. We note that the exact semantics of the options may differ | ||
9714 | by layer. For example, CADET will always strictly implement reliable and | ||
9715 | in-order delivery of messages, while the same options are only advisory for | ||
9716 | TRANSPORT and CORE: they should try (using ACKs on unreliable communicators, | ||
9717 | not changing the message order themselves), but if messages are lost anyway | ||
9718 | (i.e. because a TCP is dropped in the middle), or if messages are reordered | ||
9719 | (i.e. because they took dierent paths over the network and arrived in a | ||
9720 | different order) TRANSPORT and CORE do not have to correct this. Whether a | ||
9721 | preference is strict or loose is thus dened by the respective layer. | ||
9722 | |||
9723 | @node Communicators | ||
9724 | @subsection Communicators | ||
9725 | |||
9726 | The API for communicators is defined in | ||
9727 | @code{gnunet_transport_communication_service.h}. | ||
9728 | Each communicator must specify its (global) communication characteristics, which | ||
9729 | for now only say whether the communication is reliable (e.g. TCP, HTTPS) or | ||
9730 | unreliable (e.g. UDP, WLAN). Each communicator must specify a unique address | ||
9731 | prex, or NULL if the communicator cannot establish outgoing connections (i.e. | ||
9732 | is only acting as a TCP server). | ||
9733 | A communicator must tell TRANSPORT which addresses it is reachable under. | ||
9734 | Addresses may be added or removed at any time. A communicator may have zero | ||
9735 | addresses (transmission only). | ||
9736 | Addresses do not have to match the address prefix. | ||
9737 | |||
9738 | TRANSPORT may ask a communicator to try to connect to another address. | ||
9739 | TRANSPORT will only ask for connections where the address matches the | ||
9740 | communicator's address prefix that was provided when the connection was | ||
9741 | established. Communicators should then attempt to establish a connection. | ||
9742 | No response is provided to TRANSPORT service on failure. The TRANSPORT service | ||
9743 | has to ask the communicator explicitly to retry. | ||
9744 | |||
9745 | If a communicator succeeds in establishing an outgoing connection for | ||
9746 | transmission, or if a communicator receives an incoming bi-directional | ||
9747 | connection, the communicator must inform the TRANSPORT service that a message | ||
9748 | queue (MQ) for transmission is now available. For that MQ, the communicator must | ||
9749 | provide the peer identity claimed by the other end, a human-readable address | ||
9750 | (for debugging) and a maximum transfer unit (MTU). A MTU of zero means sending | ||
9751 | is not supported, SIZE_MAX should be used for no MTU. The communicator should | ||
9752 | also tell TRANSPORT what network type is used for the queue. The communicator | ||
9753 | may tell TRANSPORT anytime that the queue was deleted and is no longer | ||
9754 | available. | ||
9755 | |||
9756 | The communicator API also provides for flow control. First, communicators | ||
9757 | exhibit back-pressure on TRANSPORT: the number of messages TRANSPORT may add to | ||
9758 | a queue for transmission will be limited. So by not draining the transmission | ||
9759 | queue, back-pressure is provided to TRANSPORT. In the other direction, | ||
9760 | communicators may allow TRANSPORT to give back-pressure towards the | ||
9761 | communicator by providing a non-NULL | ||
9762 | @code{GNUNET_TRANSPORT_MessageCompletedCallback} | ||
9763 | argument to the @code{GNUNET_TRANSPORT_communicator_receive} function. In this | ||
9764 | case, TRANSPORT will only invoke this function once it has processed the message | ||
9765 | and is ready to receive more. Communicators should then limit how much traffic | ||
9766 | they receive based on this backpressure. Note that communicators do not have to | ||
9767 | provide a @code{GNUNET_TRANSPORT_MessageCompletedCallback}; | ||
9768 | for example, UDP cannot support back-pressure due to the nature of the UDP | ||
9769 | protocol. In this case, TRANSPORT will implement its own TRANSPORT-to-TRANSPORT | ||
9770 | flow control to reduce the sender's data rate to acceptable levels. | ||
9771 | |||
9772 | TRANSPORT may notify a communicator about backchannel messages TRANSPORT | ||
9773 | received from other peers for this communicator. Similarly, communicators can | ||
9774 | ask TRANSPORT to try to send a backchannel message to other communicators of | ||
9775 | other peers. The semantics of the backchannel message are up to the | ||
9776 | communicators which use them. | ||
9777 | TRANSPORT may fail transmitting backchannel messages, and TRANSPORT will not | ||
9778 | attempt to retransmit them. | ||
9779 | |||
9780 | @cindex MESSENGER Subsystem | ||
9781 | @cindex MESSENGER | ||
9782 | @cindex messenger | ||
9783 | @node MESSENGER Subsystem | ||
9784 | @section MESSENGER Subsystem | ||
9785 | |||
9786 | The MESSENGER subsystem is responsible for secure end-to-end communication in | ||
9787 | groups of nodes in the GNUnet overlay network. MESSENGER builds on the CADET | ||
9788 | subsystem which provides a reliable and secure end-to-end communication between | ||
9789 | the nodes inside of these groups. | ||
9790 | |||
9791 | Additionally to the CADET security benefits, MESSENGER provides following | ||
9792 | properties designed for application level usage: | ||
9793 | |||
9794 | @itemize @bullet | ||
9795 | @item MESSENGER provides integrity by signing the messages with the users | ||
9796 | provided ego | ||
9797 | @item MESSENGER adds (optional) forward secrecy by replacing the key pair of the | ||
9798 | used ego and signing the propagation of the new one with old one (chaining | ||
9799 | egos) | ||
9800 | @item MESSENGER provides verification of a original sender by checking against | ||
9801 | all used egos from a member which are currently in active use (active use | ||
9802 | depends on the state of a member session) | ||
9803 | @item MESSENGER offsers (optional) decentralized message forwarding between all | ||
9804 | nodes in a group to improve availability and prevent MITM-attacks | ||
9805 | @item MESSENGER handles new connections and disconnections from nodes in the | ||
9806 | group by reconnecting them preserving an efficient structure for message | ||
9807 | distribution (ensuring availability and accountablity) | ||
9808 | @item MESSENGER provides replay protection (messages can be uniquely identified | ||
9809 | via SHA-512, include a timestamp and the hash of the last message) | ||
9810 | @item MESSENGER allows detection for dropped messages by chaining them (messages | ||
9811 | refer to the last message by their hash) improving accountability | ||
9812 | @item MESSENGER allows requesting messages from other peers explicitly to ensure | ||
9813 | availibility | ||
9814 | @item MESSENGER provides confidentiality by padding messages to few different | ||
9815 | sizes (512 bytes, 4096 bytes, 32768 bytes and maximal message size from | ||
9816 | CADET) | ||
9817 | @item MESSENGER adds (optional) confidentiality with ECDHE to exchange and use | ||
9818 | symmetric encryption, encrypting with both AES-256 and Twofish but | ||
9819 | allowing only selected members to decrypt (using the receivers ego for | ||
9820 | ECDHE) | ||
9821 | @end itemize | ||
9822 | |||
9823 | Also MESSENGER provides multiple features with privacy in mind: | ||
9824 | |||
9825 | @itemize @bullet | ||
9826 | @item MESSENGER allows deleting messages from all peers in the group by the | ||
9827 | original sender (uses the MESSENGER provided verification) | ||
9828 | @item MESSENGER allows using the publically known anonymous ego instead of any | ||
9829 | unique identifying ego | ||
9830 | @item MESSENGER allows your node to decide between acting as host of the used | ||
9831 | messaging room (sharing your peer's identity with all nodes in the group) | ||
9832 | or acting as guest (sharing your peer's identity only with the nodes you | ||
9833 | explicitly open a connection to) | ||
9834 | @item MESSENGER handles members independantly of the peer's identity making | ||
9835 | forwarded messages indistinguishable from directly received ones ( | ||
9836 | complicating the tracking of messages and identifying its origin) | ||
9837 | @item MESSENGER allows names of members being not unique (also names are | ||
9838 | optional) | ||
9839 | @item MESSENGER does not include information about the selected receiver of an | ||
9840 | explicitly encrypted message in its header, complicating it for other | ||
9841 | members to draw conclusions from communication partners | ||
9842 | @end itemize | ||
9843 | |||
9844 | @menu | ||
9845 | * libgnunetmessenger:: | ||
9846 | * Member sessions:: | ||
9847 | @end menu | ||
9848 | |||
9849 | @node libgnunetmessenger | ||
9850 | @subsection libgnunetmessenger | ||
9851 | |||
9852 | The MESSENGER API (defined in @file{gnunet_messenger_service.h}) allows P2P | ||
9853 | applications built using GNUnet to communicate with specified kinds of messages | ||
9854 | in a group. It provides applications the ability to send and receive encrypted | ||
9855 | messages to any group of peers participating in GNUnet in a decentralized way ( | ||
9856 | without even knowing all peers's identities). | ||
9857 | |||
9858 | MESSENGER delivers messages to other peers in "rooms". A room uses a variable | ||
9859 | amount of CADET "channels" which will all be used for message distribution. Each | ||
9860 | channel can represent an outgoing connection opened by entering a room with | ||
9861 | @code{GNUNET_MESSENGER_enter_room} or an incoming connection if the room was | ||
9862 | opened before via @code{GNUNET_MESSENGER_open_room}. | ||
9863 | |||
9864 | @image{images/messenger_room,6in,,Room structure} | ||
9865 | |||
9866 | To enter a room you have to specify the "door" (peer's identity of a peer which | ||
9867 | has opened the room) and the key of the room (which is identical to a CADET | ||
9868 | "port"). To open a room you have to specify only the key to use. When opening a | ||
9869 | room you automatically distribute a PEER-message sharing your peer's identity in | ||
9870 | the room. | ||
9871 | |||
9872 | Entering or opening a room can also be combined in any order. In any case you | ||
9873 | will automatically get a unique member ID and send a JOIN-message notifying | ||
9874 | others about your entry and your public key from your selected ego. | ||
9875 | |||
9876 | The ego can be selected by name with the initial @code{GNUNET_MESSENGER_connect} | ||
9877 | besides setting a (identity-)callback for each change/confirmation of the used | ||
9878 | ego and a (message-)callback which gets called every time a message gets sent or | ||
9879 | received in the room. Once the identity-callback got called you can check your | ||
9880 | used ego with @code{GNUNET_MESSENGER_get_key} providing only its public key. The | ||
9881 | function returns NULL if the anonymous ego is used. If the ego should be | ||
9882 | replaced with a newly generated one, you can use @code{GNUNET_MESSENGER_update} | ||
9883 | to ensure proper chaining of used egos. | ||
9884 | |||
9885 | Also once the identity-callback got called you can check your used name with | ||
9886 | @code{GNUNET_MESSENGER_get_name} and potentially change or set a name via | ||
9887 | @code{GNUNET_MESSENGER_set_name}. A name is for example required to create a new | ||
9888 | ego with @code{GNUNET_MESSENGER_update}. Also any change in ego or name will | ||
9889 | automatically be distributed in the room with a NAME- or KEY-message | ||
9890 | respectively. | ||
9891 | |||
9892 | To send a message a message inside of a room you can use | ||
9893 | @code{GNUNET_MESSENGER_send_message}. If you specify a selected contact as | ||
9894 | receiver, the message gets encrypted automatically and will be sent as PRIVATE- | ||
9895 | message instead. | ||
9896 | |||
9897 | To request a potentially missed message or to get a specific message after its | ||
9898 | original call of the message-callback, you can use | ||
9899 | @code{GNUNET_MESSENGER_get_message}. Additionally once a message was distributed | ||
9900 | to application level and the message-callback got called, you can get the | ||
9901 | contact respresenting a message's sender respectively with | ||
9902 | @code{GNUNET_MESSENGER_get_sender}. This allows getting name and the public key | ||
9903 | of any sender currently in use with @code{GNUNET_MESSENGER_contact_get_name} | ||
9904 | and @code{GNUNET_MESSENGER_contact_get_key}. It is also possible to iterate | ||
9905 | through all current members of a room with | ||
9906 | @code{GNUNET_MESSENGER_iterate_members} using a callback. | ||
9907 | |||
9908 | To leave a room you can use @code{GNUNET_MESSENGER_close_room} which will also | ||
9909 | close the rooms connections once all applications on the same peer have left | ||
9910 | the room. Leaving a room will also send a LEAVE-message closing a member session | ||
9911 | on all connected peers before any connection will be closed. Leaving a room is | ||
9912 | however not required for any application to keep your member session open | ||
9913 | between multiple sessions of the actual application. | ||
9914 | |||
9915 | Finally, when an application no longer wants to use CADET, it should call | ||
9916 | @code{GNUNET_MESSENGER_disconnect}. You don't have to explicitly close the used | ||
9917 | rooms or leave them. | ||
9918 | |||
9919 | Here is a little summary to the kinds of messages you can send manually: | ||
9920 | |||
9921 | @menu | ||
9922 | * MERGE-message:: | ||
9923 | * INVITE-message:: | ||
9924 | * TEXT-message:: | ||
9925 | * FILE-message:: | ||
9926 | * DELETE-message:: | ||
9927 | @end menu | ||
9928 | |||
9929 | @node MERGE-message | ||
9930 | @subsubsection MERGE-message | ||
9931 | |||
9932 | MERGE-messages will generally be sent automatically to reduce the amount of | ||
9933 | parallel chained messages. This is necessary to close a member session for | ||
9934 | example. You can also send MERGE-messages manually if required to merge two | ||
9935 | chains of messages. | ||
9936 | |||
9937 | @node INVITE-message | ||
9938 | @subsubsection INVITE-message | ||
9939 | |||
9940 | INVITE-messages can be used to invite other members in a room to a different | ||
9941 | room, sharing one potential door and the required key to enter the room. This | ||
9942 | kind of message is typically sent as encrypted PRIVATE-message to selected | ||
9943 | members because it doesn't make much sense to invite all members from one room | ||
9944 | to another considering a rooms key doesn't specify its usage. | ||
9945 | |||
9946 | @node TEXT-message | ||
9947 | @subsubsection TEXT-message | ||
9948 | |||
9949 | TEXT-messages can be used to send simple text-based messages and should be | ||
9950 | considered as being in readable form without complex decoding. The text has to | ||
9951 | end with a NULL-terminator character and should be in UTF-8 encoding for most | ||
9952 | compatibility. | ||
9953 | |||
9954 | @node FILE-message | ||
9955 | @subsubsection FILE-message | ||
9956 | |||
9957 | FILE-messages can be used to share files inside of a room. They do not contain | ||
9958 | the actual file being shared but its original hash, filename, URI to download | ||
9959 | the file and a symmetric key to decrypt the downloaded file. | ||
9960 | |||
9961 | It is recommended to use the FS subsystem and the FILE-messages in combination. | ||
9962 | |||
9963 | @node DELETE-message | ||
9964 | @subsubsection DELETE-message | ||
9965 | |||
9966 | DELETE-messages can be used to delete messages selected with its hash. You can | ||
9967 | also select any custom delay relative to the time of sending the DELETE-message. | ||
9968 | Deletion will only be processed on each peer in a room if the sender is | ||
9969 | authorized. | ||
9970 | |||
9971 | The only information of a deleted message which being kept will be the chained | ||
9972 | hashes connecting the message graph for potential traversion. For example the | ||
9973 | check for completion of a member session requires this information. | ||
9974 | |||
9975 | @node Member sessions | ||
9976 | @subsection Member sessions | ||
9977 | |||
9978 | A member session is a triple of the room key, the member ID and the public key | ||
9979 | of the member's ego. Member sessions allow that a member can change their ID or | ||
9980 | their ego once at a time without loosing the ability to delete old messages or | ||
9981 | identifying the original sender of a message. On every change of ID or EGO a | ||
9982 | session will be marked as closed. So every session chain will only contain one | ||
9983 | open session with the current ID and public key. | ||
9984 | |||
9985 | If a session is marked as closed the MESSENGER service will check from the first | ||
9986 | message opening a session to its last one closing the session for completion. If | ||
9987 | a the service can confirm that there is no message still missing which was sent | ||
9988 | from the closed member session, it will be marked as completed. | ||
9989 | |||
9990 | A completed member session is not able to verify any incoming message to ensure | ||
9991 | forward secrecy preventing others from using old stolen egos. | ||
9992 | |||
diff --git a/doc/handbook/chapters/keyconcepts.texi b/doc/handbook/chapters/keyconcepts.texi index eb95dbf78..f429997bf 100644 --- a/doc/handbook/chapters/keyconcepts.texi +++ b/doc/handbook/chapters/keyconcepts.texi | |||
@@ -152,6 +152,7 @@ and @pxref{Deniability}. | |||
152 | 152 | ||
153 | @menu | 153 | @menu |
154 | * How file-sharing achieves Anonymity:: | 154 | * How file-sharing achieves Anonymity:: |
155 | * How messaging provides Anonymity:: | ||
155 | @end menu | 156 | @end menu |
156 | 157 | ||
157 | Providing anonymity for users is the central goal for the anonymous | 158 | Providing anonymity for users is the central goal for the anonymous |
@@ -231,6 +232,30 @@ GAP --- practical anonymous networking. In Proceedings of | |||
231 | Designing Privacy Enhancing Technologies, 2003. | 232 | Designing Privacy Enhancing Technologies, 2003. |
232 | (@uref{https://git.gnunet.org/bibliography.git/plain/docs/aff.pdf, https://git.gnunet.org/bibliography.git/plain/docs/aff.pdf}) | 233 | (@uref{https://git.gnunet.org/bibliography.git/plain/docs/aff.pdf, https://git.gnunet.org/bibliography.git/plain/docs/aff.pdf}) |
233 | 234 | ||
235 | @cindex How messaging provides Anonymity | ||
236 | @node How messaging provides Anonymity | ||
237 | @subsection How messaging provides Anonymity | ||
238 | |||
239 | While the file-sharing tries to achieve anonymity through hiding actions in | ||
240 | other traffic, the messaging service provides a weaker form of protection | ||
241 | against identification. | ||
242 | |||
243 | The messaging service allows the use of an anonymous ego for the signing and | ||
244 | verification process of messages instead of a unique ego. This anonymous ego is | ||
245 | a publically known key pair which is shared between all peers in GNUnet. | ||
246 | |||
247 | Using this ego only ensures that individual messages alone can't identify its | ||
248 | sender inside of a messenger room. It should be clarified that the route of | ||
249 | the traffic for each message can still be tracked to identify the senders peer | ||
250 | inside of a messenger room if the threat agent controls certain peers hosting | ||
251 | the room. | ||
252 | |||
253 | Also opening a room in the messenger service will potentially match your peer | ||
254 | identity with the internal member identity from the messenger service. So | ||
255 | despite using the anonymous ego you can reveal your peer identity. This means | ||
256 | to decrease the chance of being identified, it is recommended to enter rooms but | ||
257 | you should not open them for others. | ||
258 | |||
234 | @cindex Deniability | 259 | @cindex Deniability |
235 | @node Deniability | 260 | @node Deniability |
236 | @section Deniability | 261 | @section Deniability |
diff --git a/doc/handbook/chapters/user.texi b/doc/handbook/chapters/user.texi index ebc1a7979..b5889891b 100644 --- a/doc/handbook/chapters/user.texi +++ b/doc/handbook/chapters/user.texi | |||
@@ -28,6 +28,7 @@ always welcome. | |||
28 | * The GNU Name System:: | 28 | * The GNU Name System:: |
29 | * reclaimID Identity Provider:: | 29 | * reclaimID Identity Provider:: |
30 | * Using the Virtual Public Network:: | 30 | * Using the Virtual Public Network:: |
31 | * Using the GNUnet Messenger:: | ||
31 | @end menu | 32 | @end menu |
32 | 33 | ||
33 | @node Start and stop GNUnet | 34 | @node Start and stop GNUnet |
@@ -253,7 +254,6 @@ and development. | |||
253 | @subsection Creating a Business Card | 254 | @subsection Creating a Business Card |
254 | @c FIXME: Which parts of texlive are needed? Some systems offer a modular | 255 | @c FIXME: Which parts of texlive are needed? Some systems offer a modular |
255 | @c texlive (smaller size). | 256 | @c texlive (smaller size). |
256 | |||
257 | Before we can really use GNS, you should create a business card. | 257 | Before we can really use GNS, you should create a business card. |
258 | Note that this requires having @command{LaTeX} installed on your system. | 258 | Note that this requires having @command{LaTeX} installed on your system. |
259 | If you are using a Debian GNU/Linux based operating system, the | 259 | If you are using a Debian GNU/Linux based operating system, the |
@@ -261,6 +261,19 @@ following command should install the required components. | |||
261 | Keep in mind that this @b{requires 3GB} of downloaded data and possibly | 261 | Keep in mind that this @b{requires 3GB} of downloaded data and possibly |
262 | @b{even more} when unpacked. On a GNU Guix based system texlive 2017 has | 262 | @b{even more} when unpacked. On a GNU Guix based system texlive 2017 has |
263 | returns a DAG size of 5032.4 MiB. | 263 | returns a DAG size of 5032.4 MiB. |
264 | The packages which are confirmed to be required are: | ||
265 | |||
266 | @itemize @bullet | ||
267 | @item texlive-units | ||
268 | @item texlive-labels | ||
269 | @item texlive-pst-barcode | ||
270 | @item texlive-luatex85 | ||
271 | @item texlive-preview | ||
272 | @item texlive-pdfcrop | ||
273 | @item texlive-koma-script | ||
274 | @end itemize | ||
275 | |||
276 | |||
264 | @b{We welcome any help in identifying the required components of the | 277 | @b{We welcome any help in identifying the required components of the |
265 | TexLive Distribution. This way we could just state the required components | 278 | TexLive Distribution. This way we could just state the required components |
266 | without pulling in the full distribution of TexLive.} | 279 | without pulling in the full distribution of TexLive.} |
@@ -1539,7 +1552,12 @@ authoritative zone (replacing ".+" with the name of the location | |||
1539 | where the name was encountered) and hence generate a | 1552 | where the name was encountered) and hence generate a |
1540 | valid GNS name. | 1553 | valid GNS name. |
1541 | 1554 | ||
1542 | GNS currently supports the following record types: | 1555 | The GNS currently supports the record types as defined in |
1556 | @uref{https://git.gnunet.org/gana.git/tree/gnu-name-system-record-types/registry.rec, GANA}. | ||
1557 | In addition, GNS supports DNS record types, such as A, AAAA or TXT. | ||
1558 | |||
1559 | In the following, we discuss GNS records with specific behaviour or special | ||
1560 | handling of DNS records. | ||
1543 | 1561 | ||
1544 | @menu | 1562 | @menu |
1545 | * NICK:: | 1563 | * NICK:: |
@@ -1547,22 +1565,9 @@ GNS currently supports the following record types: | |||
1547 | * BOX:: | 1565 | * BOX:: |
1548 | * LEHO:: | 1566 | * LEHO:: |
1549 | * VPN:: | 1567 | * VPN:: |
1550 | * A AAAA and TXT:: | ||
1551 | * CNAME:: | 1568 | * CNAME:: |
1552 | * GNS2DNS:: | 1569 | * GNS2DNS:: |
1553 | * SOA SRV PTR and MX:: | 1570 | * SOA SRV PTR and MX:: |
1554 | * PLACE:: | ||
1555 | * PHONE:: | ||
1556 | * ID ATTR:: | ||
1557 | * ID TOKEN:: | ||
1558 | * ID TOKEN METADATA:: | ||
1559 | * CREDENTIAL:: | ||
1560 | * POLICY:: | ||
1561 | * ATTRIBUTE:: | ||
1562 | * ABE KEY:: | ||
1563 | * ABE MASTER:: | ||
1564 | * RECLAIM OIDC CLIENT:: | ||
1565 | * RECLAIM OIDC REDIRECT:: | ||
1566 | @end menu | 1571 | @end menu |
1567 | 1572 | ||
1568 | @node NICK | 1573 | @node NICK |
@@ -1658,11 +1663,6 @@ having the following lines in the @file{gnunet.conf} configuration file: | |||
1658 | TCP_REDIRECTS = 80:localhost4:8080 | 1663 | TCP_REDIRECTS = 80:localhost4:8080 |
1659 | @end example | 1664 | @end example |
1660 | 1665 | ||
1661 | @node A AAAA and TXT | ||
1662 | @subsubsection A AAAA and TXT | ||
1663 | |||
1664 | Those records work in exactly the same fashion as in traditional DNS. | ||
1665 | |||
1666 | @node CNAME | 1666 | @node CNAME |
1667 | @subsubsection CNAME | 1667 | @subsubsection CNAME |
1668 | 1668 | ||
@@ -1771,90 +1771,6 @@ $ gnunet-namestore -a -n mail -t MX -z bar -e 3600s -V \ | |||
1771 | > "10,mail.bar" | 1771 | > "10,mail.bar" |
1772 | @end example | 1772 | @end example |
1773 | 1773 | ||
1774 | @node PLACE | ||
1775 | @subsubsection PLACE | ||
1776 | |||
1777 | @c TODO describe record type and give an example of how and | ||
1778 | @c when to use it | ||
1779 | Record type for a social place. | ||
1780 | |||
1781 | @node PHONE | ||
1782 | @subsubsection PHONE | ||
1783 | |||
1784 | @c TODO describe record type and give an example of how and | ||
1785 | @c when to use it | ||
1786 | Record type for a phone (of CONVERSATION). | ||
1787 | |||
1788 | @node ID ATTR | ||
1789 | @subsubsection ID ATTR | ||
1790 | |||
1791 | @c TODO describe record type and give an example of how and | ||
1792 | @c when to use it | ||
1793 | Record type for identity attributes (of IDENTITY). | ||
1794 | |||
1795 | @node ID TOKEN | ||
1796 | @subsubsection ID TOKEN | ||
1797 | |||
1798 | @c TODO describe record type and give an example of how and | ||
1799 | @c when to use it | ||
1800 | Record type for an identity token (of IDENTITY-TOKEN). | ||
1801 | |||
1802 | @node ID TOKEN METADATA | ||
1803 | @subsubsection ID TOKEN METADATA | ||
1804 | |||
1805 | @c TODO describe record type and give an example of how and | ||
1806 | @c when to use it | ||
1807 | Record type for the private metadata of an identity token (of IDENTITY-TOKEN). | ||
1808 | |||
1809 | @node CREDENTIAL | ||
1810 | @subsubsection CREDENTIAL | ||
1811 | |||
1812 | @c TODO describe record type and give an example of how and | ||
1813 | @c when to use it | ||
1814 | Record type for credential. | ||
1815 | |||
1816 | @node POLICY | ||
1817 | @subsubsection POLICY | ||
1818 | |||
1819 | @c TODO describe record type and give an example of how and | ||
1820 | @c when to use it | ||
1821 | Record type for policies. | ||
1822 | |||
1823 | @node ATTRIBUTE | ||
1824 | @subsubsection ATTRIBUTE | ||
1825 | |||
1826 | @c TODO describe record type and give an example of how and | ||
1827 | @c when to use it | ||
1828 | Record type for reverse lookups. | ||
1829 | |||
1830 | @node ABE KEY | ||
1831 | @subsubsection ABE KEY | ||
1832 | |||
1833 | @c TODO describe record type and give an example of how and | ||
1834 | @c when to use it | ||
1835 | Record type for ABE records. | ||
1836 | |||
1837 | @node ABE MASTER | ||
1838 | @subsubsection ABE MASTER | ||
1839 | |||
1840 | @c TODO describe record type and give an example of how and | ||
1841 | @c when to use it | ||
1842 | Record type for ABE master keys. | ||
1843 | |||
1844 | @node RECLAIM OIDC CLIENT | ||
1845 | @subsubsection RECLAIM OIDC CLIENT | ||
1846 | |||
1847 | @c TODO describe record type and give an example of how and | ||
1848 | @c when to use it | ||
1849 | Record type for reclaim OIDC clients. | ||
1850 | |||
1851 | @node RECLAIM OIDC REDIRECT | ||
1852 | @subsubsection RECLAIM OIDC REDIRECT | ||
1853 | |||
1854 | @c TODO describe record type and give an example of how and | ||
1855 | @c when to use it | ||
1856 | Record type for reclaim OIDC redirect URIs. | ||
1857 | |||
1858 | @node Synchronizing with legacy DNS | 1774 | @node Synchronizing with legacy DNS |
1859 | @subsection Synchronizing with legacy DNS | 1775 | @subsection Synchronizing with legacy DNS |
1860 | 1776 | ||
@@ -2420,3 +2336,149 @@ service offered by that peer, you can create an IP tunnel to | |||
2420 | that peer by specifying the peer's identity, service name and | 2336 | that peer by specifying the peer's identity, service name and |
2421 | protocol (--tcp or --udp) and you will again receive an IP address | 2337 | protocol (--tcp or --udp) and you will again receive an IP address |
2422 | that will terminate at the respective peer's service. | 2338 | that will terminate at the respective peer's service. |
2339 | |||
2340 | @node Using the GNUnet Messenger | ||
2341 | @section Using the GNUnet Messenger | ||
2342 | |||
2343 | The GNUnet Messenger subsystem allows decentralized message-based | ||
2344 | communication inside of so called rooms. Each room can be hosted by | ||
2345 | a variable amount of peers. Every member of a room has the possibility | ||
2346 | to host the room on its own peer. A peer allows any amount of members | ||
2347 | to join a room. The amount of members in a room is not restricted. | ||
2348 | |||
2349 | Messages in a room will be distributed between all peers hosting the | ||
2350 | room or being internally (in context of the messenger service) connected | ||
2351 | to a hosting peer. All received or sent messages will be stored on any | ||
2352 | peer locally which is hosting the respective room or is internally | ||
2353 | connected to such a hosting peer. | ||
2354 | |||
2355 | The Messenger service is built on the CADET subsystem to make internal | ||
2356 | connections between peers using a reliable and encrypted transmission. | ||
2357 | Additionally the service uses a discrete padding to few different sizes. | ||
2358 | So kinds of messages and potential content can't be identified by the | ||
2359 | size of traffic from any attacker being unable to break the encryption | ||
2360 | of the transmission layer. | ||
2361 | |||
2362 | Another feature is additional end-to-end encryption for selected messages | ||
2363 | which uses the public key of another member (the receiver) to encrypt | ||
2364 | the message. Therefore it is ensured that only the selected member can | ||
2365 | read its content. This will also use additional padding. | ||
2366 | |||
2367 | @menu | ||
2368 | * Current state:: | ||
2369 | * Entering a room:: | ||
2370 | * Opening a room:: | ||
2371 | * Messaging in a room:: | ||
2372 | * Private messaging:: | ||
2373 | @end menu | ||
2374 | |||
2375 | @node Current state | ||
2376 | @subsection Current state | ||
2377 | |||
2378 | Currently there is only a simplistic CLI application available to use the | ||
2379 | messenger service. You can use this application with the | ||
2380 | @command{gnunet-messenger} command. | ||
2381 | |||
2382 | This application was designed for testing purposes and it does not provide | ||
2383 | full functionality in the current state. It is planned to replace this CLI | ||
2384 | application in later stages with a fully featured one using a client-side | ||
2385 | library designed for messenger applications. | ||
2386 | |||
2387 | @node Entering a room | ||
2388 | @subsection Entering a room | ||
2389 | |||
2390 | You can enter any room by its ROOMKEY and any PEERIDENTITY of a hosting peer. | ||
2391 | Optionally you can provide any IDENTITY which can represent a local ego by | ||
2392 | its name. | ||
2393 | |||
2394 | @example | ||
2395 | $ gnunet-messenger [-e IDENTITY] -d PEERIDENTITY -r ROOMKEY | ||
2396 | @end example | ||
2397 | |||
2398 | A PEERIDENTITY gets entered in encoded form. You can get your own peer ID by | ||
2399 | using the @command{gnunet-peerinfo} command: | ||
2400 | |||
2401 | @example | ||
2402 | $ gnunet-peerinfo -s | ||
2403 | @end example | ||
2404 | |||
2405 | A ROOMKEY gets entered in readable text form. The service will then hash the | ||
2406 | entered ROOMKEY and use the result as shared secret for transmission through | ||
2407 | the CADET submodule. You can also optionally leave out the '-r' paramter and | ||
2408 | the ROOMKEY to use the zeroed hash instead. | ||
2409 | |||
2410 | If no IDENTITY is provided you will not send any name to others, you will be | ||
2411 | referred as "anonymous" instead and use the anonymous ego. If you provide any | ||
2412 | IDENTITY a matching ego will be used to sign your messages. If there is no | ||
2413 | matching ego you will use the anonymous ego instead. The provided IDENTITY will | ||
2414 | be distributed as your name for the service in any case. | ||
2415 | |||
2416 | @node Opening a room | ||
2417 | @subsection Opening a room | ||
2418 | |||
2419 | You can open any room in a similar way to entering it. You just have to leave | ||
2420 | out the '-d' parameter and the PEERIDENTITY of the hosting peer. | ||
2421 | |||
2422 | @example | ||
2423 | $ gnunet-messenger [-e IDENTITY] -r ROOMKEY | ||
2424 | @end example | ||
2425 | |||
2426 | Providing ROOMKEY and IDENTITY is identical to entering a room. Opening a room | ||
2427 | will also make your peer to a host of this room. So others can enter the room | ||
2428 | through your peer if they have the required ROOMKEY and your peer ID. | ||
2429 | |||
2430 | If you want to use the zeroed hash as shared secret key for the room you can | ||
2431 | also leave it out as well: | ||
2432 | |||
2433 | @example | ||
2434 | $ gnunet-messenger | ||
2435 | @end example | ||
2436 | |||
2437 | @node Messaging in a room | ||
2438 | @subsection Messaging in a room | ||
2439 | |||
2440 | Once joined a room by entering it or opening it you can write text-based | ||
2441 | messages which will be distributed between all internally conntected peers. All | ||
2442 | sent messages will be displayed in the same way as received messages. | ||
2443 | |||
2444 | This relates to the internal handling of sent and received messages being mostly | ||
2445 | identical on application layer. Every handled message will be represented | ||
2446 | visually depending on its kind, content and sender. A sender can usually be | ||
2447 | identified by the encoded member ID or their name. | ||
2448 | |||
2449 | @example | ||
2450 | [17X37K] * 'anonymous' says: "hey" | ||
2451 | @end example | ||
2452 | |||
2453 | @node Private messaging | ||
2454 | @subsection Private messaging | ||
2455 | |||
2456 | As referred in the introduction the service allows sending private messages with | ||
2457 | additional end-to-end encryption. These messages will be visually represented | ||
2458 | by messages of the kind 'PRIVATE' in case they can't be decrypted with your used | ||
2459 | ego. Members who can't decrypt the message can potentially only identify its | ||
2460 | sender but they can't identify its receiver. | ||
2461 | |||
2462 | @example | ||
2463 | [17X37K] ~ message: PRIVATE | ||
2464 | @end example | ||
2465 | |||
2466 | If they can be decrypted they will appear as their secret message instead | ||
2467 | but marked visually. | ||
2468 | |||
2469 | @example | ||
2470 | [17X37K] ** 'anonymous' says: "hey" | ||
2471 | @end example | ||
2472 | |||
2473 | Currently you can only activate sending such encrypted text messages instead of | ||
2474 | usual text messages by adding the '-p' parameter: | ||
2475 | |||
2476 | @example | ||
2477 | $ gnunet-messenger [-e IDENTITY] -d PEERIDENTITY -r ROOMKEY -p | ||
2478 | @end example | ||
2479 | |||
2480 | Notice that you can only send such encrypted messages to members who use an ego | ||
2481 | which is not publically known as the anonymous ego to ensure transparency. If | ||
2482 | any user could decrypt these messages they would not be private. So as receiver | ||
2483 | of such messages the IDENTITY is required and it has to match a local ego. | ||
2484 | |||
diff --git a/doc/handbook/images/messenger_room.png b/doc/handbook/images/messenger_room.png new file mode 100644 index 000000000..8b3590cf8 --- /dev/null +++ b/doc/handbook/images/messenger_room.png | |||
Binary files differ | |||
diff --git a/doc/handbook/images/messenger_room.svg b/doc/handbook/images/messenger_room.svg new file mode 100644 index 000000000..6bd8d425c --- /dev/null +++ b/doc/handbook/images/messenger_room.svg | |||
@@ -0,0 +1,501 @@ | |||
1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | <svg | ||
3 | xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
4 | xmlns:cc="http://creativecommons.org/ns#" | ||
5 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
6 | xmlns:svg="http://www.w3.org/2000/svg" | ||
7 | xmlns="http://www.w3.org/2000/svg" | ||
8 | xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
9 | xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
10 | width="598.63586mm" | ||
11 | height="519.30621mm" | ||
12 | viewBox="0 0 598.63586 519.30621" | ||
13 | version="1.1" | ||
14 | id="svg8" | ||
15 | inkscape:version="1.0.2 (e86c870879, 2021-01-15)" | ||
16 | sodipodi:docname="messenger_room.svg" | ||
17 | inkscape:export-filename="./messenger_room.png" | ||
18 | inkscape:export-xdpi="50" | ||
19 | inkscape:export-ydpi="50"> | ||
20 | <defs | ||
21 | id="defs2" /> | ||
22 | <sodipodi:namedview | ||
23 | id="base" | ||
24 | pagecolor="#ffffff" | ||
25 | bordercolor="#666666" | ||
26 | borderopacity="1.0" | ||
27 | inkscape:pageopacity="0.0" | ||
28 | inkscape:pageshadow="2" | ||
29 | inkscape:zoom="0.35" | ||
30 | inkscape:cx="1617.1523" | ||
31 | inkscape:cy="893.76504" | ||
32 | inkscape:document-units="mm" | ||
33 | inkscape:current-layer="layer3" | ||
34 | inkscape:document-rotation="0" | ||
35 | showgrid="false" | ||
36 | fit-margin-top="10" | ||
37 | fit-margin-bottom="10" | ||
38 | fit-margin-right="10" | ||
39 | fit-margin-left="10" | ||
40 | lock-margins="true" | ||
41 | inkscape:window-width="2560" | ||
42 | inkscape:window-height="1376" | ||
43 | inkscape:window-x="0" | ||
44 | inkscape:window-y="0" | ||
45 | inkscape:window-maximized="1" /> | ||
46 | <metadata | ||
47 | id="metadata5"> | ||
48 | <rdf:RDF> | ||
49 | <cc:Work | ||
50 | rdf:about=""> | ||
51 | <dc:format>image/svg+xml</dc:format> | ||
52 | <dc:type | ||
53 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
54 | <dc:title></dc:title> | ||
55 | </cc:Work> | ||
56 | </rdf:RDF> | ||
57 | </metadata> | ||
58 | <g | ||
59 | inkscape:groupmode="layer" | ||
60 | id="layer2" | ||
61 | inkscape:label="Layer 2" | ||
62 | style="display:inline" | ||
63 | transform="translate(192.28493,120.40152)"> | ||
64 | <path | ||
65 | style="fill:none;stroke:#000000;stroke-width:3.365;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
66 | d="M 26.206579,156.45999 97.162749,89.570022 199.7759,120.1979 181.87666,217.7128 89.324169,236.23068 Z" | ||
67 | id="path915" /> | ||
68 | <path | ||
69 | style="fill:none;stroke:#000000;stroke-width:2.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
70 | d="m 181.87666,217.7128 66.26913,94.14707" | ||
71 | id="path1063" /> | ||
72 | <path | ||
73 | style="fill:none;stroke:#000000;stroke-width:2.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:2.665, 5.33;stroke-dashoffset:0;stroke-opacity:1" | ||
74 | d="M 309.85632,121.37022 199.7759,120.1979" | ||
75 | id="path1065" /> | ||
76 | <path | ||
77 | style="fill:none;stroke:#000000;stroke-width:2.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
78 | d="M 248.9298,18.638951 199.7759,120.1979" | ||
79 | id="path1067" /> | ||
80 | <path | ||
81 | style="fill:none;stroke:#000000;stroke-width:2.665;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
82 | d="M -76.608095,107.38658 26.206579,156.45999" | ||
83 | id="path1069" /> | ||
84 | </g> | ||
85 | <g | ||
86 | inkscape:groupmode="layer" | ||
87 | id="layer4" | ||
88 | inkscape:label="Layer 4" | ||
89 | style="display:inline" | ||
90 | transform="translate(192.28493,120.40152)"> | ||
91 | <path | ||
92 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
93 | d="m -137.76937,77.365523 61.161275,30.021057" | ||
94 | id="path1225" /> | ||
95 | <path | ||
96 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
97 | d="M -20.546549,199.60834 26.206579,156.45999" | ||
98 | id="path1227" /> | ||
99 | <path | ||
100 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
101 | d="M 58.558255,290.12036 89.324168,236.23068 125.2681,294.74464" | ||
102 | id="path1229" /> | ||
103 | <path | ||
104 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
105 | d="m 260.56143,374.91842 -12.41564,-63.05855 67.7611,18.91507" | ||
106 | id="path1231" /> | ||
107 | <path | ||
108 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
109 | d="M 237.39119,194.89545 181.87666,217.7128" | ||
110 | id="path1233" /> | ||
111 | <path | ||
112 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
113 | d="M 199.7759,120.1979 177.22801,54.184954" | ||
114 | id="path1235" /> | ||
115 | <path | ||
116 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
117 | d="m 309.85632,121.37022 61.96594,-12.96636" | ||
118 | id="path1237" /> | ||
119 | <path | ||
120 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
121 | d="M 248.9298,18.638951 229.25585,-38.546188" | ||
122 | id="path1239" /> | ||
123 | <path | ||
124 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
125 | d="m 55.073787,29.185372 42.088961,60.38465" | ||
126 | id="path1241" /> | ||
127 | <path | ||
128 | style="fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1.865, 3.73;stroke-dashoffset:0;stroke-opacity:1" | ||
129 | d="M -76.608095,107.38658 -138.56518,130.6705" | ||
130 | id="path1243" /> | ||
131 | </g> | ||
132 | <g | ||
133 | inkscape:label="Layer 1" | ||
134 | inkscape:groupmode="layer" | ||
135 | id="layer1" | ||
136 | transform="translate(192.28493,120.40152)"> | ||
137 | <circle | ||
138 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
139 | id="path833" | ||
140 | cx="96.685127" | ||
141 | cy="88.539452" | ||
142 | r="20" /> | ||
143 | <circle | ||
144 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
145 | id="path833-3" | ||
146 | cx="195.51556" | ||
147 | cy="120.85936" | ||
148 | r="20" /> | ||
149 | <circle | ||
150 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
151 | id="path833-5" | ||
152 | cx="183.12799" | ||
153 | cy="214.72444" | ||
154 | r="20" /> | ||
155 | <circle | ||
156 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
157 | id="path833-6" | ||
158 | cx="92.202576" | ||
159 | cy="236.97336" | ||
160 | r="20" /> | ||
161 | <circle | ||
162 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
163 | id="path833-2" | ||
164 | cx="26.400755" | ||
165 | cy="158.9449" | ||
166 | r="20" /> | ||
167 | <circle | ||
168 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
169 | id="path833-3-1" | ||
170 | cx="309.42667" | ||
171 | cy="120.44005" | ||
172 | r="20" /> | ||
173 | <circle | ||
174 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
175 | id="path833-3-2" | ||
176 | cx="248.5799" | ||
177 | cy="19.344702" | ||
178 | r="20" /> | ||
179 | <circle | ||
180 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
181 | id="path833-3-7" | ||
182 | cx="-74.235405" | ||
183 | cy="107.76899" | ||
184 | r="20" /> | ||
185 | <circle | ||
186 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
187 | id="path833-3-0" | ||
188 | cx="249.89246" | ||
189 | cy="310.73776" | ||
190 | r="20" /> | ||
191 | <path | ||
192 | style="display:inline;fill:none;stroke:#000000;stroke-width:1.865;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" | ||
193 | d="m 318.33679,228.47452 61.96594,-12.96636" | ||
194 | id="path1237-2" /> | ||
195 | <circle | ||
196 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:6.265;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:6.265, 12.53;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill" | ||
197 | id="path833-3-1-8" | ||
198 | cx="317.90714" | ||
199 | cy="227.54434" | ||
200 | r="20" /> | ||
201 | <rect | ||
202 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2.82, 5.64;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill" | ||
203 | id="rect1071-62-9" | ||
204 | width="28.700562" | ||
205 | height="22.81683" | ||
206 | x="366.24039" | ||
207 | y="204.47328" /> | ||
208 | <text | ||
209 | xml:space="preserve" | ||
210 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
211 | x="315.72601" | ||
212 | y="231.38942" | ||
213 | id="text1307-7-3-3-94-3"><tspan | ||
214 | sodipodi:role="line" | ||
215 | id="tspan1305-6-0-0-6-6" | ||
216 | x="315.72601" | ||
217 | y="231.38942" | ||
218 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">J</tspan></text> | ||
219 | </g> | ||
220 | <g | ||
221 | inkscape:groupmode="layer" | ||
222 | id="layer3" | ||
223 | inkscape:label="Layer 3" | ||
224 | transform="translate(192.28493,120.40152)"> | ||
225 | <rect | ||
226 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
227 | id="rect1071" | ||
228 | width="28.700562" | ||
229 | height="22.81683" | ||
230 | x="41.152424" | ||
231 | y="17.00181" /> | ||
232 | <rect | ||
233 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
234 | id="rect1071-6" | ||
235 | width="28.700562" | ||
236 | height="22.81683" | ||
237 | x="163.24538" | ||
238 | y="40.93095" /> | ||
239 | <rect | ||
240 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
241 | id="rect1071-0" | ||
242 | width="28.700562" | ||
243 | height="22.81683" | ||
244 | x="217.0302" | ||
245 | y="-48.476658" /> | ||
246 | <rect | ||
247 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
248 | id="rect1071-62" | ||
249 | width="28.700562" | ||
250 | height="22.81683" | ||
251 | x="357.75992" | ||
252 | y="97.368996" /> | ||
253 | <rect | ||
254 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
255 | id="rect1071-61" | ||
256 | width="28.700562" | ||
257 | height="22.81683" | ||
258 | x="221.61465" | ||
259 | y="183.89601" /> | ||
260 | <rect | ||
261 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
262 | id="rect1071-8" | ||
263 | width="28.700562" | ||
264 | height="22.81683" | ||
265 | x="302.37604" | ||
266 | y="319.27646" /> | ||
267 | <rect | ||
268 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
269 | id="rect1071-7" | ||
270 | width="28.700562" | ||
271 | height="22.81683" | ||
272 | x="244.56342" | ||
273 | y="364.67789" /> | ||
274 | <rect | ||
275 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
276 | id="rect1071-9" | ||
277 | width="28.700562" | ||
278 | height="22.81683" | ||
279 | x="43.508121" | ||
280 | y="279.02939" /> | ||
281 | <rect | ||
282 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
283 | id="rect1071-2" | ||
284 | width="28.700562" | ||
285 | height="22.81683" | ||
286 | x="110.22536" | ||
287 | y="283.7334" /> | ||
288 | <rect | ||
289 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
290 | id="rect1071-02" | ||
291 | width="28.700562" | ||
292 | height="22.81683" | ||
293 | x="-35.267426" | ||
294 | y="187.65363" /> | ||
295 | <rect | ||
296 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
297 | id="rect1071-3" | ||
298 | width="28.700562" | ||
299 | height="22.81683" | ||
300 | x="-151.39322" | ||
301 | y="66.069321" /> | ||
302 | <rect | ||
303 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:2.82;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2.82, 5.64;stroke-dashoffset:0;stroke-opacity:1;paint-order:stroke markers fill" | ||
304 | id="rect1071-3-7" | ||
305 | width="28.700562" | ||
306 | height="22.81683" | ||
307 | x="-154.87178" | ||
308 | y="119.88663" /> | ||
309 | <g | ||
310 | id="g1600" | ||
311 | transform="translate(-2.9470331,-51.038598)"> | ||
312 | <circle | ||
313 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:3.78727;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
314 | id="path833-6-5" | ||
315 | cx="-161.17276" | ||
316 | cy="336.83234" | ||
317 | r="12.09027" /> | ||
318 | <text | ||
319 | xml:space="preserve" | ||
320 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
321 | x="-140.58682" | ||
322 | y="342.66354" | ||
323 | id="text1307"><tspan | ||
324 | sodipodi:role="line" | ||
325 | id="tspan1305" | ||
326 | x="-140.58682" | ||
327 | y="342.66354" | ||
328 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">Peer</tspan></text> | ||
329 | </g> | ||
330 | <g | ||
331 | id="g1594" | ||
332 | transform="translate(-2.9470331,-54.443235)"> | ||
333 | <rect | ||
334 | style="opacity:0.999;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:1.96946;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:stroke markers fill" | ||
335 | id="rect1071-9-9" | ||
336 | width="20.044254" | ||
337 | height="15.935102" | ||
338 | x="-171.19489" | ||
339 | y="365.45282" /> | ||
340 | <text | ||
341 | xml:space="preserve" | ||
342 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
343 | x="-140.78059" | ||
344 | y="379.28705" | ||
345 | id="text1307-7"><tspan | ||
346 | sodipodi:role="line" | ||
347 | id="tspan1305-6" | ||
348 | x="-140.78059" | ||
349 | y="379.28705" | ||
350 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">Application</tspan></text> | ||
351 | </g> | ||
352 | <text | ||
353 | xml:space="preserve" | ||
354 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
355 | x="90.401619" | ||
356 | y="94.499252" | ||
357 | id="text1307-7-3"><tspan | ||
358 | sodipodi:role="line" | ||
359 | id="tspan1305-6-0" | ||
360 | x="90.401619" | ||
361 | y="94.499252" | ||
362 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">A</tspan></text> | ||
363 | <text | ||
364 | xml:space="preserve" | ||
365 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
366 | x="189.63115" | ||
367 | y="126.74821" | ||
368 | id="text1307-7-3-3"><tspan | ||
369 | sodipodi:role="line" | ||
370 | id="tspan1305-6-0-0" | ||
371 | x="189.63115" | ||
372 | y="126.74821" | ||
373 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">C</tspan></text> | ||
374 | <text | ||
375 | xml:space="preserve" | ||
376 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
377 | x="178.83551" | ||
378 | y="220.59999" | ||
379 | id="text1307-7-3-3-9"><tspan | ||
380 | sodipodi:role="line" | ||
381 | id="tspan1305-6-0-0-2" | ||
382 | x="178.83551" | ||
383 | y="220.59999" | ||
384 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">F</tspan></text> | ||
385 | <text | ||
386 | xml:space="preserve" | ||
387 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
388 | x="85.772736" | ||
389 | y="242.86221" | ||
390 | id="text1307-7-3-3-5"><tspan | ||
391 | sodipodi:role="line" | ||
392 | id="tspan1305-6-0-0-4" | ||
393 | x="85.772736" | ||
394 | y="242.86221" | ||
395 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">G</tspan></text> | ||
396 | <text | ||
397 | xml:space="preserve" | ||
398 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
399 | x="19.824577" | ||
400 | y="164.8027" | ||
401 | id="text1307-7-3-3-0"><tspan | ||
402 | sodipodi:role="line" | ||
403 | id="tspan1305-6-0-0-5" | ||
404 | x="19.824577" | ||
405 | y="164.8027" | ||
406 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">H</tspan></text> | ||
407 | <text | ||
408 | xml:space="preserve" | ||
409 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
410 | x="303.32053" | ||
411 | y="126.29786" | ||
412 | id="text1307-7-3-3-94"><tspan | ||
413 | sodipodi:role="line" | ||
414 | id="tspan1305-6-0-0-6" | ||
415 | x="303.32053" | ||
416 | y="126.29786" | ||
417 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">D</tspan></text> | ||
418 | <text | ||
419 | xml:space="preserve" | ||
420 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
421 | x="243.4848" | ||
422 | y="25.202511" | ||
423 | id="text1307-7-3-3-92"><tspan | ||
424 | sodipodi:role="line" | ||
425 | id="tspan1305-6-0-0-24" | ||
426 | x="243.4848" | ||
427 | y="25.202511" | ||
428 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">B</tspan></text> | ||
429 | <text | ||
430 | xml:space="preserve" | ||
431 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
432 | x="247.20479" | ||
433 | y="316.59558" | ||
434 | id="text1307-7-3-3-7"><tspan | ||
435 | sodipodi:role="line" | ||
436 | id="tspan1305-6-0-0-7" | ||
437 | x="247.20479" | ||
438 | y="316.59558" | ||
439 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">I</tspan></text> | ||
440 | <text | ||
441 | xml:space="preserve" | ||
442 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
443 | x="-79.01123" | ||
444 | y="113.64454" | ||
445 | id="text1307-7-3-3-54"><tspan | ||
446 | sodipodi:role="line" | ||
447 | id="tspan1305-6-0-0-8" | ||
448 | x="-79.01123" | ||
449 | y="113.64454" | ||
450 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">E</tspan></text> | ||
451 | <g | ||
452 | id="g1589" | ||
453 | transform="translate(-4.3496791,-53.330521)"> | ||
454 | <path | ||
455 | style="fill:none;stroke:#000000;stroke-width:2.62782;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:2.62782, 5.25564;stroke-dashoffset:1.05113;stroke-opacity:1" | ||
456 | d="m -176.62134,400.99519 30.89715,0.38084" | ||
457 | id="path1521" /> | ||
458 | <text | ||
459 | xml:space="preserve" | ||
460 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
461 | x="-137.64647" | ||
462 | y="406.95029" | ||
463 | id="text1307-7-2"><tspan | ||
464 | sodipodi:role="line" | ||
465 | id="tspan1305-6-1" | ||
466 | x="-137.64647" | ||
467 | y="406.95029" | ||
468 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">Inactive</tspan></text> | ||
469 | </g> | ||
470 | <g | ||
471 | id="g1583" | ||
472 | transform="translate(-4.3496791,-49.693534)"> | ||
473 | <path | ||
474 | style="fill:none;stroke:#000000;stroke-width:2.62782;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:1.05113;stroke-opacity:1" | ||
475 | d="m -176.62134,420.37019 30.89715,0.38084" | ||
476 | id="path1521-0" /> | ||
477 | <text | ||
478 | xml:space="preserve" | ||
479 | style="font-size:18.1632px;line-height:34.0561px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.340559" | ||
480 | x="-138.78186" | ||
481 | y="426.42728" | ||
482 | id="text1307-7-0"><tspan | ||
483 | sodipodi:role="line" | ||
484 | id="tspan1305-6-5" | ||
485 | x="-138.78186" | ||
486 | y="426.42728" | ||
487 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:18.1632px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.340559">Active</tspan></text> | ||
488 | </g> | ||
489 | <text | ||
490 | xml:space="preserve" | ||
491 | style="font-size:50.8px;line-height:95.25px;font-family:Primer;-inkscape-font-specification:Primer;letter-spacing:0px;word-spacing:0px;stroke-width:0.264583" | ||
492 | x="42.997746" | ||
493 | y="-77.287262" | ||
494 | id="text1604"><tspan | ||
495 | sodipodi:role="line" | ||
496 | id="tspan1602" | ||
497 | x="42.997746" | ||
498 | y="-77.287262" | ||
499 | style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:50.8px;font-family:'Linux Libertine Capitals';-inkscape-font-specification:'Linux Libertine Capitals';stroke-width:0.264583">Room</tspan></text> | ||
500 | </g> | ||
501 | </svg> | ||
diff --git a/doc/handbook/images/tng.dot b/doc/handbook/images/tng.dot new file mode 100644 index 000000000..14e72ee04 --- /dev/null +++ b/doc/handbook/images/tng.dot | |||
@@ -0,0 +1,55 @@ | |||
1 | // house = application | ||
2 | // circle (default) = service | ||
3 | // box = daemon | ||
4 | // diamond = library | ||
5 | // black line = dependency | ||
6 | // blue line = extension via plugin | ||
7 | // red line = possibly useful | ||
8 | // dashed = in planning | ||
9 | |||
10 | // this is what we have...o | ||
11 | digraph tng { | ||
12 | // splines = true; | ||
13 | compound=true; | ||
14 | subgraph cluster0 { | ||
15 | label="Our peer"; | ||
16 | style=dashed; | ||
17 | color=black; | ||
18 | subgraph cluster1 { | ||
19 | style=solid; | ||
20 | color=black; | ||
21 | tcp; | ||
22 | udp; | ||
23 | others [style=dotted]; | ||
24 | label="Communicators"; | ||
25 | } | ||
26 | subgraph cluster2 { | ||
27 | style=solid; | ||
28 | color=black; | ||
29 | dht; | ||
30 | fs; | ||
31 | cadet; | ||
32 | label="Applications"; | ||
33 | } | ||
34 | cadet -> core [ltail=cluster2,label="Communicate with peers"]; | ||
35 | dht -> transport [ltail=cluster2,label="Suggest connection to peer"]; | ||
36 | core -> transport [label="Send/receive messages via secure channel"]; | ||
37 | transport -> tcp [lhead=cluster1,dir=both,label="Offer connectivity/channel to other peer"]; | ||
38 | udp -> nat [label="Get addresses"]; | ||
39 | tcp -> nat; | ||
40 | } | ||
41 | subgraph cluster3 { | ||
42 | rank = sink; | ||
43 | style=dashed; | ||
44 | color=black; | ||
45 | peer3; | ||
46 | peer1; | ||
47 | peer2; | ||
48 | label="Other peers"; | ||
49 | } | ||
50 | |||
51 | |||
52 | tcp -> peer1 [dir=both]; | ||
53 | udp -> peer2; | ||
54 | transport->peer1 [style=invis]; | ||
55 | } | ||
diff --git a/doc/handbook/images/tng.png b/doc/handbook/images/tng.png new file mode 100644 index 000000000..3b93b77cc --- /dev/null +++ b/doc/handbook/images/tng.png | |||
Binary files differ | |||
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index a0283cf44..e7045e8bf 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am | |||
@@ -50,6 +50,7 @@ man_MANS = \ | |||
50 | gnunet-arm.1 \ | 50 | gnunet-arm.1 \ |
51 | gnunet-ats.1 \ | 51 | gnunet-ats.1 \ |
52 | gnunet-auto-share.1 \ | 52 | gnunet-auto-share.1 \ |
53 | gnunet-base32.1 \ | ||
53 | gnunet-bcd.1 \ | 54 | gnunet-bcd.1 \ |
54 | gnunet-bugreport.1 \ | 55 | gnunet-bugreport.1 \ |
55 | gnunet-config.1 \ | 56 | gnunet-config.1 \ |
diff --git a/doc/man/gnunet-base32.1 b/doc/man/gnunet-base32.1 new file mode 100644 index 000000000..2e1224279 --- /dev/null +++ b/doc/man/gnunet-base32.1 | |||
@@ -0,0 +1,74 @@ | |||
1 | .\" This file is part of GNUnet. | ||
2 | .\" Copyright (C) 2021 GNUnet e.V. | ||
3 | .\" | ||
4 | .\" Permission is granted to copy, distribute and/or modify this document | ||
5 | .\" under the terms of the GNU Free Documentation License, Version 1.3 or | ||
6 | .\" any later version published by the Free Software Foundation; with no | ||
7 | .\" Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A | ||
8 | .\" copy of the license is included in the file | ||
9 | .\" FDL-1.3. | ||
10 | .\" | ||
11 | .\" A copy of the license is also available from the Free Software | ||
12 | .\" Foundation Web site at http://www.gnu.org/licenses/fdl.html}. | ||
13 | .\" | ||
14 | .\" Alternately, this document is also available under the General | ||
15 | .\" Public License, version 3 or later, as published by the Free Software | ||
16 | .\" Foundation. A copy of the license is included in the file | ||
17 | .\" GPL3. | ||
18 | .\" | ||
19 | .\" A copy of the license is also available from the Free Software | ||
20 | .\" Foundation Web site at http://www.gnu.org/licenses/gpl.html | ||
21 | .\" | ||
22 | .\" SPDX-License-Identifier: GPL3.0-or-later OR FDL1.3-or-later | ||
23 | .\" | ||
24 | .Dd March 5, 2021 | ||
25 | .Dt GNUNET-BASE32 1 | ||
26 | .Os | ||
27 | .Sh NAME | ||
28 | .Nm gnunet-base32 | ||
29 | .Nd encode/decode to Crockford base32 encoding | ||
30 | .Sh SYNOPSIS | ||
31 | .Nm | ||
32 | .Op Fl d | -decode | ||
33 | .sp | ||
34 | .Sh DESCRIPTION | ||
35 | .Nm | ||
36 | By default, encodes data read from standard input into | ||
37 | Crockford base32 and writes the result to standard output. | ||
38 | The inverse operation is performed if the option | ||
39 | .Fl --decode | ||
40 | is given. Note that the tool keeps all of the data in | ||
41 | memory and is largely intended for quick debugging and | ||
42 | not for high performance. | ||
43 | .Bl -tag -width indent | ||
44 | .It Fl d | -decode | ||
45 | Run in decode mode instead of in encode mode. | ||
46 | .It Fl h | -help | ||
47 | Print short help on options. | ||
48 | .It Fl v | -version | ||
49 | Print GNUnet version number. | ||
50 | .El | ||
51 | .Sh SEE ALSO | ||
52 | The full documentation for gnunet is maintained as a Texinfo manual. | ||
53 | If the | ||
54 | .Xr info 1 | ||
55 | and gnunet programs are properly installed at your site, the command | ||
56 | .Pp | ||
57 | .Dl info gnunet | ||
58 | .Pp | ||
59 | should give you access to the complete handbook, | ||
60 | .Pp | ||
61 | .Dl info gnunet-c-tutorial | ||
62 | .Pp | ||
63 | will give you access to a tutorial for developers. | ||
64 | .sp | ||
65 | Depending on your installation, this information is also available in | ||
66 | .Xr gnunet 7 and | ||
67 | .Xr gnunet-c-tutorial 7 . | ||
68 | .\".Sh HISTORY | ||
69 | .\".Sh AUTHORS | ||
70 | .Sh BUGS | ||
71 | Report bugs by using | ||
72 | .Lk https://bugs.gnunet.org | ||
73 | or by sending electronic mail to | ||
74 | .Aq Mt gnunet-developers@gnu.org . | ||
diff --git a/doc/tutorial/Makefile.am b/doc/tutorial/Makefile.am index d0307ecb5..afe4aa6c0 100644 --- a/doc/tutorial/Makefile.am +++ b/doc/tutorial/Makefile.am | |||
@@ -1,25 +1,8 @@ | |||
1 | # This Makefile.am is in the public domain | 1 | # This Makefile.am is in the public domain |
2 | docdir = $(datadir)/doc/gnunet/ | 2 | docdir = $(datadir)/doc/gnunet/ |
3 | 3 | ||
4 | if ACTIVATE_TEXINFO4 | 4 | AM_MAKEINFOHTMLFLAGS = $(TEXINFO_HTMLFLAGS) |
5 | # NOTE: While GNU makeinfo 6.5 supports --css-ref=URL, | 5 | |
6 | # makeinfo 4.8 (in NetBSD 8.0, macOS, and maybe other | ||
7 | # base) does only support --css-include=FILE. | ||
8 | # The only difference is a shorter html output and | ||
9 | # in 6.5 the ability to use refs instead of include. | ||
10 | # We prefer not to break builds in this case, so | ||
11 | # we use the include version which is backwards compatible | ||
12 | # and upwards compatible, while the ref variant is neither. | ||
13 | AM_MAKEINFOHTMLFLAGS = --no-split --css-include=style.css --css-include=manual.css | ||
14 | else | ||
15 | # In the 5.x version they added `--split=chapters|sections` in | ||
16 | # addition to `--split=nodes`. | ||
17 | # Hold on to your hats: In version 6.5 this is already removed, ffs. | ||
18 | # GNU Texinfo, please be more consistent than 1 version in switches. | ||
19 | # This however is compatible to version 5.2. Thanks, I hate it. | ||
20 | # AM_MAKEINFOHTMLFLAGS = --split=sections --css-ref="../style.css" --css-ref="../manual.css" | ||
21 | AM_MAKEINFOHTMLFLAGS = --split --css-ref="../style.css" --css-ref="../manual.css" | ||
22 | endif | ||
23 | 6 | ||
24 | gnunet_tutorial_examples = \ | 7 | gnunet_tutorial_examples = \ |
25 | examples/001.c \ | 8 | examples/001.c \ |
diff --git a/po/POTFILES.in b/po/POTFILES.in index 51ada43b3..dd36b7411 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in | |||
@@ -207,25 +207,34 @@ src/json/json_mhd.c | |||
207 | src/messenger/gnunet-messenger.c | 207 | src/messenger/gnunet-messenger.c |
208 | src/messenger/gnunet-service-messenger.c | 208 | src/messenger/gnunet-service-messenger.c |
209 | src/messenger/gnunet-service-messenger_basement.c | 209 | src/messenger/gnunet-service-messenger_basement.c |
210 | src/messenger/gnunet-service-messenger_contact.c | 210 | src/messenger/gnunet-service-messenger_ego_store.c |
211 | src/messenger/gnunet-service-messenger_handle.c | 211 | src/messenger/gnunet-service-messenger_handle.c |
212 | src/messenger/gnunet-service-messenger_list_handles.c | 212 | src/messenger/gnunet-service-messenger_list_handles.c |
213 | src/messenger/gnunet-service-messenger_list_messages.c | 213 | src/messenger/gnunet-service-messenger_list_messages.c |
214 | src/messenger/gnunet-service-messenger_member.c | ||
215 | src/messenger/gnunet-service-messenger_member_session.c | ||
216 | src/messenger/gnunet-service-messenger_member_store.c | ||
214 | src/messenger/gnunet-service-messenger_message_handle.c | 217 | src/messenger/gnunet-service-messenger_message_handle.c |
215 | src/messenger/gnunet-service-messenger_message_kind.c | 218 | src/messenger/gnunet-service-messenger_message_kind.c |
216 | src/messenger/gnunet-service-messenger_message_recv.c | 219 | src/messenger/gnunet-service-messenger_message_recv.c |
217 | src/messenger/gnunet-service-messenger_message_send.c | 220 | src/messenger/gnunet-service-messenger_message_send.c |
221 | src/messenger/gnunet-service-messenger_message_state.c | ||
218 | src/messenger/gnunet-service-messenger_message_store.c | 222 | src/messenger/gnunet-service-messenger_message_store.c |
223 | src/messenger/gnunet-service-messenger_operation.c | ||
224 | src/messenger/gnunet-service-messenger_operation_store.c | ||
219 | src/messenger/gnunet-service-messenger_room.c | 225 | src/messenger/gnunet-service-messenger_room.c |
220 | src/messenger/gnunet-service-messenger_service.c | 226 | src/messenger/gnunet-service-messenger_service.c |
221 | src/messenger/gnunet-service-messenger_tunnel.c | 227 | src/messenger/gnunet-service-messenger_tunnel.c |
222 | src/messenger/gnunet-service-messenger_util.c | ||
223 | src/messenger/messenger_api.c | 228 | src/messenger/messenger_api.c |
224 | src/messenger/messenger_api_contact.c | 229 | src/messenger/messenger_api_contact.c |
230 | src/messenger/messenger_api_contact_store.c | ||
225 | src/messenger/messenger_api_handle.c | 231 | src/messenger/messenger_api_handle.c |
226 | src/messenger/messenger_api_list_tunnels.c | 232 | src/messenger/messenger_api_list_tunnels.c |
227 | src/messenger/messenger_api_message.c | 233 | src/messenger/messenger_api_message.c |
228 | src/messenger/messenger_api_room.c | 234 | src/messenger/messenger_api_room.c |
235 | src/messenger/messenger_api_util.c | ||
236 | src/messenger/testing_messenger_barrier.c | ||
237 | src/messenger/testing_messenger_setup.c | ||
229 | src/my/my.c | 238 | src/my/my.c |
230 | src/my/my_query_helper.c | 239 | src/my/my_query_helper.c |
231 | src/my/my_result_helper.c | 240 | src/my/my_result_helper.c |
@@ -293,10 +302,13 @@ src/reclaim/gnunet-service-reclaim.c | |||
293 | src/reclaim/gnunet-service-reclaim_tickets.c | 302 | src/reclaim/gnunet-service-reclaim_tickets.c |
294 | src/reclaim/json_reclaim.c | 303 | src/reclaim/json_reclaim.c |
295 | src/reclaim/oidc_helper.c | 304 | src/reclaim/oidc_helper.c |
305 | src/reclaim/pabc_helper.c | ||
296 | src/reclaim/plugin_gnsrecord_reclaim.c | 306 | src/reclaim/plugin_gnsrecord_reclaim.c |
297 | src/reclaim/plugin_reclaim_attribute_basic.c | 307 | src/reclaim/plugin_reclaim_attribute_basic.c |
298 | src/reclaim/plugin_reclaim_credential_jwt.c | 308 | src/reclaim/plugin_reclaim_credential_jwt.c |
309 | src/reclaim/plugin_reclaim_credential_pabc.c | ||
299 | src/reclaim/plugin_rest_openid_connect.c | 310 | src/reclaim/plugin_rest_openid_connect.c |
311 | src/reclaim/plugin_rest_pabc.c | ||
300 | src/reclaim/plugin_rest_reclaim.c | 312 | src/reclaim/plugin_rest_reclaim.c |
301 | src/reclaim/reclaim_api.c | 313 | src/reclaim/reclaim_api.c |
302 | src/reclaim/reclaim_attribute.c | 314 | src/reclaim/reclaim_attribute.c |
@@ -399,6 +411,11 @@ src/testbed/gnunet_mpi_test.c | |||
399 | src/testbed/gnunet_testbed_mpi_spawn.c | 411 | src/testbed/gnunet_testbed_mpi_spawn.c |
400 | src/testbed/testbed_api.c | 412 | src/testbed/testbed_api.c |
401 | src/testbed/testbed_api_barriers.c | 413 | src/testbed/testbed_api_barriers.c |
414 | src/testbed/testbed_api_cmd_controller.c | ||
415 | src/testbed/testbed_api_cmd_peer.c | ||
416 | src/testbed/testbed_api_cmd_peer_store.c | ||
417 | src/testbed/testbed_api_cmd_tng_connect.c | ||
418 | src/testbed/testbed_api_cmd_tng_service.c | ||
402 | src/testbed/testbed_api_hosts.c | 419 | src/testbed/testbed_api_hosts.c |
403 | src/testbed/testbed_api_operations.c | 420 | src/testbed/testbed_api_operations.c |
404 | src/testbed/testbed_api_peers.c | 421 | src/testbed/testbed_api_peers.c |
@@ -412,6 +429,13 @@ src/testbed/testbed_api_underlay.c | |||
412 | src/testing/gnunet-testing.c | 429 | src/testing/gnunet-testing.c |
413 | src/testing/list-keys.c | 430 | src/testing/list-keys.c |
414 | src/testing/testing.c | 431 | src/testing/testing.c |
432 | src/testing/testing_api_cmd_batch.c | ||
433 | src/testing/testing_api_cmd_hello_world.c | ||
434 | src/testing/testing_api_cmd_hello_world_birth.c | ||
435 | src/testing/testing_api_loop.c | ||
436 | src/testing/testing_api_trait_cmd.c | ||
437 | src/testing/testing_api_trait_process.c | ||
438 | src/testing/testing_api_traits.c | ||
415 | src/topology/friends.c | 439 | src/topology/friends.c |
416 | src/topology/gnunet-daemon-topology.c | 440 | src/topology/gnunet-daemon-topology.c |
417 | src/transport/gnunet-communicator-tcp.c | 441 | src/transport/gnunet-communicator-tcp.c |
@@ -508,6 +532,7 @@ src/util/dnsparser.c | |||
508 | src/util/dnsstub.c | 532 | src/util/dnsstub.c |
509 | src/util/getopt.c | 533 | src/util/getopt.c |
510 | src/util/getopt_helpers.c | 534 | src/util/getopt_helpers.c |
535 | src/util/gnunet-base32.c | ||
511 | src/util/gnunet-config-diff.c | 536 | src/util/gnunet-config-diff.c |
512 | src/util/gnunet-config.c | 537 | src/util/gnunet-config.c |
513 | src/util/gnunet-crypto-tvg.c | 538 | src/util/gnunet-crypto-tvg.c |
@@ -10,7 +10,7 @@ msgid "" | |||
10 | msgstr "" | 10 | msgstr "" |
11 | "Project-Id-Version: gnunet 0.10.1\n" | 11 | "Project-Id-Version: gnunet 0.10.1\n" |
12 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 12 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
13 | "POT-Creation-Date: 2020-11-13 23:46+0900\n" | 13 | "POT-Creation-Date: 2021-04-04 19:19+0200\n" |
14 | "PO-Revision-Date: 2015-03-08 16:16+0100\n" | 14 | "PO-Revision-Date: 2015-03-08 16:16+0100\n" |
15 | "Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n" | 15 | "Last-Translator: Mario Blättermann <mario.blaettermann@gmail.com>\n" |
16 | "Language-Team: German <translation-team-de@lists.sourceforge.net>\n" | 16 | "Language-Team: German <translation-team-de@lists.sourceforge.net>\n" |
@@ -755,7 +755,7 @@ msgstr "" | |||
755 | 755 | ||
756 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 | 756 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 |
757 | #: src/conversation/gnunet-conversation-test.c:256 | 757 | #: src/conversation/gnunet-conversation-test.c:256 |
758 | #: src/revocation/gnunet-revocation.c:569 src/template/gnunet-template.c:75 | 758 | #: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 |
759 | msgid "help text" | 759 | msgid "help text" |
760 | msgstr "Hilfetext" | 760 | msgstr "Hilfetext" |
761 | 761 | ||
@@ -1327,7 +1327,7 @@ msgstr "Unbekannter Fehler" | |||
1327 | msgid "%24s: %-30s %4s (timeout in %6s)\n" | 1327 | msgid "%24s: %-30s %4s (timeout in %6s)\n" |
1328 | msgstr "%24s: %-17s %4s (%u Verbindungen insgesamt)\n" | 1328 | msgstr "%24s: %-17s %4s (%u Verbindungen insgesamt)\n" |
1329 | 1329 | ||
1330 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:696 | 1330 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:697 |
1331 | #, c-format | 1331 | #, c-format |
1332 | msgid "Invalid command line argument `%s'\n" | 1332 | msgid "Invalid command line argument `%s'\n" |
1333 | msgstr "Ungültiges Befehlszeilenargument »%s«\n" | 1333 | msgstr "Ungültiges Befehlszeilenargument »%s«\n" |
@@ -1618,7 +1618,7 @@ msgstr "" | |||
1618 | #: src/testbed/generate-underlay-topology.c:48 | 1618 | #: src/testbed/generate-underlay-topology.c:48 |
1619 | #: src/testbed/gnunet-daemon-latency-logger.c:53 | 1619 | #: src/testbed/gnunet-daemon-latency-logger.c:53 |
1620 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 | 1620 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 |
1621 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:62 | 1621 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:78 |
1622 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 | 1622 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 |
1623 | #, c-format | 1623 | #, c-format |
1624 | msgid "`%s' failed at %s:%d with error: %s\n" | 1624 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -2064,7 +2064,7 @@ msgstr "" | |||
2064 | msgid "Exiting as the number of peers is %u\n" | 2064 | msgid "Exiting as the number of peers is %u\n" |
2065 | msgstr "" | 2065 | msgstr "" |
2066 | 2066 | ||
2067 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194 | 2067 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3136 |
2068 | #, fuzzy | 2068 | #, fuzzy |
2069 | msgid "number of peers to start" | 2069 | msgid "number of peers to start" |
2070 | msgstr "Anzahl an Durchläufen" | 2070 | msgstr "Anzahl an Durchläufen" |
@@ -3257,7 +3257,7 @@ msgid "Downloading `%s' done (%s/s).\n" | |||
3257 | msgstr "Dateien aus dem GNUnet herunterladen." | 3257 | msgstr "Dateien aus dem GNUnet herunterladen." |
3258 | 3258 | ||
3259 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 | 3259 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 |
3260 | #: src/fs/gnunet-search.c:226 src/fs/gnunet-unindex.c:117 | 3260 | #: src/fs/gnunet-search.c:229 src/fs/gnunet-unindex.c:117 |
3261 | #, c-format | 3261 | #, c-format |
3262 | msgid "Unexpected status: %d\n" | 3262 | msgid "Unexpected status: %d\n" |
3263 | msgstr "" | 3263 | msgstr "" |
@@ -3281,12 +3281,12 @@ msgid "Target filename must be specified.\n" | |||
3281 | msgstr "" | 3281 | msgstr "" |
3282 | 3282 | ||
3283 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 | 3283 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 |
3284 | #: src/fs/gnunet-search.c:291 src/fs/gnunet-unindex.c:154 | 3284 | #: src/fs/gnunet-search.c:294 src/fs/gnunet-unindex.c:154 |
3285 | #, fuzzy, c-format | 3285 | #, fuzzy, c-format |
3286 | msgid "Could not initialize `%s' subsystem.\n" | 3286 | msgid "Could not initialize `%s' subsystem.\n" |
3287 | msgstr "`%s' Dienst konnte nicht initialisiert werden.\n" | 3287 | msgstr "`%s' Dienst konnte nicht initialisiert werden.\n" |
3288 | 3288 | ||
3289 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:331 | 3289 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:334 |
3290 | msgid "set the desired LEVEL of receiver-anonymity" | 3290 | msgid "set the desired LEVEL of receiver-anonymity" |
3291 | msgstr "Den Grad LEVEL der gewünschten Empfänger-Anonymität setzen" | 3291 | msgstr "Den Grad LEVEL der gewünschten Empfänger-Anonymität setzen" |
3292 | 3292 | ||
@@ -3294,7 +3294,7 @@ msgstr "Den Grad LEVEL der gewünschten Empfänger-Anonymität setzen" | |||
3294 | msgid "delete incomplete downloads (when aborted with CTRL-C)" | 3294 | msgid "delete incomplete downloads (when aborted with CTRL-C)" |
3295 | msgstr "" | 3295 | msgstr "" |
3296 | 3296 | ||
3297 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:336 | 3297 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:339 |
3298 | msgid "only search the local peer (no P2P network search)" | 3298 | msgid "only search the local peer (no P2P network search)" |
3299 | msgstr "" | 3299 | msgstr "" |
3300 | 3300 | ||
@@ -3552,38 +3552,38 @@ msgstr "" | |||
3552 | msgid "Publish a file or directory on GNUnet" | 3552 | msgid "Publish a file or directory on GNUnet" |
3553 | msgstr "" | 3553 | msgstr "" |
3554 | 3554 | ||
3555 | #: src/fs/gnunet-search.c:127 | 3555 | #: src/fs/gnunet-search.c:130 |
3556 | #, c-format | 3556 | #, c-format |
3557 | msgid "Failed to write directory with search results to `%s'\n" | 3557 | msgid "Failed to write directory with search results to `%s'\n" |
3558 | msgstr "" | 3558 | msgstr "" |
3559 | 3559 | ||
3560 | #: src/fs/gnunet-search.c:216 | 3560 | #: src/fs/gnunet-search.c:219 |
3561 | #, fuzzy, c-format | 3561 | #, fuzzy, c-format |
3562 | msgid "Error searching: %s.\n" | 3562 | msgid "Error searching: %s.\n" |
3563 | msgstr "Fehler beim Verlassen der DHT.\n" | 3563 | msgstr "Fehler beim Verlassen der DHT.\n" |
3564 | 3564 | ||
3565 | #: src/fs/gnunet-search.c:278 | 3565 | #: src/fs/gnunet-search.c:281 |
3566 | msgid "Could not create keyword URI from arguments.\n" | 3566 | msgid "Could not create keyword URI from arguments.\n" |
3567 | msgstr "" | 3567 | msgstr "" |
3568 | 3568 | ||
3569 | #: src/fs/gnunet-search.c:305 | 3569 | #: src/fs/gnunet-search.c:308 |
3570 | #, fuzzy | 3570 | #, fuzzy |
3571 | msgid "Could not start searching.\n" | 3571 | msgid "Could not start searching.\n" |
3572 | msgstr "Fehler beim Starten der Collection.\n" | 3572 | msgstr "Fehler beim Starten der Collection.\n" |
3573 | 3573 | ||
3574 | #: src/fs/gnunet-search.c:342 | 3574 | #: src/fs/gnunet-search.c:345 |
3575 | msgid "write search results to file starting with PREFIX" | 3575 | msgid "write search results to file starting with PREFIX" |
3576 | msgstr "" | 3576 | msgstr "" |
3577 | 3577 | ||
3578 | #: src/fs/gnunet-search.c:348 | 3578 | #: src/fs/gnunet-search.c:351 |
3579 | msgid "automatically terminate search after DELAY" | 3579 | msgid "automatically terminate search after DELAY" |
3580 | msgstr "" | 3580 | msgstr "" |
3581 | 3581 | ||
3582 | #: src/fs/gnunet-search.c:354 | 3582 | #: src/fs/gnunet-search.c:357 |
3583 | msgid "automatically terminate search after VALUE results are found" | 3583 | msgid "automatically terminate search after VALUE results are found" |
3584 | msgstr "" | 3584 | msgstr "" |
3585 | 3585 | ||
3586 | #: src/fs/gnunet-search.c:368 | 3586 | #: src/fs/gnunet-search.c:371 |
3587 | msgid "Search GNUnet for files that were published on GNUnet" | 3587 | msgid "Search GNUnet for files that were published on GNUnet" |
3588 | msgstr "" | 3588 | msgstr "" |
3589 | 3589 | ||
@@ -3967,7 +3967,7 @@ msgstr "" | |||
3967 | msgid "Expected a base32-encoded public zone key\n" | 3967 | msgid "Expected a base32-encoded public zone key\n" |
3968 | msgstr "" | 3968 | msgstr "" |
3969 | 3969 | ||
3970 | #: src/gns/gnunet-bcd.c:133 | 3970 | #: src/gns/gnunet-bcd.c:134 |
3971 | #, fuzzy, c-format | 3971 | #, fuzzy, c-format |
3972 | msgid "Refusing `%s' request to HTTP server\n" | 3972 | msgid "Refusing `%s' request to HTTP server\n" |
3973 | msgstr "Fehler beim Senden einer `%s' Anfrage an den SMTP Server.\n" | 3973 | msgstr "Fehler beim Senden einer `%s' Anfrage an den SMTP Server.\n" |
@@ -3999,35 +3999,40 @@ msgstr "" | |||
3999 | msgid "Failed to pack DNS response into UDP packet!\n" | 3999 | msgid "Failed to pack DNS response into UDP packet!\n" |
4000 | msgstr "" | 4000 | msgstr "" |
4001 | 4001 | ||
4002 | #: src/gns/gnunet-dns2gns.c:444 | 4002 | #: src/gns/gnunet-dns2gns.c:315 |
4003 | #, fuzzy | ||
4004 | msgid "Failed to parse DNS response!\n" | ||
4005 | msgstr "Zustellung der Nachricht `%s' fehlgeschlagen.\n" | ||
4006 | |||
4007 | #: src/gns/gnunet-dns2gns.c:452 | ||
4003 | #, c-format | 4008 | #, c-format |
4004 | msgid "Cannot parse DNS request from %s\n" | 4009 | msgid "Cannot parse DNS request from %s\n" |
4005 | msgstr "" | 4010 | msgstr "" |
4006 | 4011 | ||
4007 | #: src/gns/gnunet-dns2gns.c:460 | 4012 | #: src/gns/gnunet-dns2gns.c:468 |
4008 | #, fuzzy, c-format | 4013 | #, fuzzy, c-format |
4009 | msgid "Received malformed DNS request from %s\n" | 4014 | msgid "Received malformed DNS request from %s\n" |
4010 | msgstr "Beschädigte Antwort auf `%s' von Knoten `%s' empfangen.\n" | 4015 | msgstr "Beschädigte Antwort auf `%s' von Knoten `%s' empfangen.\n" |
4011 | 4016 | ||
4012 | #: src/gns/gnunet-dns2gns.c:468 | 4017 | #: src/gns/gnunet-dns2gns.c:476 |
4013 | #, fuzzy, c-format | 4018 | #, fuzzy, c-format |
4014 | msgid "Received unsupported DNS request from %s\n" | 4019 | msgid "Received unsupported DNS request from %s\n" |
4015 | msgstr "Unbekannte Anfrageart %d empfangen bei %s:%d\n" | 4020 | msgstr "Unbekannte Anfrageart %d empfangen bei %s:%d\n" |
4016 | 4021 | ||
4017 | #: src/gns/gnunet-dns2gns.c:629 | 4022 | #: src/gns/gnunet-dns2gns.c:637 |
4018 | #, fuzzy | 4023 | #, fuzzy |
4019 | msgid "No DNS server specified!\n" | 4024 | msgid "No DNS server specified!\n" |
4020 | msgstr "Keine Schlüsselwörter angegeben!\n" | 4025 | msgstr "Keine Schlüsselwörter angegeben!\n" |
4021 | 4026 | ||
4022 | #: src/gns/gnunet-dns2gns.c:778 | 4027 | #: src/gns/gnunet-dns2gns.c:786 |
4023 | msgid "IP of recursive DNS resolver to use (required)" | 4028 | msgid "IP of recursive DNS resolver to use (required)" |
4024 | msgstr "" | 4029 | msgstr "" |
4025 | 4030 | ||
4026 | #: src/gns/gnunet-dns2gns.c:784 | 4031 | #: src/gns/gnunet-dns2gns.c:792 |
4027 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4032 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4028 | msgstr "" | 4033 | msgstr "" |
4029 | 4034 | ||
4030 | #: src/gns/gnunet-dns2gns.c:801 | 4035 | #: src/gns/gnunet-dns2gns.c:809 |
4031 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4036 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4032 | msgstr "" | 4037 | msgstr "" |
4033 | 4038 | ||
@@ -4148,64 +4153,64 @@ msgstr "" | |||
4148 | msgid "Cookie domain `%s' supplied by server is invalid\n" | 4153 | msgid "Cookie domain `%s' supplied by server is invalid\n" |
4149 | msgstr "" | 4154 | msgstr "" |
4150 | 4155 | ||
4151 | #: src/gns/gnunet-gns-proxy.c:2133 | 4156 | #: src/gns/gnunet-gns-proxy.c:2134 |
4152 | #, fuzzy, c-format | 4157 | #, fuzzy, c-format |
4153 | msgid "Unsupported HTTP method `%s'\n" | 4158 | msgid "Unsupported HTTP method `%s'\n" |
4154 | msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" | 4159 | msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" |
4155 | 4160 | ||
4156 | #: src/gns/gnunet-gns-proxy.c:2657 | 4161 | #: src/gns/gnunet-gns-proxy.c:2658 |
4157 | #, fuzzy, c-format | 4162 | #, fuzzy, c-format |
4158 | msgid "Unable to import private key from file `%s'\n" | 4163 | msgid "Unable to import private key from file `%s'\n" |
4159 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" | 4164 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" |
4160 | 4165 | ||
4161 | #: src/gns/gnunet-gns-proxy.c:2689 | 4166 | #: src/gns/gnunet-gns-proxy.c:2690 |
4162 | #, fuzzy, c-format | 4167 | #, fuzzy, c-format |
4163 | msgid "Unable to import certificate from `%s'\n" | 4168 | msgid "Unable to import certificate from `%s'\n" |
4164 | msgstr "SQLite Datenbank konnte nicht initialisiert werden: %s.\n" | 4169 | msgstr "SQLite Datenbank konnte nicht initialisiert werden: %s.\n" |
4165 | 4170 | ||
4166 | #: src/gns/gnunet-gns-proxy.c:2898 | 4171 | #: src/gns/gnunet-gns-proxy.c:2899 |
4167 | #, fuzzy, c-format | 4172 | #, fuzzy, c-format |
4168 | msgid "Failed to start HTTPS server for `%s'\n" | 4173 | msgid "Failed to start HTTPS server for `%s'\n" |
4169 | msgstr "Der Transportdienst auf Port %d konnte nicht gestartet werden.\n" | 4174 | msgstr "Der Transportdienst auf Port %d konnte nicht gestartet werden.\n" |
4170 | 4175 | ||
4171 | #: src/gns/gnunet-gns-proxy.c:2922 src/rest/gnunet-rest-server.c:917 | 4176 | #: src/gns/gnunet-gns-proxy.c:2923 src/rest/gnunet-rest-server.c:917 |
4172 | #, fuzzy | 4177 | #, fuzzy |
4173 | msgid "Failed to pass client to MHD\n" | 4178 | msgid "Failed to pass client to MHD\n" |
4174 | msgstr "Fehler beim Starten der Collection.\n" | 4179 | msgstr "Fehler beim Starten der Collection.\n" |
4175 | 4180 | ||
4176 | #: src/gns/gnunet-gns-proxy.c:3271 | 4181 | #: src/gns/gnunet-gns-proxy.c:3272 |
4177 | #, c-format | 4182 | #, c-format |
4178 | msgid "Unsupported socks version %d\n" | 4183 | msgid "Unsupported socks version %d\n" |
4179 | msgstr "" | 4184 | msgstr "" |
4180 | 4185 | ||
4181 | #: src/gns/gnunet-gns-proxy.c:3303 | 4186 | #: src/gns/gnunet-gns-proxy.c:3304 |
4182 | #, fuzzy, c-format | 4187 | #, fuzzy, c-format |
4183 | msgid "Unsupported socks command %d\n" | 4188 | msgid "Unsupported socks command %d\n" |
4184 | msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" | 4189 | msgstr "Kommando `%s' wird nicht unterstützt. Vorgang wird abgebrochen.\n" |
4185 | 4190 | ||
4186 | #: src/gns/gnunet-gns-proxy.c:3389 | 4191 | #: src/gns/gnunet-gns-proxy.c:3390 |
4187 | #, c-format | 4192 | #, c-format |
4188 | msgid "Unsupported socks address type %d\n" | 4193 | msgid "Unsupported socks address type %d\n" |
4189 | msgstr "" | 4194 | msgstr "" |
4190 | 4195 | ||
4191 | #: src/gns/gnunet-gns-proxy.c:3730 | 4196 | #: src/gns/gnunet-gns-proxy.c:3731 |
4192 | #, fuzzy, c-format | 4197 | #, fuzzy, c-format |
4193 | msgid "Failed to load X.509 key and certificate from `%s'\n" | 4198 | msgid "Failed to load X.509 key and certificate from `%s'\n" |
4194 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" | 4199 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" |
4195 | 4200 | ||
4196 | #: src/gns/gnunet-gns-proxy.c:3864 | 4201 | #: src/gns/gnunet-gns-proxy.c:3865 |
4197 | msgid "listen on specified port (default: 7777)" | 4202 | msgid "listen on specified port (default: 7777)" |
4198 | msgstr "" | 4203 | msgstr "" |
4199 | 4204 | ||
4200 | #: src/gns/gnunet-gns-proxy.c:3869 | 4205 | #: src/gns/gnunet-gns-proxy.c:3870 |
4201 | msgid "pem file to use as CA" | 4206 | msgid "pem file to use as CA" |
4202 | msgstr "" | 4207 | msgstr "" |
4203 | 4208 | ||
4204 | #: src/gns/gnunet-gns-proxy.c:3873 | 4209 | #: src/gns/gnunet-gns-proxy.c:3874 |
4205 | msgid "disable use of IPv6" | 4210 | msgid "disable use of IPv6" |
4206 | msgstr "" | 4211 | msgstr "" |
4207 | 4212 | ||
4208 | #: src/gns/gnunet-gns-proxy.c:3899 | 4213 | #: src/gns/gnunet-gns-proxy.c:3900 |
4209 | msgid "GNUnet GNS proxy" | 4214 | msgid "GNUnet GNS proxy" |
4210 | msgstr "" | 4215 | msgstr "" |
4211 | 4216 | ||
@@ -4231,7 +4236,7 @@ msgstr "Verbindung zu gnunetd konnte nicht hergestellt werden.\n" | |||
4231 | msgid "Error converting GNS response to DNS response!\n" | 4236 | msgid "Error converting GNS response to DNS response!\n" |
4232 | msgstr "Fehler beim Konvertieren von Parametern in URI!\n" | 4237 | msgstr "Fehler beim Konvertieren von Parametern in URI!\n" |
4233 | 4238 | ||
4234 | #: src/gns/gnunet-service-gns_interceptor.c:387 | 4239 | #: src/gns/gnunet-service-gns_interceptor.c:386 |
4235 | #, fuzzy | 4240 | #, fuzzy |
4236 | msgid "Failed to connect to the DNS service!\n" | 4241 | msgid "Failed to connect to the DNS service!\n" |
4237 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 4242 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
@@ -4266,36 +4271,36 @@ msgstr "" | |||
4266 | msgid "VPN returned empty result for `%s'\n" | 4271 | msgid "VPN returned empty result for `%s'\n" |
4267 | msgstr "" | 4272 | msgstr "" |
4268 | 4273 | ||
4269 | #: src/gns/gnunet-service-gns_resolver.c:1910 | 4274 | #: src/gns/gnunet-service-gns_resolver.c:1919 |
4270 | #, c-format | 4275 | #, c-format |
4271 | msgid "Name `%s' cannot be converted to IDNA." | 4276 | msgid "Name `%s' cannot be converted to IDNA." |
4272 | msgstr "" | 4277 | msgstr "" |
4273 | 4278 | ||
4274 | #: src/gns/gnunet-service-gns_resolver.c:1923 | 4279 | #: src/gns/gnunet-service-gns_resolver.c:1934 |
4275 | #, c-format | 4280 | #, c-format |
4276 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" | 4281 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" |
4277 | msgstr "" | 4282 | msgstr "" |
4278 | 4283 | ||
4279 | #: src/gns/gnunet-service-gns_resolver.c:1966 | 4284 | #: src/gns/gnunet-service-gns_resolver.c:1979 |
4280 | #, fuzzy, c-format | 4285 | #, fuzzy, c-format |
4281 | msgid "GNS lookup failed (zero records found for `%s')\n" | 4286 | msgid "GNS lookup failed (zero records found for `%s')\n" |
4282 | msgstr "Dienst `%s' konnte nicht ordentlich entladen werden!\n" | 4287 | msgstr "Dienst `%s' konnte nicht ordentlich entladen werden!\n" |
4283 | 4288 | ||
4284 | #: src/gns/gnunet-service-gns_resolver.c:2393 | 4289 | #: src/gns/gnunet-service-gns_resolver.c:2406 |
4285 | msgid "GNS lookup recursion failed (no delegation record found)\n" | 4290 | msgid "GNS lookup recursion failed (no delegation record found)\n" |
4286 | msgstr "" | 4291 | msgstr "" |
4287 | 4292 | ||
4288 | #: src/gns/gnunet-service-gns_resolver.c:2416 | 4293 | #: src/gns/gnunet-service-gns_resolver.c:2429 |
4289 | #, fuzzy, c-format | 4294 | #, fuzzy, c-format |
4290 | msgid "Failed to cache GNS resolution: %s\n" | 4295 | msgid "Failed to cache GNS resolution: %s\n" |
4291 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" | 4296 | msgstr "Es konnte keine Verbindung mit gnunetd hergestellt werden.\n" |
4292 | 4297 | ||
4293 | #: src/gns/gnunet-service-gns_resolver.c:2581 | 4298 | #: src/gns/gnunet-service-gns_resolver.c:2594 |
4294 | #, c-format | 4299 | #, c-format |
4295 | msgid "GNS namecache returned empty result for `%s'\n" | 4300 | msgid "GNS namecache returned empty result for `%s'\n" |
4296 | msgstr "" | 4301 | msgstr "" |
4297 | 4302 | ||
4298 | #: src/gns/gnunet-service-gns_resolver.c:2721 | 4303 | #: src/gns/gnunet-service-gns_resolver.c:2734 |
4299 | #, c-format | 4304 | #, c-format |
4300 | msgid "Zone %s was revoked, resolution fails\n" | 4305 | msgid "Zone %s was revoked, resolution fails\n" |
4301 | msgstr "" | 4306 | msgstr "" |
@@ -4329,7 +4334,7 @@ msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" | |||
4329 | msgid "Unable to parse BOX record string `%s'\n" | 4334 | msgid "Unable to parse BOX record string `%s'\n" |
4330 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" | 4335 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" |
4331 | 4336 | ||
4332 | #: src/gns/plugin_rest_gns.c:448 | 4337 | #: src/gns/plugin_rest_gns.c:450 |
4333 | #, fuzzy | 4338 | #, fuzzy |
4334 | msgid "Gns REST API initialized\n" | 4339 | msgid "Gns REST API initialized\n" |
4335 | msgstr " Verbindung fehlgeschlagen\n" | 4340 | msgstr " Verbindung fehlgeschlagen\n" |
@@ -4672,7 +4677,7 @@ msgstr "" | |||
4672 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 | 4677 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 |
4673 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 | 4678 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 |
4674 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 | 4679 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 |
4675 | #: src/peerinfo-tool/gnunet-peerinfo.c:515 | 4680 | #: src/peerinfo-tool/gnunet-peerinfo.c:516 |
4676 | #: src/topology/gnunet-daemon-topology.c:799 | 4681 | #: src/topology/gnunet-daemon-topology.c:799 |
4677 | #, fuzzy, c-format | 4682 | #, fuzzy, c-format |
4678 | msgid "Error in communication with PEERINFO service: %s\n" | 4683 | msgid "Error in communication with PEERINFO service: %s\n" |
@@ -4838,8 +4843,8 @@ msgid "default configured, but ego unknown (internal error)" | |||
4838 | msgstr "" | 4843 | msgstr "" |
4839 | 4844 | ||
4840 | #: src/identity/gnunet-service-identity.c:621 | 4845 | #: src/identity/gnunet-service-identity.c:621 |
4841 | #: src/identity/gnunet-service-identity.c:898 | 4846 | #: src/identity/gnunet-service-identity.c:896 |
4842 | #: src/identity/gnunet-service-identity.c:1018 | 4847 | #: src/identity/gnunet-service-identity.c:1016 |
4843 | #, fuzzy, c-format | 4848 | #, fuzzy, c-format |
4844 | msgid "Failed to write subsystem default identifier map to `%s'.\n" | 4849 | msgid "Failed to write subsystem default identifier map to `%s'.\n" |
4845 | msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" | 4850 | msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" |
@@ -4848,30 +4853,30 @@ msgstr "Fehler beim Aktualisieren der Daten des Moduls `%s'\n" | |||
4848 | msgid "Unknown ego specified for service (internal error)" | 4853 | msgid "Unknown ego specified for service (internal error)" |
4849 | msgstr "" | 4854 | msgstr "" |
4850 | 4855 | ||
4851 | #: src/identity/gnunet-service-identity.c:726 | 4856 | #: src/identity/gnunet-service-identity.c:725 |
4852 | msgid "identifier already in use for another ego" | 4857 | msgid "identifier already in use for another ego" |
4853 | msgstr "" | 4858 | msgstr "" |
4854 | 4859 | ||
4855 | #: src/identity/gnunet-service-identity.c:874 | 4860 | #: src/identity/gnunet-service-identity.c:872 |
4856 | msgid "target name already exists" | 4861 | msgid "target name already exists" |
4857 | msgstr "" | 4862 | msgstr "" |
4858 | 4863 | ||
4859 | #: src/identity/gnunet-service-identity.c:916 | 4864 | #: src/identity/gnunet-service-identity.c:914 |
4860 | #: src/identity/gnunet-service-identity.c:1035 | 4865 | #: src/identity/gnunet-service-identity.c:1033 |
4861 | msgid "no matching ego found" | 4866 | msgid "no matching ego found" |
4862 | msgstr "" | 4867 | msgstr "" |
4863 | 4868 | ||
4864 | #: src/identity/gnunet-service-identity.c:1133 | 4869 | #: src/identity/gnunet-service-identity.c:1131 |
4865 | #, fuzzy, c-format | 4870 | #, fuzzy, c-format |
4866 | msgid "Failed to parse ego information in `%s'\n" | 4871 | msgid "Failed to parse ego information in `%s'\n" |
4867 | msgstr "Fehler beim Parsen der Gerätedaten von `%s' bei %s:%d.\n" | 4872 | msgstr "Fehler beim Parsen der Gerätedaten von `%s' bei %s:%d.\n" |
4868 | 4873 | ||
4869 | #: src/identity/gnunet-service-identity.c:1191 | 4874 | #: src/identity/gnunet-service-identity.c:1189 |
4870 | #, fuzzy, c-format | 4875 | #, fuzzy, c-format |
4871 | msgid "Failed to parse subsystem identity configuration file `%s'\n" | 4876 | msgid "Failed to parse subsystem identity configuration file `%s'\n" |
4872 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" | 4877 | msgstr "Fehler beim Speichern der Konfigurationsdatei `%s':" |
4873 | 4878 | ||
4874 | #: src/identity/gnunet-service-identity.c:1200 | 4879 | #: src/identity/gnunet-service-identity.c:1198 |
4875 | #, fuzzy, c-format | 4880 | #, fuzzy, c-format |
4876 | msgid "Failed to create directory `%s' for storing egos\n" | 4881 | msgid "Failed to create directory `%s' for storing egos\n" |
4877 | msgstr "Dateiformat fehlerhaft (kein GNUnet Verzeichnis?)\n" | 4882 | msgstr "Dateiformat fehlerhaft (kein GNUnet Verzeichnis?)\n" |
@@ -5107,7 +5112,7 @@ msgid "Invalid public key for reverse lookup `%s'\n" | |||
5107 | msgstr "" | 5112 | msgstr "" |
5108 | 5113 | ||
5109 | #: src/namestore/gnunet-namestore.c:1220 | 5114 | #: src/namestore/gnunet-namestore.c:1220 |
5110 | #: src/peerinfo-tool/gnunet-peerinfo.c:736 | 5115 | #: src/peerinfo-tool/gnunet-peerinfo.c:737 |
5111 | #, fuzzy, c-format | 5116 | #, fuzzy, c-format |
5112 | msgid "Invalid URI `%s'\n" | 5117 | msgid "Invalid URI `%s'\n" |
5113 | msgstr "Ungültiger Parameter: `%s'\n" | 5118 | msgstr "Ungültiger Parameter: `%s'\n" |
@@ -5290,7 +5295,7 @@ msgstr "" | |||
5290 | msgid "GNU Name System First Come First Serve name registration service" | 5295 | msgid "GNU Name System First Come First Serve name registration service" |
5291 | msgstr "" | 5296 | msgstr "" |
5292 | 5297 | ||
5293 | #: src/namestore/gnunet-service-namestore.c:866 | 5298 | #: src/namestore/gnunet-service-namestore.c:871 |
5294 | #, c-format | 5299 | #, c-format |
5295 | msgid "Failed to replicate block in namecache: %s\n" | 5300 | msgid "Failed to replicate block in namecache: %s\n" |
5296 | msgstr "" | 5301 | msgstr "" |
@@ -5322,7 +5327,7 @@ msgstr "" | |||
5322 | msgid "Flat file database running\n" | 5327 | msgid "Flat file database running\n" |
5323 | msgstr "Sqlite-Datenbank läuft\n" | 5328 | msgstr "Sqlite-Datenbank läuft\n" |
5324 | 5329 | ||
5325 | #: src/namestore/plugin_rest_namestore.c:1103 | 5330 | #: src/namestore/plugin_rest_namestore.c:1105 |
5326 | #, fuzzy | 5331 | #, fuzzy |
5327 | msgid "Namestore REST API initialized\n" | 5332 | msgid "Namestore REST API initialized\n" |
5328 | msgstr " Verbindung fehlgeschlagen\n" | 5333 | msgstr " Verbindung fehlgeschlagen\n" |
@@ -5640,8 +5645,8 @@ msgstr "" | |||
5640 | msgid "Measure quality and performance of the NSE service." | 5645 | msgid "Measure quality and performance of the NSE service." |
5641 | msgstr "" | 5646 | msgstr "" |
5642 | 5647 | ||
5643 | #: src/nse/gnunet-service-nse.c:1443 | 5648 | #: src/nse/gnunet-service-nse.c:1450 |
5644 | #: src/revocation/gnunet-service-revocation.c:875 src/util/gnunet-scrypt.c:257 | 5649 | #: src/revocation/gnunet-service-revocation.c:883 src/util/gnunet-scrypt.c:260 |
5645 | msgid "Value is too large.\n" | 5650 | msgid "Value is too large.\n" |
5646 | msgstr "" | 5651 | msgstr "" |
5647 | 5652 | ||
@@ -5683,17 +5688,17 @@ msgstr "==> Verzeichnis `%s':\n" | |||
5683 | msgid "Still no peers found in `%s'!\n" | 5688 | msgid "Still no peers found in `%s'!\n" |
5684 | msgstr "Dienst `%s' konnte nicht ordentlich entladen werden!\n" | 5689 | msgstr "Dienst `%s' konnte nicht ordentlich entladen werden!\n" |
5685 | 5690 | ||
5686 | #: src/peerinfo/gnunet-service-peerinfo.c:1024 | 5691 | #: src/peerinfo/gnunet-service-peerinfo.c:1027 |
5687 | #, fuzzy, c-format | 5692 | #, fuzzy, c-format |
5688 | msgid "Cleaning up directory `%s'\n" | 5693 | msgid "Cleaning up directory `%s'\n" |
5689 | msgstr "==> Verzeichnis `%s':\n" | 5694 | msgstr "==> Verzeichnis `%s':\n" |
5690 | 5695 | ||
5691 | #: src/peerinfo/gnunet-service-peerinfo.c:1319 | 5696 | #: src/peerinfo/gnunet-service-peerinfo.c:1322 |
5692 | #, c-format | 5697 | #, c-format |
5693 | msgid "Importing HELLOs from `%s'\n" | 5698 | msgid "Importing HELLOs from `%s'\n" |
5694 | msgstr "" | 5699 | msgstr "" |
5695 | 5700 | ||
5696 | #: src/peerinfo/gnunet-service-peerinfo.c:1332 | 5701 | #: src/peerinfo/gnunet-service-peerinfo.c:1335 |
5697 | msgid "Skipping import of included HELLOs\n" | 5702 | msgid "Skipping import of included HELLOs\n" |
5698 | msgstr "" | 5703 | msgstr "" |
5699 | 5704 | ||
@@ -5713,7 +5718,7 @@ msgid "\tExpires: %s \t %s\n" | |||
5713 | msgstr "" | 5718 | msgstr "" |
5714 | 5719 | ||
5715 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 | 5720 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 |
5716 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:523 | 5721 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:525 |
5717 | #, fuzzy, c-format | 5722 | #, fuzzy, c-format |
5718 | msgid "Failure: Cannot convert address to string for peer `%s'\n" | 5723 | msgid "Failure: Cannot convert address to string for peer `%s'\n" |
5719 | msgstr "Adresse des Knotens `%s' konnte nicht ermittelt werden.\n" | 5724 | msgstr "Adresse des Knotens `%s' konnte nicht ermittelt werden.\n" |
@@ -5723,54 +5728,54 @@ msgstr "Adresse des Knotens `%s' konnte nicht ermittelt werden.\n" | |||
5723 | msgid "Failure: Received invalid %s\n" | 5728 | msgid "Failure: Received invalid %s\n" |
5724 | msgstr "Ungültiger RPC `%s' empfangen.\n" | 5729 | msgstr "Ungültiger RPC `%s' empfangen.\n" |
5725 | 5730 | ||
5726 | #: src/peerinfo-tool/gnunet-peerinfo.c:463 | 5731 | #: src/peerinfo-tool/gnunet-peerinfo.c:464 |
5727 | #, c-format | 5732 | #, c-format |
5728 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" | 5733 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" |
5729 | msgstr "" | 5734 | msgstr "" |
5730 | 5735 | ||
5731 | #: src/peerinfo-tool/gnunet-peerinfo.c:479 | 5736 | #: src/peerinfo-tool/gnunet-peerinfo.c:480 |
5732 | #, c-format | 5737 | #, c-format |
5733 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" | 5738 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" |
5734 | msgstr "" | 5739 | msgstr "" |
5735 | 5740 | ||
5736 | #: src/peerinfo-tool/gnunet-peerinfo.c:758 | 5741 | #: src/peerinfo-tool/gnunet-peerinfo.c:759 |
5737 | #, c-format | 5742 | #, c-format |
5738 | msgid "I am peer `%s'.\n" | 5743 | msgid "I am peer `%s'.\n" |
5739 | msgstr "Ich bin Knoten »%s«.\n" | 5744 | msgstr "Ich bin Knoten »%s«.\n" |
5740 | 5745 | ||
5741 | #: src/peerinfo-tool/gnunet-peerinfo.c:799 | 5746 | #: src/peerinfo-tool/gnunet-peerinfo.c:800 |
5742 | msgid "don't resolve host names" | 5747 | msgid "don't resolve host names" |
5743 | msgstr "" | 5748 | msgstr "" |
5744 | 5749 | ||
5745 | #: src/peerinfo-tool/gnunet-peerinfo.c:805 | 5750 | #: src/peerinfo-tool/gnunet-peerinfo.c:806 |
5746 | msgid "output only the identity strings" | 5751 | msgid "output only the identity strings" |
5747 | msgstr "" | 5752 | msgstr "" |
5748 | 5753 | ||
5749 | #: src/peerinfo-tool/gnunet-peerinfo.c:810 | 5754 | #: src/peerinfo-tool/gnunet-peerinfo.c:811 |
5750 | msgid "include friend-only information" | 5755 | msgid "include friend-only information" |
5751 | msgstr "" | 5756 | msgstr "" |
5752 | 5757 | ||
5753 | #: src/peerinfo-tool/gnunet-peerinfo.c:815 | 5758 | #: src/peerinfo-tool/gnunet-peerinfo.c:816 |
5754 | msgid "output our own identity only" | 5759 | msgid "output our own identity only" |
5755 | msgstr "" | 5760 | msgstr "" |
5756 | 5761 | ||
5757 | #: src/peerinfo-tool/gnunet-peerinfo.c:820 | 5762 | #: src/peerinfo-tool/gnunet-peerinfo.c:821 |
5758 | msgid "list all known peers" | 5763 | msgid "list all known peers" |
5759 | msgstr "" | 5764 | msgstr "" |
5760 | 5765 | ||
5761 | #: src/peerinfo-tool/gnunet-peerinfo.c:826 | 5766 | #: src/peerinfo-tool/gnunet-peerinfo.c:827 |
5762 | msgid "dump hello to file" | 5767 | msgid "dump hello to file" |
5763 | msgstr "" | 5768 | msgstr "" |
5764 | 5769 | ||
5765 | #: src/peerinfo-tool/gnunet-peerinfo.c:831 | 5770 | #: src/peerinfo-tool/gnunet-peerinfo.c:832 |
5766 | msgid "also output HELLO uri(s)" | 5771 | msgid "also output HELLO uri(s)" |
5767 | msgstr "" | 5772 | msgstr "" |
5768 | 5773 | ||
5769 | #: src/peerinfo-tool/gnunet-peerinfo.c:838 | 5774 | #: src/peerinfo-tool/gnunet-peerinfo.c:839 |
5770 | msgid "add given HELLO uri to the database" | 5775 | msgid "add given HELLO uri to the database" |
5771 | msgstr "" | 5776 | msgstr "" |
5772 | 5777 | ||
5773 | #: src/peerinfo-tool/gnunet-peerinfo.c:852 | 5778 | #: src/peerinfo-tool/gnunet-peerinfo.c:853 |
5774 | #, fuzzy | 5779 | #, fuzzy |
5775 | msgid "Print information about peers." | 5780 | msgid "Print information about peers." |
5776 | msgstr "Informationen über andere GNUnet Knoten ausgeben." | 5781 | msgstr "Informationen über andere GNUnet Knoten ausgeben." |
@@ -5793,7 +5798,7 @@ msgstr "Teste Transport(e) %s\n" | |||
5793 | msgid "Failed to load transport plugin for `%s'\n" | 5798 | msgid "Failed to load transport plugin for `%s'\n" |
5794 | msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n" | 5799 | msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n" |
5795 | 5800 | ||
5796 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:809 | 5801 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:811 |
5797 | #, fuzzy | 5802 | #, fuzzy |
5798 | msgid "Peerinfo REST API initialized\n" | 5803 | msgid "Peerinfo REST API initialized\n" |
5799 | msgstr " Verbindung fehlgeschlagen\n" | 5804 | msgstr " Verbindung fehlgeschlagen\n" |
@@ -5802,7 +5807,7 @@ msgstr " Verbindung fehlgeschlagen\n" | |||
5802 | msgid "peerstore" | 5807 | msgid "peerstore" |
5803 | msgstr "" | 5808 | msgstr "" |
5804 | 5809 | ||
5805 | #: src/peerstore/gnunet-service-peerstore.c:561 | 5810 | #: src/peerstore/gnunet-service-peerstore.c:570 |
5806 | #, fuzzy, c-format | 5811 | #, fuzzy, c-format |
5807 | msgid "Could not load database backend `%s'\n" | 5812 | msgid "Could not load database backend `%s'\n" |
5808 | msgstr "`%s' konnte nicht aufgelöst werden: %s\n" | 5813 | msgstr "`%s' konnte nicht aufgelöst werden: %s\n" |
@@ -5990,12 +5995,12 @@ msgstr "" | |||
5990 | msgid "re:claimID command line tool" | 5995 | msgid "re:claimID command line tool" |
5991 | msgstr "" | 5996 | msgstr "" |
5992 | 5997 | ||
5993 | #: src/reclaim/plugin_rest_openid_connect.c:2613 | 5998 | #: src/reclaim/plugin_rest_openid_connect.c:2788 |
5994 | #, fuzzy | 5999 | #, fuzzy |
5995 | msgid "OpenID Connect REST API initialized\n" | 6000 | msgid "OpenID Connect REST API initialized\n" |
5996 | msgstr " Verbindung fehlgeschlagen\n" | 6001 | msgstr " Verbindung fehlgeschlagen\n" |
5997 | 6002 | ||
5998 | #: src/reclaim/plugin_rest_reclaim.c:1502 | 6003 | #: src/reclaim/plugin_rest_reclaim.c:1521 |
5999 | #, fuzzy | 6004 | #, fuzzy |
6000 | msgid "Identity Provider REST API initialized\n" | 6005 | msgid "Identity Provider REST API initialized\n" |
6001 | msgstr " Verbindung fehlgeschlagen\n" | 6006 | msgstr " Verbindung fehlgeschlagen\n" |
@@ -6149,114 +6154,114 @@ msgstr "" | |||
6149 | msgid "Cancelling calculation.\n" | 6154 | msgid "Cancelling calculation.\n" |
6150 | msgstr "" | 6155 | msgstr "" |
6151 | 6156 | ||
6152 | #: src/revocation/gnunet-revocation.c:299 | 6157 | #: src/revocation/gnunet-revocation.c:302 |
6153 | #, c-format | 6158 | #, c-format |
6154 | msgid "Revocation certificate for `%s' stored in `%s'\n" | 6159 | msgid "Revocation certificate for `%s' stored in `%s'\n" |
6155 | msgstr "" | 6160 | msgstr "" |
6156 | 6161 | ||
6157 | #: src/revocation/gnunet-revocation.c:339 | 6162 | #: src/revocation/gnunet-revocation.c:334 |
6158 | #, fuzzy, c-format | 6163 | #, fuzzy, c-format |
6159 | msgid "Ego `%s' not found.\n" | 6164 | msgid "Ego `%s' not found.\n" |
6160 | msgstr "Kommando `%s' wurde nicht gefunden!\n" | 6165 | msgstr "Kommando `%s' wurde nicht gefunden!\n" |
6161 | 6166 | ||
6162 | #: src/revocation/gnunet-revocation.c:356 | 6167 | #: src/revocation/gnunet-revocation.c:351 |
6163 | #, c-format | 6168 | #, c-format |
6164 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" | 6169 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" |
6165 | msgstr "" | 6170 | msgstr "" |
6166 | 6171 | ||
6167 | #: src/revocation/gnunet-revocation.c:366 | 6172 | #: src/revocation/gnunet-revocation.c:361 |
6168 | msgid "Revocation certificate ready\n" | 6173 | msgid "Revocation certificate ready\n" |
6169 | msgstr "" | 6174 | msgstr "" |
6170 | 6175 | ||
6171 | #: src/revocation/gnunet-revocation.c:378 | 6176 | #: src/revocation/gnunet-revocation.c:373 |
6172 | msgid "Continuing calculation where left off...\n" | 6177 | msgid "Continuing calculation where left off...\n" |
6173 | msgstr "" | 6178 | msgstr "" |
6174 | 6179 | ||
6175 | #: src/revocation/gnunet-revocation.c:385 | 6180 | #: src/revocation/gnunet-revocation.c:380 |
6176 | msgid "Revocation certificate not ready, calculating proof of work\n" | 6181 | msgid "Revocation certificate not ready, calculating proof of work\n" |
6177 | msgstr "" | 6182 | msgstr "" |
6178 | 6183 | ||
6179 | #: src/revocation/gnunet-revocation.c:423 | 6184 | #: src/revocation/gnunet-revocation.c:418 |
6180 | #, c-format | 6185 | #, c-format |
6181 | msgid "Public key `%s' malformed\n" | 6186 | msgid "Public key `%s' malformed\n" |
6182 | msgstr "" | 6187 | msgstr "" |
6183 | 6188 | ||
6184 | #: src/revocation/gnunet-revocation.c:433 | 6189 | #: src/revocation/gnunet-revocation.c:428 |
6185 | msgid "" | 6190 | msgid "" |
6186 | "Testing and revoking at the same time is not allowed, only executing test.\n" | 6191 | "Testing and revoking at the same time is not allowed, only executing test.\n" |
6187 | msgstr "" | 6192 | msgstr "" |
6188 | 6193 | ||
6189 | #: src/revocation/gnunet-revocation.c:463 | 6194 | #: src/revocation/gnunet-revocation.c:458 |
6190 | msgid "No filename to store revocation certificate given.\n" | 6195 | msgid "No filename to store revocation certificate given.\n" |
6191 | msgstr "" | 6196 | msgstr "" |
6192 | 6197 | ||
6193 | #: src/revocation/gnunet-revocation.c:480 | 6198 | #: src/revocation/gnunet-revocation.c:475 |
6194 | #, fuzzy, c-format | 6199 | #, fuzzy, c-format |
6195 | msgid "Failed to read revocation certificate from `%s'\n" | 6200 | msgid "Failed to read revocation certificate from `%s'\n" |
6196 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" | 6201 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" |
6197 | 6202 | ||
6198 | #: src/revocation/gnunet-revocation.c:488 | 6203 | #: src/revocation/gnunet-revocation.c:483 |
6199 | #, fuzzy, c-format | 6204 | #, fuzzy, c-format |
6200 | msgid "Revocation certificate corrupted in `%s'\n" | 6205 | msgid "Revocation certificate corrupted in `%s'\n" |
6201 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" | 6206 | msgstr "Fehler beim Lesen der Freunde-Liste von `%s'\n" |
6202 | 6207 | ||
6203 | #: src/revocation/gnunet-revocation.c:510 | 6208 | #: src/revocation/gnunet-revocation.c:505 |
6204 | #, fuzzy | 6209 | #, fuzzy |
6205 | msgid "No action specified. Nothing to do.\n" | 6210 | msgid "No action specified. Nothing to do.\n" |
6206 | msgstr "Keine Kommandos angegeben.\n" | 6211 | msgstr "Keine Kommandos angegeben.\n" |
6207 | 6212 | ||
6208 | #: src/revocation/gnunet-revocation.c:529 | 6213 | #: src/revocation/gnunet-revocation.c:524 |
6209 | msgid "use NAME for the name of the revocation file" | 6214 | msgid "use NAME for the name of the revocation file" |
6210 | msgstr "" | 6215 | msgstr "" |
6211 | 6216 | ||
6212 | #: src/revocation/gnunet-revocation.c:537 | 6217 | #: src/revocation/gnunet-revocation.c:532 |
6213 | msgid "" | 6218 | msgid "" |
6214 | "revoke the private key associated for the the private key associated with " | 6219 | "revoke the private key associated for the the private key associated with " |
6215 | "the ego NAME " | 6220 | "the ego NAME " |
6216 | msgstr "" | 6221 | msgstr "" |
6217 | 6222 | ||
6218 | #: src/revocation/gnunet-revocation.c:544 | 6223 | #: src/revocation/gnunet-revocation.c:539 |
6219 | msgid "actually perform revocation, otherwise we just do the precomputation" | 6224 | msgid "actually perform revocation, otherwise we just do the precomputation" |
6220 | msgstr "" | 6225 | msgstr "" |
6221 | 6226 | ||
6222 | #: src/revocation/gnunet-revocation.c:551 | 6227 | #: src/revocation/gnunet-revocation.c:546 |
6223 | msgid "test if the public key KEY has been revoked" | 6228 | msgid "test if the public key KEY has been revoked" |
6224 | msgstr "" | 6229 | msgstr "" |
6225 | 6230 | ||
6226 | #: src/revocation/gnunet-revocation.c:557 | 6231 | #: src/revocation/gnunet-revocation.c:552 |
6227 | #, fuzzy | 6232 | #, fuzzy |
6228 | msgid "number of epochs to calculate for" | 6233 | msgid "number of epochs to calculate for" |
6229 | msgstr "Anzahl an Durchläufen" | 6234 | msgstr "Anzahl an Durchläufen" |
6230 | 6235 | ||
6231 | #: src/revocation/gnunet-service-revocation.c:494 | 6236 | #: src/revocation/gnunet-service-revocation.c:502 |
6232 | msgid "# unsupported revocations received via set union" | 6237 | msgid "# unsupported revocations received via set union" |
6233 | msgstr "" | 6238 | msgstr "" |
6234 | 6239 | ||
6235 | #: src/revocation/gnunet-service-revocation.c:504 | 6240 | #: src/revocation/gnunet-service-revocation.c:512 |
6236 | #, fuzzy | 6241 | #, fuzzy |
6237 | msgid "# revocation messages received via set union" | 6242 | msgid "# revocation messages received via set union" |
6238 | msgstr "# verschlüsselter PING Nachrichten empfangen" | 6243 | msgstr "# verschlüsselter PING Nachrichten empfangen" |
6239 | 6244 | ||
6240 | #: src/revocation/gnunet-service-revocation.c:509 | 6245 | #: src/revocation/gnunet-service-revocation.c:517 |
6241 | #, c-format | 6246 | #, c-format |
6242 | msgid "Error computing revocation set union with %s\n" | 6247 | msgid "Error computing revocation set union with %s\n" |
6243 | msgstr "" | 6248 | msgstr "" |
6244 | 6249 | ||
6245 | #: src/revocation/gnunet-service-revocation.c:513 | 6250 | #: src/revocation/gnunet-service-revocation.c:521 |
6246 | #, fuzzy | 6251 | #, fuzzy |
6247 | msgid "# revocation set unions failed" | 6252 | msgid "# revocation set unions failed" |
6248 | msgstr " Verbindung fehlgeschlagen\n" | 6253 | msgstr " Verbindung fehlgeschlagen\n" |
6249 | 6254 | ||
6250 | #: src/revocation/gnunet-service-revocation.c:521 | 6255 | #: src/revocation/gnunet-service-revocation.c:529 |
6251 | #, fuzzy | 6256 | #, fuzzy |
6252 | msgid "# revocation set unions completed" | 6257 | msgid "# revocation set unions completed" |
6253 | msgstr "# Klartext PONG Nachrichten empfangen" | 6258 | msgstr "# Klartext PONG Nachrichten empfangen" |
6254 | 6259 | ||
6255 | #: src/revocation/gnunet-service-revocation.c:559 | 6260 | #: src/revocation/gnunet-service-revocation.c:567 |
6256 | msgid "SET service crashed, terminating revocation service\n" | 6261 | msgid "SET service crashed, terminating revocation service\n" |
6257 | msgstr "" | 6262 | msgstr "" |
6258 | 6263 | ||
6259 | #: src/revocation/gnunet-service-revocation.c:912 | 6264 | #: src/revocation/gnunet-service-revocation.c:920 |
6260 | #, fuzzy | 6265 | #, fuzzy |
6261 | msgid "Could not open revocation database file!" | 6266 | msgid "Could not open revocation database file!" |
6262 | msgstr "Knoten `%s' konnte nicht in der Routing Tabelle gefunden werden!\n" | 6267 | msgstr "Knoten `%s' konnte nicht in der Routing Tabelle gefunden werden!\n" |
@@ -6273,20 +6278,20 @@ msgstr "" | |||
6273 | msgid "Get peers from biased stream" | 6278 | msgid "Get peers from biased stream" |
6274 | msgstr "" | 6279 | msgstr "" |
6275 | 6280 | ||
6276 | #: src/rps/gnunet-rps-profiler.c:3200 | 6281 | #: src/rps/gnunet-rps-profiler.c:3142 |
6277 | msgid "duration of the profiling" | 6282 | msgid "duration of the profiling" |
6278 | msgstr "" | 6283 | msgstr "" |
6279 | 6284 | ||
6280 | #: src/rps/gnunet-rps-profiler.c:3206 | 6285 | #: src/rps/gnunet-rps-profiler.c:3148 |
6281 | msgid "timeout for the profiling" | 6286 | msgid "timeout for the profiling" |
6282 | msgstr "" | 6287 | msgstr "" |
6283 | 6288 | ||
6284 | #: src/rps/gnunet-rps-profiler.c:3211 | 6289 | #: src/rps/gnunet-rps-profiler.c:3153 |
6285 | #, fuzzy | 6290 | #, fuzzy |
6286 | msgid "number of PeerIDs to request" | 6291 | msgid "number of PeerIDs to request" |
6287 | msgstr "Anzahl an Durchläufen" | 6292 | msgstr "Anzahl an Durchläufen" |
6288 | 6293 | ||
6289 | #: src/rps/gnunet-rps-profiler.c:3228 | 6294 | #: src/rps/gnunet-rps-profiler.c:3170 |
6290 | msgid "Measure quality and performance of the RPS service." | 6295 | msgid "Measure quality and performance of the RPS service." |
6291 | msgstr "" | 6296 | msgstr "" |
6292 | 6297 | ||
@@ -6374,7 +6379,7 @@ msgid "also profile decryption" | |||
6374 | msgstr "" | 6379 | msgstr "" |
6375 | 6380 | ||
6376 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 | 6381 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 |
6377 | #: src/setu/gnunet-service-setu.c:3633 | 6382 | #: src/setu/gnunet-service-setu.c:3832 |
6378 | #, fuzzy | 6383 | #, fuzzy |
6379 | msgid "Could not connect to CADET service\n" | 6384 | msgid "Could not connect to CADET service\n" |
6380 | msgstr "Verbindung zum %s-Dienst ist fehlgeschlagen!\n" | 6385 | msgstr "Verbindung zum %s-Dienst ist fehlgeschlagen!\n" |
@@ -6947,12 +6952,12 @@ msgstr "»%s« konnte nicht gestartet werden: %s\n" | |||
6947 | msgid "Failed to load configuration from %s\n" | 6952 | msgid "Failed to load configuration from %s\n" |
6948 | msgstr "Konfiguration konnte nicht aus %s geladen werden\n" | 6953 | msgstr "Konfiguration konnte nicht aus %s geladen werden\n" |
6949 | 6954 | ||
6950 | #: src/topology/friends.c:127 | 6955 | #: src/topology/friends.c:118 |
6951 | #, fuzzy, c-format | 6956 | #, fuzzy, c-format |
6952 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" | 6957 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" |
6953 | msgstr "Syntaxfehler in Topologieangabe, überspringe Bytes `%s'.\n" | 6958 | msgstr "Syntaxfehler in Topologieangabe, überspringe Bytes `%s'.\n" |
6954 | 6959 | ||
6955 | #: src/topology/friends.c:181 | 6960 | #: src/topology/friends.c:172 |
6956 | #, c-format | 6961 | #, c-format |
6957 | msgid "Directory for file `%s' does not seem to be writable.\n" | 6962 | msgid "Directory for file `%s' does not seem to be writable.\n" |
6958 | msgstr "" | 6963 | msgstr "" |
@@ -7018,18 +7023,18 @@ msgstr "# HELLO-Meldungen empfangen" | |||
7018 | msgid "GNUnet topology control" | 7023 | msgid "GNUnet topology control" |
7019 | msgstr "" | 7024 | msgstr "" |
7020 | 7025 | ||
7021 | #: src/transport/gnunet-communicator-tcp.c:3221 | 7026 | #: src/transport/gnunet-communicator-tcp.c:3331 |
7022 | #: src/transport/gnunet-communicator-udp.c:3076 | 7027 | #: src/transport/gnunet-communicator-udp.c:3790 |
7023 | #: src/transport/gnunet-service-tng.c:10014 | 7028 | #: src/transport/gnunet-service-tng.c:10220 |
7024 | #: src/transport/gnunet-service-transport.c:2627 | 7029 | #: src/transport/gnunet-service-transport.c:2627 |
7025 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7030 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7026 | msgstr "" | 7031 | msgstr "" |
7027 | 7032 | ||
7028 | #: src/transport/gnunet-communicator-tcp.c:3553 | 7033 | #: src/transport/gnunet-communicator-tcp.c:3668 |
7029 | msgid "GNUnet TCP communicator" | 7034 | msgid "GNUnet TCP communicator" |
7030 | msgstr "" | 7035 | msgstr "" |
7031 | 7036 | ||
7032 | #: src/transport/gnunet-communicator-udp.c:3148 | 7037 | #: src/transport/gnunet-communicator-udp.c:3862 |
7033 | msgid "GNUnet UDP communicator" | 7038 | msgid "GNUnet UDP communicator" |
7034 | msgstr "" | 7039 | msgstr "" |
7035 | 7040 | ||
@@ -8095,7 +8100,7 @@ msgstr "" | |||
8095 | msgid "Service process failed to report status\n" | 8100 | msgid "Service process failed to report status\n" |
8096 | msgstr "" | 8101 | msgstr "" |
8097 | 8102 | ||
8098 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1176 | 8103 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 |
8099 | #: src/util/service.c:1637 | 8104 | #: src/util/service.c:1637 |
8100 | #, fuzzy, c-format | 8105 | #, fuzzy, c-format |
8101 | msgid "Cannot obtain information about user `%s': %s\n" | 8106 | msgid "Cannot obtain information about user `%s': %s\n" |
@@ -8115,7 +8120,7 @@ msgid "do daemonize (detach from terminal)" | |||
8115 | msgstr "" | 8120 | msgstr "" |
8116 | 8121 | ||
8117 | #: src/transport/tcp_service_legacy.c:1397 | 8122 | #: src/transport/tcp_service_legacy.c:1397 |
8118 | #: src/transport/transport-testing2.c:985 src/util/service.c:2072 | 8123 | #: src/transport/transport-testing-communicator.c:1045 src/util/service.c:2072 |
8119 | #: src/util/service.c:2084 | 8124 | #: src/util/service.c:2084 |
8120 | #, fuzzy, c-format | 8125 | #, fuzzy, c-format |
8121 | msgid "Malformed configuration file `%s', exit ...\n" | 8126 | msgid "Malformed configuration file `%s', exit ...\n" |
@@ -8284,38 +8289,38 @@ msgstr "" | |||
8284 | "Die Konfigurationsdatei muss in der Sektion `%s' unter `%s' ein Verzeichnis " | 8289 | "Die Konfigurationsdatei muss in der Sektion `%s' unter `%s' ein Verzeichnis " |
8285 | "angeben, in dem FS Daten gespeichert werden.\n" | 8290 | "angeben, in dem FS Daten gespeichert werden.\n" |
8286 | 8291 | ||
8287 | #: src/util/configuration.c:402 | 8292 | #: src/util/configuration.c:370 |
8288 | #, fuzzy, c-format | 8293 | #, fuzzy, c-format |
8289 | msgid "Syntax error while deserializing in line %u\n" | 8294 | msgid "Syntax error while deserializing in line %u\n" |
8290 | msgstr "Syntaxfehler in Konfigurationsdatei `%s' in Zeile %d.\n" | 8295 | msgstr "Syntaxfehler in Konfigurationsdatei `%s' in Zeile %d.\n" |
8291 | 8296 | ||
8292 | #: src/util/configuration.c:460 | 8297 | #: src/util/configuration.c:420 |
8293 | #, fuzzy, c-format | 8298 | #, fuzzy, c-format |
8294 | msgid "Error while reading file `%s'\n" | 8299 | msgid "Error while reading file `%s'\n" |
8295 | msgstr "Konfigurationsdatei `%s' konnte nicht geöffnet werden.\n" | 8300 | msgstr "Konfigurationsdatei `%s' konnte nicht geöffnet werden.\n" |
8296 | 8301 | ||
8297 | #: src/util/configuration.c:1063 | 8302 | #: src/util/configuration.c:980 |
8298 | msgid "Not a valid relative time specification" | 8303 | msgid "Not a valid relative time specification" |
8299 | msgstr "" | 8304 | msgstr "" |
8300 | 8305 | ||
8301 | #: src/util/configuration.c:1154 | 8306 | #: src/util/configuration.c:1050 |
8302 | #, c-format | 8307 | #, c-format |
8303 | msgid "" | 8308 | msgid "" |
8304 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " | 8309 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " |
8305 | "choices\n" | 8310 | "choices\n" |
8306 | msgstr "" | 8311 | msgstr "" |
8307 | 8312 | ||
8308 | #: src/util/configuration.c:1269 | 8313 | #: src/util/configuration.c:1145 |
8309 | #, c-format | 8314 | #, c-format |
8310 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" | 8315 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" |
8311 | msgstr "" | 8316 | msgstr "" |
8312 | 8317 | ||
8313 | #: src/util/configuration.c:1301 | 8318 | #: src/util/configuration.c:1177 |
8314 | #, c-format | 8319 | #, c-format |
8315 | msgid "Missing closing `%s' in option `%s'\n" | 8320 | msgid "Missing closing `%s' in option `%s'\n" |
8316 | msgstr "" | 8321 | msgstr "" |
8317 | 8322 | ||
8318 | #: src/util/configuration.c:1367 | 8323 | #: src/util/configuration.c:1243 |
8319 | #, c-format | 8324 | #, c-format |
8320 | msgid "" | 8325 | msgid "" |
8321 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " | 8326 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " |
@@ -8329,38 +8334,38 @@ msgid "" | |||
8329 | "%llu)\n" | 8334 | "%llu)\n" |
8330 | msgstr "" | 8335 | msgstr "" |
8331 | 8336 | ||
8332 | #: src/util/crypto_ecc.c:663 | 8337 | #: src/util/crypto_ecc.c:567 |
8333 | #, fuzzy, c-format | 8338 | #, fuzzy, c-format |
8334 | msgid "ECC signing failed at %s:%d: %s\n" | 8339 | msgid "ECC signing failed at %s:%d: %s\n" |
8335 | msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" | 8340 | msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" |
8336 | 8341 | ||
8337 | #: src/util/crypto_ecc.c:791 | 8342 | #: src/util/crypto_ecc.c:669 |
8338 | #, fuzzy, c-format | 8343 | #, fuzzy, c-format |
8339 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 8344 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
8340 | msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" | 8345 | msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" |
8341 | 8346 | ||
8342 | #: src/util/crypto_ecc_setup.c:369 | 8347 | #: src/util/crypto_ecc_setup.c:273 |
8343 | #, fuzzy | 8348 | #, fuzzy |
8344 | msgid "Could not load peer's private key\n" | 8349 | msgid "Could not load peer's private key\n" |
8345 | msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n" | 8350 | msgstr "Anwendung `%s' konnte nicht initialisiert werden.\n" |
8346 | 8351 | ||
8347 | #: src/util/crypto_random.c:345 | 8352 | #: src/util/crypto_random.c:381 |
8348 | #, c-format | 8353 | #, c-format |
8349 | msgid "libgcrypt has not the expected version (version %s is required).\n" | 8354 | msgid "libgcrypt has not the expected version (version %s is required).\n" |
8350 | msgstr "" | 8355 | msgstr "" |
8351 | "libgcrypt hat nicht die erwartete Version (Version %s wird vorausgesetzt).\n" | 8356 | "libgcrypt hat nicht die erwartete Version (Version %s wird vorausgesetzt).\n" |
8352 | 8357 | ||
8353 | #: src/util/crypto_rsa.c:959 | 8358 | #: src/util/crypto_rsa.c:862 |
8354 | #, fuzzy, c-format | 8359 | #, fuzzy, c-format |
8355 | msgid "RSA signing failed at %s:%d: %s\n" | 8360 | msgid "RSA signing failed at %s:%d: %s\n" |
8356 | msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" | 8361 | msgstr "`%s' schlug fehl bei %s:%d mit dem Fehler: `%s'.\n" |
8357 | 8362 | ||
8358 | #: src/util/crypto_rsa.c:1318 | 8363 | #: src/util/crypto_rsa.c:1162 |
8359 | #, fuzzy, c-format | 8364 | #, fuzzy, c-format |
8360 | msgid "RSA signature verification failed at %s:%d: %s\n" | 8365 | msgid "RSA signature verification failed at %s:%d: %s\n" |
8361 | msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" | 8366 | msgstr "RSA Signaturüberprüfung fehlgeschlagen bei %s:%d: %s\n" |
8362 | 8367 | ||
8363 | #: src/util/disk.c:940 | 8368 | #: src/util/disk.c:823 |
8364 | #, fuzzy, c-format | 8369 | #, fuzzy, c-format |
8365 | msgid "Expected `%s' to be a directory!\n" | 8370 | msgid "Expected `%s' to be a directory!\n" |
8366 | msgstr "`%s' erwartet, dass `%s' ein Verzeichnis ist!\n" | 8371 | msgstr "`%s' erwartet, dass `%s' ein Verzeichnis ist!\n" |
@@ -8445,17 +8450,17 @@ msgstr "%s: Option »-W %s« ist mehrdeutig\n" | |||
8445 | msgid "%s: option `-W %s' does not allow an argument\n" | 8450 | msgid "%s: option `-W %s' does not allow an argument\n" |
8446 | msgstr "%s: Option »-W %s« erlaubt kein Argument\n" | 8451 | msgstr "%s: Option »-W %s« erlaubt kein Argument\n" |
8447 | 8452 | ||
8448 | #: src/util/getopt.c:974 | 8453 | #: src/util/getopt.c:970 |
8449 | #, fuzzy, c-format | 8454 | #, fuzzy, c-format |
8450 | msgid "Use %s to get a list of options.\n" | 8455 | msgid "Use %s to get a list of options.\n" |
8451 | msgstr "Verwenden Sie --help, um eine Liste der Optionen zu erhalten.\n" | 8456 | msgstr "Verwenden Sie --help, um eine Liste der Optionen zu erhalten.\n" |
8452 | 8457 | ||
8453 | #: src/util/getopt.c:986 | 8458 | #: src/util/getopt.c:983 |
8454 | #, fuzzy, c-format | 8459 | #, fuzzy, c-format |
8455 | msgid "Option `%s' can't be used with other options.\n" | 8460 | msgid "Option `%s' can't be used with other options.\n" |
8456 | msgstr "Die Option »%s« ergibt keinen Sinn ohne die Option »%s«.\n" | 8461 | msgstr "Die Option »%s« ergibt keinen Sinn ohne die Option »%s«.\n" |
8457 | 8462 | ||
8458 | #: src/util/getopt.c:998 | 8463 | #: src/util/getopt.c:995 |
8459 | #, fuzzy, c-format | 8464 | #, fuzzy, c-format |
8460 | msgid "Missing mandatory option `%s'.\n" | 8465 | msgid "Missing mandatory option `%s'.\n" |
8461 | msgstr "Unbekannte Operation `%s'\n" | 8466 | msgstr "Unbekannte Operation `%s'\n" |
@@ -8544,6 +8549,10 @@ msgstr "Sie müssen für die Option »%s« zusätzlich eine Zahl angeben.\n" | |||
8544 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 8549 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
8545 | msgstr "" | 8550 | msgstr "" |
8546 | 8551 | ||
8552 | #: src/util/gnunet-base32.c:45 | ||
8553 | msgid "run decoder modus, otherwise runs as encoder" | ||
8554 | msgstr "" | ||
8555 | |||
8547 | #: src/util/gnunet-config.c:167 | 8556 | #: src/util/gnunet-config.c:167 |
8548 | #, fuzzy, c-format | 8557 | #, fuzzy, c-format |
8549 | msgid "failed to load configuration defaults" | 8558 | msgid "failed to load configuration defaults" |
@@ -8597,6 +8606,10 @@ msgstr "" | |||
8597 | msgid "Manipulate GNUnet configuration files" | 8606 | msgid "Manipulate GNUnet configuration files" |
8598 | msgstr "GNUnet-Konfigurationsdateien bearbeiten" | 8607 | msgstr "GNUnet-Konfigurationsdateien bearbeiten" |
8599 | 8608 | ||
8609 | #: src/util/gnunet-crypto-tvg.c:1072 | ||
8610 | msgid "verify a test vector from stdin" | ||
8611 | msgstr "" | ||
8612 | |||
8600 | #: src/util/gnunet-ecc.c:94 | 8613 | #: src/util/gnunet-ecc.c:94 |
8601 | #, c-format | 8614 | #, c-format |
8602 | msgid "Failed to open `%s': %s\n" | 8615 | msgid "Failed to open `%s': %s\n" |
@@ -8720,31 +8733,31 @@ msgid "perform a reverse lookup" | |||
8720 | msgstr "" | 8733 | msgstr "" |
8721 | 8734 | ||
8722 | #: src/util/gnunet-resolver.c:182 | 8735 | #: src/util/gnunet-resolver.c:182 |
8723 | msgid "Use build-in GNUnet stub resolver" | 8736 | msgid "Use built-in GNUnet stub resolver" |
8724 | msgstr "" | 8737 | msgstr "" |
8725 | 8738 | ||
8726 | #: src/util/gnunet-scrypt.c:229 | 8739 | #: src/util/gnunet-scrypt.c:232 |
8727 | #, fuzzy, c-format | 8740 | #, fuzzy, c-format |
8728 | msgid "Loading hostkey from `%s' failed.\n" | 8741 | msgid "Loading hostkey from `%s' failed.\n" |
8729 | msgstr "Das Parsen des Hello von `%s' schlug fehl.\n" | 8742 | msgstr "Das Parsen des Hello von `%s' schlug fehl.\n" |
8730 | 8743 | ||
8731 | #: src/util/gnunet-scrypt.c:295 | 8744 | #: src/util/gnunet-scrypt.c:298 |
8732 | msgid "number of bits to require for the proof of work" | 8745 | msgid "number of bits to require for the proof of work" |
8733 | msgstr "" | 8746 | msgstr "" |
8734 | 8747 | ||
8735 | #: src/util/gnunet-scrypt.c:301 | 8748 | #: src/util/gnunet-scrypt.c:304 |
8736 | msgid "file with private key, otherwise default is used" | 8749 | msgid "file with private key, otherwise default is used" |
8737 | msgstr "" | 8750 | msgstr "" |
8738 | 8751 | ||
8739 | #: src/util/gnunet-scrypt.c:307 | 8752 | #: src/util/gnunet-scrypt.c:310 |
8740 | msgid "file with proof of work, otherwise default is used" | 8753 | msgid "file with proof of work, otherwise default is used" |
8741 | msgstr "" | 8754 | msgstr "" |
8742 | 8755 | ||
8743 | #: src/util/gnunet-scrypt.c:313 | 8756 | #: src/util/gnunet-scrypt.c:316 |
8744 | msgid "time to wait between calculations" | 8757 | msgid "time to wait between calculations" |
8745 | msgstr "" | 8758 | msgstr "" |
8746 | 8759 | ||
8747 | #: src/util/gnunet-scrypt.c:326 | 8760 | #: src/util/gnunet-scrypt.c:330 |
8748 | msgid "Manipulate GNUnet proof of work files" | 8761 | msgid "Manipulate GNUnet proof of work files" |
8749 | msgstr "" | 8762 | msgstr "" |
8750 | 8763 | ||
@@ -8781,25 +8794,25 @@ msgstr "Verbindung zu %u.%u.%u.%u:%u fehlgeschlagen: %s\n" | |||
8781 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" | 8794 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" |
8782 | msgstr "" | 8795 | msgstr "" |
8783 | 8796 | ||
8784 | #: src/util/network.c:1364 | 8797 | #: src/util/network.c:1361 |
8785 | #, c-format | 8798 | #, c-format |
8786 | msgid "" | 8799 | msgid "" |
8787 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" | 8800 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" |
8788 | msgstr "" | 8801 | msgstr "" |
8789 | 8802 | ||
8790 | #: src/util/os_installation.c:411 | 8803 | #: src/util/os_installation.c:415 |
8791 | #, c-format | 8804 | #, c-format |
8792 | msgid "" | 8805 | msgid "" |
8793 | "Could not determine installation path for %s. Set `%s' environment " | 8806 | "Could not determine installation path for %s. Set `%s' environment " |
8794 | "variable.\n" | 8807 | "variable.\n" |
8795 | msgstr "" | 8808 | msgstr "" |
8796 | 8809 | ||
8797 | #: src/util/os_installation.c:794 | 8810 | #: src/util/os_installation.c:802 |
8798 | #, fuzzy, c-format | 8811 | #, fuzzy, c-format |
8799 | msgid "Could not find binary `%s' in PATH!\n" | 8812 | msgid "Could not find binary `%s' in PATH!\n" |
8800 | msgstr "Knoten `%s' konnte nicht in der Routing Tabelle gefunden werden!\n" | 8813 | msgstr "Knoten `%s' konnte nicht in der Routing Tabelle gefunden werden!\n" |
8801 | 8814 | ||
8802 | #: src/util/os_installation.c:827 | 8815 | #: src/util/os_installation.c:835 |
8803 | #, c-format | 8816 | #, c-format |
8804 | msgid "Binary `%s' exists, but is not SUID\n" | 8817 | msgid "Binary `%s' exists, but is not SUID\n" |
8805 | msgstr "" | 8818 | msgstr "" |
@@ -8809,33 +8822,33 @@ msgstr "" | |||
8809 | msgid "Initialization of plugin mechanism failed: %s!\n" | 8822 | msgid "Initialization of plugin mechanism failed: %s!\n" |
8810 | msgstr "Initialisierung des Plugin-Mechanismus fehlgeschlagen: %s!\n" | 8823 | msgstr "Initialisierung des Plugin-Mechanismus fehlgeschlagen: %s!\n" |
8811 | 8824 | ||
8812 | #: src/util/plugin.c:147 | 8825 | #: src/util/plugin.c:156 |
8813 | #, fuzzy, c-format | 8826 | #, fuzzy, c-format |
8814 | msgid "`%s' failed to resolve method '%s' with error: %s\n" | 8827 | msgid "`%s' failed to resolve method '%s' with error: %s\n" |
8815 | msgstr "" | 8828 | msgstr "" |
8816 | "`%s' konnte die Methode '%s%s' nicht auflösen. Ort: %s:%d. Fehler: %s\n" | 8829 | "`%s' konnte die Methode '%s%s' nicht auflösen. Ort: %s:%d. Fehler: %s\n" |
8817 | 8830 | ||
8818 | #: src/util/plugin.c:223 | 8831 | #: src/util/plugin.c:234 |
8819 | #, fuzzy, c-format | 8832 | #, fuzzy, c-format |
8820 | msgid "`%s' failed for library `%s' with error: %s\n" | 8833 | msgid "`%s' failed for library `%s' with error: %s\n" |
8821 | msgstr "`%s' fehlgeschlagen für die Bibliothek `%s'. Ort: %s:%d. Fehler: %s\n" | 8834 | msgstr "`%s' fehlgeschlagen für die Bibliothek `%s'. Ort: %s:%d. Fehler: %s\n" |
8822 | 8835 | ||
8823 | #: src/util/plugin.c:384 | 8836 | #: src/util/plugin.c:409 |
8824 | #, fuzzy | 8837 | #, fuzzy |
8825 | msgid "Could not determine plugin installation path.\n" | 8838 | msgid "Could not determine plugin installation path.\n" |
8826 | msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n" | 8839 | msgstr "Öffentliche IP-Adresse konnte nicht ermittelt werden.\n" |
8827 | 8840 | ||
8828 | #: src/util/program.c:267 | 8841 | #: src/util/program.c:259 |
8829 | #, fuzzy, c-format | 8842 | #, fuzzy, c-format |
8830 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" | 8843 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" |
8831 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | 8844 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" |
8832 | 8845 | ||
8833 | #: src/util/program.c:284 | 8846 | #: src/util/program.c:276 |
8834 | #, fuzzy, c-format | 8847 | #, fuzzy, c-format |
8835 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | 8848 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" |
8836 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" | 8849 | msgstr "Konfigurationsdatei `%s' wurde erzeugt.\n" |
8837 | 8850 | ||
8838 | #: src/util/program.c:299 | 8851 | #: src/util/program.c:291 |
8839 | #, fuzzy | 8852 | #, fuzzy |
8840 | msgid "Unreadable or malformed configuration, exit ...\n" | 8853 | msgid "Unreadable or malformed configuration, exit ...\n" |
8841 | msgstr "GNUnet Konfiguration" | 8854 | msgstr "GNUnet Konfiguration" |
@@ -8973,12 +8986,12 @@ msgstr "Falsches Format `%s' für Netzmaske: %s\n" | |||
8973 | msgid "Wrong format `%s' for network\n" | 8986 | msgid "Wrong format `%s' for network\n" |
8974 | msgstr "Falsches Format `%s' für Netzwerk: %s\n" | 8987 | msgstr "Falsches Format `%s' für Netzwerk: %s\n" |
8975 | 8988 | ||
8976 | #: src/util/time.c:848 src/util/time.c:876 | 8989 | #: src/util/time.c:878 src/util/time.c:906 |
8977 | #, c-format | 8990 | #, c-format |
8978 | msgid "Failed to map `%s', cannot assure monotonic time!\n" | 8991 | msgid "Failed to map `%s', cannot assure monotonic time!\n" |
8979 | msgstr "" | 8992 | msgstr "" |
8980 | 8993 | ||
8981 | #: src/util/time.c:884 | 8994 | #: src/util/time.c:914 |
8982 | #, c-format | 8995 | #, c-format |
8983 | msgid "" | 8996 | msgid "" |
8984 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" | 8997 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" |
@@ -8,7 +8,7 @@ msgid "" | |||
8 | msgstr "" | 8 | msgstr "" |
9 | "Project-Id-Version: gnunet 0.9.5a\n" | 9 | "Project-Id-Version: gnunet 0.9.5a\n" |
10 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 10 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
11 | "POT-Creation-Date: 2020-11-13 23:46+0900\n" | 11 | "POT-Creation-Date: 2021-04-04 19:19+0200\n" |
12 | "PO-Revision-Date: 2013-02-23 17:50+0100\n" | 12 | "PO-Revision-Date: 2013-02-23 17:50+0100\n" |
13 | "Last-Translator: Miguel Ãngel Arruga Vivas <rosen644835@gmail.com>\n" | 13 | "Last-Translator: Miguel Ãngel Arruga Vivas <rosen644835@gmail.com>\n" |
14 | "Language-Team: Spanish <es@li.org>\n" | 14 | "Language-Team: Spanish <es@li.org>\n" |
@@ -812,7 +812,7 @@ msgstr "" | |||
812 | 812 | ||
813 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 | 813 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 |
814 | #: src/conversation/gnunet-conversation-test.c:256 | 814 | #: src/conversation/gnunet-conversation-test.c:256 |
815 | #: src/revocation/gnunet-revocation.c:569 src/template/gnunet-template.c:75 | 815 | #: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 |
816 | msgid "help text" | 816 | msgid "help text" |
817 | msgstr "texto de ayuda" | 817 | msgstr "texto de ayuda" |
818 | 818 | ||
@@ -1401,7 +1401,7 @@ msgstr "<tiempo desconocido>" | |||
1401 | msgid "%24s: %-30s %4s (timeout in %6s)\n" | 1401 | msgid "%24s: %-30s %4s (timeout in %6s)\n" |
1402 | msgstr "%24s: %-17s %4s (%u conexiones en total)\n" | 1402 | msgstr "%24s: %-17s %4s (%u conexiones en total)\n" |
1403 | 1403 | ||
1404 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:696 | 1404 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:697 |
1405 | #, c-format | 1405 | #, c-format |
1406 | msgid "Invalid command line argument `%s'\n" | 1406 | msgid "Invalid command line argument `%s'\n" |
1407 | msgstr "Parámetro no válido «%s» en la lÃnea de comandos\n" | 1407 | msgstr "Parámetro no válido «%s» en la lÃnea de comandos\n" |
@@ -1687,7 +1687,7 @@ msgstr "Caché de datos de montÃculo (heap) ejecutándose\n" | |||
1687 | #: src/testbed/generate-underlay-topology.c:48 | 1687 | #: src/testbed/generate-underlay-topology.c:48 |
1688 | #: src/testbed/gnunet-daemon-latency-logger.c:53 | 1688 | #: src/testbed/gnunet-daemon-latency-logger.c:53 |
1689 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 | 1689 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 |
1690 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:62 | 1690 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:78 |
1691 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 | 1691 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 |
1692 | #, c-format | 1692 | #, c-format |
1693 | msgid "`%s' failed at %s:%d with error: %s\n" | 1693 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -2151,7 +2151,7 @@ msgstr "Imprime todos los paquetes que pasan por la DHT." | |||
2151 | msgid "Exiting as the number of peers is %u\n" | 2151 | msgid "Exiting as the number of peers is %u\n" |
2152 | msgstr "El número máximo de conexiones es %u\n" | 2152 | msgstr "El número máximo de conexiones es %u\n" |
2153 | 2153 | ||
2154 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194 | 2154 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3136 |
2155 | msgid "number of peers to start" | 2155 | msgid "number of peers to start" |
2156 | msgstr "número de pares para empezar" | 2156 | msgstr "número de pares para empezar" |
2157 | 2157 | ||
@@ -3379,7 +3379,7 @@ msgid "Downloading `%s' done (%s/s).\n" | |||
3379 | msgstr "Finalizada descarga «%s» (%s/s).\n" | 3379 | msgstr "Finalizada descarga «%s» (%s/s).\n" |
3380 | 3380 | ||
3381 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 | 3381 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 |
3382 | #: src/fs/gnunet-search.c:226 src/fs/gnunet-unindex.c:117 | 3382 | #: src/fs/gnunet-search.c:229 src/fs/gnunet-unindex.c:117 |
3383 | #, c-format | 3383 | #, c-format |
3384 | msgid "Unexpected status: %d\n" | 3384 | msgid "Unexpected status: %d\n" |
3385 | msgstr "Estado inesperado: %d\n" | 3385 | msgstr "Estado inesperado: %d\n" |
@@ -3402,12 +3402,12 @@ msgid "Target filename must be specified.\n" | |||
3402 | msgstr "El nombre de fichero de destino debe ser especificado.\n" | 3402 | msgstr "El nombre de fichero de destino debe ser especificado.\n" |
3403 | 3403 | ||
3404 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 | 3404 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 |
3405 | #: src/fs/gnunet-search.c:291 src/fs/gnunet-unindex.c:154 | 3405 | #: src/fs/gnunet-search.c:294 src/fs/gnunet-unindex.c:154 |
3406 | #, c-format | 3406 | #, c-format |
3407 | msgid "Could not initialize `%s' subsystem.\n" | 3407 | msgid "Could not initialize `%s' subsystem.\n" |
3408 | msgstr "No se pudo inicializar el subsistema «%s».\n" | 3408 | msgstr "No se pudo inicializar el subsistema «%s».\n" |
3409 | 3409 | ||
3410 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:331 | 3410 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:334 |
3411 | msgid "set the desired LEVEL of receiver-anonymity" | 3411 | msgid "set the desired LEVEL of receiver-anonymity" |
3412 | msgstr "establece el nivel LEVEL deseado de anonimato del receptor" | 3412 | msgstr "establece el nivel LEVEL deseado de anonimato del receptor" |
3413 | 3413 | ||
@@ -3415,7 +3415,7 @@ msgstr "establece el nivel LEVEL deseado de anonimato del receptor" | |||
3415 | msgid "delete incomplete downloads (when aborted with CTRL-C)" | 3415 | msgid "delete incomplete downloads (when aborted with CTRL-C)" |
3416 | msgstr "borra descargas incompletas (cuando fueron abortadas con CTRL-C=" | 3416 | msgstr "borra descargas incompletas (cuando fueron abortadas con CTRL-C=" |
3417 | 3417 | ||
3418 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:336 | 3418 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:339 |
3419 | msgid "only search the local peer (no P2P network search)" | 3419 | msgid "only search the local peer (no P2P network search)" |
3420 | msgstr "únicamente buscar en el par local (no buscar en la red P2P)" | 3420 | msgstr "únicamente buscar en el par local (no buscar en la red P2P)" |
3421 | 3421 | ||
@@ -3681,39 +3681,39 @@ msgstr "" | |||
3681 | msgid "Publish a file or directory on GNUnet" | 3681 | msgid "Publish a file or directory on GNUnet" |
3682 | msgstr "Publicar un fichero o un directorio en GNUnet" | 3682 | msgstr "Publicar un fichero o un directorio en GNUnet" |
3683 | 3683 | ||
3684 | #: src/fs/gnunet-search.c:127 | 3684 | #: src/fs/gnunet-search.c:130 |
3685 | #, c-format | 3685 | #, c-format |
3686 | msgid "Failed to write directory with search results to `%s'\n" | 3686 | msgid "Failed to write directory with search results to `%s'\n" |
3687 | msgstr "" | 3687 | msgstr "" |
3688 | "Se produjo un fallo al escribir el directorio con los resultados de búsqueda " | 3688 | "Se produjo un fallo al escribir el directorio con los resultados de búsqueda " |
3689 | "de «%s»\n" | 3689 | "de «%s»\n" |
3690 | 3690 | ||
3691 | #: src/fs/gnunet-search.c:216 | 3691 | #: src/fs/gnunet-search.c:219 |
3692 | #, c-format | 3692 | #, c-format |
3693 | msgid "Error searching: %s.\n" | 3693 | msgid "Error searching: %s.\n" |
3694 | msgstr "Error buscando: %s.\n" | 3694 | msgstr "Error buscando: %s.\n" |
3695 | 3695 | ||
3696 | #: src/fs/gnunet-search.c:278 | 3696 | #: src/fs/gnunet-search.c:281 |
3697 | msgid "Could not create keyword URI from arguments.\n" | 3697 | msgid "Could not create keyword URI from arguments.\n" |
3698 | msgstr "No se pudo crear URI de palabra clave a partir de los parámetros.\n" | 3698 | msgstr "No se pudo crear URI de palabra clave a partir de los parámetros.\n" |
3699 | 3699 | ||
3700 | #: src/fs/gnunet-search.c:305 | 3700 | #: src/fs/gnunet-search.c:308 |
3701 | msgid "Could not start searching.\n" | 3701 | msgid "Could not start searching.\n" |
3702 | msgstr "No se pudo empezar a buscar.\n" | 3702 | msgstr "No se pudo empezar a buscar.\n" |
3703 | 3703 | ||
3704 | #: src/fs/gnunet-search.c:342 | 3704 | #: src/fs/gnunet-search.c:345 |
3705 | msgid "write search results to file starting with PREFIX" | 3705 | msgid "write search results to file starting with PREFIX" |
3706 | msgstr "escribir resultados de búsqueda al fichero que empiecen por «PREFIX»" | 3706 | msgstr "escribir resultados de búsqueda al fichero que empiecen por «PREFIX»" |
3707 | 3707 | ||
3708 | #: src/fs/gnunet-search.c:348 | 3708 | #: src/fs/gnunet-search.c:351 |
3709 | msgid "automatically terminate search after DELAY" | 3709 | msgid "automatically terminate search after DELAY" |
3710 | msgstr "terminar búsqueda automáticamente después de «DELAY»" | 3710 | msgstr "terminar búsqueda automáticamente después de «DELAY»" |
3711 | 3711 | ||
3712 | #: src/fs/gnunet-search.c:354 | 3712 | #: src/fs/gnunet-search.c:357 |
3713 | msgid "automatically terminate search after VALUE results are found" | 3713 | msgid "automatically terminate search after VALUE results are found" |
3714 | msgstr "terminar búsqueda después de «VALUE» resultados encontrados" | 3714 | msgstr "terminar búsqueda después de «VALUE» resultados encontrados" |
3715 | 3715 | ||
3716 | #: src/fs/gnunet-search.c:368 | 3716 | #: src/fs/gnunet-search.c:371 |
3717 | msgid "Search GNUnet for files that were published on GNUnet" | 3717 | msgid "Search GNUnet for files that were published on GNUnet" |
3718 | msgstr "Buscar en GNUnet ficheros que han sido publicados en GNUnet" | 3718 | msgstr "Buscar en GNUnet ficheros que han sido publicados en GNUnet" |
3719 | 3719 | ||
@@ -4087,7 +4087,7 @@ msgstr "Desindexa un fichero previamente indexado con «gnunet-publish»." | |||
4087 | msgid "Expected a base32-encoded public zone key\n" | 4087 | msgid "Expected a base32-encoded public zone key\n" |
4088 | msgstr "" | 4088 | msgstr "" |
4089 | 4089 | ||
4090 | #: src/gns/gnunet-bcd.c:133 | 4090 | #: src/gns/gnunet-bcd.c:134 |
4091 | #, fuzzy, c-format | 4091 | #, fuzzy, c-format |
4092 | msgid "Refusing `%s' request to HTTP server\n" | 4092 | msgid "Refusing `%s' request to HTTP server\n" |
4093 | msgstr "Rechazando petición «%s» al servidor de listas de máquinas\n" | 4093 | msgstr "Rechazando petición «%s» al servidor de listas de máquinas\n" |
@@ -4121,38 +4121,43 @@ msgid "Failed to pack DNS response into UDP packet!\n" | |||
4121 | msgstr "" | 4121 | msgstr "" |
4122 | "¡Se produjo un fallo al empaquetar una respuesta DNS en un paquete UDP!\n" | 4122 | "¡Se produjo un fallo al empaquetar una respuesta DNS en un paquete UDP!\n" |
4123 | 4123 | ||
4124 | #: src/gns/gnunet-dns2gns.c:444 | 4124 | #: src/gns/gnunet-dns2gns.c:315 |
4125 | #, fuzzy | ||
4126 | msgid "Failed to parse DNS response!\n" | ||
4127 | msgstr "Se produjo un fallo al procesar la petición DNS. Omitiendo.\n" | ||
4128 | |||
4129 | #: src/gns/gnunet-dns2gns.c:452 | ||
4125 | #, c-format | 4130 | #, c-format |
4126 | msgid "Cannot parse DNS request from %s\n" | 4131 | msgid "Cannot parse DNS request from %s\n" |
4127 | msgstr "No se puede procesar la petición DNS de %s\n" | 4132 | msgstr "No se puede procesar la petición DNS de %s\n" |
4128 | 4133 | ||
4129 | #: src/gns/gnunet-dns2gns.c:460 | 4134 | #: src/gns/gnunet-dns2gns.c:468 |
4130 | #, c-format | 4135 | #, c-format |
4131 | msgid "Received malformed DNS request from %s\n" | 4136 | msgid "Received malformed DNS request from %s\n" |
4132 | msgstr "Recibida petición DNS mal formada de %s\n" | 4137 | msgstr "Recibida petición DNS mal formada de %s\n" |
4133 | 4138 | ||
4134 | #: src/gns/gnunet-dns2gns.c:468 | 4139 | #: src/gns/gnunet-dns2gns.c:476 |
4135 | #, c-format | 4140 | #, c-format |
4136 | msgid "Received unsupported DNS request from %s\n" | 4141 | msgid "Received unsupported DNS request from %s\n" |
4137 | msgstr "Recibida petición DNS no soportada de %s\n" | 4142 | msgstr "Recibida petición DNS no soportada de %s\n" |
4138 | 4143 | ||
4139 | #: src/gns/gnunet-dns2gns.c:629 | 4144 | #: src/gns/gnunet-dns2gns.c:637 |
4140 | #, fuzzy | 4145 | #, fuzzy |
4141 | msgid "No DNS server specified!\n" | 4146 | msgid "No DNS server specified!\n" |
4142 | msgstr "¡Ninguna palabra clave especificada!\n" | 4147 | msgstr "¡Ninguna palabra clave especificada!\n" |
4143 | 4148 | ||
4144 | #: src/gns/gnunet-dns2gns.c:778 | 4149 | #: src/gns/gnunet-dns2gns.c:786 |
4145 | msgid "IP of recursive DNS resolver to use (required)" | 4150 | msgid "IP of recursive DNS resolver to use (required)" |
4146 | msgstr "IP del resolvedor recursivo DNS a usar (requerido)" | 4151 | msgstr "IP del resolvedor recursivo DNS a usar (requerido)" |
4147 | 4152 | ||
4148 | #: src/gns/gnunet-dns2gns.c:784 | 4153 | #: src/gns/gnunet-dns2gns.c:792 |
4149 | #, fuzzy | 4154 | #, fuzzy |
4150 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4155 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4151 | msgstr "" | 4156 | msgstr "" |
4152 | "Puerto UDP en el que escuchar para peticiones DNS entrantes; predeterminado: " | 4157 | "Puerto UDP en el que escuchar para peticiones DNS entrantes; predeterminado: " |
4153 | "53" | 4158 | "53" |
4154 | 4159 | ||
4155 | #: src/gns/gnunet-dns2gns.c:801 | 4160 | #: src/gns/gnunet-dns2gns.c:809 |
4156 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4161 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4157 | msgstr "Pasarela GNUnet DNS-a-GNS (un servidor DNS)" | 4162 | msgstr "Pasarela GNUnet DNS-a-GNS (un servidor DNS)" |
4158 | 4163 | ||
@@ -4275,64 +4280,64 @@ msgstr "" | |||
4275 | msgid "Cookie domain `%s' supplied by server is invalid\n" | 4280 | msgid "Cookie domain `%s' supplied by server is invalid\n" |
4276 | msgstr "" | 4281 | msgstr "" |
4277 | 4282 | ||
4278 | #: src/gns/gnunet-gns-proxy.c:2133 | 4283 | #: src/gns/gnunet-gns-proxy.c:2134 |
4279 | #, fuzzy, c-format | 4284 | #, fuzzy, c-format |
4280 | msgid "Unsupported HTTP method `%s'\n" | 4285 | msgid "Unsupported HTTP method `%s'\n" |
4281 | msgstr "Tipo no soportado «%s»\n" | 4286 | msgstr "Tipo no soportado «%s»\n" |
4282 | 4287 | ||
4283 | #: src/gns/gnunet-gns-proxy.c:2657 | 4288 | #: src/gns/gnunet-gns-proxy.c:2658 |
4284 | #, c-format | 4289 | #, c-format |
4285 | msgid "Unable to import private key from file `%s'\n" | 4290 | msgid "Unable to import private key from file `%s'\n" |
4286 | msgstr "No se pudo importar la clave privada del fichero «%s»\n" | 4291 | msgstr "No se pudo importar la clave privada del fichero «%s»\n" |
4287 | 4292 | ||
4288 | #: src/gns/gnunet-gns-proxy.c:2689 | 4293 | #: src/gns/gnunet-gns-proxy.c:2690 |
4289 | #, fuzzy, c-format | 4294 | #, fuzzy, c-format |
4290 | msgid "Unable to import certificate from `%s'\n" | 4295 | msgid "Unable to import certificate from `%s'\n" |
4291 | msgstr "No se pudo importar el certificado %s\n" | 4296 | msgstr "No se pudo importar el certificado %s\n" |
4292 | 4297 | ||
4293 | #: src/gns/gnunet-gns-proxy.c:2898 | 4298 | #: src/gns/gnunet-gns-proxy.c:2899 |
4294 | #, fuzzy, c-format | 4299 | #, fuzzy, c-format |
4295 | msgid "Failed to start HTTPS server for `%s'\n" | 4300 | msgid "Failed to start HTTPS server for `%s'\n" |
4296 | msgstr "Se produjo un fallo al iniciar el servidor HTTP\n" | 4301 | msgstr "Se produjo un fallo al iniciar el servidor HTTP\n" |
4297 | 4302 | ||
4298 | #: src/gns/gnunet-gns-proxy.c:2922 src/rest/gnunet-rest-server.c:917 | 4303 | #: src/gns/gnunet-gns-proxy.c:2923 src/rest/gnunet-rest-server.c:917 |
4299 | #, fuzzy | 4304 | #, fuzzy |
4300 | msgid "Failed to pass client to MHD\n" | 4305 | msgid "Failed to pass client to MHD\n" |
4301 | msgstr "Se produjo un fallo al conectar con GNS\n" | 4306 | msgstr "Se produjo un fallo al conectar con GNS\n" |
4302 | 4307 | ||
4303 | #: src/gns/gnunet-gns-proxy.c:3271 | 4308 | #: src/gns/gnunet-gns-proxy.c:3272 |
4304 | #, fuzzy, c-format | 4309 | #, fuzzy, c-format |
4305 | msgid "Unsupported socks version %d\n" | 4310 | msgid "Unsupported socks version %d\n" |
4306 | msgstr "Tipo de bloque %u no soportado\n" | 4311 | msgstr "Tipo de bloque %u no soportado\n" |
4307 | 4312 | ||
4308 | #: src/gns/gnunet-gns-proxy.c:3303 | 4313 | #: src/gns/gnunet-gns-proxy.c:3304 |
4309 | #, fuzzy, c-format | 4314 | #, fuzzy, c-format |
4310 | msgid "Unsupported socks command %d\n" | 4315 | msgid "Unsupported socks command %d\n" |
4311 | msgstr "Tipo de bloque %u no soportado\n" | 4316 | msgstr "Tipo de bloque %u no soportado\n" |
4312 | 4317 | ||
4313 | #: src/gns/gnunet-gns-proxy.c:3389 | 4318 | #: src/gns/gnunet-gns-proxy.c:3390 |
4314 | #, fuzzy, c-format | 4319 | #, fuzzy, c-format |
4315 | msgid "Unsupported socks address type %d\n" | 4320 | msgid "Unsupported socks address type %d\n" |
4316 | msgstr "Tipo de bloque %u no soportado\n" | 4321 | msgstr "Tipo de bloque %u no soportado\n" |
4317 | 4322 | ||
4318 | #: src/gns/gnunet-gns-proxy.c:3730 | 4323 | #: src/gns/gnunet-gns-proxy.c:3731 |
4319 | #, fuzzy, c-format | 4324 | #, fuzzy, c-format |
4320 | msgid "Failed to load X.509 key and certificate from `%s'\n" | 4325 | msgid "Failed to load X.509 key and certificate from `%s'\n" |
4321 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" | 4326 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" |
4322 | 4327 | ||
4323 | #: src/gns/gnunet-gns-proxy.c:3864 | 4328 | #: src/gns/gnunet-gns-proxy.c:3865 |
4324 | msgid "listen on specified port (default: 7777)" | 4329 | msgid "listen on specified port (default: 7777)" |
4325 | msgstr "escuchar en el puerto especificado (predeterminado: 7777)" | 4330 | msgstr "escuchar en el puerto especificado (predeterminado: 7777)" |
4326 | 4331 | ||
4327 | #: src/gns/gnunet-gns-proxy.c:3869 | 4332 | #: src/gns/gnunet-gns-proxy.c:3870 |
4328 | msgid "pem file to use as CA" | 4333 | msgid "pem file to use as CA" |
4329 | msgstr "fichero pem para usar como autoridad de certificación (CA)" | 4334 | msgstr "fichero pem para usar como autoridad de certificación (CA)" |
4330 | 4335 | ||
4331 | #: src/gns/gnunet-gns-proxy.c:3873 | 4336 | #: src/gns/gnunet-gns-proxy.c:3874 |
4332 | msgid "disable use of IPv6" | 4337 | msgid "disable use of IPv6" |
4333 | msgstr "" | 4338 | msgstr "" |
4334 | 4339 | ||
4335 | #: src/gns/gnunet-gns-proxy.c:3899 | 4340 | #: src/gns/gnunet-gns-proxy.c:3900 |
4336 | msgid "GNUnet GNS proxy" | 4341 | msgid "GNUnet GNS proxy" |
4337 | msgstr "Proxy GNUnet GNS" | 4342 | msgstr "Proxy GNUnet GNS" |
4338 | 4343 | ||
@@ -4357,7 +4362,7 @@ msgstr "¡No se pudo conectar a la DHT!\n" | |||
4357 | msgid "Error converting GNS response to DNS response!\n" | 4362 | msgid "Error converting GNS response to DNS response!\n" |
4358 | msgstr "¡Se produjo un error al convertir los argumentos a una URI!\n" | 4363 | msgstr "¡Se produjo un error al convertir los argumentos a una URI!\n" |
4359 | 4364 | ||
4360 | #: src/gns/gnunet-service-gns_interceptor.c:387 | 4365 | #: src/gns/gnunet-service-gns_interceptor.c:386 |
4361 | #, fuzzy | 4366 | #, fuzzy |
4362 | msgid "Failed to connect to the DNS service!\n" | 4367 | msgid "Failed to connect to the DNS service!\n" |
4363 | msgstr "¡Se produjo un fallo al conectar con el servicio GNS!\n" | 4368 | msgstr "¡Se produjo un fallo al conectar con el servicio GNS!\n" |
@@ -4392,36 +4397,36 @@ msgstr "" | |||
4392 | msgid "VPN returned empty result for `%s'\n" | 4397 | msgid "VPN returned empty result for `%s'\n" |
4393 | msgstr "El ATS devolvió resultados para %u direcciones\n" | 4398 | msgstr "El ATS devolvió resultados para %u direcciones\n" |
4394 | 4399 | ||
4395 | #: src/gns/gnunet-service-gns_resolver.c:1910 | 4400 | #: src/gns/gnunet-service-gns_resolver.c:1919 |
4396 | #, c-format | 4401 | #, c-format |
4397 | msgid "Name `%s' cannot be converted to IDNA." | 4402 | msgid "Name `%s' cannot be converted to IDNA." |
4398 | msgstr "" | 4403 | msgstr "" |
4399 | 4404 | ||
4400 | #: src/gns/gnunet-service-gns_resolver.c:1923 | 4405 | #: src/gns/gnunet-service-gns_resolver.c:1934 |
4401 | #, c-format | 4406 | #, c-format |
4402 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" | 4407 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" |
4403 | msgstr "" | 4408 | msgstr "" |
4404 | 4409 | ||
4405 | #: src/gns/gnunet-service-gns_resolver.c:1966 | 4410 | #: src/gns/gnunet-service-gns_resolver.c:1979 |
4406 | #, fuzzy, c-format | 4411 | #, fuzzy, c-format |
4407 | msgid "GNS lookup failed (zero records found for `%s')\n" | 4412 | msgid "GNS lookup failed (zero records found for `%s')\n" |
4408 | msgstr "No se han encontrado ficheros en «%s»\n" | 4413 | msgstr "No se han encontrado ficheros en «%s»\n" |
4409 | 4414 | ||
4410 | #: src/gns/gnunet-service-gns_resolver.c:2393 | 4415 | #: src/gns/gnunet-service-gns_resolver.c:2406 |
4411 | msgid "GNS lookup recursion failed (no delegation record found)\n" | 4416 | msgid "GNS lookup recursion failed (no delegation record found)\n" |
4412 | msgstr "" | 4417 | msgstr "" |
4413 | 4418 | ||
4414 | #: src/gns/gnunet-service-gns_resolver.c:2416 | 4419 | #: src/gns/gnunet-service-gns_resolver.c:2429 |
4415 | #, fuzzy, c-format | 4420 | #, fuzzy, c-format |
4416 | msgid "Failed to cache GNS resolution: %s\n" | 4421 | msgid "Failed to cache GNS resolution: %s\n" |
4417 | msgstr "Se produjo un fallo al mandar la petición DNS a %s\n" | 4422 | msgstr "Se produjo un fallo al mandar la petición DNS a %s\n" |
4418 | 4423 | ||
4419 | #: src/gns/gnunet-service-gns_resolver.c:2581 | 4424 | #: src/gns/gnunet-service-gns_resolver.c:2594 |
4420 | #, c-format | 4425 | #, c-format |
4421 | msgid "GNS namecache returned empty result for `%s'\n" | 4426 | msgid "GNS namecache returned empty result for `%s'\n" |
4422 | msgstr "" | 4427 | msgstr "" |
4423 | 4428 | ||
4424 | #: src/gns/gnunet-service-gns_resolver.c:2721 | 4429 | #: src/gns/gnunet-service-gns_resolver.c:2734 |
4425 | #, c-format | 4430 | #, c-format |
4426 | msgid "Zone %s was revoked, resolution fails\n" | 4431 | msgid "Zone %s was revoked, resolution fails\n" |
4427 | msgstr "" | 4432 | msgstr "" |
@@ -4457,7 +4462,7 @@ msgstr "No se pudo procesar la cadena de registro VPN «%s»\n" | |||
4457 | msgid "Unable to parse BOX record string `%s'\n" | 4462 | msgid "Unable to parse BOX record string `%s'\n" |
4458 | msgstr "No se pudo procesar la cadena de registro VPN «%s»\n" | 4463 | msgstr "No se pudo procesar la cadena de registro VPN «%s»\n" |
4459 | 4464 | ||
4460 | #: src/gns/plugin_rest_gns.c:448 | 4465 | #: src/gns/plugin_rest_gns.c:450 |
4461 | #, fuzzy | 4466 | #, fuzzy |
4462 | msgid "Gns REST API initialized\n" | 4467 | msgid "Gns REST API initialized\n" |
4463 | msgstr "Conexión fallida\n" | 4468 | msgstr "Conexión fallida\n" |
@@ -4825,7 +4830,7 @@ msgstr "direcciones expiradas encontradas" | |||
4825 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 | 4830 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 |
4826 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 | 4831 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 |
4827 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 | 4832 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 |
4828 | #: src/peerinfo-tool/gnunet-peerinfo.c:515 | 4833 | #: src/peerinfo-tool/gnunet-peerinfo.c:516 |
4829 | #: src/topology/gnunet-daemon-topology.c:799 | 4834 | #: src/topology/gnunet-daemon-topology.c:799 |
4830 | #, c-format | 4835 | #, c-format |
4831 | msgid "Error in communication with PEERINFO service: %s\n" | 4836 | msgid "Error in communication with PEERINFO service: %s\n" |
@@ -5002,8 +5007,8 @@ msgid "default configured, but ego unknown (internal error)" | |||
5002 | msgstr "" | 5007 | msgstr "" |
5003 | 5008 | ||
5004 | #: src/identity/gnunet-service-identity.c:621 | 5009 | #: src/identity/gnunet-service-identity.c:621 |
5005 | #: src/identity/gnunet-service-identity.c:898 | 5010 | #: src/identity/gnunet-service-identity.c:896 |
5006 | #: src/identity/gnunet-service-identity.c:1018 | 5011 | #: src/identity/gnunet-service-identity.c:1016 |
5007 | #, fuzzy, c-format | 5012 | #, fuzzy, c-format |
5008 | msgid "Failed to write subsystem default identifier map to `%s'.\n" | 5013 | msgid "Failed to write subsystem default identifier map to `%s'.\n" |
5009 | msgstr "" | 5014 | msgstr "" |
@@ -5013,31 +5018,31 @@ msgstr "" | |||
5013 | msgid "Unknown ego specified for service (internal error)" | 5018 | msgid "Unknown ego specified for service (internal error)" |
5014 | msgstr "" | 5019 | msgstr "" |
5015 | 5020 | ||
5016 | #: src/identity/gnunet-service-identity.c:726 | 5021 | #: src/identity/gnunet-service-identity.c:725 |
5017 | msgid "identifier already in use for another ego" | 5022 | msgid "identifier already in use for another ego" |
5018 | msgstr "" | 5023 | msgstr "" |
5019 | 5024 | ||
5020 | #: src/identity/gnunet-service-identity.c:874 | 5025 | #: src/identity/gnunet-service-identity.c:872 |
5021 | #, fuzzy | 5026 | #, fuzzy |
5022 | msgid "target name already exists" | 5027 | msgid "target name already exists" |
5023 | msgstr "El registro ya existÃa en el almacén de nombres" | 5028 | msgstr "El registro ya existÃa en el almacén de nombres" |
5024 | 5029 | ||
5025 | #: src/identity/gnunet-service-identity.c:916 | 5030 | #: src/identity/gnunet-service-identity.c:914 |
5026 | #: src/identity/gnunet-service-identity.c:1035 | 5031 | #: src/identity/gnunet-service-identity.c:1033 |
5027 | msgid "no matching ego found" | 5032 | msgid "no matching ego found" |
5028 | msgstr "" | 5033 | msgstr "" |
5029 | 5034 | ||
5030 | #: src/identity/gnunet-service-identity.c:1133 | 5035 | #: src/identity/gnunet-service-identity.c:1131 |
5031 | #, fuzzy, c-format | 5036 | #, fuzzy, c-format |
5032 | msgid "Failed to parse ego information in `%s'\n" | 5037 | msgid "Failed to parse ego information in `%s'\n" |
5033 | msgstr "Se produjo un fallo al procesar la identidad del par «%s»\n" | 5038 | msgstr "Se produjo un fallo al procesar la identidad del par «%s»\n" |
5034 | 5039 | ||
5035 | #: src/identity/gnunet-service-identity.c:1191 | 5040 | #: src/identity/gnunet-service-identity.c:1189 |
5036 | #, fuzzy, c-format | 5041 | #, fuzzy, c-format |
5037 | msgid "Failed to parse subsystem identity configuration file `%s'\n" | 5042 | msgid "Failed to parse subsystem identity configuration file `%s'\n" |
5038 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | 5043 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" |
5039 | 5044 | ||
5040 | #: src/identity/gnunet-service-identity.c:1200 | 5045 | #: src/identity/gnunet-service-identity.c:1198 |
5041 | #, fuzzy, c-format | 5046 | #, fuzzy, c-format |
5042 | msgid "Failed to create directory `%s' for storing egos\n" | 5047 | msgid "Failed to create directory `%s' for storing egos\n" |
5043 | msgstr "Se produjo un fallo al leer el directorio «%s»\n" | 5048 | msgstr "Se produjo un fallo al leer el directorio «%s»\n" |
@@ -5275,7 +5280,7 @@ msgid "Invalid public key for reverse lookup `%s'\n" | |||
5275 | msgstr "Parámetro no válido «%s»\n" | 5280 | msgstr "Parámetro no válido «%s»\n" |
5276 | 5281 | ||
5277 | #: src/namestore/gnunet-namestore.c:1220 | 5282 | #: src/namestore/gnunet-namestore.c:1220 |
5278 | #: src/peerinfo-tool/gnunet-peerinfo.c:736 | 5283 | #: src/peerinfo-tool/gnunet-peerinfo.c:737 |
5279 | #, c-format | 5284 | #, c-format |
5280 | msgid "Invalid URI `%s'\n" | 5285 | msgid "Invalid URI `%s'\n" |
5281 | msgstr "URI no válida: «%s»\n" | 5286 | msgstr "URI no válida: «%s»\n" |
@@ -5465,7 +5470,7 @@ msgstr "" | |||
5465 | msgid "GNU Name System First Come First Serve name registration service" | 5470 | msgid "GNU Name System First Come First Serve name registration service" |
5466 | msgstr "Servicio de registro GNUnet GNS primero en llegar, primero en servirse" | 5471 | msgstr "Servicio de registro GNUnet GNS primero en llegar, primero en servirse" |
5467 | 5472 | ||
5468 | #: src/namestore/gnunet-service-namestore.c:866 | 5473 | #: src/namestore/gnunet-service-namestore.c:871 |
5469 | #, fuzzy, c-format | 5474 | #, fuzzy, c-format |
5470 | msgid "Failed to replicate block in namecache: %s\n" | 5475 | msgid "Failed to replicate block in namecache: %s\n" |
5471 | msgstr "Se produjo un fallo al crear el espacio de nombres «%s»\n" | 5476 | msgstr "Se produjo un fallo al crear el espacio de nombres «%s»\n" |
@@ -5498,7 +5503,7 @@ msgstr "" | |||
5498 | msgid "Flat file database running\n" | 5503 | msgid "Flat file database running\n" |
5499 | msgstr "Base de datos de plantilla ejecutándose\n" | 5504 | msgstr "Base de datos de plantilla ejecutándose\n" |
5500 | 5505 | ||
5501 | #: src/namestore/plugin_rest_namestore.c:1103 | 5506 | #: src/namestore/plugin_rest_namestore.c:1105 |
5502 | #, fuzzy | 5507 | #, fuzzy |
5503 | msgid "Namestore REST API initialized\n" | 5508 | msgid "Namestore REST API initialized\n" |
5504 | msgstr "Conexión fallida\n" | 5509 | msgstr "Conexión fallida\n" |
@@ -5828,8 +5833,8 @@ msgstr "retraso entre rondas" | |||
5828 | msgid "Measure quality and performance of the NSE service." | 5833 | msgid "Measure quality and performance of the NSE service." |
5829 | msgstr "Medir la calidad y rendimiento del servicio NSE." | 5834 | msgstr "Medir la calidad y rendimiento del servicio NSE." |
5830 | 5835 | ||
5831 | #: src/nse/gnunet-service-nse.c:1443 | 5836 | #: src/nse/gnunet-service-nse.c:1450 |
5832 | #: src/revocation/gnunet-service-revocation.c:875 src/util/gnunet-scrypt.c:257 | 5837 | #: src/revocation/gnunet-service-revocation.c:883 src/util/gnunet-scrypt.c:260 |
5833 | msgid "Value is too large.\n" | 5838 | msgid "Value is too large.\n" |
5834 | msgstr "" | 5839 | msgstr "" |
5835 | 5840 | ||
@@ -5871,17 +5876,17 @@ msgstr "Escaneando directorio «%s».\n" | |||
5871 | msgid "Still no peers found in `%s'!\n" | 5876 | msgid "Still no peers found in `%s'!\n" |
5872 | msgstr "¡Aún no se han encontrado pares en «%s»!\n" | 5877 | msgstr "¡Aún no se han encontrado pares en «%s»!\n" |
5873 | 5878 | ||
5874 | #: src/peerinfo/gnunet-service-peerinfo.c:1024 | 5879 | #: src/peerinfo/gnunet-service-peerinfo.c:1027 |
5875 | #, fuzzy, c-format | 5880 | #, fuzzy, c-format |
5876 | msgid "Cleaning up directory `%s'\n" | 5881 | msgid "Cleaning up directory `%s'\n" |
5877 | msgstr "Escaneando directorio «%s».\n" | 5882 | msgstr "Escaneando directorio «%s».\n" |
5878 | 5883 | ||
5879 | #: src/peerinfo/gnunet-service-peerinfo.c:1319 | 5884 | #: src/peerinfo/gnunet-service-peerinfo.c:1322 |
5880 | #, c-format | 5885 | #, c-format |
5881 | msgid "Importing HELLOs from `%s'\n" | 5886 | msgid "Importing HELLOs from `%s'\n" |
5882 | msgstr "Importando HELLO de «%s»\n" | 5887 | msgstr "Importando HELLO de «%s»\n" |
5883 | 5888 | ||
5884 | #: src/peerinfo/gnunet-service-peerinfo.c:1332 | 5889 | #: src/peerinfo/gnunet-service-peerinfo.c:1335 |
5885 | msgid "Skipping import of included HELLOs\n" | 5890 | msgid "Skipping import of included HELLOs\n" |
5886 | msgstr "" | 5891 | msgstr "" |
5887 | 5892 | ||
@@ -5903,7 +5908,7 @@ msgid "\tExpires: %s \t %s\n" | |||
5903 | msgstr "" | 5908 | msgstr "" |
5904 | 5909 | ||
5905 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 | 5910 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 |
5906 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:523 | 5911 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:525 |
5907 | #, fuzzy, c-format | 5912 | #, fuzzy, c-format |
5908 | msgid "Failure: Cannot convert address to string for peer `%s'\n" | 5913 | msgid "Failure: Cannot convert address to string for peer `%s'\n" |
5909 | msgstr "Se produjo un fallo al resolver la dirección para el par «%s»\n" | 5914 | msgstr "Se produjo un fallo al resolver la dirección para el par «%s»\n" |
@@ -5913,54 +5918,54 @@ msgstr "Se produjo un fallo al resolver la dirección para el par «%s»\n" | |||
5913 | msgid "Failure: Received invalid %s\n" | 5918 | msgid "Failure: Received invalid %s\n" |
5914 | msgstr "recibido mensaje '%s' no válido: %s.\n" | 5919 | msgstr "recibido mensaje '%s' no válido: %s.\n" |
5915 | 5920 | ||
5916 | #: src/peerinfo-tool/gnunet-peerinfo.c:463 | 5921 | #: src/peerinfo-tool/gnunet-peerinfo.c:464 |
5917 | #, fuzzy, c-format | 5922 | #, fuzzy, c-format |
5918 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" | 5923 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" |
5919 | msgstr "Se produjo un fallo al procesar «HELLO» en el fichero «%s»\n" | 5924 | msgstr "Se produjo un fallo al procesar «HELLO» en el fichero «%s»\n" |
5920 | 5925 | ||
5921 | #: src/peerinfo-tool/gnunet-peerinfo.c:479 | 5926 | #: src/peerinfo-tool/gnunet-peerinfo.c:480 |
5922 | #, c-format | 5927 | #, c-format |
5923 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" | 5928 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" |
5924 | msgstr "" | 5929 | msgstr "" |
5925 | 5930 | ||
5926 | #: src/peerinfo-tool/gnunet-peerinfo.c:758 | 5931 | #: src/peerinfo-tool/gnunet-peerinfo.c:759 |
5927 | #, c-format | 5932 | #, c-format |
5928 | msgid "I am peer `%s'.\n" | 5933 | msgid "I am peer `%s'.\n" |
5929 | msgstr "Yo soy el par «%s».\n" | 5934 | msgstr "Yo soy el par «%s».\n" |
5930 | 5935 | ||
5931 | #: src/peerinfo-tool/gnunet-peerinfo.c:799 | 5936 | #: src/peerinfo-tool/gnunet-peerinfo.c:800 |
5932 | msgid "don't resolve host names" | 5937 | msgid "don't resolve host names" |
5933 | msgstr "no resolver nombres de máquina" | 5938 | msgstr "no resolver nombres de máquina" |
5934 | 5939 | ||
5935 | #: src/peerinfo-tool/gnunet-peerinfo.c:805 | 5940 | #: src/peerinfo-tool/gnunet-peerinfo.c:806 |
5936 | msgid "output only the identity strings" | 5941 | msgid "output only the identity strings" |
5937 | msgstr "mostrar únicamente las cadenas de identidad" | 5942 | msgstr "mostrar únicamente las cadenas de identidad" |
5938 | 5943 | ||
5939 | #: src/peerinfo-tool/gnunet-peerinfo.c:810 | 5944 | #: src/peerinfo-tool/gnunet-peerinfo.c:811 |
5940 | msgid "include friend-only information" | 5945 | msgid "include friend-only information" |
5941 | msgstr "" | 5946 | msgstr "" |
5942 | 5947 | ||
5943 | #: src/peerinfo-tool/gnunet-peerinfo.c:815 | 5948 | #: src/peerinfo-tool/gnunet-peerinfo.c:816 |
5944 | msgid "output our own identity only" | 5949 | msgid "output our own identity only" |
5945 | msgstr "muestra únicamente nuestra propia identidad" | 5950 | msgstr "muestra únicamente nuestra propia identidad" |
5946 | 5951 | ||
5947 | #: src/peerinfo-tool/gnunet-peerinfo.c:820 | 5952 | #: src/peerinfo-tool/gnunet-peerinfo.c:821 |
5948 | msgid "list all known peers" | 5953 | msgid "list all known peers" |
5949 | msgstr "mostrar todos los pares conocidos" | 5954 | msgstr "mostrar todos los pares conocidos" |
5950 | 5955 | ||
5951 | #: src/peerinfo-tool/gnunet-peerinfo.c:826 | 5956 | #: src/peerinfo-tool/gnunet-peerinfo.c:827 |
5952 | msgid "dump hello to file" | 5957 | msgid "dump hello to file" |
5953 | msgstr "" | 5958 | msgstr "" |
5954 | 5959 | ||
5955 | #: src/peerinfo-tool/gnunet-peerinfo.c:831 | 5960 | #: src/peerinfo-tool/gnunet-peerinfo.c:832 |
5956 | msgid "also output HELLO uri(s)" | 5961 | msgid "also output HELLO uri(s)" |
5957 | msgstr "también mostrar las URI de «HELLO»" | 5962 | msgstr "también mostrar las URI de «HELLO»" |
5958 | 5963 | ||
5959 | #: src/peerinfo-tool/gnunet-peerinfo.c:838 | 5964 | #: src/peerinfo-tool/gnunet-peerinfo.c:839 |
5960 | msgid "add given HELLO uri to the database" | 5965 | msgid "add given HELLO uri to the database" |
5961 | msgstr "añade la URI de «HELLO» dada a la base de datos" | 5966 | msgstr "añade la URI de «HELLO» dada a la base de datos" |
5962 | 5967 | ||
5963 | #: src/peerinfo-tool/gnunet-peerinfo.c:852 | 5968 | #: src/peerinfo-tool/gnunet-peerinfo.c:853 |
5964 | msgid "Print information about peers." | 5969 | msgid "Print information about peers." |
5965 | msgstr "Imprimir información sobre los pares." | 5970 | msgstr "Imprimir información sobre los pares." |
5966 | 5971 | ||
@@ -5982,7 +5987,7 @@ msgstr "Cargando el módulo de transporte «%s»\n" | |||
5982 | msgid "Failed to load transport plugin for `%s'\n" | 5987 | msgid "Failed to load transport plugin for `%s'\n" |
5983 | msgstr "Se produjo un fallo al cargar el módulo del transporte para «%s»\n" | 5988 | msgstr "Se produjo un fallo al cargar el módulo del transporte para «%s»\n" |
5984 | 5989 | ||
5985 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:809 | 5990 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:811 |
5986 | #, fuzzy | 5991 | #, fuzzy |
5987 | msgid "Peerinfo REST API initialized\n" | 5992 | msgid "Peerinfo REST API initialized\n" |
5988 | msgstr "Conexión fallida\n" | 5993 | msgstr "Conexión fallida\n" |
@@ -5991,7 +5996,7 @@ msgstr "Conexión fallida\n" | |||
5991 | msgid "peerstore" | 5996 | msgid "peerstore" |
5992 | msgstr "" | 5997 | msgstr "" |
5993 | 5998 | ||
5994 | #: src/peerstore/gnunet-service-peerstore.c:561 | 5999 | #: src/peerstore/gnunet-service-peerstore.c:570 |
5995 | #, fuzzy, c-format | 6000 | #, fuzzy, c-format |
5996 | msgid "Could not load database backend `%s'\n" | 6001 | msgid "Could not load database backend `%s'\n" |
5997 | msgstr "No se pudo leer el fichero de la lista negra «%s»\n" | 6002 | msgstr "No se pudo leer el fichero de la lista negra «%s»\n" |
@@ -6175,12 +6180,12 @@ msgstr "" | |||
6175 | msgid "re:claimID command line tool" | 6180 | msgid "re:claimID command line tool" |
6176 | msgstr "" | 6181 | msgstr "" |
6177 | 6182 | ||
6178 | #: src/reclaim/plugin_rest_openid_connect.c:2613 | 6183 | #: src/reclaim/plugin_rest_openid_connect.c:2788 |
6179 | #, fuzzy | 6184 | #, fuzzy |
6180 | msgid "OpenID Connect REST API initialized\n" | 6185 | msgid "OpenID Connect REST API initialized\n" |
6181 | msgstr "Conexión fallida\n" | 6186 | msgstr "Conexión fallida\n" |
6182 | 6187 | ||
6183 | #: src/reclaim/plugin_rest_reclaim.c:1502 | 6188 | #: src/reclaim/plugin_rest_reclaim.c:1521 |
6184 | #, fuzzy | 6189 | #, fuzzy |
6185 | msgid "Identity Provider REST API initialized\n" | 6190 | msgid "Identity Provider REST API initialized\n" |
6186 | msgstr "Conexión fallida\n" | 6191 | msgstr "Conexión fallida\n" |
@@ -6349,116 +6354,116 @@ msgstr "" | |||
6349 | msgid "Cancelling calculation.\n" | 6354 | msgid "Cancelling calculation.\n" |
6350 | msgstr "" | 6355 | msgstr "" |
6351 | 6356 | ||
6352 | #: src/revocation/gnunet-revocation.c:299 | 6357 | #: src/revocation/gnunet-revocation.c:302 |
6353 | #, c-format | 6358 | #, c-format |
6354 | msgid "Revocation certificate for `%s' stored in `%s'\n" | 6359 | msgid "Revocation certificate for `%s' stored in `%s'\n" |
6355 | msgstr "" | 6360 | msgstr "" |
6356 | 6361 | ||
6357 | #: src/revocation/gnunet-revocation.c:339 | 6362 | #: src/revocation/gnunet-revocation.c:334 |
6358 | #, fuzzy, c-format | 6363 | #, fuzzy, c-format |
6359 | msgid "Ego `%s' not found.\n" | 6364 | msgid "Ego `%s' not found.\n" |
6360 | msgstr "Módulo «%s» no encontrado\n" | 6365 | msgstr "Módulo «%s» no encontrado\n" |
6361 | 6366 | ||
6362 | #: src/revocation/gnunet-revocation.c:356 | 6367 | #: src/revocation/gnunet-revocation.c:351 |
6363 | #, c-format | 6368 | #, c-format |
6364 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" | 6369 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" |
6365 | msgstr "" | 6370 | msgstr "" |
6366 | 6371 | ||
6367 | #: src/revocation/gnunet-revocation.c:366 | 6372 | #: src/revocation/gnunet-revocation.c:361 |
6368 | msgid "Revocation certificate ready\n" | 6373 | msgid "Revocation certificate ready\n" |
6369 | msgstr "" | 6374 | msgstr "" |
6370 | 6375 | ||
6371 | #: src/revocation/gnunet-revocation.c:378 | 6376 | #: src/revocation/gnunet-revocation.c:373 |
6372 | msgid "Continuing calculation where left off...\n" | 6377 | msgid "Continuing calculation where left off...\n" |
6373 | msgstr "" | 6378 | msgstr "" |
6374 | 6379 | ||
6375 | #: src/revocation/gnunet-revocation.c:385 | 6380 | #: src/revocation/gnunet-revocation.c:380 |
6376 | msgid "Revocation certificate not ready, calculating proof of work\n" | 6381 | msgid "Revocation certificate not ready, calculating proof of work\n" |
6377 | msgstr "" | 6382 | msgstr "" |
6378 | 6383 | ||
6379 | #: src/revocation/gnunet-revocation.c:423 | 6384 | #: src/revocation/gnunet-revocation.c:418 |
6380 | #, fuzzy, c-format | 6385 | #, fuzzy, c-format |
6381 | msgid "Public key `%s' malformed\n" | 6386 | msgid "Public key `%s' malformed\n" |
6382 | msgstr "El bloque del tipo %u está mal formado\n" | 6387 | msgstr "El bloque del tipo %u está mal formado\n" |
6383 | 6388 | ||
6384 | #: src/revocation/gnunet-revocation.c:433 | 6389 | #: src/revocation/gnunet-revocation.c:428 |
6385 | msgid "" | 6390 | msgid "" |
6386 | "Testing and revoking at the same time is not allowed, only executing test.\n" | 6391 | "Testing and revoking at the same time is not allowed, only executing test.\n" |
6387 | msgstr "" | 6392 | msgstr "" |
6388 | 6393 | ||
6389 | #: src/revocation/gnunet-revocation.c:463 | 6394 | #: src/revocation/gnunet-revocation.c:458 |
6390 | #, fuzzy | 6395 | #, fuzzy |
6391 | msgid "No filename to store revocation certificate given.\n" | 6396 | msgid "No filename to store revocation certificate given.\n" |
6392 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" | 6397 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" |
6393 | 6398 | ||
6394 | #: src/revocation/gnunet-revocation.c:480 | 6399 | #: src/revocation/gnunet-revocation.c:475 |
6395 | #, fuzzy, c-format | 6400 | #, fuzzy, c-format |
6396 | msgid "Failed to read revocation certificate from `%s'\n" | 6401 | msgid "Failed to read revocation certificate from `%s'\n" |
6397 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" | 6402 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" |
6398 | 6403 | ||
6399 | #: src/revocation/gnunet-revocation.c:488 | 6404 | #: src/revocation/gnunet-revocation.c:483 |
6400 | #, fuzzy, c-format | 6405 | #, fuzzy, c-format |
6401 | msgid "Revocation certificate corrupted in `%s'\n" | 6406 | msgid "Revocation certificate corrupted in `%s'\n" |
6402 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" | 6407 | msgstr "Se produjo un fallo al leer la lista de amigos de «%s»\n" |
6403 | 6408 | ||
6404 | #: src/revocation/gnunet-revocation.c:510 | 6409 | #: src/revocation/gnunet-revocation.c:505 |
6405 | #, fuzzy | 6410 | #, fuzzy |
6406 | msgid "No action specified. Nothing to do.\n" | 6411 | msgid "No action specified. Nothing to do.\n" |
6407 | msgstr "Ninguna interfaz especificada, usando la marcada por defecto\n" | 6412 | msgstr "Ninguna interfaz especificada, usando la marcada por defecto\n" |
6408 | 6413 | ||
6409 | #: src/revocation/gnunet-revocation.c:529 | 6414 | #: src/revocation/gnunet-revocation.c:524 |
6410 | msgid "use NAME for the name of the revocation file" | 6415 | msgid "use NAME for the name of the revocation file" |
6411 | msgstr "" | 6416 | msgstr "" |
6412 | 6417 | ||
6413 | #: src/revocation/gnunet-revocation.c:537 | 6418 | #: src/revocation/gnunet-revocation.c:532 |
6414 | msgid "" | 6419 | msgid "" |
6415 | "revoke the private key associated for the the private key associated with " | 6420 | "revoke the private key associated for the the private key associated with " |
6416 | "the ego NAME " | 6421 | "the ego NAME " |
6417 | msgstr "" | 6422 | msgstr "" |
6418 | 6423 | ||
6419 | #: src/revocation/gnunet-revocation.c:544 | 6424 | #: src/revocation/gnunet-revocation.c:539 |
6420 | msgid "actually perform revocation, otherwise we just do the precomputation" | 6425 | msgid "actually perform revocation, otherwise we just do the precomputation" |
6421 | msgstr "" | 6426 | msgstr "" |
6422 | 6427 | ||
6423 | #: src/revocation/gnunet-revocation.c:551 | 6428 | #: src/revocation/gnunet-revocation.c:546 |
6424 | msgid "test if the public key KEY has been revoked" | 6429 | msgid "test if the public key KEY has been revoked" |
6425 | msgstr "" | 6430 | msgstr "" |
6426 | 6431 | ||
6427 | #: src/revocation/gnunet-revocation.c:557 | 6432 | #: src/revocation/gnunet-revocation.c:552 |
6428 | #, fuzzy | 6433 | #, fuzzy |
6429 | msgid "number of epochs to calculate for" | 6434 | msgid "number of epochs to calculate for" |
6430 | msgstr "número de pares para empezar" | 6435 | msgstr "número de pares para empezar" |
6431 | 6436 | ||
6432 | #: src/revocation/gnunet-service-revocation.c:494 | 6437 | #: src/revocation/gnunet-service-revocation.c:502 |
6433 | #, fuzzy | 6438 | #, fuzzy |
6434 | msgid "# unsupported revocations received via set union" | 6439 | msgid "# unsupported revocations received via set union" |
6435 | msgstr "Opciones de paquete IPv4 recibidas. Ignoradas.\n" | 6440 | msgstr "Opciones de paquete IPv4 recibidas. Ignoradas.\n" |
6436 | 6441 | ||
6437 | #: src/revocation/gnunet-service-revocation.c:504 | 6442 | #: src/revocation/gnunet-service-revocation.c:512 |
6438 | #, fuzzy | 6443 | #, fuzzy |
6439 | msgid "# revocation messages received via set union" | 6444 | msgid "# revocation messages received via set union" |
6440 | msgstr "# mensajes «DATA» recibidos vÃa WLAN" | 6445 | msgstr "# mensajes «DATA» recibidos vÃa WLAN" |
6441 | 6446 | ||
6442 | #: src/revocation/gnunet-service-revocation.c:509 | 6447 | #: src/revocation/gnunet-service-revocation.c:517 |
6443 | #, c-format | 6448 | #, c-format |
6444 | msgid "Error computing revocation set union with %s\n" | 6449 | msgid "Error computing revocation set union with %s\n" |
6445 | msgstr "" | 6450 | msgstr "" |
6446 | 6451 | ||
6447 | #: src/revocation/gnunet-service-revocation.c:513 | 6452 | #: src/revocation/gnunet-service-revocation.c:521 |
6448 | #, fuzzy | 6453 | #, fuzzy |
6449 | msgid "# revocation set unions failed" | 6454 | msgid "# revocation set unions failed" |
6450 | msgstr "# sesiones wlan creadas" | 6455 | msgstr "# sesiones wlan creadas" |
6451 | 6456 | ||
6452 | #: src/revocation/gnunet-service-revocation.c:521 | 6457 | #: src/revocation/gnunet-service-revocation.c:529 |
6453 | #, fuzzy | 6458 | #, fuzzy |
6454 | msgid "# revocation set unions completed" | 6459 | msgid "# revocation set unions completed" |
6455 | msgstr "# transmisiones de fragmentos completadas" | 6460 | msgstr "# transmisiones de fragmentos completadas" |
6456 | 6461 | ||
6457 | #: src/revocation/gnunet-service-revocation.c:559 | 6462 | #: src/revocation/gnunet-service-revocation.c:567 |
6458 | msgid "SET service crashed, terminating revocation service\n" | 6463 | msgid "SET service crashed, terminating revocation service\n" |
6459 | msgstr "" | 6464 | msgstr "" |
6460 | 6465 | ||
6461 | #: src/revocation/gnunet-service-revocation.c:912 | 6466 | #: src/revocation/gnunet-service-revocation.c:920 |
6462 | #, fuzzy | 6467 | #, fuzzy |
6463 | msgid "Could not open revocation database file!" | 6468 | msgid "Could not open revocation database file!" |
6464 | msgstr "No se pudo conectar con el almacén de datos." | 6469 | msgstr "No se pudo conectar con el almacén de datos." |
@@ -6475,23 +6480,23 @@ msgstr "" | |||
6475 | msgid "Get peers from biased stream" | 6480 | msgid "Get peers from biased stream" |
6476 | msgstr "" | 6481 | msgstr "" |
6477 | 6482 | ||
6478 | #: src/rps/gnunet-rps-profiler.c:3200 | 6483 | #: src/rps/gnunet-rps-profiler.c:3142 |
6479 | #, fuzzy | 6484 | #, fuzzy |
6480 | msgid "duration of the profiling" | 6485 | msgid "duration of the profiling" |
6481 | msgstr "" | 6486 | msgstr "" |
6482 | "La configuración o la versión de GNUnet cambiaron. ¡Debes ejecutar '%s'!\n" | 6487 | "La configuración o la versión de GNUnet cambiaron. ¡Debes ejecutar '%s'!\n" |
6483 | 6488 | ||
6484 | #: src/rps/gnunet-rps-profiler.c:3206 | 6489 | #: src/rps/gnunet-rps-profiler.c:3148 |
6485 | #, fuzzy | 6490 | #, fuzzy |
6486 | msgid "timeout for the profiling" | 6491 | msgid "timeout for the profiling" |
6487 | msgstr "Especificar el tipo del registro a buscar" | 6492 | msgstr "Especificar el tipo del registro a buscar" |
6488 | 6493 | ||
6489 | #: src/rps/gnunet-rps-profiler.c:3211 | 6494 | #: src/rps/gnunet-rps-profiler.c:3153 |
6490 | #, fuzzy | 6495 | #, fuzzy |
6491 | msgid "number of PeerIDs to request" | 6496 | msgid "number of PeerIDs to request" |
6492 | msgstr "número de pares para empezar" | 6497 | msgstr "número de pares para empezar" |
6493 | 6498 | ||
6494 | #: src/rps/gnunet-rps-profiler.c:3228 | 6499 | #: src/rps/gnunet-rps-profiler.c:3170 |
6495 | #, fuzzy | 6500 | #, fuzzy |
6496 | msgid "Measure quality and performance of the RPS service." | 6501 | msgid "Measure quality and performance of the RPS service." |
6497 | msgstr "Medir la calidad y rendimiento del servicio NSE." | 6502 | msgstr "Medir la calidad y rendimiento del servicio NSE." |
@@ -6580,7 +6585,7 @@ msgid "also profile decryption" | |||
6580 | msgstr "" | 6585 | msgstr "" |
6581 | 6586 | ||
6582 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 | 6587 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 |
6583 | #: src/setu/gnunet-service-setu.c:3633 | 6588 | #: src/setu/gnunet-service-setu.c:3832 |
6584 | #, fuzzy | 6589 | #, fuzzy |
6585 | msgid "Could not connect to CADET service\n" | 6590 | msgid "Could not connect to CADET service\n" |
6586 | msgstr "¡No se pudo conectar al servicio %s!\n" | 6591 | msgstr "¡No se pudo conectar al servicio %s!\n" |
@@ -7176,14 +7181,14 @@ msgstr "Se produjo un fallo al arrancar «%s»: %s\n" | |||
7176 | msgid "Failed to load configuration from %s\n" | 7181 | msgid "Failed to load configuration from %s\n" |
7177 | msgstr "Se produjo un fallo al cargar la configuración de %s\n" | 7182 | msgstr "Se produjo un fallo al cargar la configuración de %s\n" |
7178 | 7183 | ||
7179 | #: src/topology/friends.c:127 | 7184 | #: src/topology/friends.c:118 |
7180 | #, fuzzy, c-format | 7185 | #, fuzzy, c-format |
7181 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" | 7186 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" |
7182 | msgstr "" | 7187 | msgstr "" |
7183 | "Error de sintaxis en el fichero de la lista negra en el desplazamiento %llu, " | 7188 | "Error de sintaxis en el fichero de la lista negra en el desplazamiento %llu, " |
7184 | "omitiendo bytes «%s».\n" | 7189 | "omitiendo bytes «%s».\n" |
7185 | 7190 | ||
7186 | #: src/topology/friends.c:181 | 7191 | #: src/topology/friends.c:172 |
7187 | #, fuzzy, c-format | 7192 | #, fuzzy, c-format |
7188 | msgid "Directory for file `%s' does not seem to be writable.\n" | 7193 | msgid "Directory for file `%s' does not seem to be writable.\n" |
7189 | msgstr "«gnunet-arm» o «ssh» no parecen terminar.\n" | 7194 | msgstr "«gnunet-arm» o «ssh» no parecen terminar.\n" |
@@ -7255,9 +7260,9 @@ msgstr "# mensajes «HELLO» recibidos" | |||
7255 | msgid "GNUnet topology control" | 7260 | msgid "GNUnet topology control" |
7256 | msgstr "" | 7261 | msgstr "" |
7257 | 7262 | ||
7258 | #: src/transport/gnunet-communicator-tcp.c:3221 | 7263 | #: src/transport/gnunet-communicator-tcp.c:3331 |
7259 | #: src/transport/gnunet-communicator-udp.c:3076 | 7264 | #: src/transport/gnunet-communicator-udp.c:3790 |
7260 | #: src/transport/gnunet-service-tng.c:10014 | 7265 | #: src/transport/gnunet-service-tng.c:10220 |
7261 | #: src/transport/gnunet-service-transport.c:2627 | 7266 | #: src/transport/gnunet-service-transport.c:2627 |
7262 | #, fuzzy | 7267 | #, fuzzy |
7263 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7268 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
@@ -7265,12 +7270,12 @@ msgstr "" | |||
7265 | "El servicio de transporte carece de opciones de configuración de clave. " | 7270 | "El servicio de transporte carece de opciones de configuración de clave. " |
7266 | "Saliendo.\n" | 7271 | "Saliendo.\n" |
7267 | 7272 | ||
7268 | #: src/transport/gnunet-communicator-tcp.c:3553 | 7273 | #: src/transport/gnunet-communicator-tcp.c:3668 |
7269 | #, fuzzy | 7274 | #, fuzzy |
7270 | msgid "GNUnet TCP communicator" | 7275 | msgid "GNUnet TCP communicator" |
7271 | msgstr "Configurador Gtk de GNUnet" | 7276 | msgstr "Configurador Gtk de GNUnet" |
7272 | 7277 | ||
7273 | #: src/transport/gnunet-communicator-udp.c:3148 | 7278 | #: src/transport/gnunet-communicator-udp.c:3862 |
7274 | #, fuzzy | 7279 | #, fuzzy |
7275 | msgid "GNUnet UDP communicator" | 7280 | msgid "GNUnet UDP communicator" |
7276 | msgstr "Configurador Gtk de GNUnet" | 7281 | msgstr "Configurador Gtk de GNUnet" |
@@ -8400,7 +8405,7 @@ msgstr "" | |||
8400 | msgid "Service process failed to report status\n" | 8405 | msgid "Service process failed to report status\n" |
8401 | msgstr "El proceso del servicio no devolvió un estado\n" | 8406 | msgstr "El proceso del servicio no devolvió un estado\n" |
8402 | 8407 | ||
8403 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1176 | 8408 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 |
8404 | #: src/util/service.c:1637 | 8409 | #: src/util/service.c:1637 |
8405 | #, c-format | 8410 | #, c-format |
8406 | msgid "Cannot obtain information about user `%s': %s\n" | 8411 | msgid "Cannot obtain information about user `%s': %s\n" |
@@ -8420,7 +8425,7 @@ msgid "do daemonize (detach from terminal)" | |||
8420 | msgstr "demonizar (desasociar del terminal)" | 8425 | msgstr "demonizar (desasociar del terminal)" |
8421 | 8426 | ||
8422 | #: src/transport/tcp_service_legacy.c:1397 | 8427 | #: src/transport/tcp_service_legacy.c:1397 |
8423 | #: src/transport/transport-testing2.c:985 src/util/service.c:2072 | 8428 | #: src/transport/transport-testing-communicator.c:1045 src/util/service.c:2072 |
8424 | #: src/util/service.c:2084 | 8429 | #: src/util/service.c:2084 |
8425 | #, fuzzy, c-format | 8430 | #, fuzzy, c-format |
8426 | msgid "Malformed configuration file `%s', exit ...\n" | 8431 | msgid "Malformed configuration file `%s', exit ...\n" |
@@ -8587,22 +8592,22 @@ msgstr "" | |||
8587 | "La configuración especifica un valor no válido en la opción «%s» de la " | 8592 | "La configuración especifica un valor no válido en la opción «%s» de la " |
8588 | "sección «%s»: %s\n" | 8593 | "sección «%s»: %s\n" |
8589 | 8594 | ||
8590 | #: src/util/configuration.c:402 | 8595 | #: src/util/configuration.c:370 |
8591 | #, c-format | 8596 | #, c-format |
8592 | msgid "Syntax error while deserializing in line %u\n" | 8597 | msgid "Syntax error while deserializing in line %u\n" |
8593 | msgstr "Error de sintaxis en la lÃnea %u mientras se deserializaba\n" | 8598 | msgstr "Error de sintaxis en la lÃnea %u mientras se deserializaba\n" |
8594 | 8599 | ||
8595 | #: src/util/configuration.c:460 | 8600 | #: src/util/configuration.c:420 |
8596 | #, fuzzy, c-format | 8601 | #, fuzzy, c-format |
8597 | msgid "Error while reading file `%s'\n" | 8602 | msgid "Error while reading file `%s'\n" |
8598 | msgstr "Error decodificando clave %u\n" | 8603 | msgstr "Error decodificando clave %u\n" |
8599 | 8604 | ||
8600 | #: src/util/configuration.c:1063 | 8605 | #: src/util/configuration.c:980 |
8601 | #, fuzzy | 8606 | #, fuzzy |
8602 | msgid "Not a valid relative time specification" | 8607 | msgid "Not a valid relative time specification" |
8603 | msgstr "Tiempo de expiración no válido para la operación «%s»\n" | 8608 | msgstr "Tiempo de expiración no válido para la operación «%s»\n" |
8604 | 8609 | ||
8605 | #: src/util/configuration.c:1154 | 8610 | #: src/util/configuration.c:1050 |
8606 | #, c-format | 8611 | #, c-format |
8607 | msgid "" | 8612 | msgid "" |
8608 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " | 8613 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " |
@@ -8611,17 +8616,17 @@ msgstr "" | |||
8611 | "El valor de configuración «%s» para «%s» de la sección «%s» no está dentro " | 8616 | "El valor de configuración «%s» para «%s» de la sección «%s» no está dentro " |
8612 | "de las opciones legales\n" | 8617 | "de las opciones legales\n" |
8613 | 8618 | ||
8614 | #: src/util/configuration.c:1269 | 8619 | #: src/util/configuration.c:1145 |
8615 | #, c-format | 8620 | #, c-format |
8616 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" | 8621 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" |
8617 | msgstr "" | 8622 | msgstr "" |
8618 | 8623 | ||
8619 | #: src/util/configuration.c:1301 | 8624 | #: src/util/configuration.c:1177 |
8620 | #, fuzzy, c-format | 8625 | #, fuzzy, c-format |
8621 | msgid "Missing closing `%s' in option `%s'\n" | 8626 | msgid "Missing closing `%s' in option `%s'\n" |
8622 | msgstr "Falta la opción «%s» para la operación «%s»\n" | 8627 | msgstr "Falta la opción «%s» para la operación «%s»\n" |
8623 | 8628 | ||
8624 | #: src/util/configuration.c:1367 | 8629 | #: src/util/configuration.c:1243 |
8625 | #, c-format | 8630 | #, c-format |
8626 | msgid "" | 8631 | msgid "" |
8627 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " | 8632 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " |
@@ -8637,37 +8642,37 @@ msgstr "" | |||
8637 | "El tamaño del fichero en disco es incorrecto para este «Bloom " | 8642 | "El tamaño del fichero en disco es incorrecto para este «Bloom " |
8638 | "filter» (esperado %llu, tiene %llu)\n" | 8643 | "filter» (esperado %llu, tiene %llu)\n" |
8639 | 8644 | ||
8640 | #: src/util/crypto_ecc.c:663 | 8645 | #: src/util/crypto_ecc.c:567 |
8641 | #, c-format | 8646 | #, c-format |
8642 | msgid "ECC signing failed at %s:%d: %s\n" | 8647 | msgid "ECC signing failed at %s:%d: %s\n" |
8643 | msgstr "El firmado ECC falló en %s:%d: %s\n" | 8648 | msgstr "El firmado ECC falló en %s:%d: %s\n" |
8644 | 8649 | ||
8645 | #: src/util/crypto_ecc.c:791 | 8650 | #: src/util/crypto_ecc.c:669 |
8646 | #, fuzzy, c-format | 8651 | #, fuzzy, c-format |
8647 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 8652 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
8648 | msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" | 8653 | msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" |
8649 | 8654 | ||
8650 | #: src/util/crypto_ecc_setup.c:369 | 8655 | #: src/util/crypto_ecc_setup.c:273 |
8651 | #, fuzzy | 8656 | #, fuzzy |
8652 | msgid "Could not load peer's private key\n" | 8657 | msgid "Could not load peer's private key\n" |
8653 | msgstr "No se pudo acceder a la clave de máquina.\n" | 8658 | msgstr "No se pudo acceder a la clave de máquina.\n" |
8654 | 8659 | ||
8655 | #: src/util/crypto_random.c:345 | 8660 | #: src/util/crypto_random.c:381 |
8656 | #, c-format | 8661 | #, c-format |
8657 | msgid "libgcrypt has not the expected version (version %s is required).\n" | 8662 | msgid "libgcrypt has not the expected version (version %s is required).\n" |
8658 | msgstr "libgcrypt no tiene la versión esperada (se necesita la versión %s).\n" | 8663 | msgstr "libgcrypt no tiene la versión esperada (se necesita la versión %s).\n" |
8659 | 8664 | ||
8660 | #: src/util/crypto_rsa.c:959 | 8665 | #: src/util/crypto_rsa.c:862 |
8661 | #, fuzzy, c-format | 8666 | #, fuzzy, c-format |
8662 | msgid "RSA signing failed at %s:%d: %s\n" | 8667 | msgid "RSA signing failed at %s:%d: %s\n" |
8663 | msgstr "El firmado ECC falló en %s:%d: %s\n" | 8668 | msgstr "El firmado ECC falló en %s:%d: %s\n" |
8664 | 8669 | ||
8665 | #: src/util/crypto_rsa.c:1318 | 8670 | #: src/util/crypto_rsa.c:1162 |
8666 | #, c-format | 8671 | #, c-format |
8667 | msgid "RSA signature verification failed at %s:%d: %s\n" | 8672 | msgid "RSA signature verification failed at %s:%d: %s\n" |
8668 | msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" | 8673 | msgstr "La verificación de la firma RSA fallo en %s:%d: %s\n" |
8669 | 8674 | ||
8670 | #: src/util/disk.c:940 | 8675 | #: src/util/disk.c:823 |
8671 | #, c-format | 8676 | #, c-format |
8672 | msgid "Expected `%s' to be a directory!\n" | 8677 | msgid "Expected `%s' to be a directory!\n" |
8673 | msgstr "¡Se esperaba que «%s» fuera un directorio!\n" | 8678 | msgstr "¡Se esperaba que «%s» fuera un directorio!\n" |
@@ -8754,17 +8759,17 @@ msgstr "%s: la opción «-W %s» es ambigua\n" | |||
8754 | msgid "%s: option `-W %s' does not allow an argument\n" | 8759 | msgid "%s: option `-W %s' does not allow an argument\n" |
8755 | msgstr "%s: la opción «-W %s» no permite un parámetro\n" | 8760 | msgstr "%s: la opción «-W %s» no permite un parámetro\n" |
8756 | 8761 | ||
8757 | #: src/util/getopt.c:974 | 8762 | #: src/util/getopt.c:970 |
8758 | #, c-format | 8763 | #, c-format |
8759 | msgid "Use %s to get a list of options.\n" | 8764 | msgid "Use %s to get a list of options.\n" |
8760 | msgstr "Use %s para obtener una lista de opciones.\n" | 8765 | msgstr "Use %s para obtener una lista de opciones.\n" |
8761 | 8766 | ||
8762 | #: src/util/getopt.c:986 | 8767 | #: src/util/getopt.c:983 |
8763 | #, fuzzy, c-format | 8768 | #, fuzzy, c-format |
8764 | msgid "Option `%s' can't be used with other options.\n" | 8769 | msgid "Option `%s' can't be used with other options.\n" |
8765 | msgstr "La opción «%s» no tiene sentido sin la opción «%s».\n" | 8770 | msgstr "La opción «%s» no tiene sentido sin la opción «%s».\n" |
8766 | 8771 | ||
8767 | #: src/util/getopt.c:998 | 8772 | #: src/util/getopt.c:995 |
8768 | #, fuzzy, c-format | 8773 | #, fuzzy, c-format |
8769 | msgid "Missing mandatory option `%s'.\n" | 8774 | msgid "Missing mandatory option `%s'.\n" |
8770 | msgstr "Falta la opción «%s» para la operación «%s»\n" | 8775 | msgstr "Falta la opción «%s» para la operación «%s»\n" |
@@ -8852,6 +8857,10 @@ msgstr "Tienes que introducir un número en la opción «%s».\n" | |||
8852 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 8857 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
8853 | msgstr "" | 8858 | msgstr "" |
8854 | 8859 | ||
8860 | #: src/util/gnunet-base32.c:45 | ||
8861 | msgid "run decoder modus, otherwise runs as encoder" | ||
8862 | msgstr "" | ||
8863 | |||
8855 | #: src/util/gnunet-config.c:167 | 8864 | #: src/util/gnunet-config.c:167 |
8856 | #, fuzzy, c-format | 8865 | #, fuzzy, c-format |
8857 | msgid "failed to load configuration defaults" | 8866 | msgid "failed to load configuration defaults" |
@@ -8907,6 +8916,10 @@ msgstr "" | |||
8907 | msgid "Manipulate GNUnet configuration files" | 8916 | msgid "Manipulate GNUnet configuration files" |
8908 | msgstr "Manipular ficheros de configuración de GNUnet" | 8917 | msgstr "Manipular ficheros de configuración de GNUnet" |
8909 | 8918 | ||
8919 | #: src/util/gnunet-crypto-tvg.c:1072 | ||
8920 | msgid "verify a test vector from stdin" | ||
8921 | msgstr "" | ||
8922 | |||
8910 | #: src/util/gnunet-ecc.c:94 | 8923 | #: src/util/gnunet-ecc.c:94 |
8911 | #, c-format | 8924 | #, c-format |
8912 | msgid "Failed to open `%s': %s\n" | 8925 | msgid "Failed to open `%s': %s\n" |
@@ -9030,31 +9043,32 @@ msgid "perform a reverse lookup" | |||
9030 | msgstr "realizar una búsqueda inversa" | 9043 | msgstr "realizar una búsqueda inversa" |
9031 | 9044 | ||
9032 | #: src/util/gnunet-resolver.c:182 | 9045 | #: src/util/gnunet-resolver.c:182 |
9033 | msgid "Use build-in GNUnet stub resolver" | 9046 | #, fuzzy |
9047 | msgid "Use built-in GNUnet stub resolver" | ||
9034 | msgstr "Utilizar el resolvedor interno para pruebas de GNUnet" | 9048 | msgstr "Utilizar el resolvedor interno para pruebas de GNUnet" |
9035 | 9049 | ||
9036 | #: src/util/gnunet-scrypt.c:229 | 9050 | #: src/util/gnunet-scrypt.c:232 |
9037 | #, c-format | 9051 | #, c-format |
9038 | msgid "Loading hostkey from `%s' failed.\n" | 9052 | msgid "Loading hostkey from `%s' failed.\n" |
9039 | msgstr "La carga de la clave de la máquina desde «%s» ha fallado.\n" | 9053 | msgstr "La carga de la clave de la máquina desde «%s» ha fallado.\n" |
9040 | 9054 | ||
9041 | #: src/util/gnunet-scrypt.c:295 | 9055 | #: src/util/gnunet-scrypt.c:298 |
9042 | msgid "number of bits to require for the proof of work" | 9056 | msgid "number of bits to require for the proof of work" |
9043 | msgstr "" | 9057 | msgstr "" |
9044 | 9058 | ||
9045 | #: src/util/gnunet-scrypt.c:301 | 9059 | #: src/util/gnunet-scrypt.c:304 |
9046 | msgid "file with private key, otherwise default is used" | 9060 | msgid "file with private key, otherwise default is used" |
9047 | msgstr "" | 9061 | msgstr "" |
9048 | 9062 | ||
9049 | #: src/util/gnunet-scrypt.c:307 | 9063 | #: src/util/gnunet-scrypt.c:310 |
9050 | msgid "file with proof of work, otherwise default is used" | 9064 | msgid "file with proof of work, otherwise default is used" |
9051 | msgstr "" | 9065 | msgstr "" |
9052 | 9066 | ||
9053 | #: src/util/gnunet-scrypt.c:313 | 9067 | #: src/util/gnunet-scrypt.c:316 |
9054 | msgid "time to wait between calculations" | 9068 | msgid "time to wait between calculations" |
9055 | msgstr "" | 9069 | msgstr "" |
9056 | 9070 | ||
9057 | #: src/util/gnunet-scrypt.c:326 | 9071 | #: src/util/gnunet-scrypt.c:330 |
9058 | #, fuzzy | 9072 | #, fuzzy |
9059 | msgid "Manipulate GNUnet proof of work files" | 9073 | msgid "Manipulate GNUnet proof of work files" |
9060 | msgstr "Manipular los ficheros de clave privada ECC de GNUnet" | 9074 | msgstr "Manipular los ficheros de clave privada ECC de GNUnet" |
@@ -9094,7 +9108,7 @@ msgstr "Error escribiendo a «%s»: %s\n" | |||
9094 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" | 9108 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" |
9095 | msgstr "Imposible acortar la ruta unix «%s» manteniendo el nombre único\n" | 9109 | msgstr "Imposible acortar la ruta unix «%s» manteniendo el nombre único\n" |
9096 | 9110 | ||
9097 | #: src/util/network.c:1364 | 9111 | #: src/util/network.c:1361 |
9098 | #, c-format | 9112 | #, c-format |
9099 | msgid "" | 9113 | msgid "" |
9100 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" | 9114 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" |
@@ -9102,7 +9116,7 @@ msgstr "" | |||
9102 | "¡Error lógico interno fatal, el proceso está colgado en «%s» (abortar con " | 9116 | "¡Error lógico interno fatal, el proceso está colgado en «%s» (abortar con " |
9103 | "CTRL-C)!\n" | 9117 | "CTRL-C)!\n" |
9104 | 9118 | ||
9105 | #: src/util/os_installation.c:411 | 9119 | #: src/util/os_installation.c:415 |
9106 | #, c-format | 9120 | #, c-format |
9107 | msgid "" | 9121 | msgid "" |
9108 | "Could not determine installation path for %s. Set `%s' environment " | 9122 | "Could not determine installation path for %s. Set `%s' environment " |
@@ -9111,12 +9125,12 @@ msgstr "" | |||
9111 | "No se pudo determinar la ruta de instalación de %s. Establezca la variable " | 9125 | "No se pudo determinar la ruta de instalación de %s. Establezca la variable " |
9112 | "de entorno «%s».\n" | 9126 | "de entorno «%s».\n" |
9113 | 9127 | ||
9114 | #: src/util/os_installation.c:794 | 9128 | #: src/util/os_installation.c:802 |
9115 | #, c-format | 9129 | #, c-format |
9116 | msgid "Could not find binary `%s' in PATH!\n" | 9130 | msgid "Could not find binary `%s' in PATH!\n" |
9117 | msgstr "¡No se pudo encontrar el programa llamado «%s» en PATH!\n" | 9131 | msgstr "¡No se pudo encontrar el programa llamado «%s» en PATH!\n" |
9118 | 9132 | ||
9119 | #: src/util/os_installation.c:827 | 9133 | #: src/util/os_installation.c:835 |
9120 | #, c-format | 9134 | #, c-format |
9121 | msgid "Binary `%s' exists, but is not SUID\n" | 9135 | msgid "Binary `%s' exists, but is not SUID\n" |
9122 | msgstr "" | 9136 | msgstr "" |
@@ -9126,31 +9140,31 @@ msgstr "" | |||
9126 | msgid "Initialization of plugin mechanism failed: %s!\n" | 9140 | msgid "Initialization of plugin mechanism failed: %s!\n" |
9127 | msgstr "¡La inicialización del mecanismo de módulos falló: %s!\n" | 9141 | msgstr "¡La inicialización del mecanismo de módulos falló: %s!\n" |
9128 | 9142 | ||
9129 | #: src/util/plugin.c:147 | 9143 | #: src/util/plugin.c:156 |
9130 | #, c-format | 9144 | #, c-format |
9131 | msgid "`%s' failed to resolve method '%s' with error: %s\n" | 9145 | msgid "`%s' failed to resolve method '%s' with error: %s\n" |
9132 | msgstr "«%s» falló al resolver el método «%s» con error: %s\n" | 9146 | msgstr "«%s» falló al resolver el método «%s» con error: %s\n" |
9133 | 9147 | ||
9134 | #: src/util/plugin.c:223 | 9148 | #: src/util/plugin.c:234 |
9135 | #, c-format | 9149 | #, c-format |
9136 | msgid "`%s' failed for library `%s' with error: %s\n" | 9150 | msgid "`%s' failed for library `%s' with error: %s\n" |
9137 | msgstr "Falló «%s» para la biblioteca «%s» con error: %s\n" | 9151 | msgstr "Falló «%s» para la biblioteca «%s» con error: %s\n" |
9138 | 9152 | ||
9139 | #: src/util/plugin.c:384 | 9153 | #: src/util/plugin.c:409 |
9140 | msgid "Could not determine plugin installation path.\n" | 9154 | msgid "Could not determine plugin installation path.\n" |
9141 | msgstr "No se pudo determinar la ruta de instalación de los módulos.\n" | 9155 | msgstr "No se pudo determinar la ruta de instalación de los módulos.\n" |
9142 | 9156 | ||
9143 | #: src/util/program.c:267 | 9157 | #: src/util/program.c:259 |
9144 | #, fuzzy, c-format | 9158 | #, fuzzy, c-format |
9145 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" | 9159 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" |
9146 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | 9160 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" |
9147 | 9161 | ||
9148 | #: src/util/program.c:284 | 9162 | #: src/util/program.c:276 |
9149 | #, fuzzy, c-format | 9163 | #, fuzzy, c-format |
9150 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | 9164 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" |
9151 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | 9165 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" |
9152 | 9166 | ||
9153 | #: src/util/program.c:299 | 9167 | #: src/util/program.c:291 |
9154 | #, fuzzy | 9168 | #, fuzzy |
9155 | msgid "Unreadable or malformed configuration, exit ...\n" | 9169 | msgid "Unreadable or malformed configuration, exit ...\n" |
9156 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" | 9170 | msgstr "Se produjo un fallo al borrar el fichero de configuración %s\n" |
@@ -9300,14 +9314,14 @@ msgstr "Formato «%s» erroneo para máscara de red\n" | |||
9300 | msgid "Wrong format `%s' for network\n" | 9314 | msgid "Wrong format `%s' for network\n" |
9301 | msgstr "Formato «%s» erroneo para red\n" | 9315 | msgstr "Formato «%s» erroneo para red\n" |
9302 | 9316 | ||
9303 | #: src/util/time.c:848 src/util/time.c:876 | 9317 | #: src/util/time.c:878 src/util/time.c:906 |
9304 | #, fuzzy, c-format | 9318 | #, fuzzy, c-format |
9305 | msgid "Failed to map `%s', cannot assure monotonic time!\n" | 9319 | msgid "Failed to map `%s', cannot assure monotonic time!\n" |
9306 | msgstr "" | 9320 | msgstr "" |
9307 | "Se produjo un fallo al recuperar el espacio de nombres «%s», no se pudo " | 9321 | "Se produjo un fallo al recuperar el espacio de nombres «%s», no se pudo " |
9308 | "retomar la operación de publicación.\n" | 9322 | "retomar la operación de publicación.\n" |
9309 | 9323 | ||
9310 | #: src/util/time.c:884 | 9324 | #: src/util/time.c:914 |
9311 | #, c-format | 9325 | #, c-format |
9312 | msgid "" | 9326 | msgid "" |
9313 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" | 9327 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" |
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
8 | "Project-Id-Version: gnunet 0.10.1\n" | 8 | "Project-Id-Version: gnunet 0.10.1\n" |
9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
10 | "POT-Creation-Date: 2020-11-13 23:46+0900\n" | 10 | "POT-Creation-Date: 2021-04-04 19:19+0200\n" |
11 | "PO-Revision-Date: 2015-12-24 01:20+0100\n" | 11 | "PO-Revision-Date: 2015-12-24 01:20+0100\n" |
12 | "Last-Translator: Stéphane Aulery <lkppo@free.fr>\n" | 12 | "Last-Translator: Stéphane Aulery <lkppo@free.fr>\n" |
13 | "Language-Team: French <traduc@traduc.org>\n" | 13 | "Language-Team: French <traduc@traduc.org>\n" |
@@ -745,7 +745,7 @@ msgstr "" | |||
745 | 745 | ||
746 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 | 746 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 |
747 | #: src/conversation/gnunet-conversation-test.c:256 | 747 | #: src/conversation/gnunet-conversation-test.c:256 |
748 | #: src/revocation/gnunet-revocation.c:569 src/template/gnunet-template.c:75 | 748 | #: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 |
749 | msgid "help text" | 749 | msgid "help text" |
750 | msgstr "" | 750 | msgstr "" |
751 | 751 | ||
@@ -1304,7 +1304,7 @@ msgstr "adresse inconnue" | |||
1304 | msgid "%24s: %-30s %4s (timeout in %6s)\n" | 1304 | msgid "%24s: %-30s %4s (timeout in %6s)\n" |
1305 | msgstr "" | 1305 | msgstr "" |
1306 | 1306 | ||
1307 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:696 | 1307 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:697 |
1308 | #, c-format | 1308 | #, c-format |
1309 | msgid "Invalid command line argument `%s'\n" | 1309 | msgid "Invalid command line argument `%s'\n" |
1310 | msgstr "" | 1310 | msgstr "" |
@@ -1568,7 +1568,7 @@ msgstr "" | |||
1568 | #: src/testbed/generate-underlay-topology.c:48 | 1568 | #: src/testbed/generate-underlay-topology.c:48 |
1569 | #: src/testbed/gnunet-daemon-latency-logger.c:53 | 1569 | #: src/testbed/gnunet-daemon-latency-logger.c:53 |
1570 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 | 1570 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 |
1571 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:62 | 1571 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:78 |
1572 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 | 1572 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 |
1573 | #, c-format | 1573 | #, c-format |
1574 | msgid "`%s' failed at %s:%d with error: %s\n" | 1574 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -2005,7 +2005,7 @@ msgstr "" | |||
2005 | msgid "Exiting as the number of peers is %u\n" | 2005 | msgid "Exiting as the number of peers is %u\n" |
2006 | msgstr "" | 2006 | msgstr "" |
2007 | 2007 | ||
2008 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194 | 2008 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3136 |
2009 | #, fuzzy | 2009 | #, fuzzy |
2010 | msgid "number of peers to start" | 2010 | msgid "number of peers to start" |
2011 | msgstr "nombre de valeurs" | 2011 | msgstr "nombre de valeurs" |
@@ -3130,7 +3130,7 @@ msgid "Downloading `%s' done (%s/s).\n" | |||
3130 | msgstr "" | 3130 | msgstr "" |
3131 | 3131 | ||
3132 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 | 3132 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 |
3133 | #: src/fs/gnunet-search.c:226 src/fs/gnunet-unindex.c:117 | 3133 | #: src/fs/gnunet-search.c:229 src/fs/gnunet-unindex.c:117 |
3134 | #, c-format | 3134 | #, c-format |
3135 | msgid "Unexpected status: %d\n" | 3135 | msgid "Unexpected status: %d\n" |
3136 | msgstr "" | 3136 | msgstr "" |
@@ -3153,12 +3153,12 @@ msgid "Target filename must be specified.\n" | |||
3153 | msgstr "" | 3153 | msgstr "" |
3154 | 3154 | ||
3155 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 | 3155 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 |
3156 | #: src/fs/gnunet-search.c:291 src/fs/gnunet-unindex.c:154 | 3156 | #: src/fs/gnunet-search.c:294 src/fs/gnunet-unindex.c:154 |
3157 | #, c-format | 3157 | #, c-format |
3158 | msgid "Could not initialize `%s' subsystem.\n" | 3158 | msgid "Could not initialize `%s' subsystem.\n" |
3159 | msgstr "" | 3159 | msgstr "" |
3160 | 3160 | ||
3161 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:331 | 3161 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:334 |
3162 | msgid "set the desired LEVEL of receiver-anonymity" | 3162 | msgid "set the desired LEVEL of receiver-anonymity" |
3163 | msgstr "" | 3163 | msgstr "" |
3164 | 3164 | ||
@@ -3166,7 +3166,7 @@ msgstr "" | |||
3166 | msgid "delete incomplete downloads (when aborted with CTRL-C)" | 3166 | msgid "delete incomplete downloads (when aborted with CTRL-C)" |
3167 | msgstr "" | 3167 | msgstr "" |
3168 | 3168 | ||
3169 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:336 | 3169 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:339 |
3170 | msgid "only search the local peer (no P2P network search)" | 3170 | msgid "only search the local peer (no P2P network search)" |
3171 | msgstr "" | 3171 | msgstr "" |
3172 | 3172 | ||
@@ -3402,37 +3402,37 @@ msgstr "" | |||
3402 | msgid "Publish a file or directory on GNUnet" | 3402 | msgid "Publish a file or directory on GNUnet" |
3403 | msgstr "" | 3403 | msgstr "" |
3404 | 3404 | ||
3405 | #: src/fs/gnunet-search.c:127 | 3405 | #: src/fs/gnunet-search.c:130 |
3406 | #, c-format | 3406 | #, c-format |
3407 | msgid "Failed to write directory with search results to `%s'\n" | 3407 | msgid "Failed to write directory with search results to `%s'\n" |
3408 | msgstr "" | 3408 | msgstr "" |
3409 | 3409 | ||
3410 | #: src/fs/gnunet-search.c:216 | 3410 | #: src/fs/gnunet-search.c:219 |
3411 | #, c-format | 3411 | #, c-format |
3412 | msgid "Error searching: %s.\n" | 3412 | msgid "Error searching: %s.\n" |
3413 | msgstr "" | 3413 | msgstr "" |
3414 | 3414 | ||
3415 | #: src/fs/gnunet-search.c:278 | 3415 | #: src/fs/gnunet-search.c:281 |
3416 | msgid "Could not create keyword URI from arguments.\n" | 3416 | msgid "Could not create keyword URI from arguments.\n" |
3417 | msgstr "" | 3417 | msgstr "" |
3418 | 3418 | ||
3419 | #: src/fs/gnunet-search.c:305 | 3419 | #: src/fs/gnunet-search.c:308 |
3420 | msgid "Could not start searching.\n" | 3420 | msgid "Could not start searching.\n" |
3421 | msgstr "" | 3421 | msgstr "" |
3422 | 3422 | ||
3423 | #: src/fs/gnunet-search.c:342 | 3423 | #: src/fs/gnunet-search.c:345 |
3424 | msgid "write search results to file starting with PREFIX" | 3424 | msgid "write search results to file starting with PREFIX" |
3425 | msgstr "" | 3425 | msgstr "" |
3426 | 3426 | ||
3427 | #: src/fs/gnunet-search.c:348 | 3427 | #: src/fs/gnunet-search.c:351 |
3428 | msgid "automatically terminate search after DELAY" | 3428 | msgid "automatically terminate search after DELAY" |
3429 | msgstr "" | 3429 | msgstr "" |
3430 | 3430 | ||
3431 | #: src/fs/gnunet-search.c:354 | 3431 | #: src/fs/gnunet-search.c:357 |
3432 | msgid "automatically terminate search after VALUE results are found" | 3432 | msgid "automatically terminate search after VALUE results are found" |
3433 | msgstr "" | 3433 | msgstr "" |
3434 | 3434 | ||
3435 | #: src/fs/gnunet-search.c:368 | 3435 | #: src/fs/gnunet-search.c:371 |
3436 | msgid "Search GNUnet for files that were published on GNUnet" | 3436 | msgid "Search GNUnet for files that were published on GNUnet" |
3437 | msgstr "" | 3437 | msgstr "" |
3438 | 3438 | ||
@@ -3786,7 +3786,7 @@ msgstr "" | |||
3786 | msgid "Expected a base32-encoded public zone key\n" | 3786 | msgid "Expected a base32-encoded public zone key\n" |
3787 | msgstr "" | 3787 | msgstr "" |
3788 | 3788 | ||
3789 | #: src/gns/gnunet-bcd.c:133 | 3789 | #: src/gns/gnunet-bcd.c:134 |
3790 | #, c-format | 3790 | #, c-format |
3791 | msgid "Refusing `%s' request to HTTP server\n" | 3791 | msgid "Refusing `%s' request to HTTP server\n" |
3792 | msgstr "" | 3792 | msgstr "" |
@@ -3818,34 +3818,39 @@ msgstr "" | |||
3818 | msgid "Failed to pack DNS response into UDP packet!\n" | 3818 | msgid "Failed to pack DNS response into UDP packet!\n" |
3819 | msgstr "" | 3819 | msgstr "" |
3820 | 3820 | ||
3821 | #: src/gns/gnunet-dns2gns.c:444 | 3821 | #: src/gns/gnunet-dns2gns.c:315 |
3822 | #, fuzzy | ||
3823 | msgid "Failed to parse DNS response!\n" | ||
3824 | msgstr "Échec du démarrage de %s\n" | ||
3825 | |||
3826 | #: src/gns/gnunet-dns2gns.c:452 | ||
3822 | #, c-format | 3827 | #, c-format |
3823 | msgid "Cannot parse DNS request from %s\n" | 3828 | msgid "Cannot parse DNS request from %s\n" |
3824 | msgstr "" | 3829 | msgstr "" |
3825 | 3830 | ||
3826 | #: src/gns/gnunet-dns2gns.c:460 | 3831 | #: src/gns/gnunet-dns2gns.c:468 |
3827 | #, c-format | 3832 | #, c-format |
3828 | msgid "Received malformed DNS request from %s\n" | 3833 | msgid "Received malformed DNS request from %s\n" |
3829 | msgstr "" | 3834 | msgstr "" |
3830 | 3835 | ||
3831 | #: src/gns/gnunet-dns2gns.c:468 | 3836 | #: src/gns/gnunet-dns2gns.c:476 |
3832 | #, c-format | 3837 | #, c-format |
3833 | msgid "Received unsupported DNS request from %s\n" | 3838 | msgid "Received unsupported DNS request from %s\n" |
3834 | msgstr "" | 3839 | msgstr "" |
3835 | 3840 | ||
3836 | #: src/gns/gnunet-dns2gns.c:629 | 3841 | #: src/gns/gnunet-dns2gns.c:637 |
3837 | msgid "No DNS server specified!\n" | 3842 | msgid "No DNS server specified!\n" |
3838 | msgstr "" | 3843 | msgstr "" |
3839 | 3844 | ||
3840 | #: src/gns/gnunet-dns2gns.c:778 | 3845 | #: src/gns/gnunet-dns2gns.c:786 |
3841 | msgid "IP of recursive DNS resolver to use (required)" | 3846 | msgid "IP of recursive DNS resolver to use (required)" |
3842 | msgstr "" | 3847 | msgstr "" |
3843 | 3848 | ||
3844 | #: src/gns/gnunet-dns2gns.c:784 | 3849 | #: src/gns/gnunet-dns2gns.c:792 |
3845 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 3850 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
3846 | msgstr "" | 3851 | msgstr "" |
3847 | 3852 | ||
3848 | #: src/gns/gnunet-dns2gns.c:801 | 3853 | #: src/gns/gnunet-dns2gns.c:809 |
3849 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 3854 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
3850 | msgstr "" | 3855 | msgstr "" |
3851 | 3856 | ||
@@ -3963,63 +3968,63 @@ msgstr "" | |||
3963 | msgid "Cookie domain `%s' supplied by server is invalid\n" | 3968 | msgid "Cookie domain `%s' supplied by server is invalid\n" |
3964 | msgstr "" | 3969 | msgstr "" |
3965 | 3970 | ||
3966 | #: src/gns/gnunet-gns-proxy.c:2133 | 3971 | #: src/gns/gnunet-gns-proxy.c:2134 |
3967 | #, c-format | 3972 | #, c-format |
3968 | msgid "Unsupported HTTP method `%s'\n" | 3973 | msgid "Unsupported HTTP method `%s'\n" |
3969 | msgstr "" | 3974 | msgstr "" |
3970 | 3975 | ||
3971 | #: src/gns/gnunet-gns-proxy.c:2657 | 3976 | #: src/gns/gnunet-gns-proxy.c:2658 |
3972 | #, c-format | 3977 | #, c-format |
3973 | msgid "Unable to import private key from file `%s'\n" | 3978 | msgid "Unable to import private key from file `%s'\n" |
3974 | msgstr "" | 3979 | msgstr "" |
3975 | 3980 | ||
3976 | #: src/gns/gnunet-gns-proxy.c:2689 | 3981 | #: src/gns/gnunet-gns-proxy.c:2690 |
3977 | #, c-format | 3982 | #, c-format |
3978 | msgid "Unable to import certificate from `%s'\n" | 3983 | msgid "Unable to import certificate from `%s'\n" |
3979 | msgstr "" | 3984 | msgstr "" |
3980 | 3985 | ||
3981 | #: src/gns/gnunet-gns-proxy.c:2898 | 3986 | #: src/gns/gnunet-gns-proxy.c:2899 |
3982 | #, c-format | 3987 | #, c-format |
3983 | msgid "Failed to start HTTPS server for `%s'\n" | 3988 | msgid "Failed to start HTTPS server for `%s'\n" |
3984 | msgstr "" | 3989 | msgstr "" |
3985 | 3990 | ||
3986 | #: src/gns/gnunet-gns-proxy.c:2922 src/rest/gnunet-rest-server.c:917 | 3991 | #: src/gns/gnunet-gns-proxy.c:2923 src/rest/gnunet-rest-server.c:917 |
3987 | msgid "Failed to pass client to MHD\n" | 3992 | msgid "Failed to pass client to MHD\n" |
3988 | msgstr "" | 3993 | msgstr "" |
3989 | 3994 | ||
3990 | #: src/gns/gnunet-gns-proxy.c:3271 | 3995 | #: src/gns/gnunet-gns-proxy.c:3272 |
3991 | #, c-format | 3996 | #, c-format |
3992 | msgid "Unsupported socks version %d\n" | 3997 | msgid "Unsupported socks version %d\n" |
3993 | msgstr "" | 3998 | msgstr "" |
3994 | 3999 | ||
3995 | #: src/gns/gnunet-gns-proxy.c:3303 | 4000 | #: src/gns/gnunet-gns-proxy.c:3304 |
3996 | #, c-format | 4001 | #, c-format |
3997 | msgid "Unsupported socks command %d\n" | 4002 | msgid "Unsupported socks command %d\n" |
3998 | msgstr "" | 4003 | msgstr "" |
3999 | 4004 | ||
4000 | #: src/gns/gnunet-gns-proxy.c:3389 | 4005 | #: src/gns/gnunet-gns-proxy.c:3390 |
4001 | #, c-format | 4006 | #, c-format |
4002 | msgid "Unsupported socks address type %d\n" | 4007 | msgid "Unsupported socks address type %d\n" |
4003 | msgstr "" | 4008 | msgstr "" |
4004 | 4009 | ||
4005 | #: src/gns/gnunet-gns-proxy.c:3730 | 4010 | #: src/gns/gnunet-gns-proxy.c:3731 |
4006 | #, c-format | 4011 | #, c-format |
4007 | msgid "Failed to load X.509 key and certificate from `%s'\n" | 4012 | msgid "Failed to load X.509 key and certificate from `%s'\n" |
4008 | msgstr "" | 4013 | msgstr "" |
4009 | 4014 | ||
4010 | #: src/gns/gnunet-gns-proxy.c:3864 | 4015 | #: src/gns/gnunet-gns-proxy.c:3865 |
4011 | msgid "listen on specified port (default: 7777)" | 4016 | msgid "listen on specified port (default: 7777)" |
4012 | msgstr "" | 4017 | msgstr "" |
4013 | 4018 | ||
4014 | #: src/gns/gnunet-gns-proxy.c:3869 | 4019 | #: src/gns/gnunet-gns-proxy.c:3870 |
4015 | msgid "pem file to use as CA" | 4020 | msgid "pem file to use as CA" |
4016 | msgstr "" | 4021 | msgstr "" |
4017 | 4022 | ||
4018 | #: src/gns/gnunet-gns-proxy.c:3873 | 4023 | #: src/gns/gnunet-gns-proxy.c:3874 |
4019 | msgid "disable use of IPv6" | 4024 | msgid "disable use of IPv6" |
4020 | msgstr "" | 4025 | msgstr "" |
4021 | 4026 | ||
4022 | #: src/gns/gnunet-gns-proxy.c:3899 | 4027 | #: src/gns/gnunet-gns-proxy.c:3900 |
4023 | msgid "GNUnet GNS proxy" | 4028 | msgid "GNUnet GNS proxy" |
4024 | msgstr "" | 4029 | msgstr "" |
4025 | 4030 | ||
@@ -4041,7 +4046,7 @@ msgstr "" | |||
4041 | msgid "Error converting GNS response to DNS response!\n" | 4046 | msgid "Error converting GNS response to DNS response!\n" |
4042 | msgstr "" | 4047 | msgstr "" |
4043 | 4048 | ||
4044 | #: src/gns/gnunet-service-gns_interceptor.c:387 | 4049 | #: src/gns/gnunet-service-gns_interceptor.c:386 |
4045 | msgid "Failed to connect to the DNS service!\n" | 4050 | msgid "Failed to connect to the DNS service!\n" |
4046 | msgstr "" | 4051 | msgstr "" |
4047 | 4052 | ||
@@ -4074,36 +4079,36 @@ msgstr "" | |||
4074 | msgid "VPN returned empty result for `%s'\n" | 4079 | msgid "VPN returned empty result for `%s'\n" |
4075 | msgstr "" | 4080 | msgstr "" |
4076 | 4081 | ||
4077 | #: src/gns/gnunet-service-gns_resolver.c:1910 | 4082 | #: src/gns/gnunet-service-gns_resolver.c:1919 |
4078 | #, c-format | 4083 | #, c-format |
4079 | msgid "Name `%s' cannot be converted to IDNA." | 4084 | msgid "Name `%s' cannot be converted to IDNA." |
4080 | msgstr "" | 4085 | msgstr "" |
4081 | 4086 | ||
4082 | #: src/gns/gnunet-service-gns_resolver.c:1923 | 4087 | #: src/gns/gnunet-service-gns_resolver.c:1934 |
4083 | #, c-format | 4088 | #, c-format |
4084 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" | 4089 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" |
4085 | msgstr "" | 4090 | msgstr "" |
4086 | 4091 | ||
4087 | #: src/gns/gnunet-service-gns_resolver.c:1966 | 4092 | #: src/gns/gnunet-service-gns_resolver.c:1979 |
4088 | #, c-format | 4093 | #, c-format |
4089 | msgid "GNS lookup failed (zero records found for `%s')\n" | 4094 | msgid "GNS lookup failed (zero records found for `%s')\n" |
4090 | msgstr "" | 4095 | msgstr "" |
4091 | 4096 | ||
4092 | #: src/gns/gnunet-service-gns_resolver.c:2393 | 4097 | #: src/gns/gnunet-service-gns_resolver.c:2406 |
4093 | msgid "GNS lookup recursion failed (no delegation record found)\n" | 4098 | msgid "GNS lookup recursion failed (no delegation record found)\n" |
4094 | msgstr "" | 4099 | msgstr "" |
4095 | 4100 | ||
4096 | #: src/gns/gnunet-service-gns_resolver.c:2416 | 4101 | #: src/gns/gnunet-service-gns_resolver.c:2429 |
4097 | #, c-format | 4102 | #, c-format |
4098 | msgid "Failed to cache GNS resolution: %s\n" | 4103 | msgid "Failed to cache GNS resolution: %s\n" |
4099 | msgstr "" | 4104 | msgstr "" |
4100 | 4105 | ||
4101 | #: src/gns/gnunet-service-gns_resolver.c:2581 | 4106 | #: src/gns/gnunet-service-gns_resolver.c:2594 |
4102 | #, c-format | 4107 | #, c-format |
4103 | msgid "GNS namecache returned empty result for `%s'\n" | 4108 | msgid "GNS namecache returned empty result for `%s'\n" |
4104 | msgstr "" | 4109 | msgstr "" |
4105 | 4110 | ||
4106 | #: src/gns/gnunet-service-gns_resolver.c:2721 | 4111 | #: src/gns/gnunet-service-gns_resolver.c:2734 |
4107 | #, c-format | 4112 | #, c-format |
4108 | msgid "Zone %s was revoked, resolution fails\n" | 4113 | msgid "Zone %s was revoked, resolution fails\n" |
4109 | msgstr "" | 4114 | msgstr "" |
@@ -4137,7 +4142,7 @@ msgstr "" | |||
4137 | msgid "Unable to parse BOX record string `%s'\n" | 4142 | msgid "Unable to parse BOX record string `%s'\n" |
4138 | msgstr "" | 4143 | msgstr "" |
4139 | 4144 | ||
4140 | #: src/gns/plugin_rest_gns.c:448 | 4145 | #: src/gns/plugin_rest_gns.c:450 |
4141 | msgid "Gns REST API initialized\n" | 4146 | msgid "Gns REST API initialized\n" |
4142 | msgstr "" | 4147 | msgstr "" |
4143 | 4148 | ||
@@ -4470,7 +4475,7 @@ msgstr "" | |||
4470 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 | 4475 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 |
4471 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 | 4476 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 |
4472 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 | 4477 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 |
4473 | #: src/peerinfo-tool/gnunet-peerinfo.c:515 | 4478 | #: src/peerinfo-tool/gnunet-peerinfo.c:516 |
4474 | #: src/topology/gnunet-daemon-topology.c:799 | 4479 | #: src/topology/gnunet-daemon-topology.c:799 |
4475 | #, c-format | 4480 | #, c-format |
4476 | msgid "Error in communication with PEERINFO service: %s\n" | 4481 | msgid "Error in communication with PEERINFO service: %s\n" |
@@ -4633,8 +4638,8 @@ msgid "default configured, but ego unknown (internal error)" | |||
4633 | msgstr "" | 4638 | msgstr "" |
4634 | 4639 | ||
4635 | #: src/identity/gnunet-service-identity.c:621 | 4640 | #: src/identity/gnunet-service-identity.c:621 |
4636 | #: src/identity/gnunet-service-identity.c:898 | 4641 | #: src/identity/gnunet-service-identity.c:896 |
4637 | #: src/identity/gnunet-service-identity.c:1018 | 4642 | #: src/identity/gnunet-service-identity.c:1016 |
4638 | #, c-format | 4643 | #, c-format |
4639 | msgid "Failed to write subsystem default identifier map to `%s'.\n" | 4644 | msgid "Failed to write subsystem default identifier map to `%s'.\n" |
4640 | msgstr "" | 4645 | msgstr "" |
@@ -4643,30 +4648,30 @@ msgstr "" | |||
4643 | msgid "Unknown ego specified for service (internal error)" | 4648 | msgid "Unknown ego specified for service (internal error)" |
4644 | msgstr "" | 4649 | msgstr "" |
4645 | 4650 | ||
4646 | #: src/identity/gnunet-service-identity.c:726 | 4651 | #: src/identity/gnunet-service-identity.c:725 |
4647 | msgid "identifier already in use for another ego" | 4652 | msgid "identifier already in use for another ego" |
4648 | msgstr "" | 4653 | msgstr "" |
4649 | 4654 | ||
4650 | #: src/identity/gnunet-service-identity.c:874 | 4655 | #: src/identity/gnunet-service-identity.c:872 |
4651 | msgid "target name already exists" | 4656 | msgid "target name already exists" |
4652 | msgstr "" | 4657 | msgstr "" |
4653 | 4658 | ||
4654 | #: src/identity/gnunet-service-identity.c:916 | 4659 | #: src/identity/gnunet-service-identity.c:914 |
4655 | #: src/identity/gnunet-service-identity.c:1035 | 4660 | #: src/identity/gnunet-service-identity.c:1033 |
4656 | msgid "no matching ego found" | 4661 | msgid "no matching ego found" |
4657 | msgstr "" | 4662 | msgstr "" |
4658 | 4663 | ||
4659 | #: src/identity/gnunet-service-identity.c:1133 | 4664 | #: src/identity/gnunet-service-identity.c:1131 |
4660 | #, c-format | 4665 | #, c-format |
4661 | msgid "Failed to parse ego information in `%s'\n" | 4666 | msgid "Failed to parse ego information in `%s'\n" |
4662 | msgstr "" | 4667 | msgstr "" |
4663 | 4668 | ||
4664 | #: src/identity/gnunet-service-identity.c:1191 | 4669 | #: src/identity/gnunet-service-identity.c:1189 |
4665 | #, c-format | 4670 | #, c-format |
4666 | msgid "Failed to parse subsystem identity configuration file `%s'\n" | 4671 | msgid "Failed to parse subsystem identity configuration file `%s'\n" |
4667 | msgstr "" | 4672 | msgstr "" |
4668 | 4673 | ||
4669 | #: src/identity/gnunet-service-identity.c:1200 | 4674 | #: src/identity/gnunet-service-identity.c:1198 |
4670 | #, c-format | 4675 | #, c-format |
4671 | msgid "Failed to create directory `%s' for storing egos\n" | 4676 | msgid "Failed to create directory `%s' for storing egos\n" |
4672 | msgstr "" | 4677 | msgstr "" |
@@ -4898,7 +4903,7 @@ msgid "Invalid public key for reverse lookup `%s'\n" | |||
4898 | msgstr "" | 4903 | msgstr "" |
4899 | 4904 | ||
4900 | #: src/namestore/gnunet-namestore.c:1220 | 4905 | #: src/namestore/gnunet-namestore.c:1220 |
4901 | #: src/peerinfo-tool/gnunet-peerinfo.c:736 | 4906 | #: src/peerinfo-tool/gnunet-peerinfo.c:737 |
4902 | #, c-format | 4907 | #, c-format |
4903 | msgid "Invalid URI `%s'\n" | 4908 | msgid "Invalid URI `%s'\n" |
4904 | msgstr "URI invalide « %s »\n" | 4909 | msgstr "URI invalide « %s »\n" |
@@ -5079,7 +5084,7 @@ msgstr "" | |||
5079 | msgid "GNU Name System First Come First Serve name registration service" | 5084 | msgid "GNU Name System First Come First Serve name registration service" |
5080 | msgstr "" | 5085 | msgstr "" |
5081 | 5086 | ||
5082 | #: src/namestore/gnunet-service-namestore.c:866 | 5087 | #: src/namestore/gnunet-service-namestore.c:871 |
5083 | #, c-format | 5088 | #, c-format |
5084 | msgid "Failed to replicate block in namecache: %s\n" | 5089 | msgid "Failed to replicate block in namecache: %s\n" |
5085 | msgstr "" | 5090 | msgstr "" |
@@ -5110,7 +5115,7 @@ msgstr "" | |||
5110 | msgid "Flat file database running\n" | 5115 | msgid "Flat file database running\n" |
5111 | msgstr "" | 5116 | msgstr "" |
5112 | 5117 | ||
5113 | #: src/namestore/plugin_rest_namestore.c:1103 | 5118 | #: src/namestore/plugin_rest_namestore.c:1105 |
5114 | msgid "Namestore REST API initialized\n" | 5119 | msgid "Namestore REST API initialized\n" |
5115 | msgstr "" | 5120 | msgstr "" |
5116 | 5121 | ||
@@ -5413,8 +5418,8 @@ msgstr "" | |||
5413 | msgid "Measure quality and performance of the NSE service." | 5418 | msgid "Measure quality and performance of the NSE service." |
5414 | msgstr "" | 5419 | msgstr "" |
5415 | 5420 | ||
5416 | #: src/nse/gnunet-service-nse.c:1443 | 5421 | #: src/nse/gnunet-service-nse.c:1450 |
5417 | #: src/revocation/gnunet-service-revocation.c:875 src/util/gnunet-scrypt.c:257 | 5422 | #: src/revocation/gnunet-service-revocation.c:883 src/util/gnunet-scrypt.c:260 |
5418 | msgid "Value is too large.\n" | 5423 | msgid "Value is too large.\n" |
5419 | msgstr "" | 5424 | msgstr "" |
5420 | 5425 | ||
@@ -5454,17 +5459,17 @@ msgstr "" | |||
5454 | msgid "Still no peers found in `%s'!\n" | 5459 | msgid "Still no peers found in `%s'!\n" |
5455 | msgstr "" | 5460 | msgstr "" |
5456 | 5461 | ||
5457 | #: src/peerinfo/gnunet-service-peerinfo.c:1024 | 5462 | #: src/peerinfo/gnunet-service-peerinfo.c:1027 |
5458 | #, c-format | 5463 | #, c-format |
5459 | msgid "Cleaning up directory `%s'\n" | 5464 | msgid "Cleaning up directory `%s'\n" |
5460 | msgstr "" | 5465 | msgstr "" |
5461 | 5466 | ||
5462 | #: src/peerinfo/gnunet-service-peerinfo.c:1319 | 5467 | #: src/peerinfo/gnunet-service-peerinfo.c:1322 |
5463 | #, c-format | 5468 | #, c-format |
5464 | msgid "Importing HELLOs from `%s'\n" | 5469 | msgid "Importing HELLOs from `%s'\n" |
5465 | msgstr "" | 5470 | msgstr "" |
5466 | 5471 | ||
5467 | #: src/peerinfo/gnunet-service-peerinfo.c:1332 | 5472 | #: src/peerinfo/gnunet-service-peerinfo.c:1335 |
5468 | msgid "Skipping import of included HELLOs\n" | 5473 | msgid "Skipping import of included HELLOs\n" |
5469 | msgstr "" | 5474 | msgstr "" |
5470 | 5475 | ||
@@ -5483,7 +5488,7 @@ msgid "\tExpires: %s \t %s\n" | |||
5483 | msgstr "" | 5488 | msgstr "" |
5484 | 5489 | ||
5485 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 | 5490 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 |
5486 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:523 | 5491 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:525 |
5487 | #, c-format | 5492 | #, c-format |
5488 | msgid "Failure: Cannot convert address to string for peer `%s'\n" | 5493 | msgid "Failure: Cannot convert address to string for peer `%s'\n" |
5489 | msgstr "" | 5494 | msgstr "" |
@@ -5493,54 +5498,54 @@ msgstr "" | |||
5493 | msgid "Failure: Received invalid %s\n" | 5498 | msgid "Failure: Received invalid %s\n" |
5494 | msgstr "" | 5499 | msgstr "" |
5495 | 5500 | ||
5496 | #: src/peerinfo-tool/gnunet-peerinfo.c:463 | 5501 | #: src/peerinfo-tool/gnunet-peerinfo.c:464 |
5497 | #, c-format | 5502 | #, c-format |
5498 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" | 5503 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" |
5499 | msgstr "" | 5504 | msgstr "" |
5500 | 5505 | ||
5501 | #: src/peerinfo-tool/gnunet-peerinfo.c:479 | 5506 | #: src/peerinfo-tool/gnunet-peerinfo.c:480 |
5502 | #, c-format | 5507 | #, c-format |
5503 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" | 5508 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" |
5504 | msgstr "" | 5509 | msgstr "" |
5505 | 5510 | ||
5506 | #: src/peerinfo-tool/gnunet-peerinfo.c:758 | 5511 | #: src/peerinfo-tool/gnunet-peerinfo.c:759 |
5507 | #, c-format | 5512 | #, c-format |
5508 | msgid "I am peer `%s'.\n" | 5513 | msgid "I am peer `%s'.\n" |
5509 | msgstr "" | 5514 | msgstr "" |
5510 | 5515 | ||
5511 | #: src/peerinfo-tool/gnunet-peerinfo.c:799 | 5516 | #: src/peerinfo-tool/gnunet-peerinfo.c:800 |
5512 | msgid "don't resolve host names" | 5517 | msgid "don't resolve host names" |
5513 | msgstr "" | 5518 | msgstr "" |
5514 | 5519 | ||
5515 | #: src/peerinfo-tool/gnunet-peerinfo.c:805 | 5520 | #: src/peerinfo-tool/gnunet-peerinfo.c:806 |
5516 | msgid "output only the identity strings" | 5521 | msgid "output only the identity strings" |
5517 | msgstr "" | 5522 | msgstr "" |
5518 | 5523 | ||
5519 | #: src/peerinfo-tool/gnunet-peerinfo.c:810 | 5524 | #: src/peerinfo-tool/gnunet-peerinfo.c:811 |
5520 | msgid "include friend-only information" | 5525 | msgid "include friend-only information" |
5521 | msgstr "" | 5526 | msgstr "" |
5522 | 5527 | ||
5523 | #: src/peerinfo-tool/gnunet-peerinfo.c:815 | 5528 | #: src/peerinfo-tool/gnunet-peerinfo.c:816 |
5524 | msgid "output our own identity only" | 5529 | msgid "output our own identity only" |
5525 | msgstr "" | 5530 | msgstr "" |
5526 | 5531 | ||
5527 | #: src/peerinfo-tool/gnunet-peerinfo.c:820 | 5532 | #: src/peerinfo-tool/gnunet-peerinfo.c:821 |
5528 | msgid "list all known peers" | 5533 | msgid "list all known peers" |
5529 | msgstr "" | 5534 | msgstr "" |
5530 | 5535 | ||
5531 | #: src/peerinfo-tool/gnunet-peerinfo.c:826 | 5536 | #: src/peerinfo-tool/gnunet-peerinfo.c:827 |
5532 | msgid "dump hello to file" | 5537 | msgid "dump hello to file" |
5533 | msgstr "" | 5538 | msgstr "" |
5534 | 5539 | ||
5535 | #: src/peerinfo-tool/gnunet-peerinfo.c:831 | 5540 | #: src/peerinfo-tool/gnunet-peerinfo.c:832 |
5536 | msgid "also output HELLO uri(s)" | 5541 | msgid "also output HELLO uri(s)" |
5537 | msgstr "" | 5542 | msgstr "" |
5538 | 5543 | ||
5539 | #: src/peerinfo-tool/gnunet-peerinfo.c:838 | 5544 | #: src/peerinfo-tool/gnunet-peerinfo.c:839 |
5540 | msgid "add given HELLO uri to the database" | 5545 | msgid "add given HELLO uri to the database" |
5541 | msgstr "" | 5546 | msgstr "" |
5542 | 5547 | ||
5543 | #: src/peerinfo-tool/gnunet-peerinfo.c:852 | 5548 | #: src/peerinfo-tool/gnunet-peerinfo.c:853 |
5544 | msgid "Print information about peers." | 5549 | msgid "Print information about peers." |
5545 | msgstr "" | 5550 | msgstr "" |
5546 | 5551 | ||
@@ -5562,7 +5567,7 @@ msgstr "" | |||
5562 | msgid "Failed to load transport plugin for `%s'\n" | 5567 | msgid "Failed to load transport plugin for `%s'\n" |
5563 | msgstr "" | 5568 | msgstr "" |
5564 | 5569 | ||
5565 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:809 | 5570 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:811 |
5566 | msgid "Peerinfo REST API initialized\n" | 5571 | msgid "Peerinfo REST API initialized\n" |
5567 | msgstr "" | 5572 | msgstr "" |
5568 | 5573 | ||
@@ -5570,7 +5575,7 @@ msgstr "" | |||
5570 | msgid "peerstore" | 5575 | msgid "peerstore" |
5571 | msgstr "" | 5576 | msgstr "" |
5572 | 5577 | ||
5573 | #: src/peerstore/gnunet-service-peerstore.c:561 | 5578 | #: src/peerstore/gnunet-service-peerstore.c:570 |
5574 | #, fuzzy, c-format | 5579 | #, fuzzy, c-format |
5575 | msgid "Could not load database backend `%s'\n" | 5580 | msgid "Could not load database backend `%s'\n" |
5576 | msgstr "Impossible d’ouvrir « %s ».\n" | 5581 | msgstr "Impossible d’ouvrir « %s ».\n" |
@@ -5749,11 +5754,11 @@ msgstr "" | |||
5749 | msgid "re:claimID command line tool" | 5754 | msgid "re:claimID command line tool" |
5750 | msgstr "" | 5755 | msgstr "" |
5751 | 5756 | ||
5752 | #: src/reclaim/plugin_rest_openid_connect.c:2613 | 5757 | #: src/reclaim/plugin_rest_openid_connect.c:2788 |
5753 | msgid "OpenID Connect REST API initialized\n" | 5758 | msgid "OpenID Connect REST API initialized\n" |
5754 | msgstr "" | 5759 | msgstr "" |
5755 | 5760 | ||
5756 | #: src/reclaim/plugin_rest_reclaim.c:1502 | 5761 | #: src/reclaim/plugin_rest_reclaim.c:1521 |
5757 | msgid "Identity Provider REST API initialized\n" | 5762 | msgid "Identity Provider REST API initialized\n" |
5758 | msgstr "" | 5763 | msgstr "" |
5759 | 5764 | ||
@@ -5903,110 +5908,110 @@ msgstr "" | |||
5903 | msgid "Cancelling calculation.\n" | 5908 | msgid "Cancelling calculation.\n" |
5904 | msgstr "" | 5909 | msgstr "" |
5905 | 5910 | ||
5906 | #: src/revocation/gnunet-revocation.c:299 | 5911 | #: src/revocation/gnunet-revocation.c:302 |
5907 | #, c-format | 5912 | #, c-format |
5908 | msgid "Revocation certificate for `%s' stored in `%s'\n" | 5913 | msgid "Revocation certificate for `%s' stored in `%s'\n" |
5909 | msgstr "" | 5914 | msgstr "" |
5910 | 5915 | ||
5911 | #: src/revocation/gnunet-revocation.c:339 | 5916 | #: src/revocation/gnunet-revocation.c:334 |
5912 | #, c-format | 5917 | #, c-format |
5913 | msgid "Ego `%s' not found.\n" | 5918 | msgid "Ego `%s' not found.\n" |
5914 | msgstr "" | 5919 | msgstr "" |
5915 | 5920 | ||
5916 | #: src/revocation/gnunet-revocation.c:356 | 5921 | #: src/revocation/gnunet-revocation.c:351 |
5917 | #, c-format | 5922 | #, c-format |
5918 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" | 5923 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" |
5919 | msgstr "" | 5924 | msgstr "" |
5920 | 5925 | ||
5921 | #: src/revocation/gnunet-revocation.c:366 | 5926 | #: src/revocation/gnunet-revocation.c:361 |
5922 | msgid "Revocation certificate ready\n" | 5927 | msgid "Revocation certificate ready\n" |
5923 | msgstr "" | 5928 | msgstr "" |
5924 | 5929 | ||
5925 | #: src/revocation/gnunet-revocation.c:378 | 5930 | #: src/revocation/gnunet-revocation.c:373 |
5926 | msgid "Continuing calculation where left off...\n" | 5931 | msgid "Continuing calculation where left off...\n" |
5927 | msgstr "" | 5932 | msgstr "" |
5928 | 5933 | ||
5929 | #: src/revocation/gnunet-revocation.c:385 | 5934 | #: src/revocation/gnunet-revocation.c:380 |
5930 | msgid "Revocation certificate not ready, calculating proof of work\n" | 5935 | msgid "Revocation certificate not ready, calculating proof of work\n" |
5931 | msgstr "" | 5936 | msgstr "" |
5932 | 5937 | ||
5933 | #: src/revocation/gnunet-revocation.c:423 | 5938 | #: src/revocation/gnunet-revocation.c:418 |
5934 | #, c-format | 5939 | #, c-format |
5935 | msgid "Public key `%s' malformed\n" | 5940 | msgid "Public key `%s' malformed\n" |
5936 | msgstr "" | 5941 | msgstr "" |
5937 | 5942 | ||
5938 | #: src/revocation/gnunet-revocation.c:433 | 5943 | #: src/revocation/gnunet-revocation.c:428 |
5939 | msgid "" | 5944 | msgid "" |
5940 | "Testing and revoking at the same time is not allowed, only executing test.\n" | 5945 | "Testing and revoking at the same time is not allowed, only executing test.\n" |
5941 | msgstr "" | 5946 | msgstr "" |
5942 | 5947 | ||
5943 | #: src/revocation/gnunet-revocation.c:463 | 5948 | #: src/revocation/gnunet-revocation.c:458 |
5944 | msgid "No filename to store revocation certificate given.\n" | 5949 | msgid "No filename to store revocation certificate given.\n" |
5945 | msgstr "" | 5950 | msgstr "" |
5946 | 5951 | ||
5947 | #: src/revocation/gnunet-revocation.c:480 | 5952 | #: src/revocation/gnunet-revocation.c:475 |
5948 | #, c-format | 5953 | #, c-format |
5949 | msgid "Failed to read revocation certificate from `%s'\n" | 5954 | msgid "Failed to read revocation certificate from `%s'\n" |
5950 | msgstr "" | 5955 | msgstr "" |
5951 | 5956 | ||
5952 | #: src/revocation/gnunet-revocation.c:488 | 5957 | #: src/revocation/gnunet-revocation.c:483 |
5953 | #, c-format | 5958 | #, c-format |
5954 | msgid "Revocation certificate corrupted in `%s'\n" | 5959 | msgid "Revocation certificate corrupted in `%s'\n" |
5955 | msgstr "" | 5960 | msgstr "" |
5956 | 5961 | ||
5957 | #: src/revocation/gnunet-revocation.c:510 | 5962 | #: src/revocation/gnunet-revocation.c:505 |
5958 | msgid "No action specified. Nothing to do.\n" | 5963 | msgid "No action specified. Nothing to do.\n" |
5959 | msgstr "" | 5964 | msgstr "" |
5960 | 5965 | ||
5961 | #: src/revocation/gnunet-revocation.c:529 | 5966 | #: src/revocation/gnunet-revocation.c:524 |
5962 | msgid "use NAME for the name of the revocation file" | 5967 | msgid "use NAME for the name of the revocation file" |
5963 | msgstr "" | 5968 | msgstr "" |
5964 | 5969 | ||
5965 | #: src/revocation/gnunet-revocation.c:537 | 5970 | #: src/revocation/gnunet-revocation.c:532 |
5966 | msgid "" | 5971 | msgid "" |
5967 | "revoke the private key associated for the the private key associated with " | 5972 | "revoke the private key associated for the the private key associated with " |
5968 | "the ego NAME " | 5973 | "the ego NAME " |
5969 | msgstr "" | 5974 | msgstr "" |
5970 | 5975 | ||
5971 | #: src/revocation/gnunet-revocation.c:544 | 5976 | #: src/revocation/gnunet-revocation.c:539 |
5972 | msgid "actually perform revocation, otherwise we just do the precomputation" | 5977 | msgid "actually perform revocation, otherwise we just do the precomputation" |
5973 | msgstr "" | 5978 | msgstr "" |
5974 | 5979 | ||
5975 | #: src/revocation/gnunet-revocation.c:551 | 5980 | #: src/revocation/gnunet-revocation.c:546 |
5976 | msgid "test if the public key KEY has been revoked" | 5981 | msgid "test if the public key KEY has been revoked" |
5977 | msgstr "" | 5982 | msgstr "" |
5978 | 5983 | ||
5979 | #: src/revocation/gnunet-revocation.c:557 | 5984 | #: src/revocation/gnunet-revocation.c:552 |
5980 | #, fuzzy | 5985 | #, fuzzy |
5981 | msgid "number of epochs to calculate for" | 5986 | msgid "number of epochs to calculate for" |
5982 | msgstr "nombre de valeurs" | 5987 | msgstr "nombre de valeurs" |
5983 | 5988 | ||
5984 | #: src/revocation/gnunet-service-revocation.c:494 | 5989 | #: src/revocation/gnunet-service-revocation.c:502 |
5985 | msgid "# unsupported revocations received via set union" | 5990 | msgid "# unsupported revocations received via set union" |
5986 | msgstr "" | 5991 | msgstr "" |
5987 | 5992 | ||
5988 | #: src/revocation/gnunet-service-revocation.c:504 | 5993 | #: src/revocation/gnunet-service-revocation.c:512 |
5989 | msgid "# revocation messages received via set union" | 5994 | msgid "# revocation messages received via set union" |
5990 | msgstr "" | 5995 | msgstr "" |
5991 | 5996 | ||
5992 | #: src/revocation/gnunet-service-revocation.c:509 | 5997 | #: src/revocation/gnunet-service-revocation.c:517 |
5993 | #, c-format | 5998 | #, c-format |
5994 | msgid "Error computing revocation set union with %s\n" | 5999 | msgid "Error computing revocation set union with %s\n" |
5995 | msgstr "" | 6000 | msgstr "" |
5996 | 6001 | ||
5997 | #: src/revocation/gnunet-service-revocation.c:513 | 6002 | #: src/revocation/gnunet-service-revocation.c:521 |
5998 | msgid "# revocation set unions failed" | 6003 | msgid "# revocation set unions failed" |
5999 | msgstr "" | 6004 | msgstr "" |
6000 | 6005 | ||
6001 | #: src/revocation/gnunet-service-revocation.c:521 | 6006 | #: src/revocation/gnunet-service-revocation.c:529 |
6002 | msgid "# revocation set unions completed" | 6007 | msgid "# revocation set unions completed" |
6003 | msgstr "" | 6008 | msgstr "" |
6004 | 6009 | ||
6005 | #: src/revocation/gnunet-service-revocation.c:559 | 6010 | #: src/revocation/gnunet-service-revocation.c:567 |
6006 | msgid "SET service crashed, terminating revocation service\n" | 6011 | msgid "SET service crashed, terminating revocation service\n" |
6007 | msgstr "" | 6012 | msgstr "" |
6008 | 6013 | ||
6009 | #: src/revocation/gnunet-service-revocation.c:912 | 6014 | #: src/revocation/gnunet-service-revocation.c:920 |
6010 | msgid "Could not open revocation database file!" | 6015 | msgid "Could not open revocation database file!" |
6011 | msgstr "" | 6016 | msgstr "" |
6012 | 6017 | ||
@@ -6022,20 +6027,20 @@ msgstr "" | |||
6022 | msgid "Get peers from biased stream" | 6027 | msgid "Get peers from biased stream" |
6023 | msgstr "" | 6028 | msgstr "" |
6024 | 6029 | ||
6025 | #: src/rps/gnunet-rps-profiler.c:3200 | 6030 | #: src/rps/gnunet-rps-profiler.c:3142 |
6026 | msgid "duration of the profiling" | 6031 | msgid "duration of the profiling" |
6027 | msgstr "" | 6032 | msgstr "" |
6028 | 6033 | ||
6029 | #: src/rps/gnunet-rps-profiler.c:3206 | 6034 | #: src/rps/gnunet-rps-profiler.c:3148 |
6030 | msgid "timeout for the profiling" | 6035 | msgid "timeout for the profiling" |
6031 | msgstr "" | 6036 | msgstr "" |
6032 | 6037 | ||
6033 | #: src/rps/gnunet-rps-profiler.c:3211 | 6038 | #: src/rps/gnunet-rps-profiler.c:3153 |
6034 | #, fuzzy | 6039 | #, fuzzy |
6035 | msgid "number of PeerIDs to request" | 6040 | msgid "number of PeerIDs to request" |
6036 | msgstr "nombre de valeurs" | 6041 | msgstr "nombre de valeurs" |
6037 | 6042 | ||
6038 | #: src/rps/gnunet-rps-profiler.c:3228 | 6043 | #: src/rps/gnunet-rps-profiler.c:3170 |
6039 | msgid "Measure quality and performance of the RPS service." | 6044 | msgid "Measure quality and performance of the RPS service." |
6040 | msgstr "" | 6045 | msgstr "" |
6041 | 6046 | ||
@@ -6121,7 +6126,7 @@ msgid "also profile decryption" | |||
6121 | msgstr "" | 6126 | msgstr "" |
6122 | 6127 | ||
6123 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 | 6128 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 |
6124 | #: src/setu/gnunet-service-setu.c:3633 | 6129 | #: src/setu/gnunet-service-setu.c:3832 |
6125 | #, fuzzy | 6130 | #, fuzzy |
6126 | msgid "Could not connect to CADET service\n" | 6131 | msgid "Could not connect to CADET service\n" |
6127 | msgstr "Impossible d’ouvrir « %s ».\n" | 6132 | msgstr "Impossible d’ouvrir « %s ».\n" |
@@ -6683,12 +6688,12 @@ msgstr "" | |||
6683 | msgid "Failed to load configuration from %s\n" | 6688 | msgid "Failed to load configuration from %s\n" |
6684 | msgstr "" | 6689 | msgstr "" |
6685 | 6690 | ||
6686 | #: src/topology/friends.c:127 | 6691 | #: src/topology/friends.c:118 |
6687 | #, c-format | 6692 | #, c-format |
6688 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" | 6693 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" |
6689 | msgstr "" | 6694 | msgstr "" |
6690 | 6695 | ||
6691 | #: src/topology/friends.c:181 | 6696 | #: src/topology/friends.c:172 |
6692 | #, c-format | 6697 | #, c-format |
6693 | msgid "Directory for file `%s' does not seem to be writable.\n" | 6698 | msgid "Directory for file `%s' does not seem to be writable.\n" |
6694 | msgstr "" | 6699 | msgstr "" |
@@ -6752,18 +6757,18 @@ msgstr "" | |||
6752 | msgid "GNUnet topology control" | 6757 | msgid "GNUnet topology control" |
6753 | msgstr "" | 6758 | msgstr "" |
6754 | 6759 | ||
6755 | #: src/transport/gnunet-communicator-tcp.c:3221 | 6760 | #: src/transport/gnunet-communicator-tcp.c:3331 |
6756 | #: src/transport/gnunet-communicator-udp.c:3076 | 6761 | #: src/transport/gnunet-communicator-udp.c:3790 |
6757 | #: src/transport/gnunet-service-tng.c:10014 | 6762 | #: src/transport/gnunet-service-tng.c:10220 |
6758 | #: src/transport/gnunet-service-transport.c:2627 | 6763 | #: src/transport/gnunet-service-transport.c:2627 |
6759 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 6764 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
6760 | msgstr "" | 6765 | msgstr "" |
6761 | 6766 | ||
6762 | #: src/transport/gnunet-communicator-tcp.c:3553 | 6767 | #: src/transport/gnunet-communicator-tcp.c:3668 |
6763 | msgid "GNUnet TCP communicator" | 6768 | msgid "GNUnet TCP communicator" |
6764 | msgstr "" | 6769 | msgstr "" |
6765 | 6770 | ||
6766 | #: src/transport/gnunet-communicator-udp.c:3148 | 6771 | #: src/transport/gnunet-communicator-udp.c:3862 |
6767 | msgid "GNUnet UDP communicator" | 6772 | msgid "GNUnet UDP communicator" |
6768 | msgstr "" | 6773 | msgstr "" |
6769 | 6774 | ||
@@ -7785,7 +7790,7 @@ msgstr "" | |||
7785 | msgid "Service process failed to report status\n" | 7790 | msgid "Service process failed to report status\n" |
7786 | msgstr "" | 7791 | msgstr "" |
7787 | 7792 | ||
7788 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1176 | 7793 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 |
7789 | #: src/util/service.c:1637 | 7794 | #: src/util/service.c:1637 |
7790 | #, c-format | 7795 | #, c-format |
7791 | msgid "Cannot obtain information about user `%s': %s\n" | 7796 | msgid "Cannot obtain information about user `%s': %s\n" |
@@ -7805,7 +7810,7 @@ msgid "do daemonize (detach from terminal)" | |||
7805 | msgstr "" | 7810 | msgstr "" |
7806 | 7811 | ||
7807 | #: src/transport/tcp_service_legacy.c:1397 | 7812 | #: src/transport/tcp_service_legacy.c:1397 |
7808 | #: src/transport/transport-testing2.c:985 src/util/service.c:2072 | 7813 | #: src/transport/transport-testing-communicator.c:1045 src/util/service.c:2072 |
7809 | #: src/util/service.c:2084 | 7814 | #: src/util/service.c:2084 |
7810 | #, c-format | 7815 | #, c-format |
7811 | msgid "Malformed configuration file `%s', exit ...\n" | 7816 | msgid "Malformed configuration file `%s', exit ...\n" |
@@ -7969,38 +7974,38 @@ msgid "" | |||
7969 | "Configuration specifies invalid value for option `%s' in section `%s': %s\n" | 7974 | "Configuration specifies invalid value for option `%s' in section `%s': %s\n" |
7970 | msgstr "" | 7975 | msgstr "" |
7971 | 7976 | ||
7972 | #: src/util/configuration.c:402 | 7977 | #: src/util/configuration.c:370 |
7973 | #, c-format | 7978 | #, c-format |
7974 | msgid "Syntax error while deserializing in line %u\n" | 7979 | msgid "Syntax error while deserializing in line %u\n" |
7975 | msgstr "" | 7980 | msgstr "" |
7976 | 7981 | ||
7977 | #: src/util/configuration.c:460 | 7982 | #: src/util/configuration.c:420 |
7978 | #, fuzzy, c-format | 7983 | #, fuzzy, c-format |
7979 | msgid "Error while reading file `%s'\n" | 7984 | msgid "Error while reading file `%s'\n" |
7980 | msgstr "Erreur de lecture : « %s » : %s" | 7985 | msgstr "Erreur de lecture : « %s » : %s" |
7981 | 7986 | ||
7982 | #: src/util/configuration.c:1063 | 7987 | #: src/util/configuration.c:980 |
7983 | msgid "Not a valid relative time specification" | 7988 | msgid "Not a valid relative time specification" |
7984 | msgstr "" | 7989 | msgstr "" |
7985 | 7990 | ||
7986 | #: src/util/configuration.c:1154 | 7991 | #: src/util/configuration.c:1050 |
7987 | #, c-format | 7992 | #, c-format |
7988 | msgid "" | 7993 | msgid "" |
7989 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " | 7994 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " |
7990 | "choices\n" | 7995 | "choices\n" |
7991 | msgstr "" | 7996 | msgstr "" |
7992 | 7997 | ||
7993 | #: src/util/configuration.c:1269 | 7998 | #: src/util/configuration.c:1145 |
7994 | #, c-format | 7999 | #, c-format |
7995 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" | 8000 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" |
7996 | msgstr "" | 8001 | msgstr "" |
7997 | 8002 | ||
7998 | #: src/util/configuration.c:1301 | 8003 | #: src/util/configuration.c:1177 |
7999 | #, c-format | 8004 | #, c-format |
8000 | msgid "Missing closing `%s' in option `%s'\n" | 8005 | msgid "Missing closing `%s' in option `%s'\n" |
8001 | msgstr "" | 8006 | msgstr "" |
8002 | 8007 | ||
8003 | #: src/util/configuration.c:1367 | 8008 | #: src/util/configuration.c:1243 |
8004 | #, c-format | 8009 | #, c-format |
8005 | msgid "" | 8010 | msgid "" |
8006 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " | 8011 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " |
@@ -8014,36 +8019,36 @@ msgid "" | |||
8014 | "%llu)\n" | 8019 | "%llu)\n" |
8015 | msgstr "" | 8020 | msgstr "" |
8016 | 8021 | ||
8017 | #: src/util/crypto_ecc.c:663 | 8022 | #: src/util/crypto_ecc.c:567 |
8018 | #, c-format | 8023 | #, c-format |
8019 | msgid "ECC signing failed at %s:%d: %s\n" | 8024 | msgid "ECC signing failed at %s:%d: %s\n" |
8020 | msgstr "" | 8025 | msgstr "" |
8021 | 8026 | ||
8022 | #: src/util/crypto_ecc.c:791 | 8027 | #: src/util/crypto_ecc.c:669 |
8023 | #, c-format | 8028 | #, c-format |
8024 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 8029 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
8025 | msgstr "" | 8030 | msgstr "" |
8026 | 8031 | ||
8027 | #: src/util/crypto_ecc_setup.c:369 | 8032 | #: src/util/crypto_ecc_setup.c:273 |
8028 | msgid "Could not load peer's private key\n" | 8033 | msgid "Could not load peer's private key\n" |
8029 | msgstr "" | 8034 | msgstr "" |
8030 | 8035 | ||
8031 | #: src/util/crypto_random.c:345 | 8036 | #: src/util/crypto_random.c:381 |
8032 | #, c-format | 8037 | #, c-format |
8033 | msgid "libgcrypt has not the expected version (version %s is required).\n" | 8038 | msgid "libgcrypt has not the expected version (version %s is required).\n" |
8034 | msgstr "" | 8039 | msgstr "" |
8035 | 8040 | ||
8036 | #: src/util/crypto_rsa.c:959 | 8041 | #: src/util/crypto_rsa.c:862 |
8037 | #, c-format | 8042 | #, c-format |
8038 | msgid "RSA signing failed at %s:%d: %s\n" | 8043 | msgid "RSA signing failed at %s:%d: %s\n" |
8039 | msgstr "" | 8044 | msgstr "" |
8040 | 8045 | ||
8041 | #: src/util/crypto_rsa.c:1318 | 8046 | #: src/util/crypto_rsa.c:1162 |
8042 | #, c-format | 8047 | #, c-format |
8043 | msgid "RSA signature verification failed at %s:%d: %s\n" | 8048 | msgid "RSA signature verification failed at %s:%d: %s\n" |
8044 | msgstr "" | 8049 | msgstr "" |
8045 | 8050 | ||
8046 | #: src/util/disk.c:940 | 8051 | #: src/util/disk.c:823 |
8047 | #, c-format | 8052 | #, c-format |
8048 | msgid "Expected `%s' to be a directory!\n" | 8053 | msgid "Expected `%s' to be a directory!\n" |
8049 | msgstr "" | 8054 | msgstr "" |
@@ -8128,17 +8133,17 @@ msgstr "" | |||
8128 | msgid "%s: option `-W %s' does not allow an argument\n" | 8133 | msgid "%s: option `-W %s' does not allow an argument\n" |
8129 | msgstr "" | 8134 | msgstr "" |
8130 | 8135 | ||
8131 | #: src/util/getopt.c:974 | 8136 | #: src/util/getopt.c:970 |
8132 | #, c-format | 8137 | #, c-format |
8133 | msgid "Use %s to get a list of options.\n" | 8138 | msgid "Use %s to get a list of options.\n" |
8134 | msgstr "" | 8139 | msgstr "" |
8135 | 8140 | ||
8136 | #: src/util/getopt.c:986 | 8141 | #: src/util/getopt.c:983 |
8137 | #, c-format | 8142 | #, c-format |
8138 | msgid "Option `%s' can't be used with other options.\n" | 8143 | msgid "Option `%s' can't be used with other options.\n" |
8139 | msgstr "" | 8144 | msgstr "" |
8140 | 8145 | ||
8141 | #: src/util/getopt.c:998 | 8146 | #: src/util/getopt.c:995 |
8142 | #, c-format | 8147 | #, c-format |
8143 | msgid "Missing mandatory option `%s'.\n" | 8148 | msgid "Missing mandatory option `%s'.\n" |
8144 | msgstr "" | 8149 | msgstr "" |
@@ -8224,6 +8229,10 @@ msgstr "" | |||
8224 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 8229 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
8225 | msgstr "" | 8230 | msgstr "" |
8226 | 8231 | ||
8232 | #: src/util/gnunet-base32.c:45 | ||
8233 | msgid "run decoder modus, otherwise runs as encoder" | ||
8234 | msgstr "" | ||
8235 | |||
8227 | #: src/util/gnunet-config.c:167 | 8236 | #: src/util/gnunet-config.c:167 |
8228 | #, fuzzy, c-format | 8237 | #, fuzzy, c-format |
8229 | msgid "failed to load configuration defaults" | 8238 | msgid "failed to load configuration defaults" |
@@ -8276,6 +8285,10 @@ msgstr "" | |||
8276 | msgid "Manipulate GNUnet configuration files" | 8285 | msgid "Manipulate GNUnet configuration files" |
8277 | msgstr "" | 8286 | msgstr "" |
8278 | 8287 | ||
8288 | #: src/util/gnunet-crypto-tvg.c:1072 | ||
8289 | msgid "verify a test vector from stdin" | ||
8290 | msgstr "" | ||
8291 | |||
8279 | #: src/util/gnunet-ecc.c:94 | 8292 | #: src/util/gnunet-ecc.c:94 |
8280 | #, c-format | 8293 | #, c-format |
8281 | msgid "Failed to open `%s': %s\n" | 8294 | msgid "Failed to open `%s': %s\n" |
@@ -8397,31 +8410,31 @@ msgid "perform a reverse lookup" | |||
8397 | msgstr "" | 8410 | msgstr "" |
8398 | 8411 | ||
8399 | #: src/util/gnunet-resolver.c:182 | 8412 | #: src/util/gnunet-resolver.c:182 |
8400 | msgid "Use build-in GNUnet stub resolver" | 8413 | msgid "Use built-in GNUnet stub resolver" |
8401 | msgstr "" | 8414 | msgstr "" |
8402 | 8415 | ||
8403 | #: src/util/gnunet-scrypt.c:229 | 8416 | #: src/util/gnunet-scrypt.c:232 |
8404 | #, c-format | 8417 | #, c-format |
8405 | msgid "Loading hostkey from `%s' failed.\n" | 8418 | msgid "Loading hostkey from `%s' failed.\n" |
8406 | msgstr "" | 8419 | msgstr "" |
8407 | 8420 | ||
8408 | #: src/util/gnunet-scrypt.c:295 | 8421 | #: src/util/gnunet-scrypt.c:298 |
8409 | msgid "number of bits to require for the proof of work" | 8422 | msgid "number of bits to require for the proof of work" |
8410 | msgstr "" | 8423 | msgstr "" |
8411 | 8424 | ||
8412 | #: src/util/gnunet-scrypt.c:301 | 8425 | #: src/util/gnunet-scrypt.c:304 |
8413 | msgid "file with private key, otherwise default is used" | 8426 | msgid "file with private key, otherwise default is used" |
8414 | msgstr "" | 8427 | msgstr "" |
8415 | 8428 | ||
8416 | #: src/util/gnunet-scrypt.c:307 | 8429 | #: src/util/gnunet-scrypt.c:310 |
8417 | msgid "file with proof of work, otherwise default is used" | 8430 | msgid "file with proof of work, otherwise default is used" |
8418 | msgstr "" | 8431 | msgstr "" |
8419 | 8432 | ||
8420 | #: src/util/gnunet-scrypt.c:313 | 8433 | #: src/util/gnunet-scrypt.c:316 |
8421 | msgid "time to wait between calculations" | 8434 | msgid "time to wait between calculations" |
8422 | msgstr "" | 8435 | msgstr "" |
8423 | 8436 | ||
8424 | #: src/util/gnunet-scrypt.c:326 | 8437 | #: src/util/gnunet-scrypt.c:330 |
8425 | msgid "Manipulate GNUnet proof of work files" | 8438 | msgid "Manipulate GNUnet proof of work files" |
8426 | msgstr "" | 8439 | msgstr "" |
8427 | 8440 | ||
@@ -8458,25 +8471,25 @@ msgstr "" | |||
8458 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" | 8471 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" |
8459 | msgstr "" | 8472 | msgstr "" |
8460 | 8473 | ||
8461 | #: src/util/network.c:1364 | 8474 | #: src/util/network.c:1361 |
8462 | #, c-format | 8475 | #, c-format |
8463 | msgid "" | 8476 | msgid "" |
8464 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" | 8477 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" |
8465 | msgstr "" | 8478 | msgstr "" |
8466 | 8479 | ||
8467 | #: src/util/os_installation.c:411 | 8480 | #: src/util/os_installation.c:415 |
8468 | #, c-format | 8481 | #, c-format |
8469 | msgid "" | 8482 | msgid "" |
8470 | "Could not determine installation path for %s. Set `%s' environment " | 8483 | "Could not determine installation path for %s. Set `%s' environment " |
8471 | "variable.\n" | 8484 | "variable.\n" |
8472 | msgstr "" | 8485 | msgstr "" |
8473 | 8486 | ||
8474 | #: src/util/os_installation.c:794 | 8487 | #: src/util/os_installation.c:802 |
8475 | #, c-format | 8488 | #, c-format |
8476 | msgid "Could not find binary `%s' in PATH!\n" | 8489 | msgid "Could not find binary `%s' in PATH!\n" |
8477 | msgstr "" | 8490 | msgstr "" |
8478 | 8491 | ||
8479 | #: src/util/os_installation.c:827 | 8492 | #: src/util/os_installation.c:835 |
8480 | #, c-format | 8493 | #, c-format |
8481 | msgid "Binary `%s' exists, but is not SUID\n" | 8494 | msgid "Binary `%s' exists, but is not SUID\n" |
8482 | msgstr "" | 8495 | msgstr "" |
@@ -8486,31 +8499,31 @@ msgstr "" | |||
8486 | msgid "Initialization of plugin mechanism failed: %s!\n" | 8499 | msgid "Initialization of plugin mechanism failed: %s!\n" |
8487 | msgstr "" | 8500 | msgstr "" |
8488 | 8501 | ||
8489 | #: src/util/plugin.c:147 | 8502 | #: src/util/plugin.c:156 |
8490 | #, c-format | 8503 | #, c-format |
8491 | msgid "`%s' failed to resolve method '%s' with error: %s\n" | 8504 | msgid "`%s' failed to resolve method '%s' with error: %s\n" |
8492 | msgstr "" | 8505 | msgstr "" |
8493 | 8506 | ||
8494 | #: src/util/plugin.c:223 | 8507 | #: src/util/plugin.c:234 |
8495 | #, c-format | 8508 | #, c-format |
8496 | msgid "`%s' failed for library `%s' with error: %s\n" | 8509 | msgid "`%s' failed for library `%s' with error: %s\n" |
8497 | msgstr "" | 8510 | msgstr "" |
8498 | 8511 | ||
8499 | #: src/util/plugin.c:384 | 8512 | #: src/util/plugin.c:409 |
8500 | msgid "Could not determine plugin installation path.\n" | 8513 | msgid "Could not determine plugin installation path.\n" |
8501 | msgstr "" | 8514 | msgstr "" |
8502 | 8515 | ||
8503 | #: src/util/program.c:267 | 8516 | #: src/util/program.c:259 |
8504 | #, fuzzy, c-format | 8517 | #, fuzzy, c-format |
8505 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" | 8518 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" |
8506 | msgstr "fornat invalide : « %s »\n" | 8519 | msgstr "fornat invalide : « %s »\n" |
8507 | 8520 | ||
8508 | #: src/util/program.c:284 | 8521 | #: src/util/program.c:276 |
8509 | #, c-format | 8522 | #, c-format |
8510 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | 8523 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" |
8511 | msgstr "" | 8524 | msgstr "" |
8512 | 8525 | ||
8513 | #: src/util/program.c:299 | 8526 | #: src/util/program.c:291 |
8514 | #, fuzzy | 8527 | #, fuzzy |
8515 | msgid "Unreadable or malformed configuration, exit ...\n" | 8528 | msgid "Unreadable or malformed configuration, exit ...\n" |
8516 | msgstr "fornat invalide : « %s »\n" | 8529 | msgstr "fornat invalide : « %s »\n" |
@@ -8645,12 +8658,12 @@ msgstr "" | |||
8645 | msgid "Wrong format `%s' for network\n" | 8658 | msgid "Wrong format `%s' for network\n" |
8646 | msgstr "" | 8659 | msgstr "" |
8647 | 8660 | ||
8648 | #: src/util/time.c:848 src/util/time.c:876 | 8661 | #: src/util/time.c:878 src/util/time.c:906 |
8649 | #, c-format | 8662 | #, c-format |
8650 | msgid "Failed to map `%s', cannot assure monotonic time!\n" | 8663 | msgid "Failed to map `%s', cannot assure monotonic time!\n" |
8651 | msgstr "" | 8664 | msgstr "" |
8652 | 8665 | ||
8653 | #: src/util/time.c:884 | 8666 | #: src/util/time.c:914 |
8654 | #, c-format | 8667 | #, c-format |
8655 | msgid "" | 8668 | msgid "" |
8656 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" | 8669 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" |
@@ -8980,10 +8993,6 @@ msgstr "" | |||
8980 | #~ msgid "malformed" | 8993 | #~ msgid "malformed" |
8981 | #~ msgstr "malformé" | 8994 | #~ msgstr "malformé" |
8982 | 8995 | ||
8983 | #, fuzzy | ||
8984 | #~ msgid "Failed to start resolver!\n" | ||
8985 | #~ msgstr "Échec du démarrage de %s\n" | ||
8986 | |||
8987 | #~ msgid "Benchmarking done\n" | 8996 | #~ msgid "Benchmarking done\n" |
8988 | #~ msgstr "Benchmark terminé\n" | 8997 | #~ msgstr "Benchmark terminé\n" |
8989 | 8998 | ||
@@ -8,7 +8,7 @@ msgid "" | |||
8 | msgstr "" | 8 | msgstr "" |
9 | "Project-Id-Version: gnunet 0.10.1\n" | 9 | "Project-Id-Version: gnunet 0.10.1\n" |
10 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 10 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
11 | "POT-Creation-Date: 2020-11-13 23:46+0900\n" | 11 | "POT-Creation-Date: 2021-04-04 19:19+0200\n" |
12 | "PO-Revision-Date: 2019-10-16 11:00+0200\n" | 12 | "PO-Revision-Date: 2019-10-16 11:00+0200\n" |
13 | "Last-Translator: Sebastiano Pistore <sebastianopistore.info@protonmail.ch>\n" | 13 | "Last-Translator: Sebastiano Pistore <sebastianopistore.info@protonmail.ch>\n" |
14 | "Language-Team: Italian <tp@lists.linux.it>\n" | 14 | "Language-Team: Italian <tp@lists.linux.it>\n" |
@@ -747,7 +747,7 @@ msgstr "" | |||
747 | 747 | ||
748 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 | 748 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 |
749 | #: src/conversation/gnunet-conversation-test.c:256 | 749 | #: src/conversation/gnunet-conversation-test.c:256 |
750 | #: src/revocation/gnunet-revocation.c:569 src/template/gnunet-template.c:75 | 750 | #: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 |
751 | msgid "help text" | 751 | msgid "help text" |
752 | msgstr "" | 752 | msgstr "" |
753 | 753 | ||
@@ -1307,7 +1307,7 @@ msgstr "stato sconosciuto" | |||
1307 | msgid "%24s: %-30s %4s (timeout in %6s)\n" | 1307 | msgid "%24s: %-30s %4s (timeout in %6s)\n" |
1308 | msgstr "" | 1308 | msgstr "" |
1309 | 1309 | ||
1310 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:696 | 1310 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:697 |
1311 | #, c-format | 1311 | #, c-format |
1312 | msgid "Invalid command line argument `%s'\n" | 1312 | msgid "Invalid command line argument `%s'\n" |
1313 | msgstr "" | 1313 | msgstr "" |
@@ -1577,7 +1577,7 @@ msgstr "" | |||
1577 | #: src/testbed/generate-underlay-topology.c:48 | 1577 | #: src/testbed/generate-underlay-topology.c:48 |
1578 | #: src/testbed/gnunet-daemon-latency-logger.c:53 | 1578 | #: src/testbed/gnunet-daemon-latency-logger.c:53 |
1579 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 | 1579 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 |
1580 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:62 | 1580 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:78 |
1581 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 | 1581 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 |
1582 | #, c-format | 1582 | #, c-format |
1583 | msgid "`%s' failed at %s:%d with error: %s\n" | 1583 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -2012,7 +2012,7 @@ msgstr "" | |||
2012 | msgid "Exiting as the number of peers is %u\n" | 2012 | msgid "Exiting as the number of peers is %u\n" |
2013 | msgstr "" | 2013 | msgstr "" |
2014 | 2014 | ||
2015 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194 | 2015 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3136 |
2016 | msgid "number of peers to start" | 2016 | msgid "number of peers to start" |
2017 | msgstr "" | 2017 | msgstr "" |
2018 | 2018 | ||
@@ -3146,7 +3146,7 @@ msgid "Downloading `%s' done (%s/s).\n" | |||
3146 | msgstr "" | 3146 | msgstr "" |
3147 | 3147 | ||
3148 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 | 3148 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 |
3149 | #: src/fs/gnunet-search.c:226 src/fs/gnunet-unindex.c:117 | 3149 | #: src/fs/gnunet-search.c:229 src/fs/gnunet-unindex.c:117 |
3150 | #, c-format | 3150 | #, c-format |
3151 | msgid "Unexpected status: %d\n" | 3151 | msgid "Unexpected status: %d\n" |
3152 | msgstr "" | 3152 | msgstr "" |
@@ -3169,12 +3169,12 @@ msgid "Target filename must be specified.\n" | |||
3169 | msgstr "" | 3169 | msgstr "" |
3170 | 3170 | ||
3171 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 | 3171 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 |
3172 | #: src/fs/gnunet-search.c:291 src/fs/gnunet-unindex.c:154 | 3172 | #: src/fs/gnunet-search.c:294 src/fs/gnunet-unindex.c:154 |
3173 | #, c-format | 3173 | #, c-format |
3174 | msgid "Could not initialize `%s' subsystem.\n" | 3174 | msgid "Could not initialize `%s' subsystem.\n" |
3175 | msgstr "" | 3175 | msgstr "" |
3176 | 3176 | ||
3177 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:331 | 3177 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:334 |
3178 | msgid "set the desired LEVEL of receiver-anonymity" | 3178 | msgid "set the desired LEVEL of receiver-anonymity" |
3179 | msgstr "" | 3179 | msgstr "" |
3180 | 3180 | ||
@@ -3182,7 +3182,7 @@ msgstr "" | |||
3182 | msgid "delete incomplete downloads (when aborted with CTRL-C)" | 3182 | msgid "delete incomplete downloads (when aborted with CTRL-C)" |
3183 | msgstr "" | 3183 | msgstr "" |
3184 | 3184 | ||
3185 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:336 | 3185 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:339 |
3186 | msgid "only search the local peer (no P2P network search)" | 3186 | msgid "only search the local peer (no P2P network search)" |
3187 | msgstr "" | 3187 | msgstr "" |
3188 | 3188 | ||
@@ -3423,37 +3423,37 @@ msgstr "" | |||
3423 | msgid "Publish a file or directory on GNUnet" | 3423 | msgid "Publish a file or directory on GNUnet" |
3424 | msgstr "" | 3424 | msgstr "" |
3425 | 3425 | ||
3426 | #: src/fs/gnunet-search.c:127 | 3426 | #: src/fs/gnunet-search.c:130 |
3427 | #, c-format | 3427 | #, c-format |
3428 | msgid "Failed to write directory with search results to `%s'\n" | 3428 | msgid "Failed to write directory with search results to `%s'\n" |
3429 | msgstr "" | 3429 | msgstr "" |
3430 | 3430 | ||
3431 | #: src/fs/gnunet-search.c:216 | 3431 | #: src/fs/gnunet-search.c:219 |
3432 | #, c-format | 3432 | #, c-format |
3433 | msgid "Error searching: %s.\n" | 3433 | msgid "Error searching: %s.\n" |
3434 | msgstr "" | 3434 | msgstr "" |
3435 | 3435 | ||
3436 | #: src/fs/gnunet-search.c:278 | 3436 | #: src/fs/gnunet-search.c:281 |
3437 | msgid "Could not create keyword URI from arguments.\n" | 3437 | msgid "Could not create keyword URI from arguments.\n" |
3438 | msgstr "" | 3438 | msgstr "" |
3439 | 3439 | ||
3440 | #: src/fs/gnunet-search.c:305 | 3440 | #: src/fs/gnunet-search.c:308 |
3441 | msgid "Could not start searching.\n" | 3441 | msgid "Could not start searching.\n" |
3442 | msgstr "" | 3442 | msgstr "" |
3443 | 3443 | ||
3444 | #: src/fs/gnunet-search.c:342 | 3444 | #: src/fs/gnunet-search.c:345 |
3445 | msgid "write search results to file starting with PREFIX" | 3445 | msgid "write search results to file starting with PREFIX" |
3446 | msgstr "" | 3446 | msgstr "" |
3447 | 3447 | ||
3448 | #: src/fs/gnunet-search.c:348 | 3448 | #: src/fs/gnunet-search.c:351 |
3449 | msgid "automatically terminate search after DELAY" | 3449 | msgid "automatically terminate search after DELAY" |
3450 | msgstr "" | 3450 | msgstr "" |
3451 | 3451 | ||
3452 | #: src/fs/gnunet-search.c:354 | 3452 | #: src/fs/gnunet-search.c:357 |
3453 | msgid "automatically terminate search after VALUE results are found" | 3453 | msgid "automatically terminate search after VALUE results are found" |
3454 | msgstr "" | 3454 | msgstr "" |
3455 | 3455 | ||
3456 | #: src/fs/gnunet-search.c:368 | 3456 | #: src/fs/gnunet-search.c:371 |
3457 | msgid "Search GNUnet for files that were published on GNUnet" | 3457 | msgid "Search GNUnet for files that were published on GNUnet" |
3458 | msgstr "" | 3458 | msgstr "" |
3459 | 3459 | ||
@@ -3811,7 +3811,7 @@ msgstr "" | |||
3811 | msgid "Expected a base32-encoded public zone key\n" | 3811 | msgid "Expected a base32-encoded public zone key\n" |
3812 | msgstr "" | 3812 | msgstr "" |
3813 | 3813 | ||
3814 | #: src/gns/gnunet-bcd.c:133 | 3814 | #: src/gns/gnunet-bcd.c:134 |
3815 | #, c-format | 3815 | #, c-format |
3816 | msgid "Refusing `%s' request to HTTP server\n" | 3816 | msgid "Refusing `%s' request to HTTP server\n" |
3817 | msgstr "" | 3817 | msgstr "" |
@@ -3843,34 +3843,39 @@ msgstr "" | |||
3843 | msgid "Failed to pack DNS response into UDP packet!\n" | 3843 | msgid "Failed to pack DNS response into UDP packet!\n" |
3844 | msgstr "" | 3844 | msgstr "" |
3845 | 3845 | ||
3846 | #: src/gns/gnunet-dns2gns.c:444 | 3846 | #: src/gns/gnunet-dns2gns.c:315 |
3847 | #, fuzzy | ||
3848 | msgid "Failed to parse DNS response!\n" | ||
3849 | msgstr "Generazione statistiche fallita\n" | ||
3850 | |||
3851 | #: src/gns/gnunet-dns2gns.c:452 | ||
3847 | #, c-format | 3852 | #, c-format |
3848 | msgid "Cannot parse DNS request from %s\n" | 3853 | msgid "Cannot parse DNS request from %s\n" |
3849 | msgstr "" | 3854 | msgstr "" |
3850 | 3855 | ||
3851 | #: src/gns/gnunet-dns2gns.c:460 | 3856 | #: src/gns/gnunet-dns2gns.c:468 |
3852 | #, c-format | 3857 | #, c-format |
3853 | msgid "Received malformed DNS request from %s\n" | 3858 | msgid "Received malformed DNS request from %s\n" |
3854 | msgstr "" | 3859 | msgstr "" |
3855 | 3860 | ||
3856 | #: src/gns/gnunet-dns2gns.c:468 | 3861 | #: src/gns/gnunet-dns2gns.c:476 |
3857 | #, c-format | 3862 | #, c-format |
3858 | msgid "Received unsupported DNS request from %s\n" | 3863 | msgid "Received unsupported DNS request from %s\n" |
3859 | msgstr "" | 3864 | msgstr "" |
3860 | 3865 | ||
3861 | #: src/gns/gnunet-dns2gns.c:629 | 3866 | #: src/gns/gnunet-dns2gns.c:637 |
3862 | msgid "No DNS server specified!\n" | 3867 | msgid "No DNS server specified!\n" |
3863 | msgstr "" | 3868 | msgstr "" |
3864 | 3869 | ||
3865 | #: src/gns/gnunet-dns2gns.c:778 | 3870 | #: src/gns/gnunet-dns2gns.c:786 |
3866 | msgid "IP of recursive DNS resolver to use (required)" | 3871 | msgid "IP of recursive DNS resolver to use (required)" |
3867 | msgstr "" | 3872 | msgstr "" |
3868 | 3873 | ||
3869 | #: src/gns/gnunet-dns2gns.c:784 | 3874 | #: src/gns/gnunet-dns2gns.c:792 |
3870 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 3875 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
3871 | msgstr "" | 3876 | msgstr "" |
3872 | 3877 | ||
3873 | #: src/gns/gnunet-dns2gns.c:801 | 3878 | #: src/gns/gnunet-dns2gns.c:809 |
3874 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 3879 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
3875 | msgstr "" | 3880 | msgstr "" |
3876 | 3881 | ||
@@ -3988,63 +3993,63 @@ msgstr "" | |||
3988 | msgid "Cookie domain `%s' supplied by server is invalid\n" | 3993 | msgid "Cookie domain `%s' supplied by server is invalid\n" |
3989 | msgstr "" | 3994 | msgstr "" |
3990 | 3995 | ||
3991 | #: src/gns/gnunet-gns-proxy.c:2133 | 3996 | #: src/gns/gnunet-gns-proxy.c:2134 |
3992 | #, c-format | 3997 | #, c-format |
3993 | msgid "Unsupported HTTP method `%s'\n" | 3998 | msgid "Unsupported HTTP method `%s'\n" |
3994 | msgstr "" | 3999 | msgstr "" |
3995 | 4000 | ||
3996 | #: src/gns/gnunet-gns-proxy.c:2657 | 4001 | #: src/gns/gnunet-gns-proxy.c:2658 |
3997 | #, c-format | 4002 | #, c-format |
3998 | msgid "Unable to import private key from file `%s'\n" | 4003 | msgid "Unable to import private key from file `%s'\n" |
3999 | msgstr "" | 4004 | msgstr "" |
4000 | 4005 | ||
4001 | #: src/gns/gnunet-gns-proxy.c:2689 | 4006 | #: src/gns/gnunet-gns-proxy.c:2690 |
4002 | #, fuzzy, c-format | 4007 | #, fuzzy, c-format |
4003 | msgid "Unable to import certificate from `%s'\n" | 4008 | msgid "Unable to import certificate from `%s'\n" |
4004 | msgstr "Generazione statistiche fallita\n" | 4009 | msgstr "Generazione statistiche fallita\n" |
4005 | 4010 | ||
4006 | #: src/gns/gnunet-gns-proxy.c:2898 | 4011 | #: src/gns/gnunet-gns-proxy.c:2899 |
4007 | #, c-format | 4012 | #, c-format |
4008 | msgid "Failed to start HTTPS server for `%s'\n" | 4013 | msgid "Failed to start HTTPS server for `%s'\n" |
4009 | msgstr "" | 4014 | msgstr "" |
4010 | 4015 | ||
4011 | #: src/gns/gnunet-gns-proxy.c:2922 src/rest/gnunet-rest-server.c:917 | 4016 | #: src/gns/gnunet-gns-proxy.c:2923 src/rest/gnunet-rest-server.c:917 |
4012 | msgid "Failed to pass client to MHD\n" | 4017 | msgid "Failed to pass client to MHD\n" |
4013 | msgstr "" | 4018 | msgstr "" |
4014 | 4019 | ||
4015 | #: src/gns/gnunet-gns-proxy.c:3271 | 4020 | #: src/gns/gnunet-gns-proxy.c:3272 |
4016 | #, c-format | 4021 | #, c-format |
4017 | msgid "Unsupported socks version %d\n" | 4022 | msgid "Unsupported socks version %d\n" |
4018 | msgstr "" | 4023 | msgstr "" |
4019 | 4024 | ||
4020 | #: src/gns/gnunet-gns-proxy.c:3303 | 4025 | #: src/gns/gnunet-gns-proxy.c:3304 |
4021 | #, c-format | 4026 | #, c-format |
4022 | msgid "Unsupported socks command %d\n" | 4027 | msgid "Unsupported socks command %d\n" |
4023 | msgstr "" | 4028 | msgstr "" |
4024 | 4029 | ||
4025 | #: src/gns/gnunet-gns-proxy.c:3389 | 4030 | #: src/gns/gnunet-gns-proxy.c:3390 |
4026 | #, c-format | 4031 | #, c-format |
4027 | msgid "Unsupported socks address type %d\n" | 4032 | msgid "Unsupported socks address type %d\n" |
4028 | msgstr "" | 4033 | msgstr "" |
4029 | 4034 | ||
4030 | #: src/gns/gnunet-gns-proxy.c:3730 | 4035 | #: src/gns/gnunet-gns-proxy.c:3731 |
4031 | #, c-format | 4036 | #, c-format |
4032 | msgid "Failed to load X.509 key and certificate from `%s'\n" | 4037 | msgid "Failed to load X.509 key and certificate from `%s'\n" |
4033 | msgstr "" | 4038 | msgstr "" |
4034 | 4039 | ||
4035 | #: src/gns/gnunet-gns-proxy.c:3864 | 4040 | #: src/gns/gnunet-gns-proxy.c:3865 |
4036 | msgid "listen on specified port (default: 7777)" | 4041 | msgid "listen on specified port (default: 7777)" |
4037 | msgstr "" | 4042 | msgstr "" |
4038 | 4043 | ||
4039 | #: src/gns/gnunet-gns-proxy.c:3869 | 4044 | #: src/gns/gnunet-gns-proxy.c:3870 |
4040 | msgid "pem file to use as CA" | 4045 | msgid "pem file to use as CA" |
4041 | msgstr "" | 4046 | msgstr "" |
4042 | 4047 | ||
4043 | #: src/gns/gnunet-gns-proxy.c:3873 | 4048 | #: src/gns/gnunet-gns-proxy.c:3874 |
4044 | msgid "disable use of IPv6" | 4049 | msgid "disable use of IPv6" |
4045 | msgstr "" | 4050 | msgstr "" |
4046 | 4051 | ||
4047 | #: src/gns/gnunet-gns-proxy.c:3899 | 4052 | #: src/gns/gnunet-gns-proxy.c:3900 |
4048 | msgid "GNUnet GNS proxy" | 4053 | msgid "GNUnet GNS proxy" |
4049 | msgstr "" | 4054 | msgstr "" |
4050 | 4055 | ||
@@ -4067,7 +4072,7 @@ msgstr "" | |||
4067 | msgid "Error converting GNS response to DNS response!\n" | 4072 | msgid "Error converting GNS response to DNS response!\n" |
4068 | msgstr "" | 4073 | msgstr "" |
4069 | 4074 | ||
4070 | #: src/gns/gnunet-service-gns_interceptor.c:387 | 4075 | #: src/gns/gnunet-service-gns_interceptor.c:386 |
4071 | msgid "Failed to connect to the DNS service!\n" | 4076 | msgid "Failed to connect to the DNS service!\n" |
4072 | msgstr "" | 4077 | msgstr "" |
4073 | 4078 | ||
@@ -4100,36 +4105,36 @@ msgstr "" | |||
4100 | msgid "VPN returned empty result for `%s'\n" | 4105 | msgid "VPN returned empty result for `%s'\n" |
4101 | msgstr "" | 4106 | msgstr "" |
4102 | 4107 | ||
4103 | #: src/gns/gnunet-service-gns_resolver.c:1910 | 4108 | #: src/gns/gnunet-service-gns_resolver.c:1919 |
4104 | #, c-format | 4109 | #, c-format |
4105 | msgid "Name `%s' cannot be converted to IDNA." | 4110 | msgid "Name `%s' cannot be converted to IDNA." |
4106 | msgstr "" | 4111 | msgstr "" |
4107 | 4112 | ||
4108 | #: src/gns/gnunet-service-gns_resolver.c:1923 | 4113 | #: src/gns/gnunet-service-gns_resolver.c:1934 |
4109 | #, c-format | 4114 | #, c-format |
4110 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" | 4115 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" |
4111 | msgstr "" | 4116 | msgstr "" |
4112 | 4117 | ||
4113 | #: src/gns/gnunet-service-gns_resolver.c:1966 | 4118 | #: src/gns/gnunet-service-gns_resolver.c:1979 |
4114 | #, c-format | 4119 | #, c-format |
4115 | msgid "GNS lookup failed (zero records found for `%s')\n" | 4120 | msgid "GNS lookup failed (zero records found for `%s')\n" |
4116 | msgstr "" | 4121 | msgstr "" |
4117 | 4122 | ||
4118 | #: src/gns/gnunet-service-gns_resolver.c:2393 | 4123 | #: src/gns/gnunet-service-gns_resolver.c:2406 |
4119 | msgid "GNS lookup recursion failed (no delegation record found)\n" | 4124 | msgid "GNS lookup recursion failed (no delegation record found)\n" |
4120 | msgstr "" | 4125 | msgstr "" |
4121 | 4126 | ||
4122 | #: src/gns/gnunet-service-gns_resolver.c:2416 | 4127 | #: src/gns/gnunet-service-gns_resolver.c:2429 |
4123 | #, c-format | 4128 | #, c-format |
4124 | msgid "Failed to cache GNS resolution: %s\n" | 4129 | msgid "Failed to cache GNS resolution: %s\n" |
4125 | msgstr "" | 4130 | msgstr "" |
4126 | 4131 | ||
4127 | #: src/gns/gnunet-service-gns_resolver.c:2581 | 4132 | #: src/gns/gnunet-service-gns_resolver.c:2594 |
4128 | #, c-format | 4133 | #, c-format |
4129 | msgid "GNS namecache returned empty result for `%s'\n" | 4134 | msgid "GNS namecache returned empty result for `%s'\n" |
4130 | msgstr "" | 4135 | msgstr "" |
4131 | 4136 | ||
4132 | #: src/gns/gnunet-service-gns_resolver.c:2721 | 4137 | #: src/gns/gnunet-service-gns_resolver.c:2734 |
4133 | #, c-format | 4138 | #, c-format |
4134 | msgid "Zone %s was revoked, resolution fails\n" | 4139 | msgid "Zone %s was revoked, resolution fails\n" |
4135 | msgstr "" | 4140 | msgstr "" |
@@ -4163,7 +4168,7 @@ msgstr "" | |||
4163 | msgid "Unable to parse BOX record string `%s'\n" | 4168 | msgid "Unable to parse BOX record string `%s'\n" |
4164 | msgstr "Impossibile avviare il servizio ' %s'\n" | 4169 | msgstr "Impossibile avviare il servizio ' %s'\n" |
4165 | 4170 | ||
4166 | #: src/gns/plugin_rest_gns.c:448 | 4171 | #: src/gns/plugin_rest_gns.c:450 |
4167 | msgid "Gns REST API initialized\n" | 4172 | msgid "Gns REST API initialized\n" |
4168 | msgstr "" | 4173 | msgstr "" |
4169 | 4174 | ||
@@ -4496,7 +4501,7 @@ msgstr "" | |||
4496 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 | 4501 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 |
4497 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 | 4502 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 |
4498 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 | 4503 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 |
4499 | #: src/peerinfo-tool/gnunet-peerinfo.c:515 | 4504 | #: src/peerinfo-tool/gnunet-peerinfo.c:516 |
4500 | #: src/topology/gnunet-daemon-topology.c:799 | 4505 | #: src/topology/gnunet-daemon-topology.c:799 |
4501 | #, c-format | 4506 | #, c-format |
4502 | msgid "Error in communication with PEERINFO service: %s\n" | 4507 | msgid "Error in communication with PEERINFO service: %s\n" |
@@ -4660,8 +4665,8 @@ msgid "default configured, but ego unknown (internal error)" | |||
4660 | msgstr "" | 4665 | msgstr "" |
4661 | 4666 | ||
4662 | #: src/identity/gnunet-service-identity.c:621 | 4667 | #: src/identity/gnunet-service-identity.c:621 |
4663 | #: src/identity/gnunet-service-identity.c:898 | 4668 | #: src/identity/gnunet-service-identity.c:896 |
4664 | #: src/identity/gnunet-service-identity.c:1018 | 4669 | #: src/identity/gnunet-service-identity.c:1016 |
4665 | #, c-format | 4670 | #, c-format |
4666 | msgid "Failed to write subsystem default identifier map to `%s'.\n" | 4671 | msgid "Failed to write subsystem default identifier map to `%s'.\n" |
4667 | msgstr "" | 4672 | msgstr "" |
@@ -4670,30 +4675,30 @@ msgstr "" | |||
4670 | msgid "Unknown ego specified for service (internal error)" | 4675 | msgid "Unknown ego specified for service (internal error)" |
4671 | msgstr "" | 4676 | msgstr "" |
4672 | 4677 | ||
4673 | #: src/identity/gnunet-service-identity.c:726 | 4678 | #: src/identity/gnunet-service-identity.c:725 |
4674 | msgid "identifier already in use for another ego" | 4679 | msgid "identifier already in use for another ego" |
4675 | msgstr "" | 4680 | msgstr "" |
4676 | 4681 | ||
4677 | #: src/identity/gnunet-service-identity.c:874 | 4682 | #: src/identity/gnunet-service-identity.c:872 |
4678 | msgid "target name already exists" | 4683 | msgid "target name already exists" |
4679 | msgstr "" | 4684 | msgstr "" |
4680 | 4685 | ||
4681 | #: src/identity/gnunet-service-identity.c:916 | 4686 | #: src/identity/gnunet-service-identity.c:914 |
4682 | #: src/identity/gnunet-service-identity.c:1035 | 4687 | #: src/identity/gnunet-service-identity.c:1033 |
4683 | msgid "no matching ego found" | 4688 | msgid "no matching ego found" |
4684 | msgstr "" | 4689 | msgstr "" |
4685 | 4690 | ||
4686 | #: src/identity/gnunet-service-identity.c:1133 | 4691 | #: src/identity/gnunet-service-identity.c:1131 |
4687 | #, c-format | 4692 | #, c-format |
4688 | msgid "Failed to parse ego information in `%s'\n" | 4693 | msgid "Failed to parse ego information in `%s'\n" |
4689 | msgstr "" | 4694 | msgstr "" |
4690 | 4695 | ||
4691 | #: src/identity/gnunet-service-identity.c:1191 | 4696 | #: src/identity/gnunet-service-identity.c:1189 |
4692 | #, c-format | 4697 | #, c-format |
4693 | msgid "Failed to parse subsystem identity configuration file `%s'\n" | 4698 | msgid "Failed to parse subsystem identity configuration file `%s'\n" |
4694 | msgstr "" | 4699 | msgstr "" |
4695 | 4700 | ||
4696 | #: src/identity/gnunet-service-identity.c:1200 | 4701 | #: src/identity/gnunet-service-identity.c:1198 |
4697 | #, c-format | 4702 | #, c-format |
4698 | msgid "Failed to create directory `%s' for storing egos\n" | 4703 | msgid "Failed to create directory `%s' for storing egos\n" |
4699 | msgstr "" | 4704 | msgstr "" |
@@ -4925,7 +4930,7 @@ msgid "Invalid public key for reverse lookup `%s'\n" | |||
4925 | msgstr "" | 4930 | msgstr "" |
4926 | 4931 | ||
4927 | #: src/namestore/gnunet-namestore.c:1220 | 4932 | #: src/namestore/gnunet-namestore.c:1220 |
4928 | #: src/peerinfo-tool/gnunet-peerinfo.c:736 | 4933 | #: src/peerinfo-tool/gnunet-peerinfo.c:737 |
4929 | #, c-format | 4934 | #, c-format |
4930 | msgid "Invalid URI `%s'\n" | 4935 | msgid "Invalid URI `%s'\n" |
4931 | msgstr "" | 4936 | msgstr "" |
@@ -5106,7 +5111,7 @@ msgstr "" | |||
5106 | msgid "GNU Name System First Come First Serve name registration service" | 5111 | msgid "GNU Name System First Come First Serve name registration service" |
5107 | msgstr "" | 5112 | msgstr "" |
5108 | 5113 | ||
5109 | #: src/namestore/gnunet-service-namestore.c:866 | 5114 | #: src/namestore/gnunet-service-namestore.c:871 |
5110 | #, c-format | 5115 | #, c-format |
5111 | msgid "Failed to replicate block in namecache: %s\n" | 5116 | msgid "Failed to replicate block in namecache: %s\n" |
5112 | msgstr "" | 5117 | msgstr "" |
@@ -5137,7 +5142,7 @@ msgstr "" | |||
5137 | msgid "Flat file database running\n" | 5142 | msgid "Flat file database running\n" |
5138 | msgstr "" | 5143 | msgstr "" |
5139 | 5144 | ||
5140 | #: src/namestore/plugin_rest_namestore.c:1103 | 5145 | #: src/namestore/plugin_rest_namestore.c:1105 |
5141 | msgid "Namestore REST API initialized\n" | 5146 | msgid "Namestore REST API initialized\n" |
5142 | msgstr "" | 5147 | msgstr "" |
5143 | 5148 | ||
@@ -5440,8 +5445,8 @@ msgstr "" | |||
5440 | msgid "Measure quality and performance of the NSE service." | 5445 | msgid "Measure quality and performance of the NSE service." |
5441 | msgstr "" | 5446 | msgstr "" |
5442 | 5447 | ||
5443 | #: src/nse/gnunet-service-nse.c:1443 | 5448 | #: src/nse/gnunet-service-nse.c:1450 |
5444 | #: src/revocation/gnunet-service-revocation.c:875 src/util/gnunet-scrypt.c:257 | 5449 | #: src/revocation/gnunet-service-revocation.c:883 src/util/gnunet-scrypt.c:260 |
5445 | msgid "Value is too large.\n" | 5450 | msgid "Value is too large.\n" |
5446 | msgstr "" | 5451 | msgstr "" |
5447 | 5452 | ||
@@ -5481,17 +5486,17 @@ msgstr "" | |||
5481 | msgid "Still no peers found in `%s'!\n" | 5486 | msgid "Still no peers found in `%s'!\n" |
5482 | msgstr "" | 5487 | msgstr "" |
5483 | 5488 | ||
5484 | #: src/peerinfo/gnunet-service-peerinfo.c:1024 | 5489 | #: src/peerinfo/gnunet-service-peerinfo.c:1027 |
5485 | #, c-format | 5490 | #, c-format |
5486 | msgid "Cleaning up directory `%s'\n" | 5491 | msgid "Cleaning up directory `%s'\n" |
5487 | msgstr "" | 5492 | msgstr "" |
5488 | 5493 | ||
5489 | #: src/peerinfo/gnunet-service-peerinfo.c:1319 | 5494 | #: src/peerinfo/gnunet-service-peerinfo.c:1322 |
5490 | #, c-format | 5495 | #, c-format |
5491 | msgid "Importing HELLOs from `%s'\n" | 5496 | msgid "Importing HELLOs from `%s'\n" |
5492 | msgstr "" | 5497 | msgstr "" |
5493 | 5498 | ||
5494 | #: src/peerinfo/gnunet-service-peerinfo.c:1332 | 5499 | #: src/peerinfo/gnunet-service-peerinfo.c:1335 |
5495 | msgid "Skipping import of included HELLOs\n" | 5500 | msgid "Skipping import of included HELLOs\n" |
5496 | msgstr "" | 5501 | msgstr "" |
5497 | 5502 | ||
@@ -5510,7 +5515,7 @@ msgid "\tExpires: %s \t %s\n" | |||
5510 | msgstr "" | 5515 | msgstr "" |
5511 | 5516 | ||
5512 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 | 5517 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 |
5513 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:523 | 5518 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:525 |
5514 | #, fuzzy, c-format | 5519 | #, fuzzy, c-format |
5515 | msgid "Failure: Cannot convert address to string for peer `%s'\n" | 5520 | msgid "Failure: Cannot convert address to string for peer `%s'\n" |
5516 | msgstr "Impossibile avviare il servizio ' %s'\n" | 5521 | msgstr "Impossibile avviare il servizio ' %s'\n" |
@@ -5520,54 +5525,54 @@ msgstr "Impossibile avviare il servizio ' %s'\n" | |||
5520 | msgid "Failure: Received invalid %s\n" | 5525 | msgid "Failure: Received invalid %s\n" |
5521 | msgstr "" | 5526 | msgstr "" |
5522 | 5527 | ||
5523 | #: src/peerinfo-tool/gnunet-peerinfo.c:463 | 5528 | #: src/peerinfo-tool/gnunet-peerinfo.c:464 |
5524 | #, c-format | 5529 | #, c-format |
5525 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" | 5530 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" |
5526 | msgstr "" | 5531 | msgstr "" |
5527 | 5532 | ||
5528 | #: src/peerinfo-tool/gnunet-peerinfo.c:479 | 5533 | #: src/peerinfo-tool/gnunet-peerinfo.c:480 |
5529 | #, c-format | 5534 | #, c-format |
5530 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" | 5535 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" |
5531 | msgstr "" | 5536 | msgstr "" |
5532 | 5537 | ||
5533 | #: src/peerinfo-tool/gnunet-peerinfo.c:758 | 5538 | #: src/peerinfo-tool/gnunet-peerinfo.c:759 |
5534 | #, c-format | 5539 | #, c-format |
5535 | msgid "I am peer `%s'.\n" | 5540 | msgid "I am peer `%s'.\n" |
5536 | msgstr "Io sono il peer '%s''.\n" | 5541 | msgstr "Io sono il peer '%s''.\n" |
5537 | 5542 | ||
5538 | #: src/peerinfo-tool/gnunet-peerinfo.c:799 | 5543 | #: src/peerinfo-tool/gnunet-peerinfo.c:800 |
5539 | msgid "don't resolve host names" | 5544 | msgid "don't resolve host names" |
5540 | msgstr "" | 5545 | msgstr "" |
5541 | 5546 | ||
5542 | #: src/peerinfo-tool/gnunet-peerinfo.c:805 | 5547 | #: src/peerinfo-tool/gnunet-peerinfo.c:806 |
5543 | msgid "output only the identity strings" | 5548 | msgid "output only the identity strings" |
5544 | msgstr "" | 5549 | msgstr "" |
5545 | 5550 | ||
5546 | #: src/peerinfo-tool/gnunet-peerinfo.c:810 | 5551 | #: src/peerinfo-tool/gnunet-peerinfo.c:811 |
5547 | msgid "include friend-only information" | 5552 | msgid "include friend-only information" |
5548 | msgstr "" | 5553 | msgstr "" |
5549 | 5554 | ||
5550 | #: src/peerinfo-tool/gnunet-peerinfo.c:815 | 5555 | #: src/peerinfo-tool/gnunet-peerinfo.c:816 |
5551 | msgid "output our own identity only" | 5556 | msgid "output our own identity only" |
5552 | msgstr "" | 5557 | msgstr "" |
5553 | 5558 | ||
5554 | #: src/peerinfo-tool/gnunet-peerinfo.c:820 | 5559 | #: src/peerinfo-tool/gnunet-peerinfo.c:821 |
5555 | msgid "list all known peers" | 5560 | msgid "list all known peers" |
5556 | msgstr "" | 5561 | msgstr "" |
5557 | 5562 | ||
5558 | #: src/peerinfo-tool/gnunet-peerinfo.c:826 | 5563 | #: src/peerinfo-tool/gnunet-peerinfo.c:827 |
5559 | msgid "dump hello to file" | 5564 | msgid "dump hello to file" |
5560 | msgstr "" | 5565 | msgstr "" |
5561 | 5566 | ||
5562 | #: src/peerinfo-tool/gnunet-peerinfo.c:831 | 5567 | #: src/peerinfo-tool/gnunet-peerinfo.c:832 |
5563 | msgid "also output HELLO uri(s)" | 5568 | msgid "also output HELLO uri(s)" |
5564 | msgstr "" | 5569 | msgstr "" |
5565 | 5570 | ||
5566 | #: src/peerinfo-tool/gnunet-peerinfo.c:838 | 5571 | #: src/peerinfo-tool/gnunet-peerinfo.c:839 |
5567 | msgid "add given HELLO uri to the database" | 5572 | msgid "add given HELLO uri to the database" |
5568 | msgstr "" | 5573 | msgstr "" |
5569 | 5574 | ||
5570 | #: src/peerinfo-tool/gnunet-peerinfo.c:852 | 5575 | #: src/peerinfo-tool/gnunet-peerinfo.c:853 |
5571 | msgid "Print information about peers." | 5576 | msgid "Print information about peers." |
5572 | msgstr "" | 5577 | msgstr "" |
5573 | 5578 | ||
@@ -5589,7 +5594,7 @@ msgstr "" | |||
5589 | msgid "Failed to load transport plugin for `%s'\n" | 5594 | msgid "Failed to load transport plugin for `%s'\n" |
5590 | msgstr "" | 5595 | msgstr "" |
5591 | 5596 | ||
5592 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:809 | 5597 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:811 |
5593 | msgid "Peerinfo REST API initialized\n" | 5598 | msgid "Peerinfo REST API initialized\n" |
5594 | msgstr "" | 5599 | msgstr "" |
5595 | 5600 | ||
@@ -5597,7 +5602,7 @@ msgstr "" | |||
5597 | msgid "peerstore" | 5602 | msgid "peerstore" |
5598 | msgstr "" | 5603 | msgstr "" |
5599 | 5604 | ||
5600 | #: src/peerstore/gnunet-service-peerstore.c:561 | 5605 | #: src/peerstore/gnunet-service-peerstore.c:570 |
5601 | #, c-format | 5606 | #, c-format |
5602 | msgid "Could not load database backend `%s'\n" | 5607 | msgid "Could not load database backend `%s'\n" |
5603 | msgstr "" | 5608 | msgstr "" |
@@ -5776,11 +5781,11 @@ msgstr "" | |||
5776 | msgid "re:claimID command line tool" | 5781 | msgid "re:claimID command line tool" |
5777 | msgstr "" | 5782 | msgstr "" |
5778 | 5783 | ||
5779 | #: src/reclaim/plugin_rest_openid_connect.c:2613 | 5784 | #: src/reclaim/plugin_rest_openid_connect.c:2788 |
5780 | msgid "OpenID Connect REST API initialized\n" | 5785 | msgid "OpenID Connect REST API initialized\n" |
5781 | msgstr "" | 5786 | msgstr "" |
5782 | 5787 | ||
5783 | #: src/reclaim/plugin_rest_reclaim.c:1502 | 5788 | #: src/reclaim/plugin_rest_reclaim.c:1521 |
5784 | msgid "Identity Provider REST API initialized\n" | 5789 | msgid "Identity Provider REST API initialized\n" |
5785 | msgstr "" | 5790 | msgstr "" |
5786 | 5791 | ||
@@ -5930,110 +5935,110 @@ msgstr "" | |||
5930 | msgid "Cancelling calculation.\n" | 5935 | msgid "Cancelling calculation.\n" |
5931 | msgstr "" | 5936 | msgstr "" |
5932 | 5937 | ||
5933 | #: src/revocation/gnunet-revocation.c:299 | 5938 | #: src/revocation/gnunet-revocation.c:302 |
5934 | #, c-format | 5939 | #, c-format |
5935 | msgid "Revocation certificate for `%s' stored in `%s'\n" | 5940 | msgid "Revocation certificate for `%s' stored in `%s'\n" |
5936 | msgstr "" | 5941 | msgstr "" |
5937 | 5942 | ||
5938 | #: src/revocation/gnunet-revocation.c:339 | 5943 | #: src/revocation/gnunet-revocation.c:334 |
5939 | #, c-format | 5944 | #, c-format |
5940 | msgid "Ego `%s' not found.\n" | 5945 | msgid "Ego `%s' not found.\n" |
5941 | msgstr "" | 5946 | msgstr "" |
5942 | 5947 | ||
5943 | #: src/revocation/gnunet-revocation.c:356 | 5948 | #: src/revocation/gnunet-revocation.c:351 |
5944 | #, c-format | 5949 | #, c-format |
5945 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" | 5950 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" |
5946 | msgstr "" | 5951 | msgstr "" |
5947 | 5952 | ||
5948 | #: src/revocation/gnunet-revocation.c:366 | 5953 | #: src/revocation/gnunet-revocation.c:361 |
5949 | msgid "Revocation certificate ready\n" | 5954 | msgid "Revocation certificate ready\n" |
5950 | msgstr "" | 5955 | msgstr "" |
5951 | 5956 | ||
5952 | #: src/revocation/gnunet-revocation.c:378 | 5957 | #: src/revocation/gnunet-revocation.c:373 |
5953 | msgid "Continuing calculation where left off...\n" | 5958 | msgid "Continuing calculation where left off...\n" |
5954 | msgstr "" | 5959 | msgstr "" |
5955 | 5960 | ||
5956 | #: src/revocation/gnunet-revocation.c:385 | 5961 | #: src/revocation/gnunet-revocation.c:380 |
5957 | msgid "Revocation certificate not ready, calculating proof of work\n" | 5962 | msgid "Revocation certificate not ready, calculating proof of work\n" |
5958 | msgstr "" | 5963 | msgstr "" |
5959 | 5964 | ||
5960 | #: src/revocation/gnunet-revocation.c:423 | 5965 | #: src/revocation/gnunet-revocation.c:418 |
5961 | #, c-format | 5966 | #, c-format |
5962 | msgid "Public key `%s' malformed\n" | 5967 | msgid "Public key `%s' malformed\n" |
5963 | msgstr "" | 5968 | msgstr "" |
5964 | 5969 | ||
5965 | #: src/revocation/gnunet-revocation.c:433 | 5970 | #: src/revocation/gnunet-revocation.c:428 |
5966 | msgid "" | 5971 | msgid "" |
5967 | "Testing and revoking at the same time is not allowed, only executing test.\n" | 5972 | "Testing and revoking at the same time is not allowed, only executing test.\n" |
5968 | msgstr "" | 5973 | msgstr "" |
5969 | 5974 | ||
5970 | #: src/revocation/gnunet-revocation.c:463 | 5975 | #: src/revocation/gnunet-revocation.c:458 |
5971 | msgid "No filename to store revocation certificate given.\n" | 5976 | msgid "No filename to store revocation certificate given.\n" |
5972 | msgstr "" | 5977 | msgstr "" |
5973 | 5978 | ||
5974 | #: src/revocation/gnunet-revocation.c:480 | 5979 | #: src/revocation/gnunet-revocation.c:475 |
5975 | #, c-format | 5980 | #, c-format |
5976 | msgid "Failed to read revocation certificate from `%s'\n" | 5981 | msgid "Failed to read revocation certificate from `%s'\n" |
5977 | msgstr "" | 5982 | msgstr "" |
5978 | 5983 | ||
5979 | #: src/revocation/gnunet-revocation.c:488 | 5984 | #: src/revocation/gnunet-revocation.c:483 |
5980 | #, fuzzy, c-format | 5985 | #, fuzzy, c-format |
5981 | msgid "Revocation certificate corrupted in `%s'\n" | 5986 | msgid "Revocation certificate corrupted in `%s'\n" |
5982 | msgstr "Generazione statistiche fallita\n" | 5987 | msgstr "Generazione statistiche fallita\n" |
5983 | 5988 | ||
5984 | #: src/revocation/gnunet-revocation.c:510 | 5989 | #: src/revocation/gnunet-revocation.c:505 |
5985 | msgid "No action specified. Nothing to do.\n" | 5990 | msgid "No action specified. Nothing to do.\n" |
5986 | msgstr "" | 5991 | msgstr "" |
5987 | 5992 | ||
5988 | #: src/revocation/gnunet-revocation.c:529 | 5993 | #: src/revocation/gnunet-revocation.c:524 |
5989 | msgid "use NAME for the name of the revocation file" | 5994 | msgid "use NAME for the name of the revocation file" |
5990 | msgstr "" | 5995 | msgstr "" |
5991 | 5996 | ||
5992 | #: src/revocation/gnunet-revocation.c:537 | 5997 | #: src/revocation/gnunet-revocation.c:532 |
5993 | msgid "" | 5998 | msgid "" |
5994 | "revoke the private key associated for the the private key associated with " | 5999 | "revoke the private key associated for the the private key associated with " |
5995 | "the ego NAME " | 6000 | "the ego NAME " |
5996 | msgstr "" | 6001 | msgstr "" |
5997 | 6002 | ||
5998 | #: src/revocation/gnunet-revocation.c:544 | 6003 | #: src/revocation/gnunet-revocation.c:539 |
5999 | msgid "actually perform revocation, otherwise we just do the precomputation" | 6004 | msgid "actually perform revocation, otherwise we just do the precomputation" |
6000 | msgstr "" | 6005 | msgstr "" |
6001 | 6006 | ||
6002 | #: src/revocation/gnunet-revocation.c:551 | 6007 | #: src/revocation/gnunet-revocation.c:546 |
6003 | msgid "test if the public key KEY has been revoked" | 6008 | msgid "test if the public key KEY has been revoked" |
6004 | msgstr "" | 6009 | msgstr "" |
6005 | 6010 | ||
6006 | #: src/revocation/gnunet-revocation.c:557 | 6011 | #: src/revocation/gnunet-revocation.c:552 |
6007 | msgid "number of epochs to calculate for" | 6012 | msgid "number of epochs to calculate for" |
6008 | msgstr "" | 6013 | msgstr "" |
6009 | 6014 | ||
6010 | #: src/revocation/gnunet-service-revocation.c:494 | 6015 | #: src/revocation/gnunet-service-revocation.c:502 |
6011 | msgid "# unsupported revocations received via set union" | 6016 | msgid "# unsupported revocations received via set union" |
6012 | msgstr "" | 6017 | msgstr "" |
6013 | 6018 | ||
6014 | #: src/revocation/gnunet-service-revocation.c:504 | 6019 | #: src/revocation/gnunet-service-revocation.c:512 |
6015 | #, fuzzy | 6020 | #, fuzzy |
6016 | msgid "# revocation messages received via set union" | 6021 | msgid "# revocation messages received via set union" |
6017 | msgstr "# messaggi PONG ricevuti" | 6022 | msgstr "# messaggi PONG ricevuti" |
6018 | 6023 | ||
6019 | #: src/revocation/gnunet-service-revocation.c:509 | 6024 | #: src/revocation/gnunet-service-revocation.c:517 |
6020 | #, c-format | 6025 | #, c-format |
6021 | msgid "Error computing revocation set union with %s\n" | 6026 | msgid "Error computing revocation set union with %s\n" |
6022 | msgstr "" | 6027 | msgstr "" |
6023 | 6028 | ||
6024 | #: src/revocation/gnunet-service-revocation.c:513 | 6029 | #: src/revocation/gnunet-service-revocation.c:521 |
6025 | msgid "# revocation set unions failed" | 6030 | msgid "# revocation set unions failed" |
6026 | msgstr "" | 6031 | msgstr "" |
6027 | 6032 | ||
6028 | #: src/revocation/gnunet-service-revocation.c:521 | 6033 | #: src/revocation/gnunet-service-revocation.c:529 |
6029 | msgid "# revocation set unions completed" | 6034 | msgid "# revocation set unions completed" |
6030 | msgstr "" | 6035 | msgstr "" |
6031 | 6036 | ||
6032 | #: src/revocation/gnunet-service-revocation.c:559 | 6037 | #: src/revocation/gnunet-service-revocation.c:567 |
6033 | msgid "SET service crashed, terminating revocation service\n" | 6038 | msgid "SET service crashed, terminating revocation service\n" |
6034 | msgstr "" | 6039 | msgstr "" |
6035 | 6040 | ||
6036 | #: src/revocation/gnunet-service-revocation.c:912 | 6041 | #: src/revocation/gnunet-service-revocation.c:920 |
6037 | msgid "Could not open revocation database file!" | 6042 | msgid "Could not open revocation database file!" |
6038 | msgstr "" | 6043 | msgstr "" |
6039 | 6044 | ||
@@ -6049,19 +6054,19 @@ msgstr "" | |||
6049 | msgid "Get peers from biased stream" | 6054 | msgid "Get peers from biased stream" |
6050 | msgstr "" | 6055 | msgstr "" |
6051 | 6056 | ||
6052 | #: src/rps/gnunet-rps-profiler.c:3200 | 6057 | #: src/rps/gnunet-rps-profiler.c:3142 |
6053 | msgid "duration of the profiling" | 6058 | msgid "duration of the profiling" |
6054 | msgstr "" | 6059 | msgstr "" |
6055 | 6060 | ||
6056 | #: src/rps/gnunet-rps-profiler.c:3206 | 6061 | #: src/rps/gnunet-rps-profiler.c:3148 |
6057 | msgid "timeout for the profiling" | 6062 | msgid "timeout for the profiling" |
6058 | msgstr "" | 6063 | msgstr "" |
6059 | 6064 | ||
6060 | #: src/rps/gnunet-rps-profiler.c:3211 | 6065 | #: src/rps/gnunet-rps-profiler.c:3153 |
6061 | msgid "number of PeerIDs to request" | 6066 | msgid "number of PeerIDs to request" |
6062 | msgstr "" | 6067 | msgstr "" |
6063 | 6068 | ||
6064 | #: src/rps/gnunet-rps-profiler.c:3228 | 6069 | #: src/rps/gnunet-rps-profiler.c:3170 |
6065 | msgid "Measure quality and performance of the RPS service." | 6070 | msgid "Measure quality and performance of the RPS service." |
6066 | msgstr "" | 6071 | msgstr "" |
6067 | 6072 | ||
@@ -6147,7 +6152,7 @@ msgid "also profile decryption" | |||
6147 | msgstr "" | 6152 | msgstr "" |
6148 | 6153 | ||
6149 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 | 6154 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 |
6150 | #: src/setu/gnunet-service-setu.c:3633 | 6155 | #: src/setu/gnunet-service-setu.c:3832 |
6151 | #, fuzzy | 6156 | #, fuzzy |
6152 | msgid "Could not connect to CADET service\n" | 6157 | msgid "Could not connect to CADET service\n" |
6153 | msgstr "Impossibile avviare il servizio.\n" | 6158 | msgstr "Impossibile avviare il servizio.\n" |
@@ -6710,12 +6715,12 @@ msgstr "" | |||
6710 | msgid "Failed to load configuration from %s\n" | 6715 | msgid "Failed to load configuration from %s\n" |
6711 | msgstr "" | 6716 | msgstr "" |
6712 | 6717 | ||
6713 | #: src/topology/friends.c:127 | 6718 | #: src/topology/friends.c:118 |
6714 | #, c-format | 6719 | #, c-format |
6715 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" | 6720 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" |
6716 | msgstr "" | 6721 | msgstr "" |
6717 | 6722 | ||
6718 | #: src/topology/friends.c:181 | 6723 | #: src/topology/friends.c:172 |
6719 | #, c-format | 6724 | #, c-format |
6720 | msgid "Directory for file `%s' does not seem to be writable.\n" | 6725 | msgid "Directory for file `%s' does not seem to be writable.\n" |
6721 | msgstr "" | 6726 | msgstr "" |
@@ -6779,18 +6784,18 @@ msgstr "" | |||
6779 | msgid "GNUnet topology control" | 6784 | msgid "GNUnet topology control" |
6780 | msgstr "" | 6785 | msgstr "" |
6781 | 6786 | ||
6782 | #: src/transport/gnunet-communicator-tcp.c:3221 | 6787 | #: src/transport/gnunet-communicator-tcp.c:3331 |
6783 | #: src/transport/gnunet-communicator-udp.c:3076 | 6788 | #: src/transport/gnunet-communicator-udp.c:3790 |
6784 | #: src/transport/gnunet-service-tng.c:10014 | 6789 | #: src/transport/gnunet-service-tng.c:10220 |
6785 | #: src/transport/gnunet-service-transport.c:2627 | 6790 | #: src/transport/gnunet-service-transport.c:2627 |
6786 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 6791 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
6787 | msgstr "" | 6792 | msgstr "" |
6788 | 6793 | ||
6789 | #: src/transport/gnunet-communicator-tcp.c:3553 | 6794 | #: src/transport/gnunet-communicator-tcp.c:3668 |
6790 | msgid "GNUnet TCP communicator" | 6795 | msgid "GNUnet TCP communicator" |
6791 | msgstr "" | 6796 | msgstr "" |
6792 | 6797 | ||
6793 | #: src/transport/gnunet-communicator-udp.c:3148 | 6798 | #: src/transport/gnunet-communicator-udp.c:3862 |
6794 | msgid "GNUnet UDP communicator" | 6799 | msgid "GNUnet UDP communicator" |
6795 | msgstr "" | 6800 | msgstr "" |
6796 | 6801 | ||
@@ -7834,7 +7839,7 @@ msgstr "" | |||
7834 | msgid "Service process failed to report status\n" | 7839 | msgid "Service process failed to report status\n" |
7835 | msgstr "" | 7840 | msgstr "" |
7836 | 7841 | ||
7837 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1176 | 7842 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 |
7838 | #: src/util/service.c:1637 | 7843 | #: src/util/service.c:1637 |
7839 | #, c-format | 7844 | #, c-format |
7840 | msgid "Cannot obtain information about user `%s': %s\n" | 7845 | msgid "Cannot obtain information about user `%s': %s\n" |
@@ -7854,7 +7859,7 @@ msgid "do daemonize (detach from terminal)" | |||
7854 | msgstr "" | 7859 | msgstr "" |
7855 | 7860 | ||
7856 | #: src/transport/tcp_service_legacy.c:1397 | 7861 | #: src/transport/tcp_service_legacy.c:1397 |
7857 | #: src/transport/transport-testing2.c:985 src/util/service.c:2072 | 7862 | #: src/transport/transport-testing-communicator.c:1045 src/util/service.c:2072 |
7858 | #: src/util/service.c:2084 | 7863 | #: src/util/service.c:2084 |
7859 | #, c-format | 7864 | #, c-format |
7860 | msgid "Malformed configuration file `%s', exit ...\n" | 7865 | msgid "Malformed configuration file `%s', exit ...\n" |
@@ -8018,38 +8023,38 @@ msgid "" | |||
8018 | "Configuration specifies invalid value for option `%s' in section `%s': %s\n" | 8023 | "Configuration specifies invalid value for option `%s' in section `%s': %s\n" |
8019 | msgstr "" | 8024 | msgstr "" |
8020 | 8025 | ||
8021 | #: src/util/configuration.c:402 | 8026 | #: src/util/configuration.c:370 |
8022 | #, c-format | 8027 | #, c-format |
8023 | msgid "Syntax error while deserializing in line %u\n" | 8028 | msgid "Syntax error while deserializing in line %u\n" |
8024 | msgstr "" | 8029 | msgstr "" |
8025 | 8030 | ||
8026 | #: src/util/configuration.c:460 | 8031 | #: src/util/configuration.c:420 |
8027 | #, c-format | 8032 | #, c-format |
8028 | msgid "Error while reading file `%s'\n" | 8033 | msgid "Error while reading file `%s'\n" |
8029 | msgstr "Errore di lettura del file `%s'\n" | 8034 | msgstr "Errore di lettura del file `%s'\n" |
8030 | 8035 | ||
8031 | #: src/util/configuration.c:1063 | 8036 | #: src/util/configuration.c:980 |
8032 | msgid "Not a valid relative time specification" | 8037 | msgid "Not a valid relative time specification" |
8033 | msgstr "" | 8038 | msgstr "" |
8034 | 8039 | ||
8035 | #: src/util/configuration.c:1154 | 8040 | #: src/util/configuration.c:1050 |
8036 | #, c-format | 8041 | #, c-format |
8037 | msgid "" | 8042 | msgid "" |
8038 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " | 8043 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " |
8039 | "choices\n" | 8044 | "choices\n" |
8040 | msgstr "" | 8045 | msgstr "" |
8041 | 8046 | ||
8042 | #: src/util/configuration.c:1269 | 8047 | #: src/util/configuration.c:1145 |
8043 | #, c-format | 8048 | #, c-format |
8044 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" | 8049 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" |
8045 | msgstr "" | 8050 | msgstr "" |
8046 | 8051 | ||
8047 | #: src/util/configuration.c:1301 | 8052 | #: src/util/configuration.c:1177 |
8048 | #, c-format | 8053 | #, c-format |
8049 | msgid "Missing closing `%s' in option `%s'\n" | 8054 | msgid "Missing closing `%s' in option `%s'\n" |
8050 | msgstr "" | 8055 | msgstr "" |
8051 | 8056 | ||
8052 | #: src/util/configuration.c:1367 | 8057 | #: src/util/configuration.c:1243 |
8053 | #, c-format | 8058 | #, c-format |
8054 | msgid "" | 8059 | msgid "" |
8055 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " | 8060 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " |
@@ -8063,36 +8068,36 @@ msgid "" | |||
8063 | "%llu)\n" | 8068 | "%llu)\n" |
8064 | msgstr "" | 8069 | msgstr "" |
8065 | 8070 | ||
8066 | #: src/util/crypto_ecc.c:663 | 8071 | #: src/util/crypto_ecc.c:567 |
8067 | #, c-format | 8072 | #, c-format |
8068 | msgid "ECC signing failed at %s:%d: %s\n" | 8073 | msgid "ECC signing failed at %s:%d: %s\n" |
8069 | msgstr "" | 8074 | msgstr "" |
8070 | 8075 | ||
8071 | #: src/util/crypto_ecc.c:791 | 8076 | #: src/util/crypto_ecc.c:669 |
8072 | #, c-format | 8077 | #, c-format |
8073 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 8078 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
8074 | msgstr "" | 8079 | msgstr "" |
8075 | 8080 | ||
8076 | #: src/util/crypto_ecc_setup.c:369 | 8081 | #: src/util/crypto_ecc_setup.c:273 |
8077 | msgid "Could not load peer's private key\n" | 8082 | msgid "Could not load peer's private key\n" |
8078 | msgstr "" | 8083 | msgstr "" |
8079 | 8084 | ||
8080 | #: src/util/crypto_random.c:345 | 8085 | #: src/util/crypto_random.c:381 |
8081 | #, c-format | 8086 | #, c-format |
8082 | msgid "libgcrypt has not the expected version (version %s is required).\n" | 8087 | msgid "libgcrypt has not the expected version (version %s is required).\n" |
8083 | msgstr "" | 8088 | msgstr "" |
8084 | 8089 | ||
8085 | #: src/util/crypto_rsa.c:959 | 8090 | #: src/util/crypto_rsa.c:862 |
8086 | #, c-format | 8091 | #, c-format |
8087 | msgid "RSA signing failed at %s:%d: %s\n" | 8092 | msgid "RSA signing failed at %s:%d: %s\n" |
8088 | msgstr "" | 8093 | msgstr "" |
8089 | 8094 | ||
8090 | #: src/util/crypto_rsa.c:1318 | 8095 | #: src/util/crypto_rsa.c:1162 |
8091 | #, c-format | 8096 | #, c-format |
8092 | msgid "RSA signature verification failed at %s:%d: %s\n" | 8097 | msgid "RSA signature verification failed at %s:%d: %s\n" |
8093 | msgstr "" | 8098 | msgstr "" |
8094 | 8099 | ||
8095 | #: src/util/disk.c:940 | 8100 | #: src/util/disk.c:823 |
8096 | #, c-format | 8101 | #, c-format |
8097 | msgid "Expected `%s' to be a directory!\n" | 8102 | msgid "Expected `%s' to be a directory!\n" |
8098 | msgstr "" | 8103 | msgstr "" |
@@ -8177,17 +8182,17 @@ msgstr "" | |||
8177 | msgid "%s: option `-W %s' does not allow an argument\n" | 8182 | msgid "%s: option `-W %s' does not allow an argument\n" |
8178 | msgstr "" | 8183 | msgstr "" |
8179 | 8184 | ||
8180 | #: src/util/getopt.c:974 | 8185 | #: src/util/getopt.c:970 |
8181 | #, c-format | 8186 | #, c-format |
8182 | msgid "Use %s to get a list of options.\n" | 8187 | msgid "Use %s to get a list of options.\n" |
8183 | msgstr "" | 8188 | msgstr "" |
8184 | 8189 | ||
8185 | #: src/util/getopt.c:986 | 8190 | #: src/util/getopt.c:983 |
8186 | #, c-format | 8191 | #, c-format |
8187 | msgid "Option `%s' can't be used with other options.\n" | 8192 | msgid "Option `%s' can't be used with other options.\n" |
8188 | msgstr "" | 8193 | msgstr "" |
8189 | 8194 | ||
8190 | #: src/util/getopt.c:998 | 8195 | #: src/util/getopt.c:995 |
8191 | #, c-format | 8196 | #, c-format |
8192 | msgid "Missing mandatory option `%s'.\n" | 8197 | msgid "Missing mandatory option `%s'.\n" |
8193 | msgstr "" | 8198 | msgstr "" |
@@ -8272,6 +8277,10 @@ msgstr "" | |||
8272 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 8277 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
8273 | msgstr "" | 8278 | msgstr "" |
8274 | 8279 | ||
8280 | #: src/util/gnunet-base32.c:45 | ||
8281 | msgid "run decoder modus, otherwise runs as encoder" | ||
8282 | msgstr "" | ||
8283 | |||
8275 | #: src/util/gnunet-config.c:167 | 8284 | #: src/util/gnunet-config.c:167 |
8276 | #, c-format | 8285 | #, c-format |
8277 | msgid "failed to load configuration defaults" | 8286 | msgid "failed to load configuration defaults" |
@@ -8324,6 +8333,10 @@ msgstr "" | |||
8324 | msgid "Manipulate GNUnet configuration files" | 8333 | msgid "Manipulate GNUnet configuration files" |
8325 | msgstr "" | 8334 | msgstr "" |
8326 | 8335 | ||
8336 | #: src/util/gnunet-crypto-tvg.c:1072 | ||
8337 | msgid "verify a test vector from stdin" | ||
8338 | msgstr "" | ||
8339 | |||
8327 | #: src/util/gnunet-ecc.c:94 | 8340 | #: src/util/gnunet-ecc.c:94 |
8328 | #, c-format | 8341 | #, c-format |
8329 | msgid "Failed to open `%s': %s\n" | 8342 | msgid "Failed to open `%s': %s\n" |
@@ -8445,31 +8458,31 @@ msgid "perform a reverse lookup" | |||
8445 | msgstr "" | 8458 | msgstr "" |
8446 | 8459 | ||
8447 | #: src/util/gnunet-resolver.c:182 | 8460 | #: src/util/gnunet-resolver.c:182 |
8448 | msgid "Use build-in GNUnet stub resolver" | 8461 | msgid "Use built-in GNUnet stub resolver" |
8449 | msgstr "" | 8462 | msgstr "" |
8450 | 8463 | ||
8451 | #: src/util/gnunet-scrypt.c:229 | 8464 | #: src/util/gnunet-scrypt.c:232 |
8452 | #, c-format | 8465 | #, c-format |
8453 | msgid "Loading hostkey from `%s' failed.\n" | 8466 | msgid "Loading hostkey from `%s' failed.\n" |
8454 | msgstr "" | 8467 | msgstr "" |
8455 | 8468 | ||
8456 | #: src/util/gnunet-scrypt.c:295 | 8469 | #: src/util/gnunet-scrypt.c:298 |
8457 | msgid "number of bits to require for the proof of work" | 8470 | msgid "number of bits to require for the proof of work" |
8458 | msgstr "" | 8471 | msgstr "" |
8459 | 8472 | ||
8460 | #: src/util/gnunet-scrypt.c:301 | 8473 | #: src/util/gnunet-scrypt.c:304 |
8461 | msgid "file with private key, otherwise default is used" | 8474 | msgid "file with private key, otherwise default is used" |
8462 | msgstr "" | 8475 | msgstr "" |
8463 | 8476 | ||
8464 | #: src/util/gnunet-scrypt.c:307 | 8477 | #: src/util/gnunet-scrypt.c:310 |
8465 | msgid "file with proof of work, otherwise default is used" | 8478 | msgid "file with proof of work, otherwise default is used" |
8466 | msgstr "" | 8479 | msgstr "" |
8467 | 8480 | ||
8468 | #: src/util/gnunet-scrypt.c:313 | 8481 | #: src/util/gnunet-scrypt.c:316 |
8469 | msgid "time to wait between calculations" | 8482 | msgid "time to wait between calculations" |
8470 | msgstr "" | 8483 | msgstr "" |
8471 | 8484 | ||
8472 | #: src/util/gnunet-scrypt.c:326 | 8485 | #: src/util/gnunet-scrypt.c:330 |
8473 | msgid "Manipulate GNUnet proof of work files" | 8486 | msgid "Manipulate GNUnet proof of work files" |
8474 | msgstr "" | 8487 | msgstr "" |
8475 | 8488 | ||
@@ -8506,25 +8519,25 @@ msgstr "" | |||
8506 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" | 8519 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" |
8507 | msgstr "" | 8520 | msgstr "" |
8508 | 8521 | ||
8509 | #: src/util/network.c:1364 | 8522 | #: src/util/network.c:1361 |
8510 | #, c-format | 8523 | #, c-format |
8511 | msgid "" | 8524 | msgid "" |
8512 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" | 8525 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" |
8513 | msgstr "" | 8526 | msgstr "" |
8514 | 8527 | ||
8515 | #: src/util/os_installation.c:411 | 8528 | #: src/util/os_installation.c:415 |
8516 | #, c-format | 8529 | #, c-format |
8517 | msgid "" | 8530 | msgid "" |
8518 | "Could not determine installation path for %s. Set `%s' environment " | 8531 | "Could not determine installation path for %s. Set `%s' environment " |
8519 | "variable.\n" | 8532 | "variable.\n" |
8520 | msgstr "" | 8533 | msgstr "" |
8521 | 8534 | ||
8522 | #: src/util/os_installation.c:794 | 8535 | #: src/util/os_installation.c:802 |
8523 | #, c-format | 8536 | #, c-format |
8524 | msgid "Could not find binary `%s' in PATH!\n" | 8537 | msgid "Could not find binary `%s' in PATH!\n" |
8525 | msgstr "" | 8538 | msgstr "" |
8526 | 8539 | ||
8527 | #: src/util/os_installation.c:827 | 8540 | #: src/util/os_installation.c:835 |
8528 | #, c-format | 8541 | #, c-format |
8529 | msgid "Binary `%s' exists, but is not SUID\n" | 8542 | msgid "Binary `%s' exists, but is not SUID\n" |
8530 | msgstr "" | 8543 | msgstr "" |
@@ -8534,31 +8547,31 @@ msgstr "" | |||
8534 | msgid "Initialization of plugin mechanism failed: %s!\n" | 8547 | msgid "Initialization of plugin mechanism failed: %s!\n" |
8535 | msgstr "" | 8548 | msgstr "" |
8536 | 8549 | ||
8537 | #: src/util/plugin.c:147 | 8550 | #: src/util/plugin.c:156 |
8538 | #, c-format | 8551 | #, c-format |
8539 | msgid "`%s' failed to resolve method '%s' with error: %s\n" | 8552 | msgid "`%s' failed to resolve method '%s' with error: %s\n" |
8540 | msgstr "" | 8553 | msgstr "" |
8541 | 8554 | ||
8542 | #: src/util/plugin.c:223 | 8555 | #: src/util/plugin.c:234 |
8543 | #, c-format | 8556 | #, c-format |
8544 | msgid "`%s' failed for library `%s' with error: %s\n" | 8557 | msgid "`%s' failed for library `%s' with error: %s\n" |
8545 | msgstr "" | 8558 | msgstr "" |
8546 | 8559 | ||
8547 | #: src/util/plugin.c:384 | 8560 | #: src/util/plugin.c:409 |
8548 | msgid "Could not determine plugin installation path.\n" | 8561 | msgid "Could not determine plugin installation path.\n" |
8549 | msgstr "" | 8562 | msgstr "" |
8550 | 8563 | ||
8551 | #: src/util/program.c:267 | 8564 | #: src/util/program.c:259 |
8552 | #, c-format | 8565 | #, c-format |
8553 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" | 8566 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" |
8554 | msgstr "" | 8567 | msgstr "" |
8555 | 8568 | ||
8556 | #: src/util/program.c:284 | 8569 | #: src/util/program.c:276 |
8557 | #, c-format | 8570 | #, c-format |
8558 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | 8571 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" |
8559 | msgstr "" | 8572 | msgstr "" |
8560 | 8573 | ||
8561 | #: src/util/program.c:299 | 8574 | #: src/util/program.c:291 |
8562 | msgid "Unreadable or malformed configuration, exit ...\n" | 8575 | msgid "Unreadable or malformed configuration, exit ...\n" |
8563 | msgstr "" | 8576 | msgstr "" |
8564 | 8577 | ||
@@ -8692,12 +8705,12 @@ msgstr "" | |||
8692 | msgid "Wrong format `%s' for network\n" | 8705 | msgid "Wrong format `%s' for network\n" |
8693 | msgstr "" | 8706 | msgstr "" |
8694 | 8707 | ||
8695 | #: src/util/time.c:848 src/util/time.c:876 | 8708 | #: src/util/time.c:878 src/util/time.c:906 |
8696 | #, c-format | 8709 | #, c-format |
8697 | msgid "Failed to map `%s', cannot assure monotonic time!\n" | 8710 | msgid "Failed to map `%s', cannot assure monotonic time!\n" |
8698 | msgstr "" | 8711 | msgstr "" |
8699 | 8712 | ||
8700 | #: src/util/time.c:884 | 8713 | #: src/util/time.c:914 |
8701 | #, c-format | 8714 | #, c-format |
8702 | msgid "" | 8715 | msgid "" |
8703 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" | 8716 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" |
@@ -6,7 +6,7 @@ msgid "" | |||
6 | msgstr "" | 6 | msgstr "" |
7 | "Project-Id-Version: gnunet-0.10.1\n" | 7 | "Project-Id-Version: gnunet-0.10.1\n" |
8 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 8 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
9 | "POT-Creation-Date: 2020-11-13 23:46+0900\n" | 9 | "POT-Creation-Date: 2021-04-04 19:19+0200\n" |
10 | "PO-Revision-Date: 2020-10-23 18:39+0200\n" | 10 | "PO-Revision-Date: 2020-10-23 18:39+0200\n" |
11 | "Last-Translator: МироÑлав Ðиколић <miroslavnikolic@rocketmail.com>\n" | 11 | "Last-Translator: МироÑлав Ðиколић <miroslavnikolic@rocketmail.com>\n" |
12 | "Language-Team: Serbian <(nothing)>\n" | 12 | "Language-Team: Serbian <(nothing)>\n" |
@@ -775,7 +775,7 @@ msgstr "" | |||
775 | 775 | ||
776 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 | 776 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 |
777 | #: src/conversation/gnunet-conversation-test.c:256 | 777 | #: src/conversation/gnunet-conversation-test.c:256 |
778 | #: src/revocation/gnunet-revocation.c:569 src/template/gnunet-template.c:75 | 778 | #: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 |
779 | msgid "help text" | 779 | msgid "help text" |
780 | msgstr "текÑÑ‚ помоћи" | 780 | msgstr "текÑÑ‚ помоћи" |
781 | 781 | ||
@@ -1363,7 +1363,7 @@ msgstr "<непознато време>" | |||
1363 | msgid "%24s: %-30s %4s (timeout in %6s)\n" | 1363 | msgid "%24s: %-30s %4s (timeout in %6s)\n" |
1364 | msgstr "%24s: %-17s %4s (укупно повезивања: %u)\n" | 1364 | msgstr "%24s: %-17s %4s (укупно повезивања: %u)\n" |
1365 | 1365 | ||
1366 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:696 | 1366 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:697 |
1367 | #, c-format | 1367 | #, c-format |
1368 | msgid "Invalid command line argument `%s'\n" | 1368 | msgid "Invalid command line argument `%s'\n" |
1369 | msgstr "ÐеиÑправан аргумент линије наредби „%s“\n" | 1369 | msgstr "ÐеиÑправан аргумент линије наредби „%s“\n" |
@@ -1640,7 +1640,7 @@ msgstr "ОÑтава података Ñкупине ради\n" | |||
1640 | #: src/testbed/generate-underlay-topology.c:48 | 1640 | #: src/testbed/generate-underlay-topology.c:48 |
1641 | #: src/testbed/gnunet-daemon-latency-logger.c:53 | 1641 | #: src/testbed/gnunet-daemon-latency-logger.c:53 |
1642 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 | 1642 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 |
1643 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:62 | 1643 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:78 |
1644 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 | 1644 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 |
1645 | #, c-format | 1645 | #, c-format |
1646 | msgid "`%s' failed at %s:%d with error: %s\n" | 1646 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -2091,7 +2091,7 @@ msgstr "ИÑпиÑује Ñве пакете који иду кроз „DHT“. | |||
2091 | msgid "Exiting as the number of peers is %u\n" | 2091 | msgid "Exiting as the number of peers is %u\n" |
2092 | msgstr "Излазим јер је број парњака %u\n" | 2092 | msgstr "Излазим јер је број парњака %u\n" |
2093 | 2093 | ||
2094 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194 | 2094 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3136 |
2095 | #, fuzzy | 2095 | #, fuzzy |
2096 | msgid "number of peers to start" | 2096 | msgid "number of peers to start" |
2097 | msgstr "број парњака у концензуÑу" | 2097 | msgstr "број парњака у концензуÑу" |
@@ -3273,7 +3273,7 @@ msgid "Downloading `%s' done (%s/s).\n" | |||
3273 | msgstr "Преузимање „%s“ је готово (%s/Ñек).\n" | 3273 | msgstr "Преузимање „%s“ је готово (%s/Ñек).\n" |
3274 | 3274 | ||
3275 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 | 3275 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 |
3276 | #: src/fs/gnunet-search.c:226 src/fs/gnunet-unindex.c:117 | 3276 | #: src/fs/gnunet-search.c:229 src/fs/gnunet-unindex.c:117 |
3277 | #, c-format | 3277 | #, c-format |
3278 | msgid "Unexpected status: %d\n" | 3278 | msgid "Unexpected status: %d\n" |
3279 | msgstr "Ðеочекивано Ñтање: %d\n" | 3279 | msgstr "Ðеочекивано Ñтање: %d\n" |
@@ -3296,12 +3296,12 @@ msgid "Target filename must be specified.\n" | |||
3296 | msgstr "Ðазив циљне датотеке мора бити наведен.\n" | 3296 | msgstr "Ðазив циљне датотеке мора бити наведен.\n" |
3297 | 3297 | ||
3298 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 | 3298 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 |
3299 | #: src/fs/gnunet-search.c:291 src/fs/gnunet-unindex.c:154 | 3299 | #: src/fs/gnunet-search.c:294 src/fs/gnunet-unindex.c:154 |
3300 | #, c-format | 3300 | #, c-format |
3301 | msgid "Could not initialize `%s' subsystem.\n" | 3301 | msgid "Could not initialize `%s' subsystem.\n" |
3302 | msgstr "Ðе могу да покренем „%s“ ÑубÑиÑтем.\n" | 3302 | msgstr "Ðе могу да покренем „%s“ ÑубÑиÑтем.\n" |
3303 | 3303 | ||
3304 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:331 | 3304 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:334 |
3305 | msgid "set the desired LEVEL of receiver-anonymity" | 3305 | msgid "set the desired LEVEL of receiver-anonymity" |
3306 | msgstr "поÑтавља жељени ÐИВО анонимноÑти примаоца" | 3306 | msgstr "поÑтавља жељени ÐИВО анонимноÑти примаоца" |
3307 | 3307 | ||
@@ -3309,7 +3309,7 @@ msgstr "поÑтавља жељени ÐИВО анонимноÑти прима | |||
3309 | msgid "delete incomplete downloads (when aborted with CTRL-C)" | 3309 | msgid "delete incomplete downloads (when aborted with CTRL-C)" |
3310 | msgstr "брише недовршена преузимања (када Ñе прекине Ñа КТРЛ-Ц)" | 3310 | msgstr "брише недовршена преузимања (када Ñе прекине Ñа КТРЛ-Ц)" |
3311 | 3311 | ||
3312 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:336 | 3312 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:339 |
3313 | msgid "only search the local peer (no P2P network search)" | 3313 | msgid "only search the local peer (no P2P network search)" |
3314 | msgstr "тражи Ñамо локалног парњака (без претраге П2П мреже)" | 3314 | msgstr "тражи Ñамо локалног парњака (без претраге П2П мреже)" |
3315 | 3315 | ||
@@ -3568,37 +3568,37 @@ msgstr "" | |||
3568 | msgid "Publish a file or directory on GNUnet" | 3568 | msgid "Publish a file or directory on GNUnet" |
3569 | msgstr "Објављује датотеку или директоријум на ГÐУнет-у" | 3569 | msgstr "Објављује датотеку или директоријум на ГÐУнет-у" |
3570 | 3570 | ||
3571 | #: src/fs/gnunet-search.c:127 | 3571 | #: src/fs/gnunet-search.c:130 |
3572 | #, c-format | 3572 | #, c-format |
3573 | msgid "Failed to write directory with search results to `%s'\n" | 3573 | msgid "Failed to write directory with search results to `%s'\n" |
3574 | msgstr "ÐиÑам уÑпео да пишем директоријум Ñа резултатима претраге за „%s“\n" | 3574 | msgstr "ÐиÑам уÑпео да пишем директоријум Ñа резултатима претраге за „%s“\n" |
3575 | 3575 | ||
3576 | #: src/fs/gnunet-search.c:216 | 3576 | #: src/fs/gnunet-search.c:219 |
3577 | #, c-format | 3577 | #, c-format |
3578 | msgid "Error searching: %s.\n" | 3578 | msgid "Error searching: %s.\n" |
3579 | msgstr "Грешка претраге: %s.\n" | 3579 | msgstr "Грешка претраге: %s.\n" |
3580 | 3580 | ||
3581 | #: src/fs/gnunet-search.c:278 | 3581 | #: src/fs/gnunet-search.c:281 |
3582 | msgid "Could not create keyword URI from arguments.\n" | 3582 | msgid "Could not create keyword URI from arguments.\n" |
3583 | msgstr "Ðе могу да Ñтворим УРИ кључне речи из аргумената.\n" | 3583 | msgstr "Ðе могу да Ñтворим УРИ кључне речи из аргумената.\n" |
3584 | 3584 | ||
3585 | #: src/fs/gnunet-search.c:305 | 3585 | #: src/fs/gnunet-search.c:308 |
3586 | msgid "Could not start searching.\n" | 3586 | msgid "Could not start searching.\n" |
3587 | msgstr "Ðе могу да покренем претрагу.\n" | 3587 | msgstr "Ðе могу да покренем претрагу.\n" |
3588 | 3588 | ||
3589 | #: src/fs/gnunet-search.c:342 | 3589 | #: src/fs/gnunet-search.c:345 |
3590 | msgid "write search results to file starting with PREFIX" | 3590 | msgid "write search results to file starting with PREFIX" |
3591 | msgstr "пише резултате претраге у датотеку која почиње Ñа ПРЕФИКСОМ" | 3591 | msgstr "пише резултате претраге у датотеку која почиње Ñа ПРЕФИКСОМ" |
3592 | 3592 | ||
3593 | #: src/fs/gnunet-search.c:348 | 3593 | #: src/fs/gnunet-search.c:351 |
3594 | msgid "automatically terminate search after DELAY" | 3594 | msgid "automatically terminate search after DELAY" |
3595 | msgstr "ÑамоÑтално окончава претрагу након ЗÐСТОЈÐ" | 3595 | msgstr "ÑамоÑтално окончава претрагу након ЗÐСТОЈÐ" |
3596 | 3596 | ||
3597 | #: src/fs/gnunet-search.c:354 | 3597 | #: src/fs/gnunet-search.c:357 |
3598 | msgid "automatically terminate search after VALUE results are found" | 3598 | msgid "automatically terminate search after VALUE results are found" |
3599 | msgstr "ÑамоÑтално окончава претрагу након што Ñу пронађени резултати ВРЕДÐОСТ" | 3599 | msgstr "ÑамоÑтално окончава претрагу након што Ñу пронађени резултати ВРЕДÐОСТ" |
3600 | 3600 | ||
3601 | #: src/fs/gnunet-search.c:368 | 3601 | #: src/fs/gnunet-search.c:371 |
3602 | msgid "Search GNUnet for files that were published on GNUnet" | 3602 | msgid "Search GNUnet for files that were published on GNUnet" |
3603 | msgstr "Претражује ГÐУнет за датотекама које Ñу објављене на ГÐУнет-у" | 3603 | msgstr "Претражује ГÐУнет за датотекама које Ñу објављене на ГÐУнет-у" |
3604 | 3604 | ||
@@ -3971,7 +3971,7 @@ msgstr "" | |||
3971 | msgid "Expected a base32-encoded public zone key\n" | 3971 | msgid "Expected a base32-encoded public zone key\n" |
3972 | msgstr "" | 3972 | msgstr "" |
3973 | 3973 | ||
3974 | #: src/gns/gnunet-bcd.c:133 | 3974 | #: src/gns/gnunet-bcd.c:134 |
3975 | #, c-format | 3975 | #, c-format |
3976 | msgid "Refusing `%s' request to HTTP server\n" | 3976 | msgid "Refusing `%s' request to HTTP server\n" |
3977 | msgstr "Одбијам „%s“ захтев за ХТТП Ñервер\n" | 3977 | msgstr "Одбијам „%s“ захтев за ХТТП Ñервер\n" |
@@ -4003,36 +4003,41 @@ msgstr "ГÐУнет ХТТП Ñервер за Ñтварање Ð±Ð¸Ð·Ð½Ð¸Ñ Ðº | |||
4003 | msgid "Failed to pack DNS response into UDP packet!\n" | 4003 | msgid "Failed to pack DNS response into UDP packet!\n" |
4004 | msgstr "ÐиÑам уÑпео да упакујем ДÐС одговор у УДП пакет!\n" | 4004 | msgstr "ÐиÑам уÑпео да упакујем ДÐС одговор у УДП пакет!\n" |
4005 | 4005 | ||
4006 | #: src/gns/gnunet-dns2gns.c:444 | 4006 | #: src/gns/gnunet-dns2gns.c:315 |
4007 | #, fuzzy | ||
4008 | msgid "Failed to parse DNS response!\n" | ||
4009 | msgstr "ÐиÑам уÑпео да обрадим ДÐС одговор\n" | ||
4010 | |||
4011 | #: src/gns/gnunet-dns2gns.c:452 | ||
4007 | #, c-format | 4012 | #, c-format |
4008 | msgid "Cannot parse DNS request from %s\n" | 4013 | msgid "Cannot parse DNS request from %s\n" |
4009 | msgstr "Ðе могу да обрадим ДÐС захтев од „%s“\n" | 4014 | msgstr "Ðе могу да обрадим ДÐС захтев од „%s“\n" |
4010 | 4015 | ||
4011 | #: src/gns/gnunet-dns2gns.c:460 | 4016 | #: src/gns/gnunet-dns2gns.c:468 |
4012 | #, c-format | 4017 | #, c-format |
4013 | msgid "Received malformed DNS request from %s\n" | 4018 | msgid "Received malformed DNS request from %s\n" |
4014 | msgstr "Примих лош ДÐС захтев од „%s“\n" | 4019 | msgstr "Примих лош ДÐС захтев од „%s“\n" |
4015 | 4020 | ||
4016 | #: src/gns/gnunet-dns2gns.c:468 | 4021 | #: src/gns/gnunet-dns2gns.c:476 |
4017 | #, c-format | 4022 | #, c-format |
4018 | msgid "Received unsupported DNS request from %s\n" | 4023 | msgid "Received unsupported DNS request from %s\n" |
4019 | msgstr "Примих неподржан ДÐС захтев од „%s“\n" | 4024 | msgstr "Примих неподржан ДÐС захтев од „%s“\n" |
4020 | 4025 | ||
4021 | #: src/gns/gnunet-dns2gns.c:629 | 4026 | #: src/gns/gnunet-dns2gns.c:637 |
4022 | msgid "No DNS server specified!\n" | 4027 | msgid "No DNS server specified!\n" |
4023 | msgstr "Ðије наведен ДÐС Ñервер!\n" | 4028 | msgstr "Ðије наведен ДÐС Ñервер!\n" |
4024 | 4029 | ||
4025 | #: src/gns/gnunet-dns2gns.c:778 | 4030 | #: src/gns/gnunet-dns2gns.c:786 |
4026 | msgid "IP of recursive DNS resolver to use (required)" | 4031 | msgid "IP of recursive DNS resolver to use (required)" |
4027 | msgstr "ИП дубинÑког ДÐС решавача за коришћење (потребно)" | 4032 | msgstr "ИП дубинÑког ДÐС решавача за коришћење (потребно)" |
4028 | 4033 | ||
4029 | #: src/gns/gnunet-dns2gns.c:784 | 4034 | #: src/gns/gnunet-dns2gns.c:792 |
4030 | #, fuzzy | 4035 | #, fuzzy |
4031 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4036 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4032 | msgstr "" | 4037 | msgstr "" |
4033 | "УДП прикључник на коме ће оÑлушкивати за долазним ДÐС захтевима; оÑновно: 53" | 4038 | "УДП прикључник на коме ће оÑлушкивати за долазним ДÐС захтевима; оÑновно: 53" |
4034 | 4039 | ||
4035 | #: src/gns/gnunet-dns2gns.c:801 | 4040 | #: src/gns/gnunet-dns2gns.c:809 |
4036 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4041 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4037 | msgstr "ПоÑредник ДÐС-до-ГÐС ГÐУнет-а (ДÐС Ñервер)" | 4042 | msgstr "ПоÑредник ДÐС-до-ГÐС ГÐУнет-а (ДÐС Ñервер)" |
4038 | 4043 | ||
@@ -4152,63 +4157,63 @@ msgstr "Ðазив Ñубјекта ССЛ уверења (%s) не одгова | |||
4152 | msgid "Cookie domain `%s' supplied by server is invalid\n" | 4157 | msgid "Cookie domain `%s' supplied by server is invalid\n" |
4153 | msgstr "Домен колачића „%s“ које је доÑтавио Ñервер је неиÑправан\n" | 4158 | msgstr "Домен колачића „%s“ које је доÑтавио Ñервер је неиÑправан\n" |
4154 | 4159 | ||
4155 | #: src/gns/gnunet-gns-proxy.c:2133 | 4160 | #: src/gns/gnunet-gns-proxy.c:2134 |
4156 | #, c-format | 4161 | #, c-format |
4157 | msgid "Unsupported HTTP method `%s'\n" | 4162 | msgid "Unsupported HTTP method `%s'\n" |
4158 | msgstr "Ðеподржан ХТТП метод „%s“\n" | 4163 | msgstr "Ðеподржан ХТТП метод „%s“\n" |
4159 | 4164 | ||
4160 | #: src/gns/gnunet-gns-proxy.c:2657 | 4165 | #: src/gns/gnunet-gns-proxy.c:2658 |
4161 | #, c-format | 4166 | #, c-format |
4162 | msgid "Unable to import private key from file `%s'\n" | 4167 | msgid "Unable to import private key from file `%s'\n" |
4163 | msgstr "Ðе могу да увезем приватни кључ из датотеке „%s“\n" | 4168 | msgstr "Ðе могу да увезем приватни кључ из датотеке „%s“\n" |
4164 | 4169 | ||
4165 | #: src/gns/gnunet-gns-proxy.c:2689 | 4170 | #: src/gns/gnunet-gns-proxy.c:2690 |
4166 | #, fuzzy, c-format | 4171 | #, fuzzy, c-format |
4167 | msgid "Unable to import certificate from `%s'\n" | 4172 | msgid "Unable to import certificate from `%s'\n" |
4168 | msgstr "Ðе могу да увезем уверење „%s“\n" | 4173 | msgstr "Ðе могу да увезем уверење „%s“\n" |
4169 | 4174 | ||
4170 | #: src/gns/gnunet-gns-proxy.c:2898 | 4175 | #: src/gns/gnunet-gns-proxy.c:2899 |
4171 | #, c-format | 4176 | #, c-format |
4172 | msgid "Failed to start HTTPS server for `%s'\n" | 4177 | msgid "Failed to start HTTPS server for `%s'\n" |
4173 | msgstr "ÐиÑам уÑпео да покренем ХТТПС Ñервер за „%s“\n" | 4178 | msgstr "ÐиÑам уÑпео да покренем ХТТПС Ñервер за „%s“\n" |
4174 | 4179 | ||
4175 | #: src/gns/gnunet-gns-proxy.c:2922 src/rest/gnunet-rest-server.c:917 | 4180 | #: src/gns/gnunet-gns-proxy.c:2923 src/rest/gnunet-rest-server.c:917 |
4176 | msgid "Failed to pass client to MHD\n" | 4181 | msgid "Failed to pass client to MHD\n" |
4177 | msgstr "ÐиÑам уÑпео да проÑледим клијента МХД-у\n" | 4182 | msgstr "ÐиÑам уÑпео да проÑледим клијента МХД-у\n" |
4178 | 4183 | ||
4179 | #: src/gns/gnunet-gns-proxy.c:3271 | 4184 | #: src/gns/gnunet-gns-proxy.c:3272 |
4180 | #, c-format | 4185 | #, c-format |
4181 | msgid "Unsupported socks version %d\n" | 4186 | msgid "Unsupported socks version %d\n" |
4182 | msgstr "Ðеподржано издање прикључнице %d\n" | 4187 | msgstr "Ðеподржано издање прикључнице %d\n" |
4183 | 4188 | ||
4184 | #: src/gns/gnunet-gns-proxy.c:3303 | 4189 | #: src/gns/gnunet-gns-proxy.c:3304 |
4185 | #, c-format | 4190 | #, c-format |
4186 | msgid "Unsupported socks command %d\n" | 4191 | msgid "Unsupported socks command %d\n" |
4187 | msgstr "Ðеподржана наредба прикључнице %d\n" | 4192 | msgstr "Ðеподржана наредба прикључнице %d\n" |
4188 | 4193 | ||
4189 | #: src/gns/gnunet-gns-proxy.c:3389 | 4194 | #: src/gns/gnunet-gns-proxy.c:3390 |
4190 | #, c-format | 4195 | #, c-format |
4191 | msgid "Unsupported socks address type %d\n" | 4196 | msgid "Unsupported socks address type %d\n" |
4192 | msgstr "Ðеподржана врÑта адреÑе прикључнице %d\n" | 4197 | msgstr "Ðеподржана врÑта адреÑе прикључнице %d\n" |
4193 | 4198 | ||
4194 | #: src/gns/gnunet-gns-proxy.c:3730 | 4199 | #: src/gns/gnunet-gns-proxy.c:3731 |
4195 | #, fuzzy, c-format | 4200 | #, fuzzy, c-format |
4196 | msgid "Failed to load X.509 key and certificate from `%s'\n" | 4201 | msgid "Failed to load X.509 key and certificate from `%s'\n" |
4197 | msgstr "ÐиÑам уÑпео да учитам ССЛ/ТЛС кључ и уверење из „%s“\n" | 4202 | msgstr "ÐиÑам уÑпео да учитам ССЛ/ТЛС кључ и уверење из „%s“\n" |
4198 | 4203 | ||
4199 | #: src/gns/gnunet-gns-proxy.c:3864 | 4204 | #: src/gns/gnunet-gns-proxy.c:3865 |
4200 | msgid "listen on specified port (default: 7777)" | 4205 | msgid "listen on specified port (default: 7777)" |
4201 | msgstr "оÑлушкиван на наведеном прикључнику (оÑновно: 7777)" | 4206 | msgstr "оÑлушкиван на наведеном прикључнику (оÑновно: 7777)" |
4202 | 4207 | ||
4203 | #: src/gns/gnunet-gns-proxy.c:3869 | 4208 | #: src/gns/gnunet-gns-proxy.c:3870 |
4204 | msgid "pem file to use as CA" | 4209 | msgid "pem file to use as CA" |
4205 | msgstr "пем датотека за коришћење као издавач уверења" | 4210 | msgstr "пем датотека за коришћење као издавач уверења" |
4206 | 4211 | ||
4207 | #: src/gns/gnunet-gns-proxy.c:3873 | 4212 | #: src/gns/gnunet-gns-proxy.c:3874 |
4208 | msgid "disable use of IPv6" | 4213 | msgid "disable use of IPv6" |
4209 | msgstr "" | 4214 | msgstr "" |
4210 | 4215 | ||
4211 | #: src/gns/gnunet-gns-proxy.c:3899 | 4216 | #: src/gns/gnunet-gns-proxy.c:3900 |
4212 | msgid "GNUnet GNS proxy" | 4217 | msgid "GNUnet GNS proxy" |
4213 | msgstr "ГÐУнет ГÐС поÑредник" | 4218 | msgstr "ГÐУнет ГÐС поÑредник" |
4214 | 4219 | ||
@@ -4231,7 +4236,7 @@ msgstr "Ðе могу да Ñе повежем на ДХТ!\n" | |||
4231 | msgid "Error converting GNS response to DNS response!\n" | 4236 | msgid "Error converting GNS response to DNS response!\n" |
4232 | msgstr "Грешка претварања ГÐС одговора у ДÐС одговор!\n" | 4237 | msgstr "Грешка претварања ГÐС одговора у ДÐС одговор!\n" |
4233 | 4238 | ||
4234 | #: src/gns/gnunet-service-gns_interceptor.c:387 | 4239 | #: src/gns/gnunet-service-gns_interceptor.c:386 |
4235 | msgid "Failed to connect to the DNS service!\n" | 4240 | msgid "Failed to connect to the DNS service!\n" |
4236 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ДÐС уÑлугом!\n" | 4241 | msgstr "ÐиÑам уÑпео да Ñе повежем Ñа ДÐС уÑлугом!\n" |
4237 | 4242 | ||
@@ -4264,36 +4269,36 @@ msgstr "ПреÑкачем Ð·Ð°Ð¿Ð¸Ñ Ð½ÐµÐ¿Ð¾Ð´Ñ€Ð¶Ð°Ð½Ðµ врÑте %d\n" | |||
4264 | msgid "VPN returned empty result for `%s'\n" | 4269 | msgid "VPN returned empty result for `%s'\n" |
4265 | msgstr "ÐТС је вратио резултате за %u адреÑе\n" | 4270 | msgstr "ÐТС је вратио резултате за %u адреÑе\n" |
4266 | 4271 | ||
4267 | #: src/gns/gnunet-service-gns_resolver.c:1910 | 4272 | #: src/gns/gnunet-service-gns_resolver.c:1919 |
4268 | #, c-format | 4273 | #, c-format |
4269 | msgid "Name `%s' cannot be converted to IDNA." | 4274 | msgid "Name `%s' cannot be converted to IDNA." |
4270 | msgstr "" | 4275 | msgstr "" |
4271 | 4276 | ||
4272 | #: src/gns/gnunet-service-gns_resolver.c:1923 | 4277 | #: src/gns/gnunet-service-gns_resolver.c:1934 |
4273 | #, c-format | 4278 | #, c-format |
4274 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" | 4279 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" |
4275 | msgstr "ГÐС претраживање је резултирало ДÐС називом који је предуг („%s“)\n" | 4280 | msgstr "ГÐС претраживање је резултирало ДÐС називом који је предуг („%s“)\n" |
4276 | 4281 | ||
4277 | #: src/gns/gnunet-service-gns_resolver.c:1966 | 4282 | #: src/gns/gnunet-service-gns_resolver.c:1979 |
4278 | #, fuzzy, c-format | 4283 | #, fuzzy, c-format |
4279 | msgid "GNS lookup failed (zero records found for `%s')\n" | 4284 | msgid "GNS lookup failed (zero records found for `%s')\n" |
4280 | msgstr "Дубачење ГÐС претраге није уÑпело (ниÑам нашао Ð·Ð°Ð¿Ð¸Ñ Ð¸Ð·Ð°ÑланÑтва)\n" | 4285 | msgstr "Дубачење ГÐС претраге није уÑпело (ниÑам нашао Ð·Ð°Ð¿Ð¸Ñ Ð¸Ð·Ð°ÑланÑтва)\n" |
4281 | 4286 | ||
4282 | #: src/gns/gnunet-service-gns_resolver.c:2393 | 4287 | #: src/gns/gnunet-service-gns_resolver.c:2406 |
4283 | msgid "GNS lookup recursion failed (no delegation record found)\n" | 4288 | msgid "GNS lookup recursion failed (no delegation record found)\n" |
4284 | msgstr "Дубачење ГÐС претраге није уÑпело (ниÑам нашао Ð·Ð°Ð¿Ð¸Ñ Ð¸Ð·Ð°ÑланÑтва)\n" | 4289 | msgstr "Дубачење ГÐС претраге није уÑпело (ниÑам нашао Ð·Ð°Ð¿Ð¸Ñ Ð¸Ð·Ð°ÑланÑтва)\n" |
4285 | 4290 | ||
4286 | #: src/gns/gnunet-service-gns_resolver.c:2416 | 4291 | #: src/gns/gnunet-service-gns_resolver.c:2429 |
4287 | #, c-format | 4292 | #, c-format |
4288 | msgid "Failed to cache GNS resolution: %s\n" | 4293 | msgid "Failed to cache GNS resolution: %s\n" |
4289 | msgstr "ÐиÑам уÑпео да ÑмеÑтим у оÑтаву ГÐС резолуцију: %s\n" | 4294 | msgstr "ÐиÑам уÑпео да ÑмеÑтим у оÑтаву ГÐС резолуцију: %s\n" |
4290 | 4295 | ||
4291 | #: src/gns/gnunet-service-gns_resolver.c:2581 | 4296 | #: src/gns/gnunet-service-gns_resolver.c:2594 |
4292 | #, fuzzy, c-format | 4297 | #, fuzzy, c-format |
4293 | msgid "GNS namecache returned empty result for `%s'\n" | 4298 | msgid "GNS namecache returned empty result for `%s'\n" |
4294 | msgstr "ÐТС је вратио резултате за %u адреÑе\n" | 4299 | msgstr "ÐТС је вратио резултате за %u адреÑе\n" |
4295 | 4300 | ||
4296 | #: src/gns/gnunet-service-gns_resolver.c:2721 | 4301 | #: src/gns/gnunet-service-gns_resolver.c:2734 |
4297 | #, c-format | 4302 | #, c-format |
4298 | msgid "Zone %s was revoked, resolution fails\n" | 4303 | msgid "Zone %s was revoked, resolution fails\n" |
4299 | msgstr "Зона %s је опозвана, резолуција није уÑпела\n" | 4304 | msgstr "Зона %s је опозвана, резолуција није уÑпела\n" |
@@ -4327,7 +4332,7 @@ msgstr "Ðе могу да обрадим ниÑку ВПРзапиÑа „%s†| |||
4327 | msgid "Unable to parse BOX record string `%s'\n" | 4332 | msgid "Unable to parse BOX record string `%s'\n" |
4328 | msgstr "Ðе могу да обрадим ниÑку ВПРзапиÑа „%s“\n" | 4333 | msgstr "Ðе могу да обрадим ниÑку ВПРзапиÑа „%s“\n" |
4329 | 4334 | ||
4330 | #: src/gns/plugin_rest_gns.c:448 | 4335 | #: src/gns/plugin_rest_gns.c:450 |
4331 | #, fuzzy | 4336 | #, fuzzy |
4332 | msgid "Gns REST API initialized\n" | 4337 | msgid "Gns REST API initialized\n" |
4333 | msgstr "Меш је покренут\n" | 4338 | msgstr "Меш је покренут\n" |
@@ -4674,7 +4679,7 @@ msgstr "наиђох на иÑтекле адреÑе" | |||
4674 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 | 4679 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 |
4675 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 | 4680 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 |
4676 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 | 4681 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 |
4677 | #: src/peerinfo-tool/gnunet-peerinfo.c:515 | 4682 | #: src/peerinfo-tool/gnunet-peerinfo.c:516 |
4678 | #: src/topology/gnunet-daemon-topology.c:799 | 4683 | #: src/topology/gnunet-daemon-topology.c:799 |
4679 | #, c-format | 4684 | #, c-format |
4680 | msgid "Error in communication with PEERINFO service: %s\n" | 4685 | msgid "Error in communication with PEERINFO service: %s\n" |
@@ -4846,8 +4851,8 @@ msgid "default configured, but ego unknown (internal error)" | |||
4846 | msgstr "оÑновни је подешен, али его није познат (унутрашња грешка)" | 4851 | msgstr "оÑновни је подешен, али его није познат (унутрашња грешка)" |
4847 | 4852 | ||
4848 | #: src/identity/gnunet-service-identity.c:621 | 4853 | #: src/identity/gnunet-service-identity.c:621 |
4849 | #: src/identity/gnunet-service-identity.c:898 | 4854 | #: src/identity/gnunet-service-identity.c:896 |
4850 | #: src/identity/gnunet-service-identity.c:1018 | 4855 | #: src/identity/gnunet-service-identity.c:1016 |
4851 | #, c-format | 4856 | #, c-format |
4852 | msgid "Failed to write subsystem default identifier map to `%s'.\n" | 4857 | msgid "Failed to write subsystem default identifier map to `%s'.\n" |
4853 | msgstr "ÐиÑам уÑпео да запишем оÑновну мапу одредника подÑиÑтема у „%s“.\n" | 4858 | msgstr "ÐиÑам уÑпео да запишем оÑновну мапу одредника подÑиÑтема у „%s“.\n" |
@@ -4856,31 +4861,31 @@ msgstr "ÐиÑам уÑпео да запишем оÑновну мапу одр | |||
4856 | msgid "Unknown ego specified for service (internal error)" | 4861 | msgid "Unknown ego specified for service (internal error)" |
4857 | msgstr "Ðепознат его је наведен за уÑлугу (унутрашња грешка)" | 4862 | msgstr "Ðепознат его је наведен за уÑлугу (унутрашња грешка)" |
4858 | 4863 | ||
4859 | #: src/identity/gnunet-service-identity.c:726 | 4864 | #: src/identity/gnunet-service-identity.c:725 |
4860 | msgid "identifier already in use for another ego" | 4865 | msgid "identifier already in use for another ego" |
4861 | msgstr "одредник Ñе већ кориÑти за други его" | 4866 | msgstr "одредник Ñе већ кориÑти за други его" |
4862 | 4867 | ||
4863 | #: src/identity/gnunet-service-identity.c:874 | 4868 | #: src/identity/gnunet-service-identity.c:872 |
4864 | msgid "target name already exists" | 4869 | msgid "target name already exists" |
4865 | msgstr "назив мете већ поÑтоји" | 4870 | msgstr "назив мете већ поÑтоји" |
4866 | 4871 | ||
4867 | #: src/identity/gnunet-service-identity.c:916 | 4872 | #: src/identity/gnunet-service-identity.c:914 |
4868 | #: src/identity/gnunet-service-identity.c:1035 | 4873 | #: src/identity/gnunet-service-identity.c:1033 |
4869 | msgid "no matching ego found" | 4874 | msgid "no matching ego found" |
4870 | msgstr "ниÑам нашао одговарајући его" | 4875 | msgstr "ниÑам нашао одговарајући его" |
4871 | 4876 | ||
4872 | #: src/identity/gnunet-service-identity.c:1133 | 4877 | #: src/identity/gnunet-service-identity.c:1131 |
4873 | #, c-format | 4878 | #, c-format |
4874 | msgid "Failed to parse ego information in `%s'\n" | 4879 | msgid "Failed to parse ego information in `%s'\n" |
4875 | msgstr "ÐиÑам уÑпео да обрадим податке егоа у „%s“\n" | 4880 | msgstr "ÐиÑам уÑпео да обрадим податке егоа у „%s“\n" |
4876 | 4881 | ||
4877 | #: src/identity/gnunet-service-identity.c:1191 | 4882 | #: src/identity/gnunet-service-identity.c:1189 |
4878 | #, c-format | 4883 | #, c-format |
4879 | msgid "Failed to parse subsystem identity configuration file `%s'\n" | 4884 | msgid "Failed to parse subsystem identity configuration file `%s'\n" |
4880 | msgstr "" | 4885 | msgstr "" |
4881 | "ÐиÑам уÑпео да обрадим датотеку подешавања идентитета ÑубÑиÑтема „%s“\n" | 4886 | "ÐиÑам уÑпео да обрадим датотеку подешавања идентитета ÑубÑиÑтема „%s“\n" |
4882 | 4887 | ||
4883 | #: src/identity/gnunet-service-identity.c:1200 | 4888 | #: src/identity/gnunet-service-identity.c:1198 |
4884 | #, c-format | 4889 | #, c-format |
4885 | msgid "Failed to create directory `%s' for storing egos\n" | 4890 | msgid "Failed to create directory `%s' for storing egos\n" |
4886 | msgstr "ÐиÑам уÑпео да направим директоријум „%s“ за Ñмештајне егое\n" | 4891 | msgstr "ÐиÑам уÑпео да направим директоријум „%s“ за Ñмештајне егое\n" |
@@ -5114,7 +5119,7 @@ msgid "Invalid public key for reverse lookup `%s'\n" | |||
5114 | msgstr "ÐеиÑправан јавни кључ за обратну претрагу „%s“\n" | 5119 | msgstr "ÐеиÑправан јавни кључ за обратну претрагу „%s“\n" |
5115 | 5120 | ||
5116 | #: src/namestore/gnunet-namestore.c:1220 | 5121 | #: src/namestore/gnunet-namestore.c:1220 |
5117 | #: src/peerinfo-tool/gnunet-peerinfo.c:736 | 5122 | #: src/peerinfo-tool/gnunet-peerinfo.c:737 |
5118 | #, c-format | 5123 | #, c-format |
5119 | msgid "Invalid URI `%s'\n" | 5124 | msgid "Invalid URI `%s'\n" |
5120 | msgstr "ÐеиÑправан УРИ „%s“\n" | 5125 | msgstr "ÐеиÑправан УРИ „%s“\n" |
@@ -5296,7 +5301,7 @@ msgstr "" | |||
5296 | msgid "GNU Name System First Come First Serve name registration service" | 5301 | msgid "GNU Name System First Come First Serve name registration service" |
5297 | msgstr "УÑлуга региÑтрације назива Први Стиже Први Служи ГÐУ СиÑтема Ðазива" | 5302 | msgstr "УÑлуга региÑтрације назива Први Стиже Први Служи ГÐУ СиÑтема Ðазива" |
5298 | 5303 | ||
5299 | #: src/namestore/gnunet-service-namestore.c:866 | 5304 | #: src/namestore/gnunet-service-namestore.c:871 |
5300 | #, c-format | 5305 | #, c-format |
5301 | msgid "Failed to replicate block in namecache: %s\n" | 5306 | msgid "Failed to replicate block in namecache: %s\n" |
5302 | msgstr "ÐиÑам уÑпео да реплицирам блок у оÑтави назива: %s\n" | 5307 | msgstr "ÐиÑам уÑпео да реплицирам блок у оÑтави назива: %s\n" |
@@ -5328,7 +5333,7 @@ msgstr "" | |||
5328 | msgid "Flat file database running\n" | 5333 | msgid "Flat file database running\n" |
5329 | msgstr "База података шаблона ради\n" | 5334 | msgstr "База података шаблона ради\n" |
5330 | 5335 | ||
5331 | #: src/namestore/plugin_rest_namestore.c:1103 | 5336 | #: src/namestore/plugin_rest_namestore.c:1105 |
5332 | #, fuzzy | 5337 | #, fuzzy |
5333 | msgid "Namestore REST API initialized\n" | 5338 | msgid "Namestore REST API initialized\n" |
5334 | msgstr "Меш је покренут\n" | 5339 | msgstr "Меш је покренут\n" |
@@ -5648,8 +5653,8 @@ msgstr "заÑтој између рунди" | |||
5648 | msgid "Measure quality and performance of the NSE service." | 5653 | msgid "Measure quality and performance of the NSE service." |
5649 | msgstr "Мери квалитет и учинковитоÑÑ‚ ÐСЕ уÑлуге." | 5654 | msgstr "Мери квалитет и учинковитоÑÑ‚ ÐСЕ уÑлуге." |
5650 | 5655 | ||
5651 | #: src/nse/gnunet-service-nse.c:1443 | 5656 | #: src/nse/gnunet-service-nse.c:1450 |
5652 | #: src/revocation/gnunet-service-revocation.c:875 src/util/gnunet-scrypt.c:257 | 5657 | #: src/revocation/gnunet-service-revocation.c:883 src/util/gnunet-scrypt.c:260 |
5653 | msgid "Value is too large.\n" | 5658 | msgid "Value is too large.\n" |
5654 | msgstr "ВредноÑÑ‚ је превелика.\n" | 5659 | msgstr "ВредноÑÑ‚ је превелика.\n" |
5655 | 5660 | ||
@@ -5691,17 +5696,17 @@ msgstr "Скенирам директоријум „%s“\n" | |||
5691 | msgid "Still no peers found in `%s'!\n" | 5696 | msgid "Still no peers found in `%s'!\n" |
5692 | msgstr "Још увек ниÑам нашао парњаке у „%s“!\n" | 5697 | msgstr "Још увек ниÑам нашао парњаке у „%s“!\n" |
5693 | 5698 | ||
5694 | #: src/peerinfo/gnunet-service-peerinfo.c:1024 | 5699 | #: src/peerinfo/gnunet-service-peerinfo.c:1027 |
5695 | #, c-format | 5700 | #, c-format |
5696 | msgid "Cleaning up directory `%s'\n" | 5701 | msgid "Cleaning up directory `%s'\n" |
5697 | msgstr "ЧиÑтим директоријум „%s“\n" | 5702 | msgstr "ЧиÑтим директоријум „%s“\n" |
5698 | 5703 | ||
5699 | #: src/peerinfo/gnunet-service-peerinfo.c:1319 | 5704 | #: src/peerinfo/gnunet-service-peerinfo.c:1322 |
5700 | #, c-format | 5705 | #, c-format |
5701 | msgid "Importing HELLOs from `%s'\n" | 5706 | msgid "Importing HELLOs from `%s'\n" |
5702 | msgstr "Увозим „HELLO“-е из „%s“\n" | 5707 | msgstr "Увозим „HELLO“-е из „%s“\n" |
5703 | 5708 | ||
5704 | #: src/peerinfo/gnunet-service-peerinfo.c:1332 | 5709 | #: src/peerinfo/gnunet-service-peerinfo.c:1335 |
5705 | msgid "Skipping import of included HELLOs\n" | 5710 | msgid "Skipping import of included HELLOs\n" |
5706 | msgstr "ПреÑкачем увоз укључених „HELLO“-а\n" | 5711 | msgstr "ПреÑкачем увоз укључених „HELLO“-а\n" |
5707 | 5712 | ||
@@ -5720,7 +5725,7 @@ msgid "\tExpires: %s \t %s\n" | |||
5720 | msgstr "\tИÑтиче: %s \t %s\n" | 5725 | msgstr "\tИÑтиче: %s \t %s\n" |
5721 | 5726 | ||
5722 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 | 5727 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 |
5723 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:523 | 5728 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:525 |
5724 | #, fuzzy, c-format | 5729 | #, fuzzy, c-format |
5725 | msgid "Failure: Cannot convert address to string for peer `%s'\n" | 5730 | msgid "Failure: Cannot convert address to string for peer `%s'\n" |
5726 | msgstr "ÐиÑам уÑпео да решим адреÑу за парњака „%s“\n" | 5731 | msgstr "ÐиÑам уÑпео да решим адреÑу за парњака „%s“\n" |
@@ -5730,54 +5735,54 @@ msgstr "ÐиÑам уÑпео да решим адреÑу за парњака â | |||
5730 | msgid "Failure: Received invalid %s\n" | 5735 | msgid "Failure: Received invalid %s\n" |
5731 | msgstr "ÐеуÑпех: Примих неиÑправно „%s“\n" | 5736 | msgstr "ÐеуÑпех: Примих неиÑправно „%s“\n" |
5732 | 5737 | ||
5733 | #: src/peerinfo-tool/gnunet-peerinfo.c:463 | 5738 | #: src/peerinfo-tool/gnunet-peerinfo.c:464 |
5734 | #, c-format | 5739 | #, c-format |
5735 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" | 5740 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" |
5736 | msgstr "ÐиÑам уÑпео да упишем „HELLO“ Ñа %u бајта у датотеку „%s“\n" | 5741 | msgstr "ÐиÑам уÑпео да упишем „HELLO“ Ñа %u бајта у датотеку „%s“\n" |
5737 | 5742 | ||
5738 | #: src/peerinfo-tool/gnunet-peerinfo.c:479 | 5743 | #: src/peerinfo-tool/gnunet-peerinfo.c:480 |
5739 | #, c-format | 5744 | #, c-format |
5740 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" | 5745 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" |
5741 | msgstr "ЗапиÑах „%s HELLO“ које Ñадржи %u адреÑе Ñа %u бајта у датотеку „%s“\n" | 5746 | msgstr "ЗапиÑах „%s HELLO“ које Ñадржи %u адреÑе Ñа %u бајта у датотеку „%s“\n" |
5742 | 5747 | ||
5743 | #: src/peerinfo-tool/gnunet-peerinfo.c:758 | 5748 | #: src/peerinfo-tool/gnunet-peerinfo.c:759 |
5744 | #, c-format | 5749 | #, c-format |
5745 | msgid "I am peer `%s'.\n" | 5750 | msgid "I am peer `%s'.\n" |
5746 | msgstr "Ја Ñам парњак „%s“.\n" | 5751 | msgstr "Ја Ñам парњак „%s“.\n" |
5747 | 5752 | ||
5748 | #: src/peerinfo-tool/gnunet-peerinfo.c:799 | 5753 | #: src/peerinfo-tool/gnunet-peerinfo.c:800 |
5749 | msgid "don't resolve host names" | 5754 | msgid "don't resolve host names" |
5750 | msgstr "не разрешава називе домаћина" | 5755 | msgstr "не разрешава називе домаћина" |
5751 | 5756 | ||
5752 | #: src/peerinfo-tool/gnunet-peerinfo.c:805 | 5757 | #: src/peerinfo-tool/gnunet-peerinfo.c:806 |
5753 | msgid "output only the identity strings" | 5758 | msgid "output only the identity strings" |
5754 | msgstr "иÑпиÑује Ñамо ниÑке идентитета" | 5759 | msgstr "иÑпиÑује Ñамо ниÑке идентитета" |
5755 | 5760 | ||
5756 | #: src/peerinfo-tool/gnunet-peerinfo.c:810 | 5761 | #: src/peerinfo-tool/gnunet-peerinfo.c:811 |
5757 | msgid "include friend-only information" | 5762 | msgid "include friend-only information" |
5758 | msgstr "укључује податке Ñамо-пријатељ" | 5763 | msgstr "укључује податке Ñамо-пријатељ" |
5759 | 5764 | ||
5760 | #: src/peerinfo-tool/gnunet-peerinfo.c:815 | 5765 | #: src/peerinfo-tool/gnunet-peerinfo.c:816 |
5761 | msgid "output our own identity only" | 5766 | msgid "output our own identity only" |
5762 | msgstr "иÑпиÑује Ñамо наш лични идентитет" | 5767 | msgstr "иÑпиÑује Ñамо наш лични идентитет" |
5763 | 5768 | ||
5764 | #: src/peerinfo-tool/gnunet-peerinfo.c:820 | 5769 | #: src/peerinfo-tool/gnunet-peerinfo.c:821 |
5765 | msgid "list all known peers" | 5770 | msgid "list all known peers" |
5766 | msgstr "иÑпиÑује Ñве познате парњаке" | 5771 | msgstr "иÑпиÑује Ñве познате парњаке" |
5767 | 5772 | ||
5768 | #: src/peerinfo-tool/gnunet-peerinfo.c:826 | 5773 | #: src/peerinfo-tool/gnunet-peerinfo.c:827 |
5769 | msgid "dump hello to file" | 5774 | msgid "dump hello to file" |
5770 | msgstr "шаље „hello“ у датотеку" | 5775 | msgstr "шаље „hello“ у датотеку" |
5771 | 5776 | ||
5772 | #: src/peerinfo-tool/gnunet-peerinfo.c:831 | 5777 | #: src/peerinfo-tool/gnunet-peerinfo.c:832 |
5773 | msgid "also output HELLO uri(s)" | 5778 | msgid "also output HELLO uri(s)" |
5774 | msgstr "такође иÑпиÑује „HELLO“ ури-је" | 5779 | msgstr "такође иÑпиÑује „HELLO“ ури-је" |
5775 | 5780 | ||
5776 | #: src/peerinfo-tool/gnunet-peerinfo.c:838 | 5781 | #: src/peerinfo-tool/gnunet-peerinfo.c:839 |
5777 | msgid "add given HELLO uri to the database" | 5782 | msgid "add given HELLO uri to the database" |
5778 | msgstr "додаје дату „HELLO“ путању у базу података" | 5783 | msgstr "додаје дату „HELLO“ путању у базу података" |
5779 | 5784 | ||
5780 | #: src/peerinfo-tool/gnunet-peerinfo.c:852 | 5785 | #: src/peerinfo-tool/gnunet-peerinfo.c:853 |
5781 | msgid "Print information about peers." | 5786 | msgid "Print information about peers." |
5782 | msgstr "ИÑпиÑује податке о парњацима." | 5787 | msgstr "ИÑпиÑује податке о парњацима." |
5783 | 5788 | ||
@@ -5799,7 +5804,7 @@ msgstr "Учитавам „%s“ прикључак преноÑа\n" | |||
5799 | msgid "Failed to load transport plugin for `%s'\n" | 5804 | msgid "Failed to load transport plugin for `%s'\n" |
5800 | msgstr "ÐиÑам уÑпео да учитам прикључак преноÑа за „%s“\n" | 5805 | msgstr "ÐиÑам уÑпео да учитам прикључак преноÑа за „%s“\n" |
5801 | 5806 | ||
5802 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:809 | 5807 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:811 |
5803 | msgid "Peerinfo REST API initialized\n" | 5808 | msgid "Peerinfo REST API initialized\n" |
5804 | msgstr "" | 5809 | msgstr "" |
5805 | 5810 | ||
@@ -5807,7 +5812,7 @@ msgstr "" | |||
5807 | msgid "peerstore" | 5812 | msgid "peerstore" |
5808 | msgstr "" | 5813 | msgstr "" |
5809 | 5814 | ||
5810 | #: src/peerstore/gnunet-service-peerstore.c:561 | 5815 | #: src/peerstore/gnunet-service-peerstore.c:570 |
5811 | #, fuzzy, c-format | 5816 | #, fuzzy, c-format |
5812 | msgid "Could not load database backend `%s'\n" | 5817 | msgid "Could not load database backend `%s'\n" |
5813 | msgstr "Ðе могу да отворим „%s“.\n" | 5818 | msgstr "Ðе могу да отворим „%s“.\n" |
@@ -5992,11 +5997,11 @@ msgstr "" | |||
5992 | msgid "re:claimID command line tool" | 5997 | msgid "re:claimID command line tool" |
5993 | msgstr "" | 5998 | msgstr "" |
5994 | 5999 | ||
5995 | #: src/reclaim/plugin_rest_openid_connect.c:2613 | 6000 | #: src/reclaim/plugin_rest_openid_connect.c:2788 |
5996 | msgid "OpenID Connect REST API initialized\n" | 6001 | msgid "OpenID Connect REST API initialized\n" |
5997 | msgstr "" | 6002 | msgstr "" |
5998 | 6003 | ||
5999 | #: src/reclaim/plugin_rest_reclaim.c:1502 | 6004 | #: src/reclaim/plugin_rest_reclaim.c:1521 |
6000 | msgid "Identity Provider REST API initialized\n" | 6005 | msgid "Identity Provider REST API initialized\n" |
6001 | msgstr "" | 6006 | msgstr "" |
6002 | 6007 | ||
@@ -6148,115 +6153,115 @@ msgstr "Унутрашња грешка, опозив кључа можда ни | |||
6148 | msgid "Cancelling calculation.\n" | 6153 | msgid "Cancelling calculation.\n" |
6149 | msgstr "" | 6154 | msgstr "" |
6150 | 6155 | ||
6151 | #: src/revocation/gnunet-revocation.c:299 | 6156 | #: src/revocation/gnunet-revocation.c:302 |
6152 | #, c-format | 6157 | #, c-format |
6153 | msgid "Revocation certificate for `%s' stored in `%s'\n" | 6158 | msgid "Revocation certificate for `%s' stored in `%s'\n" |
6154 | msgstr "Уверење опозива за „%s“ је Ñмештено у „%s“\n" | 6159 | msgstr "Уверење опозива за „%s“ је Ñмештено у „%s“\n" |
6155 | 6160 | ||
6156 | #: src/revocation/gnunet-revocation.c:339 | 6161 | #: src/revocation/gnunet-revocation.c:334 |
6157 | #, c-format | 6162 | #, c-format |
6158 | msgid "Ego `%s' not found.\n" | 6163 | msgid "Ego `%s' not found.\n" |
6159 | msgstr "ÐиÑам нашао его „%s“.\n" | 6164 | msgstr "ÐиÑам нашао его „%s“.\n" |
6160 | 6165 | ||
6161 | #: src/revocation/gnunet-revocation.c:356 | 6166 | #: src/revocation/gnunet-revocation.c:351 |
6162 | #, c-format | 6167 | #, c-format |
6163 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" | 6168 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" |
6164 | msgstr "Грешка: уверење опозива у „%s“ није за „%s“\n" | 6169 | msgstr "Грешка: уверење опозива у „%s“ није за „%s“\n" |
6165 | 6170 | ||
6166 | #: src/revocation/gnunet-revocation.c:366 | 6171 | #: src/revocation/gnunet-revocation.c:361 |
6167 | msgid "Revocation certificate ready\n" | 6172 | msgid "Revocation certificate ready\n" |
6168 | msgstr "Уверење опозива је Ñпремно\n" | 6173 | msgstr "Уверење опозива је Ñпремно\n" |
6169 | 6174 | ||
6170 | #: src/revocation/gnunet-revocation.c:378 | 6175 | #: src/revocation/gnunet-revocation.c:373 |
6171 | msgid "Continuing calculation where left off...\n" | 6176 | msgid "Continuing calculation where left off...\n" |
6172 | msgstr "" | 6177 | msgstr "" |
6173 | 6178 | ||
6174 | #: src/revocation/gnunet-revocation.c:385 | 6179 | #: src/revocation/gnunet-revocation.c:380 |
6175 | msgid "Revocation certificate not ready, calculating proof of work\n" | 6180 | msgid "Revocation certificate not ready, calculating proof of work\n" |
6176 | msgstr "Уверење опозива није Ñпремно, израчунавам доказ о раду\n" | 6181 | msgstr "Уверење опозива није Ñпремно, израчунавам доказ о раду\n" |
6177 | 6182 | ||
6178 | #: src/revocation/gnunet-revocation.c:423 | 6183 | #: src/revocation/gnunet-revocation.c:418 |
6179 | #, c-format | 6184 | #, c-format |
6180 | msgid "Public key `%s' malformed\n" | 6185 | msgid "Public key `%s' malformed\n" |
6181 | msgstr "Јавни кључ „%s“ је лош\n" | 6186 | msgstr "Јавни кључ „%s“ је лош\n" |
6182 | 6187 | ||
6183 | #: src/revocation/gnunet-revocation.c:433 | 6188 | #: src/revocation/gnunet-revocation.c:428 |
6184 | msgid "" | 6189 | msgid "" |
6185 | "Testing and revoking at the same time is not allowed, only executing test.\n" | 6190 | "Testing and revoking at the same time is not allowed, only executing test.\n" |
6186 | msgstr "" | 6191 | msgstr "" |
6187 | "ТеÑтирање и опозивање у иÑто време није дозвољено, Ñамо теÑтирање " | 6192 | "ТеÑтирање и опозивање у иÑто време није дозвољено, Ñамо теÑтирање " |
6188 | "извршавам.\n" | 6193 | "извршавам.\n" |
6189 | 6194 | ||
6190 | #: src/revocation/gnunet-revocation.c:463 | 6195 | #: src/revocation/gnunet-revocation.c:458 |
6191 | msgid "No filename to store revocation certificate given.\n" | 6196 | msgid "No filename to store revocation certificate given.\n" |
6192 | msgstr "Ðије дат назив датотеке за Ñмештање уверења опозива.\n" | 6197 | msgstr "Ðије дат назив датотеке за Ñмештање уверења опозива.\n" |
6193 | 6198 | ||
6194 | #: src/revocation/gnunet-revocation.c:480 | 6199 | #: src/revocation/gnunet-revocation.c:475 |
6195 | #, c-format | 6200 | #, c-format |
6196 | msgid "Failed to read revocation certificate from `%s'\n" | 6201 | msgid "Failed to read revocation certificate from `%s'\n" |
6197 | msgstr "ÐиÑам уÑпео да прочитам уверење опозива из „%s“\n" | 6202 | msgstr "ÐиÑам уÑпео да прочитам уверење опозива из „%s“\n" |
6198 | 6203 | ||
6199 | #: src/revocation/gnunet-revocation.c:488 | 6204 | #: src/revocation/gnunet-revocation.c:483 |
6200 | #, fuzzy, c-format | 6205 | #, fuzzy, c-format |
6201 | msgid "Revocation certificate corrupted in `%s'\n" | 6206 | msgid "Revocation certificate corrupted in `%s'\n" |
6202 | msgstr "Уверење опозива за „%s“ је Ñмештено у „%s“\n" | 6207 | msgstr "Уверење опозива за „%s“ је Ñмештено у „%s“\n" |
6203 | 6208 | ||
6204 | #: src/revocation/gnunet-revocation.c:510 | 6209 | #: src/revocation/gnunet-revocation.c:505 |
6205 | msgid "No action specified. Nothing to do.\n" | 6210 | msgid "No action specified. Nothing to do.\n" |
6206 | msgstr "Ðије наведена ниједна радња. Ðемам шта да радим.\n" | 6211 | msgstr "Ðије наведена ниједна радња. Ðемам шта да радим.\n" |
6207 | 6212 | ||
6208 | #: src/revocation/gnunet-revocation.c:529 | 6213 | #: src/revocation/gnunet-revocation.c:524 |
6209 | msgid "use NAME for the name of the revocation file" | 6214 | msgid "use NAME for the name of the revocation file" |
6210 | msgstr "кориÑти ÐÐЗИВ за назив датотеке опозивања" | 6215 | msgstr "кориÑти ÐÐЗИВ за назив датотеке опозивања" |
6211 | 6216 | ||
6212 | #: src/revocation/gnunet-revocation.c:537 | 6217 | #: src/revocation/gnunet-revocation.c:532 |
6213 | msgid "" | 6218 | msgid "" |
6214 | "revoke the private key associated for the the private key associated with " | 6219 | "revoke the private key associated for the the private key associated with " |
6215 | "the ego NAME " | 6220 | "the ego NAME " |
6216 | msgstr "опозива лични кључ придружен личном кључу Ñа его ÐÐЗИВОМ " | 6221 | msgstr "опозива лични кључ придружен личном кључу Ñа его ÐÐЗИВОМ " |
6217 | 6222 | ||
6218 | #: src/revocation/gnunet-revocation.c:544 | 6223 | #: src/revocation/gnunet-revocation.c:539 |
6219 | msgid "actually perform revocation, otherwise we just do the precomputation" | 6224 | msgid "actually perform revocation, otherwise we just do the precomputation" |
6220 | msgstr "заправо обавља опозив, у Ñупротном Ñамо радимо предизрачунавање" | 6225 | msgstr "заправо обавља опозив, у Ñупротном Ñамо радимо предизрачунавање" |
6221 | 6226 | ||
6222 | #: src/revocation/gnunet-revocation.c:551 | 6227 | #: src/revocation/gnunet-revocation.c:546 |
6223 | msgid "test if the public key KEY has been revoked" | 6228 | msgid "test if the public key KEY has been revoked" |
6224 | msgstr "теÑтира да ли је јавни кључ КЉУЧ опозван" | 6229 | msgstr "теÑтира да ли је јавни кључ КЉУЧ опозван" |
6225 | 6230 | ||
6226 | #: src/revocation/gnunet-revocation.c:557 | 6231 | #: src/revocation/gnunet-revocation.c:552 |
6227 | msgid "number of epochs to calculate for" | 6232 | msgid "number of epochs to calculate for" |
6228 | msgstr "" | 6233 | msgstr "" |
6229 | 6234 | ||
6230 | #: src/revocation/gnunet-service-revocation.c:494 | 6235 | #: src/revocation/gnunet-service-revocation.c:502 |
6231 | #, fuzzy | 6236 | #, fuzzy |
6232 | msgid "# unsupported revocations received via set union" | 6237 | msgid "# unsupported revocations received via set union" |
6233 | msgstr "ДвоÑтруки опзив је примљен од парњака. Занемарено.\n" | 6238 | msgstr "ДвоÑтруки опзив је примљен од парњака. Занемарено.\n" |
6234 | 6239 | ||
6235 | #: src/revocation/gnunet-service-revocation.c:504 | 6240 | #: src/revocation/gnunet-service-revocation.c:512 |
6236 | #, fuzzy | 6241 | #, fuzzy |
6237 | msgid "# revocation messages received via set union" | 6242 | msgid "# revocation messages received via set union" |
6238 | msgstr "# поруке ПОДÐТÐКРÑу примљене путем блутута" | 6243 | msgstr "# поруке ПОДÐТÐКРÑу примљене путем блутута" |
6239 | 6244 | ||
6240 | #: src/revocation/gnunet-service-revocation.c:509 | 6245 | #: src/revocation/gnunet-service-revocation.c:517 |
6241 | #, c-format | 6246 | #, c-format |
6242 | msgid "Error computing revocation set union with %s\n" | 6247 | msgid "Error computing revocation set union with %s\n" |
6243 | msgstr "Грешка прорачуна уније Ñкупа опозивања Ñа %s\n" | 6248 | msgstr "Грешка прорачуна уније Ñкупа опозивања Ñа %s\n" |
6244 | 6249 | ||
6245 | #: src/revocation/gnunet-service-revocation.c:513 | 6250 | #: src/revocation/gnunet-service-revocation.c:521 |
6246 | #, fuzzy | 6251 | #, fuzzy |
6247 | msgid "# revocation set unions failed" | 6252 | msgid "# revocation set unions failed" |
6248 | msgstr "# Бирање парњака није уÑпело" | 6253 | msgstr "# Бирање парњака није уÑпело" |
6249 | 6254 | ||
6250 | #: src/revocation/gnunet-service-revocation.c:521 | 6255 | #: src/revocation/gnunet-service-revocation.c:529 |
6251 | #, fuzzy | 6256 | #, fuzzy |
6252 | msgid "# revocation set unions completed" | 6257 | msgid "# revocation set unions completed" |
6253 | msgstr "# преноÑи раÑцепканоÑти Ñу завршени" | 6258 | msgstr "# преноÑи раÑцепканоÑти Ñу завршени" |
6254 | 6259 | ||
6255 | #: src/revocation/gnunet-service-revocation.c:559 | 6260 | #: src/revocation/gnunet-service-revocation.c:567 |
6256 | msgid "SET service crashed, terminating revocation service\n" | 6261 | msgid "SET service crashed, terminating revocation service\n" |
6257 | msgstr "УÑлуга ПОСТÐВИ Ñе урушила, окончавам уÑлугу опозивања\n" | 6262 | msgstr "УÑлуга ПОСТÐВИ Ñе урушила, окончавам уÑлугу опозивања\n" |
6258 | 6263 | ||
6259 | #: src/revocation/gnunet-service-revocation.c:912 | 6264 | #: src/revocation/gnunet-service-revocation.c:920 |
6260 | msgid "Could not open revocation database file!" | 6265 | msgid "Could not open revocation database file!" |
6261 | msgstr "Ðе могу да отворим датотеку базе података опозивања!" | 6266 | msgstr "Ðе могу да отворим датотеку базе података опозивања!" |
6262 | 6267 | ||
@@ -6272,21 +6277,21 @@ msgstr "" | |||
6272 | msgid "Get peers from biased stream" | 6277 | msgid "Get peers from biased stream" |
6273 | msgstr "" | 6278 | msgstr "" |
6274 | 6279 | ||
6275 | #: src/rps/gnunet-rps-profiler.c:3200 | 6280 | #: src/rps/gnunet-rps-profiler.c:3142 |
6276 | msgid "duration of the profiling" | 6281 | msgid "duration of the profiling" |
6277 | msgstr "" | 6282 | msgstr "" |
6278 | 6283 | ||
6279 | #: src/rps/gnunet-rps-profiler.c:3206 | 6284 | #: src/rps/gnunet-rps-profiler.c:3148 |
6280 | #, fuzzy | 6285 | #, fuzzy |
6281 | msgid "timeout for the profiling" | 6286 | msgid "timeout for the profiling" |
6282 | msgstr "Ðаводи време иÑтека за претраживање" | 6287 | msgstr "Ðаводи време иÑтека за претраживање" |
6283 | 6288 | ||
6284 | #: src/rps/gnunet-rps-profiler.c:3211 | 6289 | #: src/rps/gnunet-rps-profiler.c:3153 |
6285 | #, fuzzy | 6290 | #, fuzzy |
6286 | msgid "number of PeerIDs to request" | 6291 | msgid "number of PeerIDs to request" |
6287 | msgstr "број парњака у концензуÑу" | 6292 | msgstr "број парњака у концензуÑу" |
6288 | 6293 | ||
6289 | #: src/rps/gnunet-rps-profiler.c:3228 | 6294 | #: src/rps/gnunet-rps-profiler.c:3170 |
6290 | #, fuzzy | 6295 | #, fuzzy |
6291 | msgid "Measure quality and performance of the RPS service." | 6296 | msgid "Measure quality and performance of the RPS service." |
6292 | msgstr "Мери квалитет и учинковитоÑÑ‚ ÐСЕ уÑлуге." | 6297 | msgstr "Мери квалитет и учинковитоÑÑ‚ ÐСЕ уÑлуге." |
@@ -6383,7 +6388,7 @@ msgid "also profile decryption" | |||
6383 | msgstr "такође Ð¾Ð¿Ð¸Ñ Ð¿Ñ€Ð¾Ñ„Ð¸Ð»Ð°" | 6388 | msgstr "такође Ð¾Ð¿Ð¸Ñ Ð¿Ñ€Ð¾Ñ„Ð¸Ð»Ð°" |
6384 | 6389 | ||
6385 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 | 6390 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 |
6386 | #: src/setu/gnunet-service-setu.c:3633 | 6391 | #: src/setu/gnunet-service-setu.c:3832 |
6387 | #, fuzzy | 6392 | #, fuzzy |
6388 | msgid "Could not connect to CADET service\n" | 6393 | msgid "Could not connect to CADET service\n" |
6389 | msgstr "Ðе могу да Ñе повежем Ñа „%s“ уÑлугом!\n" | 6394 | msgstr "Ðе могу да Ñе повежем Ñа „%s“ уÑлугом!\n" |
@@ -6993,14 +6998,14 @@ msgstr "ÐиÑам уÑпео да покренем „%s“: %s\n" | |||
6993 | msgid "Failed to load configuration from %s\n" | 6998 | msgid "Failed to load configuration from %s\n" |
6994 | msgstr "ÐиÑам уÑпео да учитам подешавање за „%s“\n" | 6999 | msgstr "ÐиÑам уÑпео да учитам подешавање за „%s“\n" |
6995 | 7000 | ||
6996 | #: src/topology/friends.c:127 | 7001 | #: src/topology/friends.c:118 |
6997 | #, c-format | 7002 | #, c-format |
6998 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" | 7003 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" |
6999 | msgstr "" | 7004 | msgstr "" |
7000 | "Грешка ÑинтакÑе у датотеци „FRIENDS“ на померају %llu, преÑкачем бајтове " | 7005 | "Грешка ÑинтакÑе у датотеци „FRIENDS“ на померају %llu, преÑкачем бајтове " |
7001 | "„%.*s“.\n" | 7006 | "„%.*s“.\n" |
7002 | 7007 | ||
7003 | #: src/topology/friends.c:181 | 7008 | #: src/topology/friends.c:172 |
7004 | #, c-format | 7009 | #, c-format |
7005 | msgid "Directory for file `%s' does not seem to be writable.\n" | 7010 | msgid "Directory for file `%s' does not seem to be writable.\n" |
7006 | msgstr "Директоријум за датотеку „%s“ не изгледа да је упиÑив.\n" | 7011 | msgstr "Директоријум за датотеку „%s“ не изгледа да је упиÑив.\n" |
@@ -7068,18 +7073,18 @@ msgstr "# „HELLO“ поруке Ñу примљене" | |||
7068 | msgid "GNUnet topology control" | 7073 | msgid "GNUnet topology control" |
7069 | msgstr "" | 7074 | msgstr "" |
7070 | 7075 | ||
7071 | #: src/transport/gnunet-communicator-tcp.c:3221 | 7076 | #: src/transport/gnunet-communicator-tcp.c:3331 |
7072 | #: src/transport/gnunet-communicator-udp.c:3076 | 7077 | #: src/transport/gnunet-communicator-udp.c:3790 |
7073 | #: src/transport/gnunet-service-tng.c:10014 | 7078 | #: src/transport/gnunet-service-tng.c:10220 |
7074 | #: src/transport/gnunet-service-transport.c:2627 | 7079 | #: src/transport/gnunet-service-transport.c:2627 |
7075 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7080 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7076 | msgstr "УÑлузи преноÑа недоÑтају поÑтавке подешавања кључа. Излазим.\n" | 7081 | msgstr "УÑлузи преноÑа недоÑтају поÑтавке подешавања кључа. Излазим.\n" |
7077 | 7082 | ||
7078 | #: src/transport/gnunet-communicator-tcp.c:3553 | 7083 | #: src/transport/gnunet-communicator-tcp.c:3668 |
7079 | msgid "GNUnet TCP communicator" | 7084 | msgid "GNUnet TCP communicator" |
7080 | msgstr "" | 7085 | msgstr "" |
7081 | 7086 | ||
7082 | #: src/transport/gnunet-communicator-udp.c:3148 | 7087 | #: src/transport/gnunet-communicator-udp.c:3862 |
7083 | msgid "GNUnet UDP communicator" | 7088 | msgid "GNUnet UDP communicator" |
7084 | msgstr "" | 7089 | msgstr "" |
7085 | 7090 | ||
@@ -8181,7 +8186,7 @@ msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге не може да покрене функци | |||
8181 | msgid "Service process failed to report status\n" | 8186 | msgid "Service process failed to report status\n" |
8182 | msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да извеÑти о Ñтању\n" | 8187 | msgstr "ÐŸÑ€Ð¾Ñ†ÐµÑ ÑƒÑлуге није уÑпео да извеÑти о Ñтању\n" |
8183 | 8188 | ||
8184 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1176 | 8189 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 |
8185 | #: src/util/service.c:1637 | 8190 | #: src/util/service.c:1637 |
8186 | #, c-format | 8191 | #, c-format |
8187 | msgid "Cannot obtain information about user `%s': %s\n" | 8192 | msgid "Cannot obtain information about user `%s': %s\n" |
@@ -8201,7 +8206,7 @@ msgid "do daemonize (detach from terminal)" | |||
8201 | msgstr "ради демонизацију (откачиње од терминала)" | 8206 | msgstr "ради демонизацију (откачиње од терминала)" |
8202 | 8207 | ||
8203 | #: src/transport/tcp_service_legacy.c:1397 | 8208 | #: src/transport/tcp_service_legacy.c:1397 |
8204 | #: src/transport/transport-testing2.c:985 src/util/service.c:2072 | 8209 | #: src/transport/transport-testing-communicator.c:1045 src/util/service.c:2072 |
8205 | #: src/util/service.c:2084 | 8210 | #: src/util/service.c:2084 |
8206 | #, c-format | 8211 | #, c-format |
8207 | msgid "Malformed configuration file `%s', exit ...\n" | 8212 | msgid "Malformed configuration file `%s', exit ...\n" |
@@ -8366,21 +8371,21 @@ msgid "" | |||
8366 | msgstr "" | 8371 | msgstr "" |
8367 | "Подешавање наводи неиÑправну вредноÑÑ‚ за опцију „%s“ у одељку „%s“: %s\n" | 8372 | "Подешавање наводи неиÑправну вредноÑÑ‚ за опцију „%s“ у одељку „%s“: %s\n" |
8368 | 8373 | ||
8369 | #: src/util/configuration.c:402 | 8374 | #: src/util/configuration.c:370 |
8370 | #, c-format | 8375 | #, c-format |
8371 | msgid "Syntax error while deserializing in line %u\n" | 8376 | msgid "Syntax error while deserializing in line %u\n" |
8372 | msgstr "Грешка ÑинтакÑе приликом деÑеријализације у реду %u\n" | 8377 | msgstr "Грешка ÑинтакÑе приликом деÑеријализације у реду %u\n" |
8373 | 8378 | ||
8374 | #: src/util/configuration.c:460 | 8379 | #: src/util/configuration.c:420 |
8375 | #, fuzzy, c-format | 8380 | #, fuzzy, c-format |
8376 | msgid "Error while reading file `%s'\n" | 8381 | msgid "Error while reading file `%s'\n" |
8377 | msgstr "Грешка отварања датотеке „%s“: %s\n" | 8382 | msgstr "Грешка отварања датотеке „%s“: %s\n" |
8378 | 8383 | ||
8379 | #: src/util/configuration.c:1063 | 8384 | #: src/util/configuration.c:980 |
8380 | msgid "Not a valid relative time specification" | 8385 | msgid "Not a valid relative time specification" |
8381 | msgstr "" | 8386 | msgstr "" |
8382 | 8387 | ||
8383 | #: src/util/configuration.c:1154 | 8388 | #: src/util/configuration.c:1050 |
8384 | #, c-format | 8389 | #, c-format |
8385 | msgid "" | 8390 | msgid "" |
8386 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " | 8391 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " |
@@ -8389,17 +8394,17 @@ msgstr "" | |||
8389 | "ВредноÑÑ‚ подешавања '%s' за '%s' у одељку '%s' није ÑƒÑ ÐºÑƒÐ¿Ñƒ иÑправних " | 8394 | "ВредноÑÑ‚ подешавања '%s' за '%s' у одељку '%s' није ÑƒÑ ÐºÑƒÐ¿Ñƒ иÑправних " |
8390 | "избора\n" | 8395 | "избора\n" |
8391 | 8396 | ||
8392 | #: src/util/configuration.c:1269 | 8397 | #: src/util/configuration.c:1145 |
8393 | #, c-format | 8398 | #, c-format |
8394 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" | 8399 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" |
8395 | msgstr "Сумња Ñе на дубинÑко ширење, прекидам $-ширење за термин „%s“\n" | 8400 | msgstr "Сумња Ñе на дубинÑко ширење, прекидам $-ширење за термин „%s“\n" |
8396 | 8401 | ||
8397 | #: src/util/configuration.c:1301 | 8402 | #: src/util/configuration.c:1177 |
8398 | #, c-format | 8403 | #, c-format |
8399 | msgid "Missing closing `%s' in option `%s'\n" | 8404 | msgid "Missing closing `%s' in option `%s'\n" |
8400 | msgstr "ÐедоÑтаје затварење „%s“ у опцији „%s“\n" | 8405 | msgstr "ÐедоÑтаје затварење „%s“ у опцији „%s“\n" |
8401 | 8406 | ||
8402 | #: src/util/configuration.c:1367 | 8407 | #: src/util/configuration.c:1243 |
8403 | #, c-format | 8408 | #, c-format |
8404 | msgid "" | 8409 | msgid "" |
8405 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " | 8410 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " |
@@ -8417,36 +8422,36 @@ msgstr "" | |||
8417 | "Величина датотеке на диÑку није тачна за овај Блум филтер (желим %llu, имам " | 8422 | "Величина датотеке на диÑку није тачна за овај Блум филтер (желим %llu, имам " |
8418 | "%llu)\n" | 8423 | "%llu)\n" |
8419 | 8424 | ||
8420 | #: src/util/crypto_ecc.c:663 | 8425 | #: src/util/crypto_ecc.c:567 |
8421 | #, c-format | 8426 | #, c-format |
8422 | msgid "ECC signing failed at %s:%d: %s\n" | 8427 | msgid "ECC signing failed at %s:%d: %s\n" |
8423 | msgstr "„ECC“ потпиÑивање није уÑпело на %s:%d: %s\n" | 8428 | msgstr "„ECC“ потпиÑивање није уÑпело на %s:%d: %s\n" |
8424 | 8429 | ||
8425 | #: src/util/crypto_ecc.c:791 | 8430 | #: src/util/crypto_ecc.c:669 |
8426 | #, c-format | 8431 | #, c-format |
8427 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 8432 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
8428 | msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:%d: %s\n" | 8433 | msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:%d: %s\n" |
8429 | 8434 | ||
8430 | #: src/util/crypto_ecc_setup.c:369 | 8435 | #: src/util/crypto_ecc_setup.c:273 |
8431 | msgid "Could not load peer's private key\n" | 8436 | msgid "Could not load peer's private key\n" |
8432 | msgstr "Ðе могу да учитам лични кључ парњака\n" | 8437 | msgstr "Ðе могу да учитам лични кључ парњака\n" |
8433 | 8438 | ||
8434 | #: src/util/crypto_random.c:345 | 8439 | #: src/util/crypto_random.c:381 |
8435 | #, c-format | 8440 | #, c-format |
8436 | msgid "libgcrypt has not the expected version (version %s is required).\n" | 8441 | msgid "libgcrypt has not the expected version (version %s is required).\n" |
8437 | msgstr "„libgcrypt“ није очекиваног издања (издање %s је потребно).\n" | 8442 | msgstr "„libgcrypt“ није очекиваног издања (издање %s је потребно).\n" |
8438 | 8443 | ||
8439 | #: src/util/crypto_rsa.c:959 | 8444 | #: src/util/crypto_rsa.c:862 |
8440 | #, fuzzy, c-format | 8445 | #, fuzzy, c-format |
8441 | msgid "RSA signing failed at %s:%d: %s\n" | 8446 | msgid "RSA signing failed at %s:%d: %s\n" |
8442 | msgstr "„EdDSA“ потпиÑивање није уÑпело на %s:%d: %s\n" | 8447 | msgstr "„EdDSA“ потпиÑивање није уÑпело на %s:%d: %s\n" |
8443 | 8448 | ||
8444 | #: src/util/crypto_rsa.c:1318 | 8449 | #: src/util/crypto_rsa.c:1162 |
8445 | #, fuzzy, c-format | 8450 | #, fuzzy, c-format |
8446 | msgid "RSA signature verification failed at %s:%d: %s\n" | 8451 | msgid "RSA signature verification failed at %s:%d: %s\n" |
8447 | msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:%d: %s\n" | 8452 | msgstr "Провера „ECDSA“ потпиÑа није уÑпела на %s:%d: %s\n" |
8448 | 8453 | ||
8449 | #: src/util/disk.c:940 | 8454 | #: src/util/disk.c:823 |
8450 | #, c-format | 8455 | #, c-format |
8451 | msgid "Expected `%s' to be a directory!\n" | 8456 | msgid "Expected `%s' to be a directory!\n" |
8452 | msgstr "Очекивах да „%s“ буде директоријум!\n" | 8457 | msgstr "Очекивах да „%s“ буде директоријум!\n" |
@@ -8531,17 +8536,17 @@ msgstr "%s: опција „-W %s“ је нејаÑна\n" | |||
8531 | msgid "%s: option `-W %s' does not allow an argument\n" | 8536 | msgid "%s: option `-W %s' does not allow an argument\n" |
8532 | msgstr "%s: опција „-W %s“ не дозвољава аргумент\n" | 8537 | msgstr "%s: опција „-W %s“ не дозвољава аргумент\n" |
8533 | 8538 | ||
8534 | #: src/util/getopt.c:974 | 8539 | #: src/util/getopt.c:970 |
8535 | #, c-format | 8540 | #, c-format |
8536 | msgid "Use %s to get a list of options.\n" | 8541 | msgid "Use %s to get a list of options.\n" |
8537 | msgstr "Употребите „%s“ да добавите ÑпиÑак опција.\n" | 8542 | msgstr "Употребите „%s“ да добавите ÑпиÑак опција.\n" |
8538 | 8543 | ||
8539 | #: src/util/getopt.c:986 | 8544 | #: src/util/getopt.c:983 |
8540 | #, fuzzy, c-format | 8545 | #, fuzzy, c-format |
8541 | msgid "Option `%s' can't be used with other options.\n" | 8546 | msgid "Option `%s' can't be used with other options.\n" |
8542 | msgstr "Опција „%s“ нема ÑмиÑла без опције „%s“.\n" | 8547 | msgstr "Опција „%s“ нема ÑмиÑла без опције „%s“.\n" |
8543 | 8548 | ||
8544 | #: src/util/getopt.c:998 | 8549 | #: src/util/getopt.c:995 |
8545 | #, fuzzy, c-format | 8550 | #, fuzzy, c-format |
8546 | msgid "Missing mandatory option `%s'.\n" | 8551 | msgid "Missing mandatory option `%s'.\n" |
8547 | msgstr "ÐедоÑтаје опција „%s“ за радњу „%s“\n" | 8552 | msgstr "ÐедоÑтаје опција „%s“ за радњу „%s“\n" |
@@ -8628,6 +8633,10 @@ msgstr "Морате да проÑледите број опцији „%s“.\n | |||
8628 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 8633 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
8629 | msgstr "" | 8634 | msgstr "" |
8630 | 8635 | ||
8636 | #: src/util/gnunet-base32.c:45 | ||
8637 | msgid "run decoder modus, otherwise runs as encoder" | ||
8638 | msgstr "" | ||
8639 | |||
8631 | #: src/util/gnunet-config.c:167 | 8640 | #: src/util/gnunet-config.c:167 |
8632 | #, fuzzy, c-format | 8641 | #, fuzzy, c-format |
8633 | msgid "failed to load configuration defaults" | 8642 | msgid "failed to load configuration defaults" |
@@ -8682,6 +8691,10 @@ msgstr "" | |||
8682 | msgid "Manipulate GNUnet configuration files" | 8691 | msgid "Manipulate GNUnet configuration files" |
8683 | msgstr "Управља ГÐУнет датотекама подешавања" | 8692 | msgstr "Управља ГÐУнет датотекама подешавања" |
8684 | 8693 | ||
8694 | #: src/util/gnunet-crypto-tvg.c:1072 | ||
8695 | msgid "verify a test vector from stdin" | ||
8696 | msgstr "" | ||
8697 | |||
8685 | #: src/util/gnunet-ecc.c:94 | 8698 | #: src/util/gnunet-ecc.c:94 |
8686 | #, c-format | 8699 | #, c-format |
8687 | msgid "Failed to open `%s': %s\n" | 8700 | msgid "Failed to open `%s': %s\n" |
@@ -8809,31 +8822,32 @@ msgid "perform a reverse lookup" | |||
8809 | msgstr "обавља повратну претрагу" | 8822 | msgstr "обавља повратну претрагу" |
8810 | 8823 | ||
8811 | #: src/util/gnunet-resolver.c:182 | 8824 | #: src/util/gnunet-resolver.c:182 |
8812 | msgid "Use build-in GNUnet stub resolver" | 8825 | #, fuzzy |
8826 | msgid "Use built-in GNUnet stub resolver" | ||
8813 | msgstr "КориÑти уграђеног заменÑког решавача ГÐУнет-а" | 8827 | msgstr "КориÑти уграђеног заменÑког решавача ГÐУнет-а" |
8814 | 8828 | ||
8815 | #: src/util/gnunet-scrypt.c:229 | 8829 | #: src/util/gnunet-scrypt.c:232 |
8816 | #, c-format | 8830 | #, c-format |
8817 | msgid "Loading hostkey from `%s' failed.\n" | 8831 | msgid "Loading hostkey from `%s' failed.\n" |
8818 | msgstr "Учитавање кључа домаћина из „%s“ није уÑпело.\n" | 8832 | msgstr "Учитавање кључа домаћина из „%s“ није уÑпело.\n" |
8819 | 8833 | ||
8820 | #: src/util/gnunet-scrypt.c:295 | 8834 | #: src/util/gnunet-scrypt.c:298 |
8821 | msgid "number of bits to require for the proof of work" | 8835 | msgid "number of bits to require for the proof of work" |
8822 | msgstr "број битова за тражење доказивања о раду" | 8836 | msgstr "број битова за тражење доказивања о раду" |
8823 | 8837 | ||
8824 | #: src/util/gnunet-scrypt.c:301 | 8838 | #: src/util/gnunet-scrypt.c:304 |
8825 | msgid "file with private key, otherwise default is used" | 8839 | msgid "file with private key, otherwise default is used" |
8826 | msgstr "датотека Ñа личним кључем, у Ñупротном кориÑти Ñе оÑновна" | 8840 | msgstr "датотека Ñа личним кључем, у Ñупротном кориÑти Ñе оÑновна" |
8827 | 8841 | ||
8828 | #: src/util/gnunet-scrypt.c:307 | 8842 | #: src/util/gnunet-scrypt.c:310 |
8829 | msgid "file with proof of work, otherwise default is used" | 8843 | msgid "file with proof of work, otherwise default is used" |
8830 | msgstr "датотека Ñа доказом о раду, у Ñупротном кориÑти Ñе оÑновна" | 8844 | msgstr "датотека Ñа доказом о раду, у Ñупротном кориÑти Ñе оÑновна" |
8831 | 8845 | ||
8832 | #: src/util/gnunet-scrypt.c:313 | 8846 | #: src/util/gnunet-scrypt.c:316 |
8833 | msgid "time to wait between calculations" | 8847 | msgid "time to wait between calculations" |
8834 | msgstr "време за чекање између прорачуна" | 8848 | msgstr "време за чекање између прорачуна" |
8835 | 8849 | ||
8836 | #: src/util/gnunet-scrypt.c:326 | 8850 | #: src/util/gnunet-scrypt.c:330 |
8837 | msgid "Manipulate GNUnet proof of work files" | 8851 | msgid "Manipulate GNUnet proof of work files" |
8838 | msgstr "Управља ГÐУнет датотекама доказа о раду" | 8852 | msgstr "Управља ГÐУнет датотекама доказа о раду" |
8839 | 8853 | ||
@@ -8871,7 +8885,7 @@ msgid "Unable to shorten unix path `%s' while keeping name unique\n" | |||
8871 | msgstr "" | 8885 | msgstr "" |
8872 | "Ðе могу да Ñкратим Ñ˜ÑƒÐ½Ð¸ÐºÑ Ð¿ÑƒÑ‚Ð°ÑšÑƒ „%s“ док задржавам назив јединÑтвеним\n" | 8886 | "Ðе могу да Ñкратим Ñ˜ÑƒÐ½Ð¸ÐºÑ Ð¿ÑƒÑ‚Ð°ÑšÑƒ „%s“ док задржавам назив јединÑтвеним\n" |
8873 | 8887 | ||
8874 | #: src/util/network.c:1364 | 8888 | #: src/util/network.c:1361 |
8875 | #, c-format | 8889 | #, c-format |
8876 | msgid "" | 8890 | msgid "" |
8877 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" | 8891 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" |
@@ -8879,7 +8893,7 @@ msgstr "" | |||
8879 | "Кобна унутрашња логичка грешка, Ð¿Ñ€Ð¾Ñ†ÐµÑ Ñе заплео у „%s“ (прекините Ñа КТРЛ-" | 8893 | "Кобна унутрашња логичка грешка, Ð¿Ñ€Ð¾Ñ†ÐµÑ Ñе заплео у „%s“ (прекините Ñа КТРЛ-" |
8880 | "Ц)!\n" | 8894 | "Ц)!\n" |
8881 | 8895 | ||
8882 | #: src/util/os_installation.c:411 | 8896 | #: src/util/os_installation.c:415 |
8883 | #, c-format | 8897 | #, c-format |
8884 | msgid "" | 8898 | msgid "" |
8885 | "Could not determine installation path for %s. Set `%s' environment " | 8899 | "Could not determine installation path for %s. Set `%s' environment " |
@@ -8888,12 +8902,12 @@ msgstr "" | |||
8888 | "Ðе могу да одредим путању инÑталирања за „%s“. ПоÑтавите „%s“ променљиву " | 8902 | "Ðе могу да одредим путању инÑталирања за „%s“. ПоÑтавите „%s“ променљиву " |
8889 | "окружења.\n" | 8903 | "окружења.\n" |
8890 | 8904 | ||
8891 | #: src/util/os_installation.c:794 | 8905 | #: src/util/os_installation.c:802 |
8892 | #, c-format | 8906 | #, c-format |
8893 | msgid "Could not find binary `%s' in PATH!\n" | 8907 | msgid "Could not find binary `%s' in PATH!\n" |
8894 | msgstr "Ðе могу да нађем извршну „%s“ у ПУТÐЊИ!\n" | 8908 | msgstr "Ðе могу да нађем извршну „%s“ у ПУТÐЊИ!\n" |
8895 | 8909 | ||
8896 | #: src/util/os_installation.c:827 | 8910 | #: src/util/os_installation.c:835 |
8897 | #, c-format | 8911 | #, c-format |
8898 | msgid "Binary `%s' exists, but is not SUID\n" | 8912 | msgid "Binary `%s' exists, but is not SUID\n" |
8899 | msgstr "" | 8913 | msgstr "" |
@@ -8903,31 +8917,31 @@ msgstr "" | |||
8903 | msgid "Initialization of plugin mechanism failed: %s!\n" | 8917 | msgid "Initialization of plugin mechanism failed: %s!\n" |
8904 | msgstr "Покретање механизма прикључка није уÑпело: %s!\n" | 8918 | msgstr "Покретање механизма прикључка није уÑпело: %s!\n" |
8905 | 8919 | ||
8906 | #: src/util/plugin.c:147 | 8920 | #: src/util/plugin.c:156 |
8907 | #, c-format | 8921 | #, c-format |
8908 | msgid "`%s' failed to resolve method '%s' with error: %s\n" | 8922 | msgid "`%s' failed to resolve method '%s' with error: %s\n" |
8909 | msgstr "„%s“ није уÑпело да реши метод '%s' Ñа грешком: %s\n" | 8923 | msgstr "„%s“ није уÑпело да реши метод '%s' Ñа грешком: %s\n" |
8910 | 8924 | ||
8911 | #: src/util/plugin.c:223 | 8925 | #: src/util/plugin.c:234 |
8912 | #, c-format | 8926 | #, c-format |
8913 | msgid "`%s' failed for library `%s' with error: %s\n" | 8927 | msgid "`%s' failed for library `%s' with error: %s\n" |
8914 | msgstr "„%s“ није уÑпело за библиотеку '%s' Ñа грешком: %s\n" | 8928 | msgstr "„%s“ није уÑпело за библиотеку '%s' Ñа грешком: %s\n" |
8915 | 8929 | ||
8916 | #: src/util/plugin.c:384 | 8930 | #: src/util/plugin.c:409 |
8917 | msgid "Could not determine plugin installation path.\n" | 8931 | msgid "Could not determine plugin installation path.\n" |
8918 | msgstr "Ðе могу да одредим путању инÑталирања прикључка.\n" | 8932 | msgstr "Ðе могу да одредим путању инÑталирања прикључка.\n" |
8919 | 8933 | ||
8920 | #: src/util/program.c:267 | 8934 | #: src/util/program.c:259 |
8921 | #, fuzzy, c-format | 8935 | #, fuzzy, c-format |
8922 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" | 8936 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" |
8923 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | 8937 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" |
8924 | 8938 | ||
8925 | #: src/util/program.c:284 | 8939 | #: src/util/program.c:276 |
8926 | #, fuzzy, c-format | 8940 | #, fuzzy, c-format |
8927 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | 8941 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" |
8928 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" | 8942 | msgstr "Лоша датотека подешавања „%s“, излазим ...\n" |
8929 | 8943 | ||
8930 | #: src/util/program.c:299 | 8944 | #: src/util/program.c:291 |
8931 | #, fuzzy | 8945 | #, fuzzy |
8932 | msgid "Unreadable or malformed configuration, exit ...\n" | 8946 | msgid "Unreadable or malformed configuration, exit ...\n" |
8933 | msgstr "Лоше подешавање, излазим ...\n" | 8947 | msgstr "Лоше подешавање, излазим ...\n" |
@@ -9067,12 +9081,12 @@ msgstr "Погрешан формат „%s“ за мрежну маÑку\n" | |||
9067 | msgid "Wrong format `%s' for network\n" | 9081 | msgid "Wrong format `%s' for network\n" |
9068 | msgstr "Погрешан формат „%s“ за мрежу\n" | 9082 | msgstr "Погрешан формат „%s“ за мрежу\n" |
9069 | 9083 | ||
9070 | #: src/util/time.c:848 src/util/time.c:876 | 9084 | #: src/util/time.c:878 src/util/time.c:906 |
9071 | #, c-format | 9085 | #, c-format |
9072 | msgid "Failed to map `%s', cannot assure monotonic time!\n" | 9086 | msgid "Failed to map `%s', cannot assure monotonic time!\n" |
9073 | msgstr "" | 9087 | msgstr "" |
9074 | 9088 | ||
9075 | #: src/util/time.c:884 | 9089 | #: src/util/time.c:914 |
9076 | #, c-format | 9090 | #, c-format |
9077 | msgid "" | 9091 | msgid "" |
9078 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" | 9092 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" |
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
8 | "Project-Id-Version: GNUnet 0.7.0b\n" | 8 | "Project-Id-Version: GNUnet 0.7.0b\n" |
9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
10 | "POT-Creation-Date: 2020-11-13 23:46+0900\n" | 10 | "POT-Creation-Date: 2021-04-04 19:19+0200\n" |
11 | "PO-Revision-Date: 2006-01-21 17:16+0100\n" | 11 | "PO-Revision-Date: 2006-01-21 17:16+0100\n" |
12 | "Last-Translator: Daniel Nylander <po@danielnylander.se>\n" | 12 | "Last-Translator: Daniel Nylander <po@danielnylander.se>\n" |
13 | "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" | 13 | "Language-Team: Swedish <tp-sv@listor.tp-sv.se>\n" |
@@ -763,7 +763,7 @@ msgstr "" | |||
763 | 763 | ||
764 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 | 764 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 |
765 | #: src/conversation/gnunet-conversation-test.c:256 | 765 | #: src/conversation/gnunet-conversation-test.c:256 |
766 | #: src/revocation/gnunet-revocation.c:569 src/template/gnunet-template.c:75 | 766 | #: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 |
767 | #, fuzzy | 767 | #, fuzzy |
768 | msgid "help text" | 768 | msgid "help text" |
769 | msgstr "hjälptext för -t" | 769 | msgstr "hjälptext för -t" |
@@ -1347,7 +1347,7 @@ msgstr "Okänt fel" | |||
1347 | msgid "%24s: %-30s %4s (timeout in %6s)\n" | 1347 | msgid "%24s: %-30s %4s (timeout in %6s)\n" |
1348 | msgstr "" | 1348 | msgstr "" |
1349 | 1349 | ||
1350 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:696 | 1350 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:697 |
1351 | #, fuzzy, c-format | 1351 | #, fuzzy, c-format |
1352 | msgid "Invalid command line argument `%s'\n" | 1352 | msgid "Invalid command line argument `%s'\n" |
1353 | msgstr "Ogiltiga kommandoradsargument:\n" | 1353 | msgstr "Ogiltiga kommandoradsargument:\n" |
@@ -1649,7 +1649,7 @@ msgstr "" | |||
1649 | #: src/testbed/generate-underlay-topology.c:48 | 1649 | #: src/testbed/generate-underlay-topology.c:48 |
1650 | #: src/testbed/gnunet-daemon-latency-logger.c:53 | 1650 | #: src/testbed/gnunet-daemon-latency-logger.c:53 |
1651 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 | 1651 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 |
1652 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:62 | 1652 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:78 |
1653 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 | 1653 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 |
1654 | #, c-format | 1654 | #, c-format |
1655 | msgid "`%s' failed at %s:%d with error: %s\n" | 1655 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -2098,7 +2098,7 @@ msgstr "" | |||
2098 | msgid "Exiting as the number of peers is %u\n" | 2098 | msgid "Exiting as the number of peers is %u\n" |
2099 | msgstr "Maximalt antal chattklienter uppnått.\n" | 2099 | msgstr "Maximalt antal chattklienter uppnått.\n" |
2100 | 2100 | ||
2101 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194 | 2101 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3136 |
2102 | #, fuzzy | 2102 | #, fuzzy |
2103 | msgid "number of peers to start" | 2103 | msgid "number of peers to start" |
2104 | msgstr "antal iterationer" | 2104 | msgstr "antal iterationer" |
@@ -3300,7 +3300,7 @@ msgid "Downloading `%s' done (%s/s).\n" | |||
3300 | msgstr "Uppladdning vägrades!" | 3300 | msgstr "Uppladdning vägrades!" |
3301 | 3301 | ||
3302 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 | 3302 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 |
3303 | #: src/fs/gnunet-search.c:226 src/fs/gnunet-unindex.c:117 | 3303 | #: src/fs/gnunet-search.c:229 src/fs/gnunet-unindex.c:117 |
3304 | #, c-format | 3304 | #, c-format |
3305 | msgid "Unexpected status: %d\n" | 3305 | msgid "Unexpected status: %d\n" |
3306 | msgstr "" | 3306 | msgstr "" |
@@ -3324,12 +3324,12 @@ msgid "Target filename must be specified.\n" | |||
3324 | msgstr "" | 3324 | msgstr "" |
3325 | 3325 | ||
3326 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 | 3326 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 |
3327 | #: src/fs/gnunet-search.c:291 src/fs/gnunet-unindex.c:154 | 3327 | #: src/fs/gnunet-search.c:294 src/fs/gnunet-unindex.c:154 |
3328 | #, fuzzy, c-format | 3328 | #, fuzzy, c-format |
3329 | msgid "Could not initialize `%s' subsystem.\n" | 3329 | msgid "Could not initialize `%s' subsystem.\n" |
3330 | msgstr "Misslyckades att initiera tjänsten \"%s\".\n" | 3330 | msgstr "Misslyckades att initiera tjänsten \"%s\".\n" |
3331 | 3331 | ||
3332 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:331 | 3332 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:334 |
3333 | msgid "set the desired LEVEL of receiver-anonymity" | 3333 | msgid "set the desired LEVEL of receiver-anonymity" |
3334 | msgstr "" | 3334 | msgstr "" |
3335 | 3335 | ||
@@ -3337,7 +3337,7 @@ msgstr "" | |||
3337 | msgid "delete incomplete downloads (when aborted with CTRL-C)" | 3337 | msgid "delete incomplete downloads (when aborted with CTRL-C)" |
3338 | msgstr "" | 3338 | msgstr "" |
3339 | 3339 | ||
3340 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:336 | 3340 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:339 |
3341 | msgid "only search the local peer (no P2P network search)" | 3341 | msgid "only search the local peer (no P2P network search)" |
3342 | msgstr "" | 3342 | msgstr "" |
3343 | 3343 | ||
@@ -3581,39 +3581,39 @@ msgstr "" | |||
3581 | msgid "Publish a file or directory on GNUnet" | 3581 | msgid "Publish a file or directory on GNUnet" |
3582 | msgstr "" | 3582 | msgstr "" |
3583 | 3583 | ||
3584 | #: src/fs/gnunet-search.c:127 | 3584 | #: src/fs/gnunet-search.c:130 |
3585 | #, c-format | 3585 | #, c-format |
3586 | msgid "Failed to write directory with search results to `%s'\n" | 3586 | msgid "Failed to write directory with search results to `%s'\n" |
3587 | msgstr "" | 3587 | msgstr "" |
3588 | 3588 | ||
3589 | #: src/fs/gnunet-search.c:216 | 3589 | #: src/fs/gnunet-search.c:219 |
3590 | #, fuzzy, c-format | 3590 | #, fuzzy, c-format |
3591 | msgid "Error searching: %s.\n" | 3591 | msgid "Error searching: %s.\n" |
3592 | msgstr "Fel vid lämning av DHT.\n" | 3592 | msgstr "Fel vid lämning av DHT.\n" |
3593 | 3593 | ||
3594 | #: src/fs/gnunet-search.c:278 | 3594 | #: src/fs/gnunet-search.c:281 |
3595 | #, fuzzy | 3595 | #, fuzzy |
3596 | msgid "Could not create keyword URI from arguments.\n" | 3596 | msgid "Could not create keyword URI from arguments.\n" |
3597 | msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" | 3597 | msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" |
3598 | 3598 | ||
3599 | #: src/fs/gnunet-search.c:305 | 3599 | #: src/fs/gnunet-search.c:308 |
3600 | #, fuzzy | 3600 | #, fuzzy |
3601 | msgid "Could not start searching.\n" | 3601 | msgid "Could not start searching.\n" |
3602 | msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" | 3602 | msgstr "Kunde inte skapa namnrymd \"%s\" (existerar?).\n" |
3603 | 3603 | ||
3604 | #: src/fs/gnunet-search.c:342 | 3604 | #: src/fs/gnunet-search.c:345 |
3605 | msgid "write search results to file starting with PREFIX" | 3605 | msgid "write search results to file starting with PREFIX" |
3606 | msgstr "" | 3606 | msgstr "" |
3607 | 3607 | ||
3608 | #: src/fs/gnunet-search.c:348 | 3608 | #: src/fs/gnunet-search.c:351 |
3609 | msgid "automatically terminate search after DELAY" | 3609 | msgid "automatically terminate search after DELAY" |
3610 | msgstr "" | 3610 | msgstr "" |
3611 | 3611 | ||
3612 | #: src/fs/gnunet-search.c:354 | 3612 | #: src/fs/gnunet-search.c:357 |
3613 | msgid "automatically terminate search after VALUE results are found" | 3613 | msgid "automatically terminate search after VALUE results are found" |
3614 | msgstr "" | 3614 | msgstr "" |
3615 | 3615 | ||
3616 | #: src/fs/gnunet-search.c:368 | 3616 | #: src/fs/gnunet-search.c:371 |
3617 | msgid "Search GNUnet for files that were published on GNUnet" | 3617 | msgid "Search GNUnet for files that were published on GNUnet" |
3618 | msgstr "" | 3618 | msgstr "" |
3619 | 3619 | ||
@@ -3997,7 +3997,7 @@ msgstr "" | |||
3997 | msgid "Expected a base32-encoded public zone key\n" | 3997 | msgid "Expected a base32-encoded public zone key\n" |
3998 | msgstr "" | 3998 | msgstr "" |
3999 | 3999 | ||
4000 | #: src/gns/gnunet-bcd.c:133 | 4000 | #: src/gns/gnunet-bcd.c:134 |
4001 | #, c-format | 4001 | #, c-format |
4002 | msgid "Refusing `%s' request to HTTP server\n" | 4002 | msgid "Refusing `%s' request to HTTP server\n" |
4003 | msgstr "" | 4003 | msgstr "" |
@@ -4030,35 +4030,40 @@ msgstr "" | |||
4030 | msgid "Failed to pack DNS response into UDP packet!\n" | 4030 | msgid "Failed to pack DNS response into UDP packet!\n" |
4031 | msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n" | 4031 | msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n" |
4032 | 4032 | ||
4033 | #: src/gns/gnunet-dns2gns.c:444 | 4033 | #: src/gns/gnunet-dns2gns.c:315 |
4034 | #, fuzzy | ||
4035 | msgid "Failed to parse DNS response!\n" | ||
4036 | msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n" | ||
4037 | |||
4038 | #: src/gns/gnunet-dns2gns.c:452 | ||
4034 | #, fuzzy, c-format | 4039 | #, fuzzy, c-format |
4035 | msgid "Cannot parse DNS request from %s\n" | 4040 | msgid "Cannot parse DNS request from %s\n" |
4036 | msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n" | 4041 | msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n" |
4037 | 4042 | ||
4038 | #: src/gns/gnunet-dns2gns.c:460 | 4043 | #: src/gns/gnunet-dns2gns.c:468 |
4039 | #, fuzzy, c-format | 4044 | #, fuzzy, c-format |
4040 | msgid "Received malformed DNS request from %s\n" | 4045 | msgid "Received malformed DNS request from %s\n" |
4041 | msgstr "Mottog ogiltig \"%s\" begäran (storlek %d)\n" | 4046 | msgstr "Mottog ogiltig \"%s\" begäran (storlek %d)\n" |
4042 | 4047 | ||
4043 | #: src/gns/gnunet-dns2gns.c:468 | 4048 | #: src/gns/gnunet-dns2gns.c:476 |
4044 | #, fuzzy, c-format | 4049 | #, fuzzy, c-format |
4045 | msgid "Received unsupported DNS request from %s\n" | 4050 | msgid "Received unsupported DNS request from %s\n" |
4046 | msgstr "Mottog okänd typ av begäran %d vid %s:%d\n" | 4051 | msgstr "Mottog okänd typ av begäran %d vid %s:%d\n" |
4047 | 4052 | ||
4048 | #: src/gns/gnunet-dns2gns.c:629 | 4053 | #: src/gns/gnunet-dns2gns.c:637 |
4049 | #, fuzzy | 4054 | #, fuzzy |
4050 | msgid "No DNS server specified!\n" | 4055 | msgid "No DNS server specified!\n" |
4051 | msgstr "Inga nyckelord angivna!\n" | 4056 | msgstr "Inga nyckelord angivna!\n" |
4052 | 4057 | ||
4053 | #: src/gns/gnunet-dns2gns.c:778 | 4058 | #: src/gns/gnunet-dns2gns.c:786 |
4054 | msgid "IP of recursive DNS resolver to use (required)" | 4059 | msgid "IP of recursive DNS resolver to use (required)" |
4055 | msgstr "" | 4060 | msgstr "" |
4056 | 4061 | ||
4057 | #: src/gns/gnunet-dns2gns.c:784 | 4062 | #: src/gns/gnunet-dns2gns.c:792 |
4058 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4063 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4059 | msgstr "" | 4064 | msgstr "" |
4060 | 4065 | ||
4061 | #: src/gns/gnunet-dns2gns.c:801 | 4066 | #: src/gns/gnunet-dns2gns.c:809 |
4062 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4067 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4063 | msgstr "" | 4068 | msgstr "" |
4064 | 4069 | ||
@@ -4179,64 +4184,64 @@ msgstr "" | |||
4179 | msgid "Cookie domain `%s' supplied by server is invalid\n" | 4184 | msgid "Cookie domain `%s' supplied by server is invalid\n" |
4180 | msgstr "" | 4185 | msgstr "" |
4181 | 4186 | ||
4182 | #: src/gns/gnunet-gns-proxy.c:2133 | 4187 | #: src/gns/gnunet-gns-proxy.c:2134 |
4183 | #, fuzzy, c-format | 4188 | #, fuzzy, c-format |
4184 | msgid "Unsupported HTTP method `%s'\n" | 4189 | msgid "Unsupported HTTP method `%s'\n" |
4185 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" | 4190 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" |
4186 | 4191 | ||
4187 | #: src/gns/gnunet-gns-proxy.c:2657 | 4192 | #: src/gns/gnunet-gns-proxy.c:2658 |
4188 | #, fuzzy, c-format | 4193 | #, fuzzy, c-format |
4189 | msgid "Unable to import private key from file `%s'\n" | 4194 | msgid "Unable to import private key from file `%s'\n" |
4190 | msgstr "Kunde inte skapa användarkonto:" | 4195 | msgstr "Kunde inte skapa användarkonto:" |
4191 | 4196 | ||
4192 | #: src/gns/gnunet-gns-proxy.c:2689 | 4197 | #: src/gns/gnunet-gns-proxy.c:2690 |
4193 | #, fuzzy, c-format | 4198 | #, fuzzy, c-format |
4194 | msgid "Unable to import certificate from `%s'\n" | 4199 | msgid "Unable to import certificate from `%s'\n" |
4195 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 4200 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
4196 | 4201 | ||
4197 | #: src/gns/gnunet-gns-proxy.c:2898 | 4202 | #: src/gns/gnunet-gns-proxy.c:2899 |
4198 | #, fuzzy, c-format | 4203 | #, fuzzy, c-format |
4199 | msgid "Failed to start HTTPS server for `%s'\n" | 4204 | msgid "Failed to start HTTPS server for `%s'\n" |
4200 | msgstr "Misslyckades att starta samling.\n" | 4205 | msgstr "Misslyckades att starta samling.\n" |
4201 | 4206 | ||
4202 | #: src/gns/gnunet-gns-proxy.c:2922 src/rest/gnunet-rest-server.c:917 | 4207 | #: src/gns/gnunet-gns-proxy.c:2923 src/rest/gnunet-rest-server.c:917 |
4203 | #, fuzzy | 4208 | #, fuzzy |
4204 | msgid "Failed to pass client to MHD\n" | 4209 | msgid "Failed to pass client to MHD\n" |
4205 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 4210 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
4206 | 4211 | ||
4207 | #: src/gns/gnunet-gns-proxy.c:3271 | 4212 | #: src/gns/gnunet-gns-proxy.c:3272 |
4208 | #, fuzzy, c-format | 4213 | #, fuzzy, c-format |
4209 | msgid "Unsupported socks version %d\n" | 4214 | msgid "Unsupported socks version %d\n" |
4210 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" | 4215 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" |
4211 | 4216 | ||
4212 | #: src/gns/gnunet-gns-proxy.c:3303 | 4217 | #: src/gns/gnunet-gns-proxy.c:3304 |
4213 | #, fuzzy, c-format | 4218 | #, fuzzy, c-format |
4214 | msgid "Unsupported socks command %d\n" | 4219 | msgid "Unsupported socks command %d\n" |
4215 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" | 4220 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" |
4216 | 4221 | ||
4217 | #: src/gns/gnunet-gns-proxy.c:3389 | 4222 | #: src/gns/gnunet-gns-proxy.c:3390 |
4218 | #, fuzzy, c-format | 4223 | #, fuzzy, c-format |
4219 | msgid "Unsupported socks address type %d\n" | 4224 | msgid "Unsupported socks address type %d\n" |
4220 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" | 4225 | msgstr "Kommando \"%s\" stöds ej. Avbryter.\n" |
4221 | 4226 | ||
4222 | #: src/gns/gnunet-gns-proxy.c:3730 | 4227 | #: src/gns/gnunet-gns-proxy.c:3731 |
4223 | #, fuzzy, c-format | 4228 | #, fuzzy, c-format |
4224 | msgid "Failed to load X.509 key and certificate from `%s'\n" | 4229 | msgid "Failed to load X.509 key and certificate from `%s'\n" |
4225 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 4230 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
4226 | 4231 | ||
4227 | #: src/gns/gnunet-gns-proxy.c:3864 | 4232 | #: src/gns/gnunet-gns-proxy.c:3865 |
4228 | msgid "listen on specified port (default: 7777)" | 4233 | msgid "listen on specified port (default: 7777)" |
4229 | msgstr "" | 4234 | msgstr "" |
4230 | 4235 | ||
4231 | #: src/gns/gnunet-gns-proxy.c:3869 | 4236 | #: src/gns/gnunet-gns-proxy.c:3870 |
4232 | msgid "pem file to use as CA" | 4237 | msgid "pem file to use as CA" |
4233 | msgstr "" | 4238 | msgstr "" |
4234 | 4239 | ||
4235 | #: src/gns/gnunet-gns-proxy.c:3873 | 4240 | #: src/gns/gnunet-gns-proxy.c:3874 |
4236 | msgid "disable use of IPv6" | 4241 | msgid "disable use of IPv6" |
4237 | msgstr "" | 4242 | msgstr "" |
4238 | 4243 | ||
4239 | #: src/gns/gnunet-gns-proxy.c:3899 | 4244 | #: src/gns/gnunet-gns-proxy.c:3900 |
4240 | msgid "GNUnet GNS proxy" | 4245 | msgid "GNUnet GNS proxy" |
4241 | msgstr "" | 4246 | msgstr "" |
4242 | 4247 | ||
@@ -4261,7 +4266,7 @@ msgstr "Kunde inte ansluta till gnunetd.\n" | |||
4261 | msgid "Error converting GNS response to DNS response!\n" | 4266 | msgid "Error converting GNS response to DNS response!\n" |
4262 | msgstr "" | 4267 | msgstr "" |
4263 | 4268 | ||
4264 | #: src/gns/gnunet-service-gns_interceptor.c:387 | 4269 | #: src/gns/gnunet-service-gns_interceptor.c:386 |
4265 | #, fuzzy | 4270 | #, fuzzy |
4266 | msgid "Failed to connect to the DNS service!\n" | 4271 | msgid "Failed to connect to the DNS service!\n" |
4267 | msgstr "Misslyckades att ansluta till gnunetd.\n" | 4272 | msgstr "Misslyckades att ansluta till gnunetd.\n" |
@@ -4296,36 +4301,36 @@ msgstr "" | |||
4296 | msgid "VPN returned empty result for `%s'\n" | 4301 | msgid "VPN returned empty result for `%s'\n" |
4297 | msgstr "" | 4302 | msgstr "" |
4298 | 4303 | ||
4299 | #: src/gns/gnunet-service-gns_resolver.c:1910 | 4304 | #: src/gns/gnunet-service-gns_resolver.c:1919 |
4300 | #, c-format | 4305 | #, c-format |
4301 | msgid "Name `%s' cannot be converted to IDNA." | 4306 | msgid "Name `%s' cannot be converted to IDNA." |
4302 | msgstr "" | 4307 | msgstr "" |
4303 | 4308 | ||
4304 | #: src/gns/gnunet-service-gns_resolver.c:1923 | 4309 | #: src/gns/gnunet-service-gns_resolver.c:1934 |
4305 | #, c-format | 4310 | #, c-format |
4306 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" | 4311 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" |
4307 | msgstr "" | 4312 | msgstr "" |
4308 | 4313 | ||
4309 | #: src/gns/gnunet-service-gns_resolver.c:1966 | 4314 | #: src/gns/gnunet-service-gns_resolver.c:1979 |
4310 | #, fuzzy, c-format | 4315 | #, fuzzy, c-format |
4311 | msgid "GNS lookup failed (zero records found for `%s')\n" | 4316 | msgid "GNS lookup failed (zero records found for `%s')\n" |
4312 | msgstr "%d filer hittades i katalog.\n" | 4317 | msgstr "%d filer hittades i katalog.\n" |
4313 | 4318 | ||
4314 | #: src/gns/gnunet-service-gns_resolver.c:2393 | 4319 | #: src/gns/gnunet-service-gns_resolver.c:2406 |
4315 | msgid "GNS lookup recursion failed (no delegation record found)\n" | 4320 | msgid "GNS lookup recursion failed (no delegation record found)\n" |
4316 | msgstr "" | 4321 | msgstr "" |
4317 | 4322 | ||
4318 | #: src/gns/gnunet-service-gns_resolver.c:2416 | 4323 | #: src/gns/gnunet-service-gns_resolver.c:2429 |
4319 | #, fuzzy, c-format | 4324 | #, fuzzy, c-format |
4320 | msgid "Failed to cache GNS resolution: %s\n" | 4325 | msgid "Failed to cache GNS resolution: %s\n" |
4321 | msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n" | 4326 | msgstr "Misslyckades att skicka HTTP-begäran till värd \"%s\": %s\n" |
4322 | 4327 | ||
4323 | #: src/gns/gnunet-service-gns_resolver.c:2581 | 4328 | #: src/gns/gnunet-service-gns_resolver.c:2594 |
4324 | #, c-format | 4329 | #, c-format |
4325 | msgid "GNS namecache returned empty result for `%s'\n" | 4330 | msgid "GNS namecache returned empty result for `%s'\n" |
4326 | msgstr "" | 4331 | msgstr "" |
4327 | 4332 | ||
4328 | #: src/gns/gnunet-service-gns_resolver.c:2721 | 4333 | #: src/gns/gnunet-service-gns_resolver.c:2734 |
4329 | #, c-format | 4334 | #, c-format |
4330 | msgid "Zone %s was revoked, resolution fails\n" | 4335 | msgid "Zone %s was revoked, resolution fails\n" |
4331 | msgstr "" | 4336 | msgstr "" |
@@ -4359,7 +4364,7 @@ msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | |||
4359 | msgid "Unable to parse BOX record string `%s'\n" | 4364 | msgid "Unable to parse BOX record string `%s'\n" |
4360 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 4365 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
4361 | 4366 | ||
4362 | #: src/gns/plugin_rest_gns.c:448 | 4367 | #: src/gns/plugin_rest_gns.c:450 |
4363 | #, fuzzy | 4368 | #, fuzzy |
4364 | msgid "Gns REST API initialized\n" | 4369 | msgid "Gns REST API initialized\n" |
4365 | msgstr " Anslutning misslyckades\n" | 4370 | msgstr " Anslutning misslyckades\n" |
@@ -4701,7 +4706,7 @@ msgstr "" | |||
4701 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 | 4706 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 |
4702 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 | 4707 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 |
4703 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 | 4708 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 |
4704 | #: src/peerinfo-tool/gnunet-peerinfo.c:515 | 4709 | #: src/peerinfo-tool/gnunet-peerinfo.c:516 |
4705 | #: src/topology/gnunet-daemon-topology.c:799 | 4710 | #: src/topology/gnunet-daemon-topology.c:799 |
4706 | #, fuzzy, c-format | 4711 | #, fuzzy, c-format |
4707 | msgid "Error in communication with PEERINFO service: %s\n" | 4712 | msgid "Error in communication with PEERINFO service: %s\n" |
@@ -4866,8 +4871,8 @@ msgid "default configured, but ego unknown (internal error)" | |||
4866 | msgstr "" | 4871 | msgstr "" |
4867 | 4872 | ||
4868 | #: src/identity/gnunet-service-identity.c:621 | 4873 | #: src/identity/gnunet-service-identity.c:621 |
4869 | #: src/identity/gnunet-service-identity.c:898 | 4874 | #: src/identity/gnunet-service-identity.c:896 |
4870 | #: src/identity/gnunet-service-identity.c:1018 | 4875 | #: src/identity/gnunet-service-identity.c:1016 |
4871 | #, fuzzy, c-format | 4876 | #, fuzzy, c-format |
4872 | msgid "Failed to write subsystem default identifier map to `%s'.\n" | 4877 | msgid "Failed to write subsystem default identifier map to `%s'.\n" |
4873 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 4878 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
@@ -4876,30 +4881,30 @@ msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | |||
4876 | msgid "Unknown ego specified for service (internal error)" | 4881 | msgid "Unknown ego specified for service (internal error)" |
4877 | msgstr "" | 4882 | msgstr "" |
4878 | 4883 | ||
4879 | #: src/identity/gnunet-service-identity.c:726 | 4884 | #: src/identity/gnunet-service-identity.c:725 |
4880 | msgid "identifier already in use for another ego" | 4885 | msgid "identifier already in use for another ego" |
4881 | msgstr "" | 4886 | msgstr "" |
4882 | 4887 | ||
4883 | #: src/identity/gnunet-service-identity.c:874 | 4888 | #: src/identity/gnunet-service-identity.c:872 |
4884 | msgid "target name already exists" | 4889 | msgid "target name already exists" |
4885 | msgstr "" | 4890 | msgstr "" |
4886 | 4891 | ||
4887 | #: src/identity/gnunet-service-identity.c:916 | 4892 | #: src/identity/gnunet-service-identity.c:914 |
4888 | #: src/identity/gnunet-service-identity.c:1035 | 4893 | #: src/identity/gnunet-service-identity.c:1033 |
4889 | msgid "no matching ego found" | 4894 | msgid "no matching ego found" |
4890 | msgstr "" | 4895 | msgstr "" |
4891 | 4896 | ||
4892 | #: src/identity/gnunet-service-identity.c:1133 | 4897 | #: src/identity/gnunet-service-identity.c:1131 |
4893 | #, fuzzy, c-format | 4898 | #, fuzzy, c-format |
4894 | msgid "Failed to parse ego information in `%s'\n" | 4899 | msgid "Failed to parse ego information in `%s'\n" |
4895 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 4900 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
4896 | 4901 | ||
4897 | #: src/identity/gnunet-service-identity.c:1191 | 4902 | #: src/identity/gnunet-service-identity.c:1189 |
4898 | #, fuzzy, c-format | 4903 | #, fuzzy, c-format |
4899 | msgid "Failed to parse subsystem identity configuration file `%s'\n" | 4904 | msgid "Failed to parse subsystem identity configuration file `%s'\n" |
4900 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 4905 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
4901 | 4906 | ||
4902 | #: src/identity/gnunet-service-identity.c:1200 | 4907 | #: src/identity/gnunet-service-identity.c:1198 |
4903 | #, fuzzy, c-format | 4908 | #, fuzzy, c-format |
4904 | msgid "Failed to create directory `%s' for storing egos\n" | 4909 | msgid "Failed to create directory `%s' for storing egos\n" |
4905 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 4910 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
@@ -5141,7 +5146,7 @@ msgid "Invalid public key for reverse lookup `%s'\n" | |||
5141 | msgstr "Ogiltigt argument: \"%s\"\n" | 5146 | msgstr "Ogiltigt argument: \"%s\"\n" |
5142 | 5147 | ||
5143 | #: src/namestore/gnunet-namestore.c:1220 | 5148 | #: src/namestore/gnunet-namestore.c:1220 |
5144 | #: src/peerinfo-tool/gnunet-peerinfo.c:736 | 5149 | #: src/peerinfo-tool/gnunet-peerinfo.c:737 |
5145 | #, fuzzy, c-format | 5150 | #, fuzzy, c-format |
5146 | msgid "Invalid URI `%s'\n" | 5151 | msgid "Invalid URI `%s'\n" |
5147 | msgstr "Ogiltiga argument: " | 5152 | msgstr "Ogiltiga argument: " |
@@ -5328,7 +5333,7 @@ msgstr "" | |||
5328 | msgid "GNU Name System First Come First Serve name registration service" | 5333 | msgid "GNU Name System First Come First Serve name registration service" |
5329 | msgstr "" | 5334 | msgstr "" |
5330 | 5335 | ||
5331 | #: src/namestore/gnunet-service-namestore.c:866 | 5336 | #: src/namestore/gnunet-service-namestore.c:871 |
5332 | #, fuzzy, c-format | 5337 | #, fuzzy, c-format |
5333 | msgid "Failed to replicate block in namecache: %s\n" | 5338 | msgid "Failed to replicate block in namecache: %s\n" |
5334 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 5339 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
@@ -5359,7 +5364,7 @@ msgstr "" | |||
5359 | msgid "Flat file database running\n" | 5364 | msgid "Flat file database running\n" |
5360 | msgstr "" | 5365 | msgstr "" |
5361 | 5366 | ||
5362 | #: src/namestore/plugin_rest_namestore.c:1103 | 5367 | #: src/namestore/plugin_rest_namestore.c:1105 |
5363 | #, fuzzy | 5368 | #, fuzzy |
5364 | msgid "Namestore REST API initialized\n" | 5369 | msgid "Namestore REST API initialized\n" |
5365 | msgstr " Anslutning misslyckades\n" | 5370 | msgstr " Anslutning misslyckades\n" |
@@ -5681,8 +5686,8 @@ msgstr "" | |||
5681 | msgid "Measure quality and performance of the NSE service." | 5686 | msgid "Measure quality and performance of the NSE service." |
5682 | msgstr "Kan inte tillgå tjänsten" | 5687 | msgstr "Kan inte tillgå tjänsten" |
5683 | 5688 | ||
5684 | #: src/nse/gnunet-service-nse.c:1443 | 5689 | #: src/nse/gnunet-service-nse.c:1450 |
5685 | #: src/revocation/gnunet-service-revocation.c:875 src/util/gnunet-scrypt.c:257 | 5690 | #: src/revocation/gnunet-service-revocation.c:883 src/util/gnunet-scrypt.c:260 |
5686 | msgid "Value is too large.\n" | 5691 | msgid "Value is too large.\n" |
5687 | msgstr "" | 5692 | msgstr "" |
5688 | 5693 | ||
@@ -5722,17 +5727,17 @@ msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | |||
5722 | msgid "Still no peers found in `%s'!\n" | 5727 | msgid "Still no peers found in `%s'!\n" |
5723 | msgstr "" | 5728 | msgstr "" |
5724 | 5729 | ||
5725 | #: src/peerinfo/gnunet-service-peerinfo.c:1024 | 5730 | #: src/peerinfo/gnunet-service-peerinfo.c:1027 |
5726 | #, fuzzy, c-format | 5731 | #, fuzzy, c-format |
5727 | msgid "Cleaning up directory `%s'\n" | 5732 | msgid "Cleaning up directory `%s'\n" |
5728 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 5733 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
5729 | 5734 | ||
5730 | #: src/peerinfo/gnunet-service-peerinfo.c:1319 | 5735 | #: src/peerinfo/gnunet-service-peerinfo.c:1322 |
5731 | #, c-format | 5736 | #, c-format |
5732 | msgid "Importing HELLOs from `%s'\n" | 5737 | msgid "Importing HELLOs from `%s'\n" |
5733 | msgstr "" | 5738 | msgstr "" |
5734 | 5739 | ||
5735 | #: src/peerinfo/gnunet-service-peerinfo.c:1332 | 5740 | #: src/peerinfo/gnunet-service-peerinfo.c:1335 |
5736 | msgid "Skipping import of included HELLOs\n" | 5741 | msgid "Skipping import of included HELLOs\n" |
5737 | msgstr "" | 5742 | msgstr "" |
5738 | 5743 | ||
@@ -5752,7 +5757,7 @@ msgid "\tExpires: %s \t %s\n" | |||
5752 | msgstr "" | 5757 | msgstr "" |
5753 | 5758 | ||
5754 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 | 5759 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 |
5755 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:523 | 5760 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:525 |
5756 | #, fuzzy, c-format | 5761 | #, fuzzy, c-format |
5757 | msgid "Failure: Cannot convert address to string for peer `%s'\n" | 5762 | msgid "Failure: Cannot convert address to string for peer `%s'\n" |
5758 | msgstr "Misslyckades att binda till UDP-port %d.\n" | 5763 | msgstr "Misslyckades att binda till UDP-port %d.\n" |
@@ -5762,54 +5767,54 @@ msgstr "Misslyckades att binda till UDP-port %d.\n" | |||
5762 | msgid "Failure: Received invalid %s\n" | 5767 | msgid "Failure: Received invalid %s\n" |
5763 | msgstr "" | 5768 | msgstr "" |
5764 | 5769 | ||
5765 | #: src/peerinfo-tool/gnunet-peerinfo.c:463 | 5770 | #: src/peerinfo-tool/gnunet-peerinfo.c:464 |
5766 | #, fuzzy, c-format | 5771 | #, fuzzy, c-format |
5767 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" | 5772 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" |
5768 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 5773 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
5769 | 5774 | ||
5770 | #: src/peerinfo-tool/gnunet-peerinfo.c:479 | 5775 | #: src/peerinfo-tool/gnunet-peerinfo.c:480 |
5771 | #, c-format | 5776 | #, c-format |
5772 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" | 5777 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" |
5773 | msgstr "" | 5778 | msgstr "" |
5774 | 5779 | ||
5775 | #: src/peerinfo-tool/gnunet-peerinfo.c:758 | 5780 | #: src/peerinfo-tool/gnunet-peerinfo.c:759 |
5776 | #, c-format | 5781 | #, c-format |
5777 | msgid "I am peer `%s'.\n" | 5782 | msgid "I am peer `%s'.\n" |
5778 | msgstr "Jag är ändpunkt \"%s\".\n" | 5783 | msgstr "Jag är ändpunkt \"%s\".\n" |
5779 | 5784 | ||
5780 | #: src/peerinfo-tool/gnunet-peerinfo.c:799 | 5785 | #: src/peerinfo-tool/gnunet-peerinfo.c:800 |
5781 | msgid "don't resolve host names" | 5786 | msgid "don't resolve host names" |
5782 | msgstr "" | 5787 | msgstr "" |
5783 | 5788 | ||
5784 | #: src/peerinfo-tool/gnunet-peerinfo.c:805 | 5789 | #: src/peerinfo-tool/gnunet-peerinfo.c:806 |
5785 | msgid "output only the identity strings" | 5790 | msgid "output only the identity strings" |
5786 | msgstr "" | 5791 | msgstr "" |
5787 | 5792 | ||
5788 | #: src/peerinfo-tool/gnunet-peerinfo.c:810 | 5793 | #: src/peerinfo-tool/gnunet-peerinfo.c:811 |
5789 | msgid "include friend-only information" | 5794 | msgid "include friend-only information" |
5790 | msgstr "" | 5795 | msgstr "" |
5791 | 5796 | ||
5792 | #: src/peerinfo-tool/gnunet-peerinfo.c:815 | 5797 | #: src/peerinfo-tool/gnunet-peerinfo.c:816 |
5793 | msgid "output our own identity only" | 5798 | msgid "output our own identity only" |
5794 | msgstr "" | 5799 | msgstr "" |
5795 | 5800 | ||
5796 | #: src/peerinfo-tool/gnunet-peerinfo.c:820 | 5801 | #: src/peerinfo-tool/gnunet-peerinfo.c:821 |
5797 | msgid "list all known peers" | 5802 | msgid "list all known peers" |
5798 | msgstr "" | 5803 | msgstr "" |
5799 | 5804 | ||
5800 | #: src/peerinfo-tool/gnunet-peerinfo.c:826 | 5805 | #: src/peerinfo-tool/gnunet-peerinfo.c:827 |
5801 | msgid "dump hello to file" | 5806 | msgid "dump hello to file" |
5802 | msgstr "" | 5807 | msgstr "" |
5803 | 5808 | ||
5804 | #: src/peerinfo-tool/gnunet-peerinfo.c:831 | 5809 | #: src/peerinfo-tool/gnunet-peerinfo.c:832 |
5805 | msgid "also output HELLO uri(s)" | 5810 | msgid "also output HELLO uri(s)" |
5806 | msgstr "" | 5811 | msgstr "" |
5807 | 5812 | ||
5808 | #: src/peerinfo-tool/gnunet-peerinfo.c:838 | 5813 | #: src/peerinfo-tool/gnunet-peerinfo.c:839 |
5809 | msgid "add given HELLO uri to the database" | 5814 | msgid "add given HELLO uri to the database" |
5810 | msgstr "" | 5815 | msgstr "" |
5811 | 5816 | ||
5812 | #: src/peerinfo-tool/gnunet-peerinfo.c:852 | 5817 | #: src/peerinfo-tool/gnunet-peerinfo.c:853 |
5813 | #, fuzzy | 5818 | #, fuzzy |
5814 | msgid "Print information about peers." | 5819 | msgid "Print information about peers." |
5815 | msgstr "Skriv ut information om GNUnets motparter." | 5820 | msgstr "Skriv ut information om GNUnets motparter." |
@@ -5832,7 +5837,7 @@ msgstr "Testar transport(er) %s\n" | |||
5832 | msgid "Failed to load transport plugin for `%s'\n" | 5837 | msgid "Failed to load transport plugin for `%s'\n" |
5833 | msgstr "Kunde inte slå upp \"%s\": %s\n" | 5838 | msgstr "Kunde inte slå upp \"%s\": %s\n" |
5834 | 5839 | ||
5835 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:809 | 5840 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:811 |
5836 | #, fuzzy | 5841 | #, fuzzy |
5837 | msgid "Peerinfo REST API initialized\n" | 5842 | msgid "Peerinfo REST API initialized\n" |
5838 | msgstr " Anslutning misslyckades\n" | 5843 | msgstr " Anslutning misslyckades\n" |
@@ -5841,7 +5846,7 @@ msgstr " Anslutning misslyckades\n" | |||
5841 | msgid "peerstore" | 5846 | msgid "peerstore" |
5842 | msgstr "" | 5847 | msgstr "" |
5843 | 5848 | ||
5844 | #: src/peerstore/gnunet-service-peerstore.c:561 | 5849 | #: src/peerstore/gnunet-service-peerstore.c:570 |
5845 | #, fuzzy, c-format | 5850 | #, fuzzy, c-format |
5846 | msgid "Could not load database backend `%s'\n" | 5851 | msgid "Could not load database backend `%s'\n" |
5847 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 5852 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
@@ -6032,12 +6037,12 @@ msgstr "" | |||
6032 | msgid "re:claimID command line tool" | 6037 | msgid "re:claimID command line tool" |
6033 | msgstr "" | 6038 | msgstr "" |
6034 | 6039 | ||
6035 | #: src/reclaim/plugin_rest_openid_connect.c:2613 | 6040 | #: src/reclaim/plugin_rest_openid_connect.c:2788 |
6036 | #, fuzzy | 6041 | #, fuzzy |
6037 | msgid "OpenID Connect REST API initialized\n" | 6042 | msgid "OpenID Connect REST API initialized\n" |
6038 | msgstr " Anslutning misslyckades\n" | 6043 | msgstr " Anslutning misslyckades\n" |
6039 | 6044 | ||
6040 | #: src/reclaim/plugin_rest_reclaim.c:1502 | 6045 | #: src/reclaim/plugin_rest_reclaim.c:1521 |
6041 | #, fuzzy | 6046 | #, fuzzy |
6042 | msgid "Identity Provider REST API initialized\n" | 6047 | msgid "Identity Provider REST API initialized\n" |
6043 | msgstr " Anslutning misslyckades\n" | 6048 | msgstr " Anslutning misslyckades\n" |
@@ -6199,116 +6204,116 @@ msgstr "" | |||
6199 | msgid "Cancelling calculation.\n" | 6204 | msgid "Cancelling calculation.\n" |
6200 | msgstr "" | 6205 | msgstr "" |
6201 | 6206 | ||
6202 | #: src/revocation/gnunet-revocation.c:299 | 6207 | #: src/revocation/gnunet-revocation.c:302 |
6203 | #, c-format | 6208 | #, c-format |
6204 | msgid "Revocation certificate for `%s' stored in `%s'\n" | 6209 | msgid "Revocation certificate for `%s' stored in `%s'\n" |
6205 | msgstr "" | 6210 | msgstr "" |
6206 | 6211 | ||
6207 | #: src/revocation/gnunet-revocation.c:339 | 6212 | #: src/revocation/gnunet-revocation.c:334 |
6208 | #, fuzzy, c-format | 6213 | #, fuzzy, c-format |
6209 | msgid "Ego `%s' not found.\n" | 6214 | msgid "Ego `%s' not found.\n" |
6210 | msgstr "\"%s\" misslyckades: tabell hittades inte!\n" | 6215 | msgstr "\"%s\" misslyckades: tabell hittades inte!\n" |
6211 | 6216 | ||
6212 | #: src/revocation/gnunet-revocation.c:356 | 6217 | #: src/revocation/gnunet-revocation.c:351 |
6213 | #, c-format | 6218 | #, c-format |
6214 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" | 6219 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" |
6215 | msgstr "" | 6220 | msgstr "" |
6216 | 6221 | ||
6217 | #: src/revocation/gnunet-revocation.c:366 | 6222 | #: src/revocation/gnunet-revocation.c:361 |
6218 | msgid "Revocation certificate ready\n" | 6223 | msgid "Revocation certificate ready\n" |
6219 | msgstr "" | 6224 | msgstr "" |
6220 | 6225 | ||
6221 | #: src/revocation/gnunet-revocation.c:378 | 6226 | #: src/revocation/gnunet-revocation.c:373 |
6222 | msgid "Continuing calculation where left off...\n" | 6227 | msgid "Continuing calculation where left off...\n" |
6223 | msgstr "" | 6228 | msgstr "" |
6224 | 6229 | ||
6225 | #: src/revocation/gnunet-revocation.c:385 | 6230 | #: src/revocation/gnunet-revocation.c:380 |
6226 | msgid "Revocation certificate not ready, calculating proof of work\n" | 6231 | msgid "Revocation certificate not ready, calculating proof of work\n" |
6227 | msgstr "" | 6232 | msgstr "" |
6228 | 6233 | ||
6229 | #: src/revocation/gnunet-revocation.c:423 | 6234 | #: src/revocation/gnunet-revocation.c:418 |
6230 | #, fuzzy, c-format | 6235 | #, fuzzy, c-format |
6231 | msgid "Public key `%s' malformed\n" | 6236 | msgid "Public key `%s' malformed\n" |
6232 | msgstr "Ogiltigt argument: \"%s\"\n" | 6237 | msgstr "Ogiltigt argument: \"%s\"\n" |
6233 | 6238 | ||
6234 | #: src/revocation/gnunet-revocation.c:433 | 6239 | #: src/revocation/gnunet-revocation.c:428 |
6235 | msgid "" | 6240 | msgid "" |
6236 | "Testing and revoking at the same time is not allowed, only executing test.\n" | 6241 | "Testing and revoking at the same time is not allowed, only executing test.\n" |
6237 | msgstr "" | 6242 | msgstr "" |
6238 | 6243 | ||
6239 | #: src/revocation/gnunet-revocation.c:463 | 6244 | #: src/revocation/gnunet-revocation.c:458 |
6240 | #, fuzzy | 6245 | #, fuzzy |
6241 | msgid "No filename to store revocation certificate given.\n" | 6246 | msgid "No filename to store revocation certificate given.\n" |
6242 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 6247 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
6243 | 6248 | ||
6244 | #: src/revocation/gnunet-revocation.c:480 | 6249 | #: src/revocation/gnunet-revocation.c:475 |
6245 | #, fuzzy, c-format | 6250 | #, fuzzy, c-format |
6246 | msgid "Failed to read revocation certificate from `%s'\n" | 6251 | msgid "Failed to read revocation certificate from `%s'\n" |
6247 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 6252 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
6248 | 6253 | ||
6249 | #: src/revocation/gnunet-revocation.c:488 | 6254 | #: src/revocation/gnunet-revocation.c:483 |
6250 | #, fuzzy, c-format | 6255 | #, fuzzy, c-format |
6251 | msgid "Revocation certificate corrupted in `%s'\n" | 6256 | msgid "Revocation certificate corrupted in `%s'\n" |
6252 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" | 6257 | msgstr "Misslyckades att läsa kompislista från \"%s\"\n" |
6253 | 6258 | ||
6254 | #: src/revocation/gnunet-revocation.c:510 | 6259 | #: src/revocation/gnunet-revocation.c:505 |
6255 | #, fuzzy | 6260 | #, fuzzy |
6256 | msgid "No action specified. Nothing to do.\n" | 6261 | msgid "No action specified. Nothing to do.\n" |
6257 | msgstr "Inget tabellnamn angivet, använder \"%s\".\n" | 6262 | msgstr "Inget tabellnamn angivet, använder \"%s\".\n" |
6258 | 6263 | ||
6259 | #: src/revocation/gnunet-revocation.c:529 | 6264 | #: src/revocation/gnunet-revocation.c:524 |
6260 | msgid "use NAME for the name of the revocation file" | 6265 | msgid "use NAME for the name of the revocation file" |
6261 | msgstr "" | 6266 | msgstr "" |
6262 | 6267 | ||
6263 | #: src/revocation/gnunet-revocation.c:537 | 6268 | #: src/revocation/gnunet-revocation.c:532 |
6264 | msgid "" | 6269 | msgid "" |
6265 | "revoke the private key associated for the the private key associated with " | 6270 | "revoke the private key associated for the the private key associated with " |
6266 | "the ego NAME " | 6271 | "the ego NAME " |
6267 | msgstr "" | 6272 | msgstr "" |
6268 | 6273 | ||
6269 | #: src/revocation/gnunet-revocation.c:544 | 6274 | #: src/revocation/gnunet-revocation.c:539 |
6270 | msgid "actually perform revocation, otherwise we just do the precomputation" | 6275 | msgid "actually perform revocation, otherwise we just do the precomputation" |
6271 | msgstr "" | 6276 | msgstr "" |
6272 | 6277 | ||
6273 | #: src/revocation/gnunet-revocation.c:551 | 6278 | #: src/revocation/gnunet-revocation.c:546 |
6274 | msgid "test if the public key KEY has been revoked" | 6279 | msgid "test if the public key KEY has been revoked" |
6275 | msgstr "" | 6280 | msgstr "" |
6276 | 6281 | ||
6277 | #: src/revocation/gnunet-revocation.c:557 | 6282 | #: src/revocation/gnunet-revocation.c:552 |
6278 | #, fuzzy | 6283 | #, fuzzy |
6279 | msgid "number of epochs to calculate for" | 6284 | msgid "number of epochs to calculate for" |
6280 | msgstr "antal iterationer" | 6285 | msgstr "antal iterationer" |
6281 | 6286 | ||
6282 | #: src/revocation/gnunet-service-revocation.c:494 | 6287 | #: src/revocation/gnunet-service-revocation.c:502 |
6283 | #, fuzzy | 6288 | #, fuzzy |
6284 | msgid "# unsupported revocations received via set union" | 6289 | msgid "# unsupported revocations received via set union" |
6285 | msgstr "# byte mottogs via TCP" | 6290 | msgstr "# byte mottogs via TCP" |
6286 | 6291 | ||
6287 | #: src/revocation/gnunet-service-revocation.c:504 | 6292 | #: src/revocation/gnunet-service-revocation.c:512 |
6288 | #, fuzzy | 6293 | #, fuzzy |
6289 | msgid "# revocation messages received via set union" | 6294 | msgid "# revocation messages received via set union" |
6290 | msgstr "# krypterade PONG-meddelanden mottagna" | 6295 | msgstr "# krypterade PONG-meddelanden mottagna" |
6291 | 6296 | ||
6292 | #: src/revocation/gnunet-service-revocation.c:509 | 6297 | #: src/revocation/gnunet-service-revocation.c:517 |
6293 | #, c-format | 6298 | #, c-format |
6294 | msgid "Error computing revocation set union with %s\n" | 6299 | msgid "Error computing revocation set union with %s\n" |
6295 | msgstr "" | 6300 | msgstr "" |
6296 | 6301 | ||
6297 | #: src/revocation/gnunet-service-revocation.c:513 | 6302 | #: src/revocation/gnunet-service-revocation.c:521 |
6298 | #, fuzzy | 6303 | #, fuzzy |
6299 | msgid "# revocation set unions failed" | 6304 | msgid "# revocation set unions failed" |
6300 | msgstr "# sessionsnycklar accepterade" | 6305 | msgstr "# sessionsnycklar accepterade" |
6301 | 6306 | ||
6302 | #: src/revocation/gnunet-service-revocation.c:521 | 6307 | #: src/revocation/gnunet-service-revocation.c:529 |
6303 | #, fuzzy | 6308 | #, fuzzy |
6304 | msgid "# revocation set unions completed" | 6309 | msgid "# revocation set unions completed" |
6305 | msgstr "# klartext PONG-meddelanden mottagna" | 6310 | msgstr "# klartext PONG-meddelanden mottagna" |
6306 | 6311 | ||
6307 | #: src/revocation/gnunet-service-revocation.c:559 | 6312 | #: src/revocation/gnunet-service-revocation.c:567 |
6308 | msgid "SET service crashed, terminating revocation service\n" | 6313 | msgid "SET service crashed, terminating revocation service\n" |
6309 | msgstr "" | 6314 | msgstr "" |
6310 | 6315 | ||
6311 | #: src/revocation/gnunet-service-revocation.c:912 | 6316 | #: src/revocation/gnunet-service-revocation.c:920 |
6312 | #, fuzzy | 6317 | #, fuzzy |
6313 | msgid "Could not open revocation database file!" | 6318 | msgid "Could not open revocation database file!" |
6314 | msgstr "Kunde inte ansluta till gnunetd.\n" | 6319 | msgstr "Kunde inte ansluta till gnunetd.\n" |
@@ -6325,21 +6330,21 @@ msgstr "" | |||
6325 | msgid "Get peers from biased stream" | 6330 | msgid "Get peers from biased stream" |
6326 | msgstr "" | 6331 | msgstr "" |
6327 | 6332 | ||
6328 | #: src/rps/gnunet-rps-profiler.c:3200 | 6333 | #: src/rps/gnunet-rps-profiler.c:3142 |
6329 | msgid "duration of the profiling" | 6334 | msgid "duration of the profiling" |
6330 | msgstr "" | 6335 | msgstr "" |
6331 | 6336 | ||
6332 | #: src/rps/gnunet-rps-profiler.c:3206 | 6337 | #: src/rps/gnunet-rps-profiler.c:3148 |
6333 | #, fuzzy | 6338 | #, fuzzy |
6334 | msgid "timeout for the profiling" | 6339 | msgid "timeout for the profiling" |
6335 | msgstr "ange prioritet för innehållet" | 6340 | msgstr "ange prioritet för innehållet" |
6336 | 6341 | ||
6337 | #: src/rps/gnunet-rps-profiler.c:3211 | 6342 | #: src/rps/gnunet-rps-profiler.c:3153 |
6338 | #, fuzzy | 6343 | #, fuzzy |
6339 | msgid "number of PeerIDs to request" | 6344 | msgid "number of PeerIDs to request" |
6340 | msgstr "antal iterationer" | 6345 | msgstr "antal iterationer" |
6341 | 6346 | ||
6342 | #: src/rps/gnunet-rps-profiler.c:3228 | 6347 | #: src/rps/gnunet-rps-profiler.c:3170 |
6343 | #, fuzzy | 6348 | #, fuzzy |
6344 | msgid "Measure quality and performance of the RPS service." | 6349 | msgid "Measure quality and performance of the RPS service." |
6345 | msgstr "Kan inte tillgå tjänsten" | 6350 | msgstr "Kan inte tillgå tjänsten" |
@@ -6428,7 +6433,7 @@ msgid "also profile decryption" | |||
6428 | msgstr "" | 6433 | msgstr "" |
6429 | 6434 | ||
6430 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 | 6435 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 |
6431 | #: src/setu/gnunet-service-setu.c:3633 | 6436 | #: src/setu/gnunet-service-setu.c:3832 |
6432 | #, fuzzy | 6437 | #, fuzzy |
6433 | msgid "Could not connect to CADET service\n" | 6438 | msgid "Could not connect to CADET service\n" |
6434 | msgstr "Kunde inte ansluta till gnunetd.\n" | 6439 | msgstr "Kunde inte ansluta till gnunetd.\n" |
@@ -7001,12 +7006,12 @@ msgstr "Fel vid %s:%d.\n" | |||
7001 | msgid "Failed to load configuration from %s\n" | 7006 | msgid "Failed to load configuration from %s\n" |
7002 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 7007 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
7003 | 7008 | ||
7004 | #: src/topology/friends.c:127 | 7009 | #: src/topology/friends.c:118 |
7005 | #, fuzzy, c-format | 7010 | #, fuzzy, c-format |
7006 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" | 7011 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" |
7007 | msgstr "Syntaxfel i konfigurationsfil \"%s\" på rad %d.\n" | 7012 | msgstr "Syntaxfel i konfigurationsfil \"%s\" på rad %d.\n" |
7008 | 7013 | ||
7009 | #: src/topology/friends.c:181 | 7014 | #: src/topology/friends.c:172 |
7010 | #, c-format | 7015 | #, c-format |
7011 | msgid "Directory for file `%s' does not seem to be writable.\n" | 7016 | msgid "Directory for file `%s' does not seem to be writable.\n" |
7012 | msgstr "" | 7017 | msgstr "" |
@@ -7074,19 +7079,19 @@ msgstr "# krypterade PONG-meddelanden mottagna" | |||
7074 | msgid "GNUnet topology control" | 7079 | msgid "GNUnet topology control" |
7075 | msgstr "" | 7080 | msgstr "" |
7076 | 7081 | ||
7077 | #: src/transport/gnunet-communicator-tcp.c:3221 | 7082 | #: src/transport/gnunet-communicator-tcp.c:3331 |
7078 | #: src/transport/gnunet-communicator-udp.c:3076 | 7083 | #: src/transport/gnunet-communicator-udp.c:3790 |
7079 | #: src/transport/gnunet-service-tng.c:10014 | 7084 | #: src/transport/gnunet-service-tng.c:10220 |
7080 | #: src/transport/gnunet-service-transport.c:2627 | 7085 | #: src/transport/gnunet-service-transport.c:2627 |
7081 | #, fuzzy | 7086 | #, fuzzy |
7082 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7087 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7083 | msgstr "GNUnet-konfiguration" | 7088 | msgstr "GNUnet-konfiguration" |
7084 | 7089 | ||
7085 | #: src/transport/gnunet-communicator-tcp.c:3553 | 7090 | #: src/transport/gnunet-communicator-tcp.c:3668 |
7086 | msgid "GNUnet TCP communicator" | 7091 | msgid "GNUnet TCP communicator" |
7087 | msgstr "" | 7092 | msgstr "" |
7088 | 7093 | ||
7089 | #: src/transport/gnunet-communicator-udp.c:3148 | 7094 | #: src/transport/gnunet-communicator-udp.c:3862 |
7090 | msgid "GNUnet UDP communicator" | 7095 | msgid "GNUnet UDP communicator" |
7091 | msgstr "" | 7096 | msgstr "" |
7092 | 7097 | ||
@@ -8194,7 +8199,7 @@ msgstr "" | |||
8194 | msgid "Service process failed to report status\n" | 8199 | msgid "Service process failed to report status\n" |
8195 | msgstr "" | 8200 | msgstr "" |
8196 | 8201 | ||
8197 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1176 | 8202 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 |
8198 | #: src/util/service.c:1637 | 8203 | #: src/util/service.c:1637 |
8199 | #, fuzzy, c-format | 8204 | #, fuzzy, c-format |
8200 | msgid "Cannot obtain information about user `%s': %s\n" | 8205 | msgid "Cannot obtain information about user `%s': %s\n" |
@@ -8214,7 +8219,7 @@ msgid "do daemonize (detach from terminal)" | |||
8214 | msgstr "" | 8219 | msgstr "" |
8215 | 8220 | ||
8216 | #: src/transport/tcp_service_legacy.c:1397 | 8221 | #: src/transport/tcp_service_legacy.c:1397 |
8217 | #: src/transport/transport-testing2.c:985 src/util/service.c:2072 | 8222 | #: src/transport/transport-testing-communicator.c:1045 src/util/service.c:2072 |
8218 | #: src/util/service.c:2084 | 8223 | #: src/util/service.c:2084 |
8219 | #, fuzzy, c-format | 8224 | #, fuzzy, c-format |
8220 | msgid "Malformed configuration file `%s', exit ...\n" | 8225 | msgid "Malformed configuration file `%s', exit ...\n" |
@@ -8380,39 +8385,39 @@ msgid "" | |||
8380 | "Configuration specifies invalid value for option `%s' in section `%s': %s\n" | 8385 | "Configuration specifies invalid value for option `%s' in section `%s': %s\n" |
8381 | msgstr "Konfigurationsfil \"%s\" hittades inte. Kör \"gnunet-setup -d\"!\n" | 8386 | msgstr "Konfigurationsfil \"%s\" hittades inte. Kör \"gnunet-setup -d\"!\n" |
8382 | 8387 | ||
8383 | #: src/util/configuration.c:402 | 8388 | #: src/util/configuration.c:370 |
8384 | #, fuzzy, c-format | 8389 | #, fuzzy, c-format |
8385 | msgid "Syntax error while deserializing in line %u\n" | 8390 | msgid "Syntax error while deserializing in line %u\n" |
8386 | msgstr "Syntaxfel i konfigurationsfil \"%s\" på rad %d.\n" | 8391 | msgstr "Syntaxfel i konfigurationsfil \"%s\" på rad %d.\n" |
8387 | 8392 | ||
8388 | #: src/util/configuration.c:460 | 8393 | #: src/util/configuration.c:420 |
8389 | #, fuzzy, c-format | 8394 | #, fuzzy, c-format |
8390 | msgid "Error while reading file `%s'\n" | 8395 | msgid "Error while reading file `%s'\n" |
8391 | msgstr "Fel vid nedladdning: %s\n" | 8396 | msgstr "Fel vid nedladdning: %s\n" |
8392 | 8397 | ||
8393 | #: src/util/configuration.c:1063 | 8398 | #: src/util/configuration.c:980 |
8394 | #, fuzzy | 8399 | #, fuzzy |
8395 | msgid "Not a valid relative time specification" | 8400 | msgid "Not a valid relative time specification" |
8396 | msgstr "Konfigurationsfil \"%s\" skapad.\n" | 8401 | msgstr "Konfigurationsfil \"%s\" skapad.\n" |
8397 | 8402 | ||
8398 | #: src/util/configuration.c:1154 | 8403 | #: src/util/configuration.c:1050 |
8399 | #, c-format | 8404 | #, c-format |
8400 | msgid "" | 8405 | msgid "" |
8401 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " | 8406 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " |
8402 | "choices\n" | 8407 | "choices\n" |
8403 | msgstr "" | 8408 | msgstr "" |
8404 | 8409 | ||
8405 | #: src/util/configuration.c:1269 | 8410 | #: src/util/configuration.c:1145 |
8406 | #, c-format | 8411 | #, c-format |
8407 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" | 8412 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" |
8408 | msgstr "" | 8413 | msgstr "" |
8409 | 8414 | ||
8410 | #: src/util/configuration.c:1301 | 8415 | #: src/util/configuration.c:1177 |
8411 | #, fuzzy, c-format | 8416 | #, fuzzy, c-format |
8412 | msgid "Missing closing `%s' in option `%s'\n" | 8417 | msgid "Missing closing `%s' in option `%s'\n" |
8413 | msgstr "Konfigurationsfil \"%s\" skapad.\n" | 8418 | msgstr "Konfigurationsfil \"%s\" skapad.\n" |
8414 | 8419 | ||
8415 | #: src/util/configuration.c:1367 | 8420 | #: src/util/configuration.c:1243 |
8416 | #, c-format | 8421 | #, c-format |
8417 | msgid "" | 8422 | msgid "" |
8418 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " | 8423 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " |
@@ -8426,37 +8431,37 @@ msgid "" | |||
8426 | "%llu)\n" | 8431 | "%llu)\n" |
8427 | msgstr "" | 8432 | msgstr "" |
8428 | 8433 | ||
8429 | #: src/util/crypto_ecc.c:663 | 8434 | #: src/util/crypto_ecc.c:567 |
8430 | #, fuzzy, c-format | 8435 | #, fuzzy, c-format |
8431 | msgid "ECC signing failed at %s:%d: %s\n" | 8436 | msgid "ECC signing failed at %s:%d: %s\n" |
8432 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" | 8437 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" |
8433 | 8438 | ||
8434 | #: src/util/crypto_ecc.c:791 | 8439 | #: src/util/crypto_ecc.c:669 |
8435 | #, fuzzy, c-format | 8440 | #, fuzzy, c-format |
8436 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 8441 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
8437 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" | 8442 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" |
8438 | 8443 | ||
8439 | #: src/util/crypto_ecc_setup.c:369 | 8444 | #: src/util/crypto_ecc_setup.c:273 |
8440 | #, fuzzy | 8445 | #, fuzzy |
8441 | msgid "Could not load peer's private key\n" | 8446 | msgid "Could not load peer's private key\n" |
8442 | msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n" | 8447 | msgstr "Kunde inte tolka konfigurationsfil \"%s\".\n" |
8443 | 8448 | ||
8444 | #: src/util/crypto_random.c:345 | 8449 | #: src/util/crypto_random.c:381 |
8445 | #, c-format | 8450 | #, c-format |
8446 | msgid "libgcrypt has not the expected version (version %s is required).\n" | 8451 | msgid "libgcrypt has not the expected version (version %s is required).\n" |
8447 | msgstr "libgcrypt har inte den förväntande versionen (version %s krävs).\n" | 8452 | msgstr "libgcrypt har inte den förväntande versionen (version %s krävs).\n" |
8448 | 8453 | ||
8449 | #: src/util/crypto_rsa.c:959 | 8454 | #: src/util/crypto_rsa.c:862 |
8450 | #, fuzzy, c-format | 8455 | #, fuzzy, c-format |
8451 | msgid "RSA signing failed at %s:%d: %s\n" | 8456 | msgid "RSA signing failed at %s:%d: %s\n" |
8452 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" | 8457 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" |
8453 | 8458 | ||
8454 | #: src/util/crypto_rsa.c:1318 | 8459 | #: src/util/crypto_rsa.c:1162 |
8455 | #, fuzzy, c-format | 8460 | #, fuzzy, c-format |
8456 | msgid "RSA signature verification failed at %s:%d: %s\n" | 8461 | msgid "RSA signature verification failed at %s:%d: %s\n" |
8457 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" | 8462 | msgstr "\"%s\" misslyckades vid %s:%d med fel: \"%s\".\n" |
8458 | 8463 | ||
8459 | #: src/util/disk.c:940 | 8464 | #: src/util/disk.c:823 |
8460 | #, fuzzy, c-format | 8465 | #, fuzzy, c-format |
8461 | msgid "Expected `%s' to be a directory!\n" | 8466 | msgid "Expected `%s' to be a directory!\n" |
8462 | msgstr "\"%s\" förväntade att \"%s\" skulle vara en katalog!\n" | 8467 | msgstr "\"%s\" förväntade att \"%s\" skulle vara en katalog!\n" |
@@ -8541,17 +8546,17 @@ msgstr "%s: flagga \"-W %s\" är tvetydig\n" | |||
8541 | msgid "%s: option `-W %s' does not allow an argument\n" | 8546 | msgid "%s: option `-W %s' does not allow an argument\n" |
8542 | msgstr "%s: flagga \"-W %s\" tillåter inte ett argument\n" | 8547 | msgstr "%s: flagga \"-W %s\" tillåter inte ett argument\n" |
8543 | 8548 | ||
8544 | #: src/util/getopt.c:974 | 8549 | #: src/util/getopt.c:970 |
8545 | #, fuzzy, c-format | 8550 | #, fuzzy, c-format |
8546 | msgid "Use %s to get a list of options.\n" | 8551 | msgid "Use %s to get a list of options.\n" |
8547 | msgstr "Använd --help för att få en lista på flaggor.\n" | 8552 | msgstr "Använd --help för att få en lista på flaggor.\n" |
8548 | 8553 | ||
8549 | #: src/util/getopt.c:986 | 8554 | #: src/util/getopt.c:983 |
8550 | #, fuzzy, c-format | 8555 | #, fuzzy, c-format |
8551 | msgid "Option `%s' can't be used with other options.\n" | 8556 | msgid "Option `%s' can't be used with other options.\n" |
8552 | msgstr "Kommando \"%s\" kräver ett argument (\"%s\").\n" | 8557 | msgstr "Kommando \"%s\" kräver ett argument (\"%s\").\n" |
8553 | 8558 | ||
8554 | #: src/util/getopt.c:998 | 8559 | #: src/util/getopt.c:995 |
8555 | #, fuzzy, c-format | 8560 | #, fuzzy, c-format |
8556 | msgid "Missing mandatory option `%s'.\n" | 8561 | msgid "Missing mandatory option `%s'.\n" |
8557 | msgstr "Konfigurationsfil \"%s\" skapad.\n" | 8562 | msgstr "Konfigurationsfil \"%s\" skapad.\n" |
@@ -8639,6 +8644,10 @@ msgstr "Du måste skicka med ett nummer till flaggan \"%s\".\n" | |||
8639 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 8644 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
8640 | msgstr "" | 8645 | msgstr "" |
8641 | 8646 | ||
8647 | #: src/util/gnunet-base32.c:45 | ||
8648 | msgid "run decoder modus, otherwise runs as encoder" | ||
8649 | msgstr "" | ||
8650 | |||
8642 | #: src/util/gnunet-config.c:167 | 8651 | #: src/util/gnunet-config.c:167 |
8643 | #, fuzzy, c-format | 8652 | #, fuzzy, c-format |
8644 | msgid "failed to load configuration defaults" | 8653 | msgid "failed to load configuration defaults" |
@@ -8694,6 +8703,10 @@ msgstr "" | |||
8694 | msgid "Manipulate GNUnet configuration files" | 8703 | msgid "Manipulate GNUnet configuration files" |
8695 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" | 8704 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" |
8696 | 8705 | ||
8706 | #: src/util/gnunet-crypto-tvg.c:1072 | ||
8707 | msgid "verify a test vector from stdin" | ||
8708 | msgstr "" | ||
8709 | |||
8697 | #: src/util/gnunet-ecc.c:94 | 8710 | #: src/util/gnunet-ecc.c:94 |
8698 | #, fuzzy, c-format | 8711 | #, fuzzy, c-format |
8699 | msgid "Failed to open `%s': %s\n" | 8712 | msgid "Failed to open `%s': %s\n" |
@@ -8814,31 +8827,31 @@ msgid "perform a reverse lookup" | |||
8814 | msgstr "" | 8827 | msgstr "" |
8815 | 8828 | ||
8816 | #: src/util/gnunet-resolver.c:182 | 8829 | #: src/util/gnunet-resolver.c:182 |
8817 | msgid "Use build-in GNUnet stub resolver" | 8830 | msgid "Use built-in GNUnet stub resolver" |
8818 | msgstr "" | 8831 | msgstr "" |
8819 | 8832 | ||
8820 | #: src/util/gnunet-scrypt.c:229 | 8833 | #: src/util/gnunet-scrypt.c:232 |
8821 | #, fuzzy, c-format | 8834 | #, fuzzy, c-format |
8822 | msgid "Loading hostkey from `%s' failed.\n" | 8835 | msgid "Loading hostkey from `%s' failed.\n" |
8823 | msgstr "Tolkning av HTTP-svar för URL \"%s\" misslyckades.\n" | 8836 | msgstr "Tolkning av HTTP-svar för URL \"%s\" misslyckades.\n" |
8824 | 8837 | ||
8825 | #: src/util/gnunet-scrypt.c:295 | 8838 | #: src/util/gnunet-scrypt.c:298 |
8826 | msgid "number of bits to require for the proof of work" | 8839 | msgid "number of bits to require for the proof of work" |
8827 | msgstr "" | 8840 | msgstr "" |
8828 | 8841 | ||
8829 | #: src/util/gnunet-scrypt.c:301 | 8842 | #: src/util/gnunet-scrypt.c:304 |
8830 | msgid "file with private key, otherwise default is used" | 8843 | msgid "file with private key, otherwise default is used" |
8831 | msgstr "" | 8844 | msgstr "" |
8832 | 8845 | ||
8833 | #: src/util/gnunet-scrypt.c:307 | 8846 | #: src/util/gnunet-scrypt.c:310 |
8834 | msgid "file with proof of work, otherwise default is used" | 8847 | msgid "file with proof of work, otherwise default is used" |
8835 | msgstr "" | 8848 | msgstr "" |
8836 | 8849 | ||
8837 | #: src/util/gnunet-scrypt.c:313 | 8850 | #: src/util/gnunet-scrypt.c:316 |
8838 | msgid "time to wait between calculations" | 8851 | msgid "time to wait between calculations" |
8839 | msgstr "" | 8852 | msgstr "" |
8840 | 8853 | ||
8841 | #: src/util/gnunet-scrypt.c:326 | 8854 | #: src/util/gnunet-scrypt.c:330 |
8842 | #, fuzzy | 8855 | #, fuzzy |
8843 | msgid "Manipulate GNUnet proof of work files" | 8856 | msgid "Manipulate GNUnet proof of work files" |
8844 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" | 8857 | msgstr "skriv ut ett värde från konfigurationsfilen till standard ut" |
@@ -8876,25 +8889,25 @@ msgstr "Fel vid skapandet av användare" | |||
8876 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" | 8889 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" |
8877 | msgstr "" | 8890 | msgstr "" |
8878 | 8891 | ||
8879 | #: src/util/network.c:1364 | 8892 | #: src/util/network.c:1361 |
8880 | #, c-format | 8893 | #, c-format |
8881 | msgid "" | 8894 | msgid "" |
8882 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" | 8895 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" |
8883 | msgstr "" | 8896 | msgstr "" |
8884 | 8897 | ||
8885 | #: src/util/os_installation.c:411 | 8898 | #: src/util/os_installation.c:415 |
8886 | #, c-format | 8899 | #, c-format |
8887 | msgid "" | 8900 | msgid "" |
8888 | "Could not determine installation path for %s. Set `%s' environment " | 8901 | "Could not determine installation path for %s. Set `%s' environment " |
8889 | "variable.\n" | 8902 | "variable.\n" |
8890 | msgstr "" | 8903 | msgstr "" |
8891 | 8904 | ||
8892 | #: src/util/os_installation.c:794 | 8905 | #: src/util/os_installation.c:802 |
8893 | #, fuzzy, c-format | 8906 | #, fuzzy, c-format |
8894 | msgid "Could not find binary `%s' in PATH!\n" | 8907 | msgid "Could not find binary `%s' in PATH!\n" |
8895 | msgstr "Kunde inte hitta motpart \"%s\" i routingtabell!\n" | 8908 | msgstr "Kunde inte hitta motpart \"%s\" i routingtabell!\n" |
8896 | 8909 | ||
8897 | #: src/util/os_installation.c:827 | 8910 | #: src/util/os_installation.c:835 |
8898 | #, c-format | 8911 | #, c-format |
8899 | msgid "Binary `%s' exists, but is not SUID\n" | 8912 | msgid "Binary `%s' exists, but is not SUID\n" |
8900 | msgstr "" | 8913 | msgstr "" |
@@ -8904,32 +8917,32 @@ msgstr "" | |||
8904 | msgid "Initialization of plugin mechanism failed: %s!\n" | 8917 | msgid "Initialization of plugin mechanism failed: %s!\n" |
8905 | msgstr "Initiering av insticksmekanism misslyckades: %s!\n" | 8918 | msgstr "Initiering av insticksmekanism misslyckades: %s!\n" |
8906 | 8919 | ||
8907 | #: src/util/plugin.c:147 | 8920 | #: src/util/plugin.c:156 |
8908 | #, fuzzy, c-format | 8921 | #, fuzzy, c-format |
8909 | msgid "`%s' failed to resolve method '%s' with error: %s\n" | 8922 | msgid "`%s' failed to resolve method '%s' with error: %s\n" |
8910 | msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" | 8923 | msgstr "\"%s\" misslyckades för fil \"%s\" vid %s:%d med fel: %s\n" |
8911 | 8924 | ||
8912 | #: src/util/plugin.c:223 | 8925 | #: src/util/plugin.c:234 |
8913 | #, fuzzy, c-format | 8926 | #, fuzzy, c-format |
8914 | msgid "`%s' failed for library `%s' with error: %s\n" | 8927 | msgid "`%s' failed for library `%s' with error: %s\n" |
8915 | msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n" | 8928 | msgstr "\"%s\" misslyckades vid %s:%d med fel: %s\n" |
8916 | 8929 | ||
8917 | #: src/util/plugin.c:384 | 8930 | #: src/util/plugin.c:409 |
8918 | #, fuzzy | 8931 | #, fuzzy |
8919 | msgid "Could not determine plugin installation path.\n" | 8932 | msgid "Could not determine plugin installation path.\n" |
8920 | msgstr "Kunde inte fastställa min publika IPv6-adress.\n" | 8933 | msgstr "Kunde inte fastställa min publika IPv6-adress.\n" |
8921 | 8934 | ||
8922 | #: src/util/program.c:267 | 8935 | #: src/util/program.c:259 |
8923 | #, fuzzy, c-format | 8936 | #, fuzzy, c-format |
8924 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" | 8937 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" |
8925 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 8938 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
8926 | 8939 | ||
8927 | #: src/util/program.c:284 | 8940 | #: src/util/program.c:276 |
8928 | #, fuzzy, c-format | 8941 | #, fuzzy, c-format |
8929 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | 8942 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" |
8930 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 8943 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
8931 | 8944 | ||
8932 | #: src/util/program.c:299 | 8945 | #: src/util/program.c:291 |
8933 | #, fuzzy | 8946 | #, fuzzy |
8934 | msgid "Unreadable or malformed configuration, exit ...\n" | 8947 | msgid "Unreadable or malformed configuration, exit ...\n" |
8935 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" | 8948 | msgstr "Kunde inte spara konfigurationsfil \"%s\":" |
@@ -9066,12 +9079,12 @@ msgstr "Fel format \"%s\" för nätmask: %s\n" | |||
9066 | msgid "Wrong format `%s' for network\n" | 9079 | msgid "Wrong format `%s' for network\n" |
9067 | msgstr "Fel format \"%s\" för nätverk: %s\n" | 9080 | msgstr "Fel format \"%s\" för nätverk: %s\n" |
9068 | 9081 | ||
9069 | #: src/util/time.c:848 src/util/time.c:876 | 9082 | #: src/util/time.c:878 src/util/time.c:906 |
9070 | #, c-format | 9083 | #, c-format |
9071 | msgid "Failed to map `%s', cannot assure monotonic time!\n" | 9084 | msgid "Failed to map `%s', cannot assure monotonic time!\n" |
9072 | msgstr "" | 9085 | msgstr "" |
9073 | 9086 | ||
9074 | #: src/util/time.c:884 | 9087 | #: src/util/time.c:914 |
9075 | #, c-format | 9088 | #, c-format |
9076 | msgid "" | 9089 | msgid "" |
9077 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" | 9090 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" |
@@ -8,7 +8,7 @@ msgid "" | |||
8 | msgstr "" | 8 | msgstr "" |
9 | "Project-Id-Version: gnunet 0.8.0a\n" | 9 | "Project-Id-Version: gnunet 0.8.0a\n" |
10 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 10 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
11 | "POT-Creation-Date: 2020-11-13 23:46+0900\n" | 11 | "POT-Creation-Date: 2021-04-04 19:19+0200\n" |
12 | "PO-Revision-Date: 2008-09-10 22:05+0930\n" | 12 | "PO-Revision-Date: 2008-09-10 22:05+0930\n" |
13 | "Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n" | 13 | "Last-Translator: Clytie Siddall <clytie@riverland.net.au>\n" |
14 | "Language-Team: Vietnamese <vi-VN@googlegroups.com>\n" | 14 | "Language-Team: Vietnamese <vi-VN@googlegroups.com>\n" |
@@ -773,7 +773,7 @@ msgstr "" | |||
773 | 773 | ||
774 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 | 774 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 |
775 | #: src/conversation/gnunet-conversation-test.c:256 | 775 | #: src/conversation/gnunet-conversation-test.c:256 |
776 | #: src/revocation/gnunet-revocation.c:569 src/template/gnunet-template.c:75 | 776 | #: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 |
777 | msgid "help text" | 777 | msgid "help text" |
778 | msgstr "" | 778 | msgstr "" |
779 | 779 | ||
@@ -1354,7 +1354,7 @@ msgstr "Lỗi không rõ" | |||
1354 | msgid "%24s: %-30s %4s (timeout in %6s)\n" | 1354 | msgid "%24s: %-30s %4s (timeout in %6s)\n" |
1355 | msgstr "" | 1355 | msgstr "" |
1356 | 1356 | ||
1357 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:696 | 1357 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:697 |
1358 | #, fuzzy, c-format | 1358 | #, fuzzy, c-format |
1359 | msgid "Invalid command line argument `%s'\n" | 1359 | msgid "Invalid command line argument `%s'\n" |
1360 | msgstr "Äối số không hợp lệ cho « %s ».\n" | 1360 | msgstr "Äối số không hợp lệ cho « %s ».\n" |
@@ -1659,7 +1659,7 @@ msgstr "kho dữ liệu sqlite" | |||
1659 | #: src/testbed/generate-underlay-topology.c:48 | 1659 | #: src/testbed/generate-underlay-topology.c:48 |
1660 | #: src/testbed/gnunet-daemon-latency-logger.c:53 | 1660 | #: src/testbed/gnunet-daemon-latency-logger.c:53 |
1661 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 | 1661 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 |
1662 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:62 | 1662 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:78 |
1663 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 | 1663 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 |
1664 | #, c-format | 1664 | #, c-format |
1665 | msgid "`%s' failed at %s:%d with error: %s\n" | 1665 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -2120,7 +2120,7 @@ msgstr "" | |||
2120 | msgid "Exiting as the number of peers is %u\n" | 2120 | msgid "Exiting as the number of peers is %u\n" |
2121 | msgstr "tăng sổ tối đa các kết nối TCP/IP" | 2121 | msgstr "tăng sổ tối đa các kết nối TCP/IP" |
2122 | 2122 | ||
2123 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194 | 2123 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3136 |
2124 | #, fuzzy | 2124 | #, fuzzy |
2125 | msgid "number of peers to start" | 2125 | msgid "number of peers to start" |
2126 | msgstr "số lần lặp lại" | 2126 | msgstr "số lần lặp lại" |
@@ -3320,7 +3320,7 @@ msgid "Downloading `%s' done (%s/s).\n" | |||
3320 | msgstr "Tiến trình tải lên « %s » đã tiếp tục lại.\n" | 3320 | msgstr "Tiến trình tải lên « %s » đã tiếp tục lại.\n" |
3321 | 3321 | ||
3322 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 | 3322 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 |
3323 | #: src/fs/gnunet-search.c:226 src/fs/gnunet-unindex.c:117 | 3323 | #: src/fs/gnunet-search.c:229 src/fs/gnunet-unindex.c:117 |
3324 | #, fuzzy, c-format | 3324 | #, fuzzy, c-format |
3325 | msgid "Unexpected status: %d\n" | 3325 | msgid "Unexpected status: %d\n" |
3326 | msgstr "Gặp sá»± kiện bất thÆ°á»ng: %d\n" | 3326 | msgstr "Gặp sá»± kiện bất thÆ°á»ng: %d\n" |
@@ -3344,12 +3344,12 @@ msgid "Target filename must be specified.\n" | |||
3344 | msgstr "" | 3344 | msgstr "" |
3345 | 3345 | ||
3346 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 | 3346 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 |
3347 | #: src/fs/gnunet-search.c:291 src/fs/gnunet-unindex.c:154 | 3347 | #: src/fs/gnunet-search.c:294 src/fs/gnunet-unindex.c:154 |
3348 | #, fuzzy, c-format | 3348 | #, fuzzy, c-format |
3349 | msgid "Could not initialize `%s' subsystem.\n" | 3349 | msgid "Could not initialize `%s' subsystem.\n" |
3350 | msgstr "Lỗi sơ khởi dịch vụ « %s ».\n" | 3350 | msgstr "Lỗi sơ khởi dịch vụ « %s ».\n" |
3351 | 3351 | ||
3352 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:331 | 3352 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:334 |
3353 | #, fuzzy | 3353 | #, fuzzy |
3354 | msgid "set the desired LEVEL of receiver-anonymity" | 3354 | msgid "set the desired LEVEL of receiver-anonymity" |
3355 | msgstr "đặt CẤP mong muốn của tình trạng nặc danh của ngÆ°á»i gá»i" | 3355 | msgstr "đặt CẤP mong muốn của tình trạng nặc danh của ngÆ°á»i gá»i" |
@@ -3358,7 +3358,7 @@ msgstr "đặt CẤP mong muốn của tình trạng nặc danh của ngÆ°á»i g | |||
3358 | msgid "delete incomplete downloads (when aborted with CTRL-C)" | 3358 | msgid "delete incomplete downloads (when aborted with CTRL-C)" |
3359 | msgstr "xoá việc tải vỠkhông hoà n thà nh (khi hủy bở dùng CTRL-C)" | 3359 | msgstr "xoá việc tải vỠkhông hoà n thà nh (khi hủy bở dùng CTRL-C)" |
3360 | 3360 | ||
3361 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:336 | 3361 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:339 |
3362 | msgid "only search the local peer (no P2P network search)" | 3362 | msgid "only search the local peer (no P2P network search)" |
3363 | msgstr "" | 3363 | msgstr "" |
3364 | 3364 | ||
@@ -3618,39 +3618,39 @@ msgstr "" | |||
3618 | msgid "Publish a file or directory on GNUnet" | 3618 | msgid "Publish a file or directory on GNUnet" |
3619 | msgstr "" | 3619 | msgstr "" |
3620 | 3620 | ||
3621 | #: src/fs/gnunet-search.c:127 | 3621 | #: src/fs/gnunet-search.c:130 |
3622 | #, c-format | 3622 | #, c-format |
3623 | msgid "Failed to write directory with search results to `%s'\n" | 3623 | msgid "Failed to write directory with search results to `%s'\n" |
3624 | msgstr "" | 3624 | msgstr "" |
3625 | 3625 | ||
3626 | #: src/fs/gnunet-search.c:216 | 3626 | #: src/fs/gnunet-search.c:219 |
3627 | #, fuzzy, c-format | 3627 | #, fuzzy, c-format |
3628 | msgid "Error searching: %s.\n" | 3628 | msgid "Error searching: %s.\n" |
3629 | msgstr "Gặp lỗi khi tải xuống: %s\n" | 3629 | msgstr "Gặp lỗi khi tải xuống: %s\n" |
3630 | 3630 | ||
3631 | #: src/fs/gnunet-search.c:278 | 3631 | #: src/fs/gnunet-search.c:281 |
3632 | #, fuzzy | 3632 | #, fuzzy |
3633 | msgid "Could not create keyword URI from arguments.\n" | 3633 | msgid "Could not create keyword URI from arguments.\n" |
3634 | msgstr "Không thể tạo miá»n tên.\n" | 3634 | msgstr "Không thể tạo miá»n tên.\n" |
3635 | 3635 | ||
3636 | #: src/fs/gnunet-search.c:305 | 3636 | #: src/fs/gnunet-search.c:308 |
3637 | #, fuzzy | 3637 | #, fuzzy |
3638 | msgid "Could not start searching.\n" | 3638 | msgid "Could not start searching.\n" |
3639 | msgstr "Không thể tạo miá»n tên.\n" | 3639 | msgstr "Không thể tạo miá»n tên.\n" |
3640 | 3640 | ||
3641 | #: src/fs/gnunet-search.c:342 | 3641 | #: src/fs/gnunet-search.c:345 |
3642 | msgid "write search results to file starting with PREFIX" | 3642 | msgid "write search results to file starting with PREFIX" |
3643 | msgstr "" | 3643 | msgstr "" |
3644 | 3644 | ||
3645 | #: src/fs/gnunet-search.c:348 | 3645 | #: src/fs/gnunet-search.c:351 |
3646 | msgid "automatically terminate search after DELAY" | 3646 | msgid "automatically terminate search after DELAY" |
3647 | msgstr "" | 3647 | msgstr "" |
3648 | 3648 | ||
3649 | #: src/fs/gnunet-search.c:354 | 3649 | #: src/fs/gnunet-search.c:357 |
3650 | msgid "automatically terminate search after VALUE results are found" | 3650 | msgid "automatically terminate search after VALUE results are found" |
3651 | msgstr "" | 3651 | msgstr "" |
3652 | 3652 | ||
3653 | #: src/fs/gnunet-search.c:368 | 3653 | #: src/fs/gnunet-search.c:371 |
3654 | #, fuzzy | 3654 | #, fuzzy |
3655 | msgid "Search GNUnet for files that were published on GNUnet" | 3655 | msgid "Search GNUnet for files that were published on GNUnet" |
3656 | msgstr "Không hiển thị kết quả tìm kiếm cho táºp tin được chúng ta tải lên" | 3656 | msgstr "Không hiển thị kết quả tìm kiếm cho táºp tin được chúng ta tải lên" |
@@ -4044,7 +4044,7 @@ msgstr "" | |||
4044 | msgid "Expected a base32-encoded public zone key\n" | 4044 | msgid "Expected a base32-encoded public zone key\n" |
4045 | msgstr "" | 4045 | msgstr "" |
4046 | 4046 | ||
4047 | #: src/gns/gnunet-bcd.c:133 | 4047 | #: src/gns/gnunet-bcd.c:134 |
4048 | #, fuzzy, c-format | 4048 | #, fuzzy, c-format |
4049 | msgid "Refusing `%s' request to HTTP server\n" | 4049 | msgid "Refusing `%s' request to HTTP server\n" |
4050 | msgstr "trình phục vụ danh sách máy HTTP hợp nhất" | 4050 | msgstr "trình phục vụ danh sách máy HTTP hợp nhất" |
@@ -4077,35 +4077,40 @@ msgstr "" | |||
4077 | msgid "Failed to pack DNS response into UDP packet!\n" | 4077 | msgid "Failed to pack DNS response into UDP packet!\n" |
4078 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" | 4078 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" |
4079 | 4079 | ||
4080 | #: src/gns/gnunet-dns2gns.c:444 | 4080 | #: src/gns/gnunet-dns2gns.c:315 |
4081 | #, fuzzy | ||
4082 | msgid "Failed to parse DNS response!\n" | ||
4083 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" | ||
4084 | |||
4085 | #: src/gns/gnunet-dns2gns.c:452 | ||
4081 | #, c-format | 4086 | #, c-format |
4082 | msgid "Cannot parse DNS request from %s\n" | 4087 | msgid "Cannot parse DNS request from %s\n" |
4083 | msgstr "" | 4088 | msgstr "" |
4084 | 4089 | ||
4085 | #: src/gns/gnunet-dns2gns.c:460 | 4090 | #: src/gns/gnunet-dns2gns.c:468 |
4086 | #, fuzzy, c-format | 4091 | #, fuzzy, c-format |
4087 | msgid "Received malformed DNS request from %s\n" | 4092 | msgid "Received malformed DNS request from %s\n" |
4088 | msgstr "Nháºn yêu cầu định tuyến\n" | 4093 | msgstr "Nháºn yêu cầu định tuyến\n" |
4089 | 4094 | ||
4090 | #: src/gns/gnunet-dns2gns.c:468 | 4095 | #: src/gns/gnunet-dns2gns.c:476 |
4091 | #, fuzzy, c-format | 4096 | #, fuzzy, c-format |
4092 | msgid "Received unsupported DNS request from %s\n" | 4097 | msgid "Received unsupported DNS request from %s\n" |
4093 | msgstr "Nháºn yêu cầu định tuyến\n" | 4098 | msgstr "Nháºn yêu cầu định tuyến\n" |
4094 | 4099 | ||
4095 | #: src/gns/gnunet-dns2gns.c:629 | 4100 | #: src/gns/gnunet-dns2gns.c:637 |
4096 | #, fuzzy | 4101 | #, fuzzy |
4097 | msgid "No DNS server specified!\n" | 4102 | msgid "No DNS server specified!\n" |
4098 | msgstr "Chưa ghi rõ từ khoá.\n" | 4103 | msgstr "Chưa ghi rõ từ khoá.\n" |
4099 | 4104 | ||
4100 | #: src/gns/gnunet-dns2gns.c:778 | 4105 | #: src/gns/gnunet-dns2gns.c:786 |
4101 | msgid "IP of recursive DNS resolver to use (required)" | 4106 | msgid "IP of recursive DNS resolver to use (required)" |
4102 | msgstr "" | 4107 | msgstr "" |
4103 | 4108 | ||
4104 | #: src/gns/gnunet-dns2gns.c:784 | 4109 | #: src/gns/gnunet-dns2gns.c:792 |
4105 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 4110 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
4106 | msgstr "" | 4111 | msgstr "" |
4107 | 4112 | ||
4108 | #: src/gns/gnunet-dns2gns.c:801 | 4113 | #: src/gns/gnunet-dns2gns.c:809 |
4109 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 4114 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
4110 | msgstr "" | 4115 | msgstr "" |
4111 | 4116 | ||
@@ -4226,64 +4231,64 @@ msgstr "" | |||
4226 | msgid "Cookie domain `%s' supplied by server is invalid\n" | 4231 | msgid "Cookie domain `%s' supplied by server is invalid\n" |
4227 | msgstr "" | 4232 | msgstr "" |
4228 | 4233 | ||
4229 | #: src/gns/gnunet-gns-proxy.c:2133 | 4234 | #: src/gns/gnunet-gns-proxy.c:2134 |
4230 | #, fuzzy, c-format | 4235 | #, fuzzy, c-format |
4231 | msgid "Unsupported HTTP method `%s'\n" | 4236 | msgid "Unsupported HTTP method `%s'\n" |
4232 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" | 4237 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" |
4233 | 4238 | ||
4234 | #: src/gns/gnunet-gns-proxy.c:2657 | 4239 | #: src/gns/gnunet-gns-proxy.c:2658 |
4235 | #, fuzzy, c-format | 4240 | #, fuzzy, c-format |
4236 | msgid "Unable to import private key from file `%s'\n" | 4241 | msgid "Unable to import private key from file `%s'\n" |
4237 | msgstr "Không thể tạo tà i khoản ngÆ°á»i dùng:" | 4242 | msgstr "Không thể tạo tà i khoản ngÆ°á»i dùng:" |
4238 | 4243 | ||
4239 | #: src/gns/gnunet-gns-proxy.c:2689 | 4244 | #: src/gns/gnunet-gns-proxy.c:2690 |
4240 | #, fuzzy, c-format | 4245 | #, fuzzy, c-format |
4241 | msgid "Unable to import certificate from `%s'\n" | 4246 | msgid "Unable to import certificate from `%s'\n" |
4242 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 4247 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
4243 | 4248 | ||
4244 | #: src/gns/gnunet-gns-proxy.c:2898 | 4249 | #: src/gns/gnunet-gns-proxy.c:2899 |
4245 | #, fuzzy, c-format | 4250 | #, fuzzy, c-format |
4246 | msgid "Failed to start HTTPS server for `%s'\n" | 4251 | msgid "Failed to start HTTPS server for `%s'\n" |
4247 | msgstr "Lá»—i bắt đầu thu tháºp.\n" | 4252 | msgstr "Lá»—i bắt đầu thu tháºp.\n" |
4248 | 4253 | ||
4249 | #: src/gns/gnunet-gns-proxy.c:2922 src/rest/gnunet-rest-server.c:917 | 4254 | #: src/gns/gnunet-gns-proxy.c:2923 src/rest/gnunet-rest-server.c:917 |
4250 | #, fuzzy | 4255 | #, fuzzy |
4251 | msgid "Failed to pass client to MHD\n" | 4256 | msgid "Failed to pass client to MHD\n" |
4252 | msgstr "Lỗi kết nối đến gnunetd.\n" | 4257 | msgstr "Lỗi kết nối đến gnunetd.\n" |
4253 | 4258 | ||
4254 | #: src/gns/gnunet-gns-proxy.c:3271 | 4259 | #: src/gns/gnunet-gns-proxy.c:3272 |
4255 | #, fuzzy, c-format | 4260 | #, fuzzy, c-format |
4256 | msgid "Unsupported socks version %d\n" | 4261 | msgid "Unsupported socks version %d\n" |
4257 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" | 4262 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" |
4258 | 4263 | ||
4259 | #: src/gns/gnunet-gns-proxy.c:3303 | 4264 | #: src/gns/gnunet-gns-proxy.c:3304 |
4260 | #, fuzzy, c-format | 4265 | #, fuzzy, c-format |
4261 | msgid "Unsupported socks command %d\n" | 4266 | msgid "Unsupported socks command %d\n" |
4262 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" | 4267 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" |
4263 | 4268 | ||
4264 | #: src/gns/gnunet-gns-proxy.c:3389 | 4269 | #: src/gns/gnunet-gns-proxy.c:3390 |
4265 | #, fuzzy, c-format | 4270 | #, fuzzy, c-format |
4266 | msgid "Unsupported socks address type %d\n" | 4271 | msgid "Unsupported socks address type %d\n" |
4267 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" | 4272 | msgstr "Lệnh không được há»— trợ « %s ». Äang hủy bá».\n" |
4268 | 4273 | ||
4269 | #: src/gns/gnunet-gns-proxy.c:3730 | 4274 | #: src/gns/gnunet-gns-proxy.c:3731 |
4270 | #, fuzzy, c-format | 4275 | #, fuzzy, c-format |
4271 | msgid "Failed to load X.509 key and certificate from `%s'\n" | 4276 | msgid "Failed to load X.509 key and certificate from `%s'\n" |
4272 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 4277 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
4273 | 4278 | ||
4274 | #: src/gns/gnunet-gns-proxy.c:3864 | 4279 | #: src/gns/gnunet-gns-proxy.c:3865 |
4275 | msgid "listen on specified port (default: 7777)" | 4280 | msgid "listen on specified port (default: 7777)" |
4276 | msgstr "" | 4281 | msgstr "" |
4277 | 4282 | ||
4278 | #: src/gns/gnunet-gns-proxy.c:3869 | 4283 | #: src/gns/gnunet-gns-proxy.c:3870 |
4279 | msgid "pem file to use as CA" | 4284 | msgid "pem file to use as CA" |
4280 | msgstr "" | 4285 | msgstr "" |
4281 | 4286 | ||
4282 | #: src/gns/gnunet-gns-proxy.c:3873 | 4287 | #: src/gns/gnunet-gns-proxy.c:3874 |
4283 | msgid "disable use of IPv6" | 4288 | msgid "disable use of IPv6" |
4284 | msgstr "" | 4289 | msgstr "" |
4285 | 4290 | ||
4286 | #: src/gns/gnunet-gns-proxy.c:3899 | 4291 | #: src/gns/gnunet-gns-proxy.c:3900 |
4287 | msgid "GNUnet GNS proxy" | 4292 | msgid "GNUnet GNS proxy" |
4288 | msgstr "" | 4293 | msgstr "" |
4289 | 4294 | ||
@@ -4309,7 +4314,7 @@ msgstr "Không thể kết nối tới %s:%u: %s\n" | |||
4309 | msgid "Error converting GNS response to DNS response!\n" | 4314 | msgid "Error converting GNS response to DNS response!\n" |
4310 | msgstr "Gặp lỗi khi chuyển đổi các đối số sang URI.\n" | 4315 | msgstr "Gặp lỗi khi chuyển đổi các đối số sang URI.\n" |
4311 | 4316 | ||
4312 | #: src/gns/gnunet-service-gns_interceptor.c:387 | 4317 | #: src/gns/gnunet-service-gns_interceptor.c:386 |
4313 | #, fuzzy | 4318 | #, fuzzy |
4314 | msgid "Failed to connect to the DNS service!\n" | 4319 | msgid "Failed to connect to the DNS service!\n" |
4315 | msgstr "Lỗi kết nối đến gnunetd.\n" | 4320 | msgstr "Lỗi kết nối đến gnunetd.\n" |
@@ -4344,36 +4349,36 @@ msgstr "" | |||
4344 | msgid "VPN returned empty result for `%s'\n" | 4349 | msgid "VPN returned empty result for `%s'\n" |
4345 | msgstr "" | 4350 | msgstr "" |
4346 | 4351 | ||
4347 | #: src/gns/gnunet-service-gns_resolver.c:1910 | 4352 | #: src/gns/gnunet-service-gns_resolver.c:1919 |
4348 | #, c-format | 4353 | #, c-format |
4349 | msgid "Name `%s' cannot be converted to IDNA." | 4354 | msgid "Name `%s' cannot be converted to IDNA." |
4350 | msgstr "" | 4355 | msgstr "" |
4351 | 4356 | ||
4352 | #: src/gns/gnunet-service-gns_resolver.c:1923 | 4357 | #: src/gns/gnunet-service-gns_resolver.c:1934 |
4353 | #, c-format | 4358 | #, c-format |
4354 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" | 4359 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" |
4355 | msgstr "" | 4360 | msgstr "" |
4356 | 4361 | ||
4357 | #: src/gns/gnunet-service-gns_resolver.c:1966 | 4362 | #: src/gns/gnunet-service-gns_resolver.c:1979 |
4358 | #, fuzzy, c-format | 4363 | #, fuzzy, c-format |
4359 | msgid "GNS lookup failed (zero records found for `%s')\n" | 4364 | msgid "GNS lookup failed (zero records found for `%s')\n" |
4360 | msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n" | 4365 | msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n" |
4361 | 4366 | ||
4362 | #: src/gns/gnunet-service-gns_resolver.c:2393 | 4367 | #: src/gns/gnunet-service-gns_resolver.c:2406 |
4363 | msgid "GNS lookup recursion failed (no delegation record found)\n" | 4368 | msgid "GNS lookup recursion failed (no delegation record found)\n" |
4364 | msgstr "" | 4369 | msgstr "" |
4365 | 4370 | ||
4366 | #: src/gns/gnunet-service-gns_resolver.c:2416 | 4371 | #: src/gns/gnunet-service-gns_resolver.c:2429 |
4367 | #, fuzzy, c-format | 4372 | #, fuzzy, c-format |
4368 | msgid "Failed to cache GNS resolution: %s\n" | 4373 | msgid "Failed to cache GNS resolution: %s\n" |
4369 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" | 4374 | msgstr "Lá»—i mở táºp tin ghi sá»± kiện « %s »: %s\n" |
4370 | 4375 | ||
4371 | #: src/gns/gnunet-service-gns_resolver.c:2581 | 4376 | #: src/gns/gnunet-service-gns_resolver.c:2594 |
4372 | #, c-format | 4377 | #, c-format |
4373 | msgid "GNS namecache returned empty result for `%s'\n" | 4378 | msgid "GNS namecache returned empty result for `%s'\n" |
4374 | msgstr "" | 4379 | msgstr "" |
4375 | 4380 | ||
4376 | #: src/gns/gnunet-service-gns_resolver.c:2721 | 4381 | #: src/gns/gnunet-service-gns_resolver.c:2734 |
4377 | #, c-format | 4382 | #, c-format |
4378 | msgid "Zone %s was revoked, resolution fails\n" | 4383 | msgid "Zone %s was revoked, resolution fails\n" |
4379 | msgstr "" | 4384 | msgstr "" |
@@ -4407,7 +4412,7 @@ msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | |||
4407 | msgid "Unable to parse BOX record string `%s'\n" | 4412 | msgid "Unable to parse BOX record string `%s'\n" |
4408 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 4413 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
4409 | 4414 | ||
4410 | #: src/gns/plugin_rest_gns.c:448 | 4415 | #: src/gns/plugin_rest_gns.c:450 |
4411 | #, fuzzy | 4416 | #, fuzzy |
4412 | msgid "Gns REST API initialized\n" | 4417 | msgid "Gns REST API initialized\n" |
4413 | msgstr "Lỗi sơ khởi lõi.\n" | 4418 | msgstr "Lỗi sơ khởi lõi.\n" |
@@ -4755,7 +4760,7 @@ msgstr "" | |||
4755 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 | 4760 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 |
4756 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 | 4761 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 |
4757 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 | 4762 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 |
4758 | #: src/peerinfo-tool/gnunet-peerinfo.c:515 | 4763 | #: src/peerinfo-tool/gnunet-peerinfo.c:516 |
4759 | #: src/topology/gnunet-daemon-topology.c:799 | 4764 | #: src/topology/gnunet-daemon-topology.c:799 |
4760 | #, fuzzy, c-format | 4765 | #, fuzzy, c-format |
4761 | msgid "Error in communication with PEERINFO service: %s\n" | 4766 | msgid "Error in communication with PEERINFO service: %s\n" |
@@ -4927,8 +4932,8 @@ msgid "default configured, but ego unknown (internal error)" | |||
4927 | msgstr "" | 4932 | msgstr "" |
4928 | 4933 | ||
4929 | #: src/identity/gnunet-service-identity.c:621 | 4934 | #: src/identity/gnunet-service-identity.c:621 |
4930 | #: src/identity/gnunet-service-identity.c:898 | 4935 | #: src/identity/gnunet-service-identity.c:896 |
4931 | #: src/identity/gnunet-service-identity.c:1018 | 4936 | #: src/identity/gnunet-service-identity.c:1016 |
4932 | #, fuzzy, c-format | 4937 | #, fuzzy, c-format |
4933 | msgid "Failed to write subsystem default identifier map to `%s'.\n" | 4938 | msgid "Failed to write subsystem default identifier map to `%s'.\n" |
4934 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 4939 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
@@ -4937,30 +4942,30 @@ msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | |||
4937 | msgid "Unknown ego specified for service (internal error)" | 4942 | msgid "Unknown ego specified for service (internal error)" |
4938 | msgstr "" | 4943 | msgstr "" |
4939 | 4944 | ||
4940 | #: src/identity/gnunet-service-identity.c:726 | 4945 | #: src/identity/gnunet-service-identity.c:725 |
4941 | msgid "identifier already in use for another ego" | 4946 | msgid "identifier already in use for another ego" |
4942 | msgstr "" | 4947 | msgstr "" |
4943 | 4948 | ||
4944 | #: src/identity/gnunet-service-identity.c:874 | 4949 | #: src/identity/gnunet-service-identity.c:872 |
4945 | msgid "target name already exists" | 4950 | msgid "target name already exists" |
4946 | msgstr "" | 4951 | msgstr "" |
4947 | 4952 | ||
4948 | #: src/identity/gnunet-service-identity.c:916 | 4953 | #: src/identity/gnunet-service-identity.c:914 |
4949 | #: src/identity/gnunet-service-identity.c:1035 | 4954 | #: src/identity/gnunet-service-identity.c:1033 |
4950 | msgid "no matching ego found" | 4955 | msgid "no matching ego found" |
4951 | msgstr "" | 4956 | msgstr "" |
4952 | 4957 | ||
4953 | #: src/identity/gnunet-service-identity.c:1133 | 4958 | #: src/identity/gnunet-service-identity.c:1131 |
4954 | #, fuzzy, c-format | 4959 | #, fuzzy, c-format |
4955 | msgid "Failed to parse ego information in `%s'\n" | 4960 | msgid "Failed to parse ego information in `%s'\n" |
4956 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 4961 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
4957 | 4962 | ||
4958 | #: src/identity/gnunet-service-identity.c:1191 | 4963 | #: src/identity/gnunet-service-identity.c:1189 |
4959 | #, fuzzy, c-format | 4964 | #, fuzzy, c-format |
4960 | msgid "Failed to parse subsystem identity configuration file `%s'\n" | 4965 | msgid "Failed to parse subsystem identity configuration file `%s'\n" |
4961 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 4966 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
4962 | 4967 | ||
4963 | #: src/identity/gnunet-service-identity.c:1200 | 4968 | #: src/identity/gnunet-service-identity.c:1198 |
4964 | #, fuzzy, c-format | 4969 | #, fuzzy, c-format |
4965 | msgid "Failed to create directory `%s' for storing egos\n" | 4970 | msgid "Failed to create directory `%s' for storing egos\n" |
4966 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 4971 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
@@ -5197,7 +5202,7 @@ msgid "Invalid public key for reverse lookup `%s'\n" | |||
5197 | msgstr "Äối số không hợp lệ cho « %s ».\n" | 5202 | msgstr "Äối số không hợp lệ cho « %s ».\n" |
5198 | 5203 | ||
5199 | #: src/namestore/gnunet-namestore.c:1220 | 5204 | #: src/namestore/gnunet-namestore.c:1220 |
5200 | #: src/peerinfo-tool/gnunet-peerinfo.c:736 | 5205 | #: src/peerinfo-tool/gnunet-peerinfo.c:737 |
5201 | #, fuzzy, c-format | 5206 | #, fuzzy, c-format |
5202 | msgid "Invalid URI `%s'\n" | 5207 | msgid "Invalid URI `%s'\n" |
5203 | msgstr "Dữ liệu nháºp không hợp lệ.\n" | 5208 | msgstr "Dữ liệu nháºp không hợp lệ.\n" |
@@ -5383,7 +5388,7 @@ msgstr "" | |||
5383 | msgid "GNU Name System First Come First Serve name registration service" | 5388 | msgid "GNU Name System First Come First Serve name registration service" |
5384 | msgstr "" | 5389 | msgstr "" |
5385 | 5390 | ||
5386 | #: src/namestore/gnunet-service-namestore.c:866 | 5391 | #: src/namestore/gnunet-service-namestore.c:871 |
5387 | #, fuzzy, c-format | 5392 | #, fuzzy, c-format |
5388 | msgid "Failed to replicate block in namecache: %s\n" | 5393 | msgid "Failed to replicate block in namecache: %s\n" |
5389 | msgstr "Lá»—i cáºp nháºt dữ liệu cho mô-Ä‘un « %s »\n" | 5394 | msgstr "Lá»—i cáºp nháºt dữ liệu cho mô-Ä‘un « %s »\n" |
@@ -5415,7 +5420,7 @@ msgstr "" | |||
5415 | msgid "Flat file database running\n" | 5420 | msgid "Flat file database running\n" |
5416 | msgstr "kho dữ liệu sqlite" | 5421 | msgstr "kho dữ liệu sqlite" |
5417 | 5422 | ||
5418 | #: src/namestore/plugin_rest_namestore.c:1103 | 5423 | #: src/namestore/plugin_rest_namestore.c:1105 |
5419 | #, fuzzy | 5424 | #, fuzzy |
5420 | msgid "Namestore REST API initialized\n" | 5425 | msgid "Namestore REST API initialized\n" |
5421 | msgstr "Lỗi sơ khởi lõi.\n" | 5426 | msgstr "Lỗi sơ khởi lõi.\n" |
@@ -5733,8 +5738,8 @@ msgstr "" | |||
5733 | msgid "Measure quality and performance of the NSE service." | 5738 | msgid "Measure quality and performance of the NSE service." |
5734 | msgstr "Không thể truy cáºp đến dịch vụ" | 5739 | msgstr "Không thể truy cáºp đến dịch vụ" |
5735 | 5740 | ||
5736 | #: src/nse/gnunet-service-nse.c:1443 | 5741 | #: src/nse/gnunet-service-nse.c:1450 |
5737 | #: src/revocation/gnunet-service-revocation.c:875 src/util/gnunet-scrypt.c:257 | 5742 | #: src/revocation/gnunet-service-revocation.c:883 src/util/gnunet-scrypt.c:260 |
5738 | #, fuzzy | 5743 | #, fuzzy |
5739 | msgid "Value is too large.\n" | 5744 | msgid "Value is too large.\n" |
5740 | msgstr "Giá trị không nằm trong phạm vi được phép." | 5745 | msgstr "Giá trị không nằm trong phạm vi được phép." |
@@ -5777,17 +5782,17 @@ msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | |||
5777 | msgid "Still no peers found in `%s'!\n" | 5782 | msgid "Still no peers found in `%s'!\n" |
5778 | msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n" | 5783 | msgstr "Vẫn còn không tìm thấy đồng đẳng trong « %s ».\n" |
5779 | 5784 | ||
5780 | #: src/peerinfo/gnunet-service-peerinfo.c:1024 | 5785 | #: src/peerinfo/gnunet-service-peerinfo.c:1027 |
5781 | #, fuzzy, c-format | 5786 | #, fuzzy, c-format |
5782 | msgid "Cleaning up directory `%s'\n" | 5787 | msgid "Cleaning up directory `%s'\n" |
5783 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 5788 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
5784 | 5789 | ||
5785 | #: src/peerinfo/gnunet-service-peerinfo.c:1319 | 5790 | #: src/peerinfo/gnunet-service-peerinfo.c:1322 |
5786 | #, c-format | 5791 | #, c-format |
5787 | msgid "Importing HELLOs from `%s'\n" | 5792 | msgid "Importing HELLOs from `%s'\n" |
5788 | msgstr "" | 5793 | msgstr "" |
5789 | 5794 | ||
5790 | #: src/peerinfo/gnunet-service-peerinfo.c:1332 | 5795 | #: src/peerinfo/gnunet-service-peerinfo.c:1335 |
5791 | msgid "Skipping import of included HELLOs\n" | 5796 | msgid "Skipping import of included HELLOs\n" |
5792 | msgstr "" | 5797 | msgstr "" |
5793 | 5798 | ||
@@ -5809,7 +5814,7 @@ msgid "\tExpires: %s \t %s\n" | |||
5809 | msgstr "" | 5814 | msgstr "" |
5810 | 5815 | ||
5811 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 | 5816 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 |
5812 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:523 | 5817 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:525 |
5813 | #, fuzzy, c-format | 5818 | #, fuzzy, c-format |
5814 | msgid "Failure: Cannot convert address to string for peer `%s'\n" | 5819 | msgid "Failure: Cannot convert address to string for peer `%s'\n" |
5815 | msgstr "Lỗi đóng kết đến cổng %s %d.\n" | 5820 | msgstr "Lỗi đóng kết đến cổng %s %d.\n" |
@@ -5819,55 +5824,55 @@ msgstr "Lỗi đóng kết đến cổng %s %d.\n" | |||
5819 | msgid "Failure: Received invalid %s\n" | 5824 | msgid "Failure: Received invalid %s\n" |
5820 | msgstr "" | 5825 | msgstr "" |
5821 | 5826 | ||
5822 | #: src/peerinfo-tool/gnunet-peerinfo.c:463 | 5827 | #: src/peerinfo-tool/gnunet-peerinfo.c:464 |
5823 | #, fuzzy, c-format | 5828 | #, fuzzy, c-format |
5824 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" | 5829 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" |
5825 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 5830 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
5826 | 5831 | ||
5827 | #: src/peerinfo-tool/gnunet-peerinfo.c:479 | 5832 | #: src/peerinfo-tool/gnunet-peerinfo.c:480 |
5828 | #, c-format | 5833 | #, c-format |
5829 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" | 5834 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" |
5830 | msgstr "" | 5835 | msgstr "" |
5831 | 5836 | ||
5832 | #: src/peerinfo-tool/gnunet-peerinfo.c:758 | 5837 | #: src/peerinfo-tool/gnunet-peerinfo.c:759 |
5833 | #, c-format | 5838 | #, c-format |
5834 | msgid "I am peer `%s'.\n" | 5839 | msgid "I am peer `%s'.\n" |
5835 | msgstr "Tôi là đồng đẳng « %s ».\n" | 5840 | msgstr "Tôi là đồng đẳng « %s ».\n" |
5836 | 5841 | ||
5837 | #: src/peerinfo-tool/gnunet-peerinfo.c:799 | 5842 | #: src/peerinfo-tool/gnunet-peerinfo.c:800 |
5838 | msgid "don't resolve host names" | 5843 | msgid "don't resolve host names" |
5839 | msgstr "không quyết định các tên máy" | 5844 | msgstr "không quyết định các tên máy" |
5840 | 5845 | ||
5841 | #: src/peerinfo-tool/gnunet-peerinfo.c:805 | 5846 | #: src/peerinfo-tool/gnunet-peerinfo.c:806 |
5842 | msgid "output only the identity strings" | 5847 | msgid "output only the identity strings" |
5843 | msgstr "chỉ xuất những chuá»—i nháºn diện" | 5848 | msgstr "chỉ xuất những chuá»—i nháºn diện" |
5844 | 5849 | ||
5845 | #: src/peerinfo-tool/gnunet-peerinfo.c:810 | 5850 | #: src/peerinfo-tool/gnunet-peerinfo.c:811 |
5846 | msgid "include friend-only information" | 5851 | msgid "include friend-only information" |
5847 | msgstr "" | 5852 | msgstr "" |
5848 | 5853 | ||
5849 | #: src/peerinfo-tool/gnunet-peerinfo.c:815 | 5854 | #: src/peerinfo-tool/gnunet-peerinfo.c:816 |
5850 | msgid "output our own identity only" | 5855 | msgid "output our own identity only" |
5851 | msgstr "chỉ xuất nháºn diện mình" | 5856 | msgstr "chỉ xuất nháºn diện mình" |
5852 | 5857 | ||
5853 | #: src/peerinfo-tool/gnunet-peerinfo.c:820 | 5858 | #: src/peerinfo-tool/gnunet-peerinfo.c:821 |
5854 | #, fuzzy | 5859 | #, fuzzy |
5855 | msgid "list all known peers" | 5860 | msgid "list all known peers" |
5856 | msgstr "liệt kê má»i bá»™ tiếp hợp mạng" | 5861 | msgstr "liệt kê má»i bá»™ tiếp hợp mạng" |
5857 | 5862 | ||
5858 | #: src/peerinfo-tool/gnunet-peerinfo.c:826 | 5863 | #: src/peerinfo-tool/gnunet-peerinfo.c:827 |
5859 | msgid "dump hello to file" | 5864 | msgid "dump hello to file" |
5860 | msgstr "" | 5865 | msgstr "" |
5861 | 5866 | ||
5862 | #: src/peerinfo-tool/gnunet-peerinfo.c:831 | 5867 | #: src/peerinfo-tool/gnunet-peerinfo.c:832 |
5863 | msgid "also output HELLO uri(s)" | 5868 | msgid "also output HELLO uri(s)" |
5864 | msgstr "" | 5869 | msgstr "" |
5865 | 5870 | ||
5866 | #: src/peerinfo-tool/gnunet-peerinfo.c:838 | 5871 | #: src/peerinfo-tool/gnunet-peerinfo.c:839 |
5867 | msgid "add given HELLO uri to the database" | 5872 | msgid "add given HELLO uri to the database" |
5868 | msgstr "" | 5873 | msgstr "" |
5869 | 5874 | ||
5870 | #: src/peerinfo-tool/gnunet-peerinfo.c:852 | 5875 | #: src/peerinfo-tool/gnunet-peerinfo.c:853 |
5871 | #, fuzzy | 5876 | #, fuzzy |
5872 | msgid "Print information about peers." | 5877 | msgid "Print information about peers." |
5873 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." | 5878 | msgstr "In ra thông tin vỠcác đồng đẳng GNUnet." |
@@ -5890,7 +5895,7 @@ msgstr "Äang nạp các truyá»n tải « %s »\n" | |||
5890 | msgid "Failed to load transport plugin for `%s'\n" | 5895 | msgid "Failed to load transport plugin for `%s'\n" |
5891 | msgstr "Không thể nạp phần bổ sung truyá»n tải « %s »\n" | 5896 | msgstr "Không thể nạp phần bổ sung truyá»n tải « %s »\n" |
5892 | 5897 | ||
5893 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:809 | 5898 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:811 |
5894 | #, fuzzy | 5899 | #, fuzzy |
5895 | msgid "Peerinfo REST API initialized\n" | 5900 | msgid "Peerinfo REST API initialized\n" |
5896 | msgstr "Lỗi sơ khởi lõi.\n" | 5901 | msgstr "Lỗi sơ khởi lõi.\n" |
@@ -5899,7 +5904,7 @@ msgstr "Lỗi sơ khởi lõi.\n" | |||
5899 | msgid "peerstore" | 5904 | msgid "peerstore" |
5900 | msgstr "" | 5905 | msgstr "" |
5901 | 5906 | ||
5902 | #: src/peerstore/gnunet-service-peerstore.c:561 | 5907 | #: src/peerstore/gnunet-service-peerstore.c:570 |
5903 | #, fuzzy, c-format | 5908 | #, fuzzy, c-format |
5904 | msgid "Could not load database backend `%s'\n" | 5909 | msgid "Could not load database backend `%s'\n" |
5905 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" | 5910 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" |
@@ -6089,12 +6094,12 @@ msgstr "" | |||
6089 | msgid "re:claimID command line tool" | 6094 | msgid "re:claimID command line tool" |
6090 | msgstr "" | 6095 | msgstr "" |
6091 | 6096 | ||
6092 | #: src/reclaim/plugin_rest_openid_connect.c:2613 | 6097 | #: src/reclaim/plugin_rest_openid_connect.c:2788 |
6093 | #, fuzzy | 6098 | #, fuzzy |
6094 | msgid "OpenID Connect REST API initialized\n" | 6099 | msgid "OpenID Connect REST API initialized\n" |
6095 | msgstr "Lỗi sơ khởi lõi.\n" | 6100 | msgstr "Lỗi sơ khởi lõi.\n" |
6096 | 6101 | ||
6097 | #: src/reclaim/plugin_rest_reclaim.c:1502 | 6102 | #: src/reclaim/plugin_rest_reclaim.c:1521 |
6098 | #, fuzzy | 6103 | #, fuzzy |
6099 | msgid "Identity Provider REST API initialized\n" | 6104 | msgid "Identity Provider REST API initialized\n" |
6100 | msgstr "Lỗi sơ khởi lõi.\n" | 6105 | msgstr "Lỗi sơ khởi lõi.\n" |
@@ -6255,116 +6260,116 @@ msgstr "" | |||
6255 | msgid "Cancelling calculation.\n" | 6260 | msgid "Cancelling calculation.\n" |
6256 | msgstr "" | 6261 | msgstr "" |
6257 | 6262 | ||
6258 | #: src/revocation/gnunet-revocation.c:299 | 6263 | #: src/revocation/gnunet-revocation.c:302 |
6259 | #, c-format | 6264 | #, c-format |
6260 | msgid "Revocation certificate for `%s' stored in `%s'\n" | 6265 | msgid "Revocation certificate for `%s' stored in `%s'\n" |
6261 | msgstr "" | 6266 | msgstr "" |
6262 | 6267 | ||
6263 | #: src/revocation/gnunet-revocation.c:339 | 6268 | #: src/revocation/gnunet-revocation.c:334 |
6264 | #, fuzzy, c-format | 6269 | #, fuzzy, c-format |
6265 | msgid "Ego `%s' not found.\n" | 6270 | msgid "Ego `%s' not found.\n" |
6266 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" | 6271 | msgstr "Khoá phiên chạy từ đồng đẳng « %s » không thể được thẩm tra.\n" |
6267 | 6272 | ||
6268 | #: src/revocation/gnunet-revocation.c:356 | 6273 | #: src/revocation/gnunet-revocation.c:351 |
6269 | #, c-format | 6274 | #, c-format |
6270 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" | 6275 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" |
6271 | msgstr "" | 6276 | msgstr "" |
6272 | 6277 | ||
6273 | #: src/revocation/gnunet-revocation.c:366 | 6278 | #: src/revocation/gnunet-revocation.c:361 |
6274 | msgid "Revocation certificate ready\n" | 6279 | msgid "Revocation certificate ready\n" |
6275 | msgstr "" | 6280 | msgstr "" |
6276 | 6281 | ||
6277 | #: src/revocation/gnunet-revocation.c:378 | 6282 | #: src/revocation/gnunet-revocation.c:373 |
6278 | msgid "Continuing calculation where left off...\n" | 6283 | msgid "Continuing calculation where left off...\n" |
6279 | msgstr "" | 6284 | msgstr "" |
6280 | 6285 | ||
6281 | #: src/revocation/gnunet-revocation.c:385 | 6286 | #: src/revocation/gnunet-revocation.c:380 |
6282 | msgid "Revocation certificate not ready, calculating proof of work\n" | 6287 | msgid "Revocation certificate not ready, calculating proof of work\n" |
6283 | msgstr "" | 6288 | msgstr "" |
6284 | 6289 | ||
6285 | #: src/revocation/gnunet-revocation.c:423 | 6290 | #: src/revocation/gnunet-revocation.c:418 |
6286 | #, fuzzy, c-format | 6291 | #, fuzzy, c-format |
6287 | msgid "Public key `%s' malformed\n" | 6292 | msgid "Public key `%s' malformed\n" |
6288 | msgstr "Äối số không hợp lệ cho « %s ».\n" | 6293 | msgstr "Äối số không hợp lệ cho « %s ».\n" |
6289 | 6294 | ||
6290 | #: src/revocation/gnunet-revocation.c:433 | 6295 | #: src/revocation/gnunet-revocation.c:428 |
6291 | msgid "" | 6296 | msgid "" |
6292 | "Testing and revoking at the same time is not allowed, only executing test.\n" | 6297 | "Testing and revoking at the same time is not allowed, only executing test.\n" |
6293 | msgstr "" | 6298 | msgstr "" |
6294 | 6299 | ||
6295 | #: src/revocation/gnunet-revocation.c:463 | 6300 | #: src/revocation/gnunet-revocation.c:458 |
6296 | #, fuzzy | 6301 | #, fuzzy |
6297 | msgid "No filename to store revocation certificate given.\n" | 6302 | msgid "No filename to store revocation certificate given.\n" |
6298 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 6303 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
6299 | 6304 | ||
6300 | #: src/revocation/gnunet-revocation.c:480 | 6305 | #: src/revocation/gnunet-revocation.c:475 |
6301 | #, fuzzy, c-format | 6306 | #, fuzzy, c-format |
6302 | msgid "Failed to read revocation certificate from `%s'\n" | 6307 | msgid "Failed to read revocation certificate from `%s'\n" |
6303 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 6308 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
6304 | 6309 | ||
6305 | #: src/revocation/gnunet-revocation.c:488 | 6310 | #: src/revocation/gnunet-revocation.c:483 |
6306 | #, fuzzy, c-format | 6311 | #, fuzzy, c-format |
6307 | msgid "Revocation certificate corrupted in `%s'\n" | 6312 | msgid "Revocation certificate corrupted in `%s'\n" |
6308 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" | 6313 | msgstr "Lá»—i Ä‘á»c danh sách bạn bè từ « %s »\n" |
6309 | 6314 | ||
6310 | #: src/revocation/gnunet-revocation.c:510 | 6315 | #: src/revocation/gnunet-revocation.c:505 |
6311 | #, fuzzy | 6316 | #, fuzzy |
6312 | msgid "No action specified. Nothing to do.\n" | 6317 | msgid "No action specified. Nothing to do.\n" |
6313 | msgstr "Chưa xác định giao diện nên dùng mặc định.\n" | 6318 | msgstr "Chưa xác định giao diện nên dùng mặc định.\n" |
6314 | 6319 | ||
6315 | #: src/revocation/gnunet-revocation.c:529 | 6320 | #: src/revocation/gnunet-revocation.c:524 |
6316 | msgid "use NAME for the name of the revocation file" | 6321 | msgid "use NAME for the name of the revocation file" |
6317 | msgstr "" | 6322 | msgstr "" |
6318 | 6323 | ||
6319 | #: src/revocation/gnunet-revocation.c:537 | 6324 | #: src/revocation/gnunet-revocation.c:532 |
6320 | msgid "" | 6325 | msgid "" |
6321 | "revoke the private key associated for the the private key associated with " | 6326 | "revoke the private key associated for the the private key associated with " |
6322 | "the ego NAME " | 6327 | "the ego NAME " |
6323 | msgstr "" | 6328 | msgstr "" |
6324 | 6329 | ||
6325 | #: src/revocation/gnunet-revocation.c:544 | 6330 | #: src/revocation/gnunet-revocation.c:539 |
6326 | msgid "actually perform revocation, otherwise we just do the precomputation" | 6331 | msgid "actually perform revocation, otherwise we just do the precomputation" |
6327 | msgstr "" | 6332 | msgstr "" |
6328 | 6333 | ||
6329 | #: src/revocation/gnunet-revocation.c:551 | 6334 | #: src/revocation/gnunet-revocation.c:546 |
6330 | msgid "test if the public key KEY has been revoked" | 6335 | msgid "test if the public key KEY has been revoked" |
6331 | msgstr "" | 6336 | msgstr "" |
6332 | 6337 | ||
6333 | #: src/revocation/gnunet-revocation.c:557 | 6338 | #: src/revocation/gnunet-revocation.c:552 |
6334 | #, fuzzy | 6339 | #, fuzzy |
6335 | msgid "number of epochs to calculate for" | 6340 | msgid "number of epochs to calculate for" |
6336 | msgstr "số lần lặp lại" | 6341 | msgstr "số lần lặp lại" |
6337 | 6342 | ||
6338 | #: src/revocation/gnunet-service-revocation.c:494 | 6343 | #: src/revocation/gnunet-service-revocation.c:502 |
6339 | #, fuzzy | 6344 | #, fuzzy |
6340 | msgid "# unsupported revocations received via set union" | 6345 | msgid "# unsupported revocations received via set union" |
6341 | msgstr "# các yêu cầu danh sách máy được nháºn" | 6346 | msgstr "# các yêu cầu danh sách máy được nháºn" |
6342 | 6347 | ||
6343 | #: src/revocation/gnunet-service-revocation.c:504 | 6348 | #: src/revocation/gnunet-service-revocation.c:512 |
6344 | #, fuzzy | 6349 | #, fuzzy |
6345 | msgid "# revocation messages received via set union" | 6350 | msgid "# revocation messages received via set union" |
6346 | msgstr "# các thông báo PONG đã máºt mã được nháºn" | 6351 | msgstr "# các thông báo PONG đã máºt mã được nháºn" |
6347 | 6352 | ||
6348 | #: src/revocation/gnunet-service-revocation.c:509 | 6353 | #: src/revocation/gnunet-service-revocation.c:517 |
6349 | #, c-format | 6354 | #, c-format |
6350 | msgid "Error computing revocation set union with %s\n" | 6355 | msgid "Error computing revocation set union with %s\n" |
6351 | msgstr "" | 6356 | msgstr "" |
6352 | 6357 | ||
6353 | #: src/revocation/gnunet-service-revocation.c:513 | 6358 | #: src/revocation/gnunet-service-revocation.c:521 |
6354 | #, fuzzy | 6359 | #, fuzzy |
6355 | msgid "# revocation set unions failed" | 6360 | msgid "# revocation set unions failed" |
6356 | msgstr "# các khoá phiên chạy được chấp nháºn" | 6361 | msgstr "# các khoá phiên chạy được chấp nháºn" |
6357 | 6362 | ||
6358 | #: src/revocation/gnunet-service-revocation.c:521 | 6363 | #: src/revocation/gnunet-service-revocation.c:529 |
6359 | #, fuzzy | 6364 | #, fuzzy |
6360 | msgid "# revocation set unions completed" | 6365 | msgid "# revocation set unions completed" |
6361 | msgstr "# các sá»± truyá»n PONG bị lá»—i" | 6366 | msgstr "# các sá»± truyá»n PONG bị lá»—i" |
6362 | 6367 | ||
6363 | #: src/revocation/gnunet-service-revocation.c:559 | 6368 | #: src/revocation/gnunet-service-revocation.c:567 |
6364 | msgid "SET service crashed, terminating revocation service\n" | 6369 | msgid "SET service crashed, terminating revocation service\n" |
6365 | msgstr "" | 6370 | msgstr "" |
6366 | 6371 | ||
6367 | #: src/revocation/gnunet-service-revocation.c:912 | 6372 | #: src/revocation/gnunet-service-revocation.c:920 |
6368 | #, fuzzy | 6373 | #, fuzzy |
6369 | msgid "Could not open revocation database file!" | 6374 | msgid "Could not open revocation database file!" |
6370 | msgstr "« %s »: Không thể kết nối.\n" | 6375 | msgstr "« %s »: Không thể kết nối.\n" |
@@ -6381,21 +6386,21 @@ msgstr "" | |||
6381 | msgid "Get peers from biased stream" | 6386 | msgid "Get peers from biased stream" |
6382 | msgstr "" | 6387 | msgstr "" |
6383 | 6388 | ||
6384 | #: src/rps/gnunet-rps-profiler.c:3200 | 6389 | #: src/rps/gnunet-rps-profiler.c:3142 |
6385 | msgid "duration of the profiling" | 6390 | msgid "duration of the profiling" |
6386 | msgstr "" | 6391 | msgstr "" |
6387 | 6392 | ||
6388 | #: src/rps/gnunet-rps-profiler.c:3206 | 6393 | #: src/rps/gnunet-rps-profiler.c:3148 |
6389 | #, fuzzy | 6394 | #, fuzzy |
6390 | msgid "timeout for the profiling" | 6395 | msgid "timeout for the profiling" |
6391 | msgstr "xác định mức ưu tiên của nội dung" | 6396 | msgstr "xác định mức ưu tiên của nội dung" |
6392 | 6397 | ||
6393 | #: src/rps/gnunet-rps-profiler.c:3211 | 6398 | #: src/rps/gnunet-rps-profiler.c:3153 |
6394 | #, fuzzy | 6399 | #, fuzzy |
6395 | msgid "number of PeerIDs to request" | 6400 | msgid "number of PeerIDs to request" |
6396 | msgstr "số lần lặp lại" | 6401 | msgstr "số lần lặp lại" |
6397 | 6402 | ||
6398 | #: src/rps/gnunet-rps-profiler.c:3228 | 6403 | #: src/rps/gnunet-rps-profiler.c:3170 |
6399 | #, fuzzy | 6404 | #, fuzzy |
6400 | msgid "Measure quality and performance of the RPS service." | 6405 | msgid "Measure quality and performance of the RPS service." |
6401 | msgstr "Không thể truy cáºp đến dịch vụ" | 6406 | msgstr "Không thể truy cáºp đến dịch vụ" |
@@ -6484,7 +6489,7 @@ msgid "also profile decryption" | |||
6484 | msgstr "" | 6489 | msgstr "" |
6485 | 6490 | ||
6486 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 | 6491 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 |
6487 | #: src/setu/gnunet-service-setu.c:3633 | 6492 | #: src/setu/gnunet-service-setu.c:3832 |
6488 | #, fuzzy | 6493 | #, fuzzy |
6489 | msgid "Could not connect to CADET service\n" | 6494 | msgid "Could not connect to CADET service\n" |
6490 | msgstr "Không thể kết nối tới %s:%u: %s\n" | 6495 | msgstr "Không thể kết nối tới %s:%u: %s\n" |
@@ -7056,13 +7061,13 @@ msgstr "Lỗi chạy %s: %s %d\n" | |||
7056 | msgid "Failed to load configuration from %s\n" | 7061 | msgid "Failed to load configuration from %s\n" |
7057 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 7062 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
7058 | 7063 | ||
7059 | #: src/topology/friends.c:127 | 7064 | #: src/topology/friends.c:118 |
7060 | #, fuzzy, c-format | 7065 | #, fuzzy, c-format |
7061 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" | 7066 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" |
7062 | msgstr "" | 7067 | msgstr "" |
7063 | "Lá»—i cú pháp trong sá»± xác định địa hình há»c, Ä‘ang bá» qua các byte « %s ».\n" | 7068 | "Lá»—i cú pháp trong sá»± xác định địa hình há»c, Ä‘ang bá» qua các byte « %s ».\n" |
7064 | 7069 | ||
7065 | #: src/topology/friends.c:181 | 7070 | #: src/topology/friends.c:172 |
7066 | #, c-format | 7071 | #, c-format |
7067 | msgid "Directory for file `%s' does not seem to be writable.\n" | 7072 | msgid "Directory for file `%s' does not seem to be writable.\n" |
7068 | msgstr "" | 7073 | msgstr "" |
@@ -7136,19 +7141,19 @@ msgstr "# các thông báo PONG đã máºt mã được nháºn" | |||
7136 | msgid "GNUnet topology control" | 7141 | msgid "GNUnet topology control" |
7137 | msgstr "" | 7142 | msgstr "" |
7138 | 7143 | ||
7139 | #: src/transport/gnunet-communicator-tcp.c:3221 | 7144 | #: src/transport/gnunet-communicator-tcp.c:3331 |
7140 | #: src/transport/gnunet-communicator-udp.c:3076 | 7145 | #: src/transport/gnunet-communicator-udp.c:3790 |
7141 | #: src/transport/gnunet-service-tng.c:10014 | 7146 | #: src/transport/gnunet-service-tng.c:10220 |
7142 | #: src/transport/gnunet-service-transport.c:2627 | 7147 | #: src/transport/gnunet-service-transport.c:2627 |
7143 | #, fuzzy | 7148 | #, fuzzy |
7144 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 7149 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
7145 | msgstr "Lưu cấu hình ngay bây giỠkhông?" | 7150 | msgstr "Lưu cấu hình ngay bây giỠkhông?" |
7146 | 7151 | ||
7147 | #: src/transport/gnunet-communicator-tcp.c:3553 | 7152 | #: src/transport/gnunet-communicator-tcp.c:3668 |
7148 | msgid "GNUnet TCP communicator" | 7153 | msgid "GNUnet TCP communicator" |
7149 | msgstr "" | 7154 | msgstr "" |
7150 | 7155 | ||
7151 | #: src/transport/gnunet-communicator-udp.c:3148 | 7156 | #: src/transport/gnunet-communicator-udp.c:3862 |
7152 | msgid "GNUnet UDP communicator" | 7157 | msgid "GNUnet UDP communicator" |
7153 | msgstr "" | 7158 | msgstr "" |
7154 | 7159 | ||
@@ -8250,7 +8255,7 @@ msgstr "" | |||
8250 | msgid "Service process failed to report status\n" | 8255 | msgid "Service process failed to report status\n" |
8251 | msgstr "" | 8256 | msgstr "" |
8252 | 8257 | ||
8253 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1176 | 8258 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 |
8254 | #: src/util/service.c:1637 | 8259 | #: src/util/service.c:1637 |
8255 | #, c-format | 8260 | #, c-format |
8256 | msgid "Cannot obtain information about user `%s': %s\n" | 8261 | msgid "Cannot obtain information about user `%s': %s\n" |
@@ -8270,7 +8275,7 @@ msgid "do daemonize (detach from terminal)" | |||
8270 | msgstr "" | 8275 | msgstr "" |
8271 | 8276 | ||
8272 | #: src/transport/tcp_service_legacy.c:1397 | 8277 | #: src/transport/tcp_service_legacy.c:1397 |
8273 | #: src/transport/transport-testing2.c:985 src/util/service.c:2072 | 8278 | #: src/transport/transport-testing-communicator.c:1045 src/util/service.c:2072 |
8274 | #: src/util/service.c:2084 | 8279 | #: src/util/service.c:2084 |
8275 | #, fuzzy, c-format | 8280 | #, fuzzy, c-format |
8276 | msgid "Malformed configuration file `%s', exit ...\n" | 8281 | msgid "Malformed configuration file `%s', exit ...\n" |
@@ -8437,22 +8442,22 @@ msgid "" | |||
8437 | msgstr "" | 8442 | msgstr "" |
8438 | "Cấu hình không thá»a mãn các rà ng buá»™c của táºp tin đặc tả cấu hình « %s ».\n" | 8443 | "Cấu hình không thá»a mãn các rà ng buá»™c của táºp tin đặc tả cấu hình « %s ».\n" |
8439 | 8444 | ||
8440 | #: src/util/configuration.c:402 | 8445 | #: src/util/configuration.c:370 |
8441 | #, fuzzy, c-format | 8446 | #, fuzzy, c-format |
8442 | msgid "Syntax error while deserializing in line %u\n" | 8447 | msgid "Syntax error while deserializing in line %u\n" |
8443 | msgstr "Gặp lá»—i cú pháp trong táºp tin cấu hình « %s » tại dòng %d.\n" | 8448 | msgstr "Gặp lá»—i cú pháp trong táºp tin cấu hình « %s » tại dòng %d.\n" |
8444 | 8449 | ||
8445 | #: src/util/configuration.c:460 | 8450 | #: src/util/configuration.c:420 |
8446 | #, fuzzy, c-format | 8451 | #, fuzzy, c-format |
8447 | msgid "Error while reading file `%s'\n" | 8452 | msgid "Error while reading file `%s'\n" |
8448 | msgstr "Gặp lỗi khi tải xuống: %s\n" | 8453 | msgstr "Gặp lỗi khi tải xuống: %s\n" |
8449 | 8454 | ||
8450 | #: src/util/configuration.c:1063 | 8455 | #: src/util/configuration.c:980 |
8451 | #, fuzzy | 8456 | #, fuzzy |
8452 | msgid "Not a valid relative time specification" | 8457 | msgid "Not a valid relative time specification" |
8453 | msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" | 8458 | msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" |
8454 | 8459 | ||
8455 | #: src/util/configuration.c:1154 | 8460 | #: src/util/configuration.c:1050 |
8456 | #, c-format | 8461 | #, c-format |
8457 | msgid "" | 8462 | msgid "" |
8458 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " | 8463 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " |
@@ -8461,17 +8466,17 @@ msgstr "" | |||
8461 | "Giá trị cấu hình « %s » cho « %s » trong phần « %s » không phải nằm trong " | 8466 | "Giá trị cấu hình « %s » cho « %s » trong phần « %s » không phải nằm trong " |
8462 | "táºp hợp các sá»± chá»n được phép\n" | 8467 | "táºp hợp các sá»± chá»n được phép\n" |
8463 | 8468 | ||
8464 | #: src/util/configuration.c:1269 | 8469 | #: src/util/configuration.c:1145 |
8465 | #, c-format | 8470 | #, c-format |
8466 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" | 8471 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" |
8467 | msgstr "" | 8472 | msgstr "" |
8468 | 8473 | ||
8469 | #: src/util/configuration.c:1301 | 8474 | #: src/util/configuration.c:1177 |
8470 | #, fuzzy, c-format | 8475 | #, fuzzy, c-format |
8471 | msgid "Missing closing `%s' in option `%s'\n" | 8476 | msgid "Missing closing `%s' in option `%s'\n" |
8472 | msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" | 8477 | msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" |
8473 | 8478 | ||
8474 | #: src/util/configuration.c:1367 | 8479 | #: src/util/configuration.c:1243 |
8475 | #, c-format | 8480 | #, c-format |
8476 | msgid "" | 8481 | msgid "" |
8477 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " | 8482 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " |
@@ -8485,37 +8490,37 @@ msgid "" | |||
8485 | "%llu)\n" | 8490 | "%llu)\n" |
8486 | msgstr "" | 8491 | msgstr "" |
8487 | 8492 | ||
8488 | #: src/util/crypto_ecc.c:663 | 8493 | #: src/util/crypto_ecc.c:567 |
8489 | #, fuzzy, c-format | 8494 | #, fuzzy, c-format |
8490 | msgid "ECC signing failed at %s:%d: %s\n" | 8495 | msgid "ECC signing failed at %s:%d: %s\n" |
8491 | msgstr "%s bị lỗi tại %s:%d: « %s »\n" | 8496 | msgstr "%s bị lỗi tại %s:%d: « %s »\n" |
8492 | 8497 | ||
8493 | #: src/util/crypto_ecc.c:791 | 8498 | #: src/util/crypto_ecc.c:669 |
8494 | #, fuzzy, c-format | 8499 | #, fuzzy, c-format |
8495 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 8500 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
8496 | msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" | 8501 | msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" |
8497 | 8502 | ||
8498 | #: src/util/crypto_ecc_setup.c:369 | 8503 | #: src/util/crypto_ecc_setup.c:273 |
8499 | #, fuzzy | 8504 | #, fuzzy |
8500 | msgid "Could not load peer's private key\n" | 8505 | msgid "Could not load peer's private key\n" |
8501 | msgstr "Không thể truy cáºp đến táºp tin gnunet-directory « %s »\n" | 8506 | msgstr "Không thể truy cáºp đến táºp tin gnunet-directory « %s »\n" |
8502 | 8507 | ||
8503 | #: src/util/crypto_random.c:345 | 8508 | #: src/util/crypto_random.c:381 |
8504 | #, c-format | 8509 | #, c-format |
8505 | msgid "libgcrypt has not the expected version (version %s is required).\n" | 8510 | msgid "libgcrypt has not the expected version (version %s is required).\n" |
8506 | msgstr "libgcrypt không có phiên bản mong đợi (yêu cầu phiên bản %s).\n" | 8511 | msgstr "libgcrypt không có phiên bản mong đợi (yêu cầu phiên bản %s).\n" |
8507 | 8512 | ||
8508 | #: src/util/crypto_rsa.c:959 | 8513 | #: src/util/crypto_rsa.c:862 |
8509 | #, fuzzy, c-format | 8514 | #, fuzzy, c-format |
8510 | msgid "RSA signing failed at %s:%d: %s\n" | 8515 | msgid "RSA signing failed at %s:%d: %s\n" |
8511 | msgstr "%s bị lỗi tại %s:%d: « %s »\n" | 8516 | msgstr "%s bị lỗi tại %s:%d: « %s »\n" |
8512 | 8517 | ||
8513 | #: src/util/crypto_rsa.c:1318 | 8518 | #: src/util/crypto_rsa.c:1162 |
8514 | #, c-format | 8519 | #, c-format |
8515 | msgid "RSA signature verification failed at %s:%d: %s\n" | 8520 | msgid "RSA signature verification failed at %s:%d: %s\n" |
8516 | msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" | 8521 | msgstr "Lỗi thẩm tra chữ ký RSA tại %s:%d: %s\n" |
8517 | 8522 | ||
8518 | #: src/util/disk.c:940 | 8523 | #: src/util/disk.c:823 |
8519 | #, c-format | 8524 | #, c-format |
8520 | msgid "Expected `%s' to be a directory!\n" | 8525 | msgid "Expected `%s' to be a directory!\n" |
8521 | msgstr "Mong đợi « %s » là một thư mục.\n" | 8526 | msgstr "Mong đợi « %s » là một thư mục.\n" |
@@ -8600,18 +8605,18 @@ msgstr "%s: tùy chá»n « -W %s » là mÆ¡ hồ\n" | |||
8600 | msgid "%s: option `-W %s' does not allow an argument\n" | 8605 | msgid "%s: option `-W %s' does not allow an argument\n" |
8601 | msgstr "%s: tùy chá»n « -W %s » không cho phép đối số\n" | 8606 | msgstr "%s: tùy chá»n « -W %s » không cho phép đối số\n" |
8602 | 8607 | ||
8603 | #: src/util/getopt.c:974 | 8608 | #: src/util/getopt.c:970 |
8604 | #, fuzzy, c-format | 8609 | #, fuzzy, c-format |
8605 | msgid "Use %s to get a list of options.\n" | 8610 | msgid "Use %s to get a list of options.\n" |
8606 | msgstr "" | 8611 | msgstr "" |
8607 | "Hãy sá» dụng câu lệnh trợ giúp « --help » để xem danh sách các tùy chá»n.\n" | 8612 | "Hãy sá» dụng câu lệnh trợ giúp « --help » để xem danh sách các tùy chá»n.\n" |
8608 | 8613 | ||
8609 | #: src/util/getopt.c:986 | 8614 | #: src/util/getopt.c:983 |
8610 | #, fuzzy, c-format | 8615 | #, fuzzy, c-format |
8611 | msgid "Option `%s' can't be used with other options.\n" | 8616 | msgid "Option `%s' can't be used with other options.\n" |
8612 | msgstr "Tùy chá»n « %s » không có nghÄ©a khi không có tùy chá»n « %s ».\n" | 8617 | msgstr "Tùy chá»n « %s » không có nghÄ©a khi không có tùy chá»n « %s ».\n" |
8613 | 8618 | ||
8614 | #: src/util/getopt.c:998 | 8619 | #: src/util/getopt.c:995 |
8615 | #, fuzzy, c-format | 8620 | #, fuzzy, c-format |
8616 | msgid "Missing mandatory option `%s'.\n" | 8621 | msgid "Missing mandatory option `%s'.\n" |
8617 | msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" | 8622 | msgstr "Giá trị cấu hình « %s » cho « %s » trong phần « %s » nên là con số\n" |
@@ -8700,6 +8705,10 @@ msgstr "Phải gá»i má»™t con số cho tùy chá»n « %s ».\n" | |||
8700 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 8705 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
8701 | msgstr "" | 8706 | msgstr "" |
8702 | 8707 | ||
8708 | #: src/util/gnunet-base32.c:45 | ||
8709 | msgid "run decoder modus, otherwise runs as encoder" | ||
8710 | msgstr "" | ||
8711 | |||
8703 | #: src/util/gnunet-config.c:167 | 8712 | #: src/util/gnunet-config.c:167 |
8704 | #, fuzzy, c-format | 8713 | #, fuzzy, c-format |
8705 | msgid "failed to load configuration defaults" | 8714 | msgid "failed to load configuration defaults" |
@@ -8754,6 +8763,10 @@ msgstr "" | |||
8754 | msgid "Manipulate GNUnet configuration files" | 8763 | msgid "Manipulate GNUnet configuration files" |
8755 | msgstr "cáºp nháºt má»™t giá trị trong táºp tin cấu hình" | 8764 | msgstr "cáºp nháºt má»™t giá trị trong táºp tin cấu hình" |
8756 | 8765 | ||
8766 | #: src/util/gnunet-crypto-tvg.c:1072 | ||
8767 | msgid "verify a test vector from stdin" | ||
8768 | msgstr "" | ||
8769 | |||
8757 | #: src/util/gnunet-ecc.c:94 | 8770 | #: src/util/gnunet-ecc.c:94 |
8758 | #, fuzzy, c-format | 8771 | #, fuzzy, c-format |
8759 | msgid "Failed to open `%s': %s\n" | 8772 | msgid "Failed to open `%s': %s\n" |
@@ -8874,31 +8887,31 @@ msgid "perform a reverse lookup" | |||
8874 | msgstr "" | 8887 | msgstr "" |
8875 | 8888 | ||
8876 | #: src/util/gnunet-resolver.c:182 | 8889 | #: src/util/gnunet-resolver.c:182 |
8877 | msgid "Use build-in GNUnet stub resolver" | 8890 | msgid "Use built-in GNUnet stub resolver" |
8878 | msgstr "" | 8891 | msgstr "" |
8879 | 8892 | ||
8880 | #: src/util/gnunet-scrypt.c:229 | 8893 | #: src/util/gnunet-scrypt.c:232 |
8881 | #, c-format | 8894 | #, c-format |
8882 | msgid "Loading hostkey from `%s' failed.\n" | 8895 | msgid "Loading hostkey from `%s' failed.\n" |
8883 | msgstr "" | 8896 | msgstr "" |
8884 | 8897 | ||
8885 | #: src/util/gnunet-scrypt.c:295 | 8898 | #: src/util/gnunet-scrypt.c:298 |
8886 | msgid "number of bits to require for the proof of work" | 8899 | msgid "number of bits to require for the proof of work" |
8887 | msgstr "" | 8900 | msgstr "" |
8888 | 8901 | ||
8889 | #: src/util/gnunet-scrypt.c:301 | 8902 | #: src/util/gnunet-scrypt.c:304 |
8890 | msgid "file with private key, otherwise default is used" | 8903 | msgid "file with private key, otherwise default is used" |
8891 | msgstr "" | 8904 | msgstr "" |
8892 | 8905 | ||
8893 | #: src/util/gnunet-scrypt.c:307 | 8906 | #: src/util/gnunet-scrypt.c:310 |
8894 | msgid "file with proof of work, otherwise default is used" | 8907 | msgid "file with proof of work, otherwise default is used" |
8895 | msgstr "" | 8908 | msgstr "" |
8896 | 8909 | ||
8897 | #: src/util/gnunet-scrypt.c:313 | 8910 | #: src/util/gnunet-scrypt.c:316 |
8898 | msgid "time to wait between calculations" | 8911 | msgid "time to wait between calculations" |
8899 | msgstr "" | 8912 | msgstr "" |
8900 | 8913 | ||
8901 | #: src/util/gnunet-scrypt.c:326 | 8914 | #: src/util/gnunet-scrypt.c:330 |
8902 | #, fuzzy | 8915 | #, fuzzy |
8903 | msgid "Manipulate GNUnet proof of work files" | 8916 | msgid "Manipulate GNUnet proof of work files" |
8904 | msgstr "cáºp nháºt má»™t giá trị trong táºp tin cấu hình" | 8917 | msgstr "cáºp nháºt má»™t giá trị trong táºp tin cấu hình" |
@@ -8936,25 +8949,25 @@ msgstr "Gặp lá»—i khi tạo ngÆ°á»i dùng" | |||
8936 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" | 8949 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" |
8937 | msgstr "" | 8950 | msgstr "" |
8938 | 8951 | ||
8939 | #: src/util/network.c:1364 | 8952 | #: src/util/network.c:1361 |
8940 | #, c-format | 8953 | #, c-format |
8941 | msgid "" | 8954 | msgid "" |
8942 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" | 8955 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" |
8943 | msgstr "" | 8956 | msgstr "" |
8944 | 8957 | ||
8945 | #: src/util/os_installation.c:411 | 8958 | #: src/util/os_installation.c:415 |
8946 | #, c-format | 8959 | #, c-format |
8947 | msgid "" | 8960 | msgid "" |
8948 | "Could not determine installation path for %s. Set `%s' environment " | 8961 | "Could not determine installation path for %s. Set `%s' environment " |
8949 | "variable.\n" | 8962 | "variable.\n" |
8950 | msgstr "" | 8963 | msgstr "" |
8951 | 8964 | ||
8952 | #: src/util/os_installation.c:794 | 8965 | #: src/util/os_installation.c:802 |
8953 | #, fuzzy, c-format | 8966 | #, fuzzy, c-format |
8954 | msgid "Could not find binary `%s' in PATH!\n" | 8967 | msgid "Could not find binary `%s' in PATH!\n" |
8955 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" | 8968 | msgstr "Không thể Ä‘á»c danh sách bạn bè « %s »\n" |
8956 | 8969 | ||
8957 | #: src/util/os_installation.c:827 | 8970 | #: src/util/os_installation.c:835 |
8958 | #, c-format | 8971 | #, c-format |
8959 | msgid "Binary `%s' exists, but is not SUID\n" | 8972 | msgid "Binary `%s' exists, but is not SUID\n" |
8960 | msgstr "" | 8973 | msgstr "" |
@@ -8964,32 +8977,32 @@ msgstr "" | |||
8964 | msgid "Initialization of plugin mechanism failed: %s!\n" | 8977 | msgid "Initialization of plugin mechanism failed: %s!\n" |
8965 | msgstr "Lỗi sơ khởi cơ chế phần bổ sung: %s\n" | 8978 | msgstr "Lỗi sơ khởi cơ chế phần bổ sung: %s\n" |
8966 | 8979 | ||
8967 | #: src/util/plugin.c:147 | 8980 | #: src/util/plugin.c:156 |
8968 | #, c-format | 8981 | #, c-format |
8969 | msgid "`%s' failed to resolve method '%s' with error: %s\n" | 8982 | msgid "`%s' failed to resolve method '%s' with error: %s\n" |
8970 | msgstr "« %s » không giải quyết được phương pháp « %s », với lỗi: %s\n" | 8983 | msgstr "« %s » không giải quyết được phương pháp « %s », với lỗi: %s\n" |
8971 | 8984 | ||
8972 | #: src/util/plugin.c:223 | 8985 | #: src/util/plugin.c:234 |
8973 | #, c-format | 8986 | #, c-format |
8974 | msgid "`%s' failed for library `%s' with error: %s\n" | 8987 | msgid "`%s' failed for library `%s' with error: %s\n" |
8975 | msgstr "« %s » thất bại cho thư viện « %s » với lỗi: %s\n" | 8988 | msgstr "« %s » thất bại cho thư viện « %s » với lỗi: %s\n" |
8976 | 8989 | ||
8977 | #: src/util/plugin.c:384 | 8990 | #: src/util/plugin.c:409 |
8978 | #, fuzzy | 8991 | #, fuzzy |
8979 | msgid "Could not determine plugin installation path.\n" | 8992 | msgid "Could not determine plugin installation path.\n" |
8980 | msgstr "Không thể truy cáºp đến thông tin vá» không gian tên.\n" | 8993 | msgstr "Không thể truy cáºp đến thông tin vá» không gian tên.\n" |
8981 | 8994 | ||
8982 | #: src/util/program.c:267 | 8995 | #: src/util/program.c:259 |
8983 | #, fuzzy, c-format | 8996 | #, fuzzy, c-format |
8984 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" | 8997 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" |
8985 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 8998 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
8986 | 8999 | ||
8987 | #: src/util/program.c:284 | 9000 | #: src/util/program.c:276 |
8988 | #, fuzzy, c-format | 9001 | #, fuzzy, c-format |
8989 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | 9002 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" |
8990 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 9003 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
8991 | 9004 | ||
8992 | #: src/util/program.c:299 | 9005 | #: src/util/program.c:291 |
8993 | #, fuzzy | 9006 | #, fuzzy |
8994 | msgid "Unreadable or malformed configuration, exit ...\n" | 9007 | msgid "Unreadable or malformed configuration, exit ...\n" |
8995 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" | 9008 | msgstr "Không thể lÆ°u táºp tin cấu hình « %s »:" |
@@ -9125,12 +9138,12 @@ msgstr "Mặt nạ mạng có định dạng sai « %s »: %s\n" | |||
9125 | msgid "Wrong format `%s' for network\n" | 9138 | msgid "Wrong format `%s' for network\n" |
9126 | msgstr "Mạng có định dạng sai « %s »: %s\n" | 9139 | msgstr "Mạng có định dạng sai « %s »: %s\n" |
9127 | 9140 | ||
9128 | #: src/util/time.c:848 src/util/time.c:876 | 9141 | #: src/util/time.c:878 src/util/time.c:906 |
9129 | #, c-format | 9142 | #, c-format |
9130 | msgid "Failed to map `%s', cannot assure monotonic time!\n" | 9143 | msgid "Failed to map `%s', cannot assure monotonic time!\n" |
9131 | msgstr "" | 9144 | msgstr "" |
9132 | 9145 | ||
9133 | #: src/util/time.c:884 | 9146 | #: src/util/time.c:914 |
9134 | #, c-format | 9147 | #, c-format |
9135 | msgid "" | 9148 | msgid "" |
9136 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" | 9149 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" |
diff --git a/po/zh_CN.po b/po/zh_CN.po index 3b3e78ae0..3346968de 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po | |||
@@ -7,7 +7,7 @@ msgid "" | |||
7 | msgstr "" | 7 | msgstr "" |
8 | "Project-Id-Version: gnunet-0.8.1\n" | 8 | "Project-Id-Version: gnunet-0.8.1\n" |
9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" | 9 | "Report-Msgid-Bugs-To: gnunet-developers@mail.gnu.org\n" |
10 | "POT-Creation-Date: 2020-11-13 23:46+0900\n" | 10 | "POT-Creation-Date: 2021-04-04 19:19+0200\n" |
11 | "PO-Revision-Date: 2011-07-09 12:12+0800\n" | 11 | "PO-Revision-Date: 2011-07-09 12:12+0800\n" |
12 | "Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n" | 12 | "Last-Translator: Wylmer Wang <wantinghard@gmail.com>\n" |
13 | "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" | 13 | "Language-Team: Chinese (simplified) <i18n-zh@googlegroups.com>\n" |
@@ -755,7 +755,7 @@ msgstr "" | |||
755 | 755 | ||
756 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 | 756 | #: src/auction/gnunet-auction-info.c:77 src/auction/gnunet-auction-join.c:77 |
757 | #: src/conversation/gnunet-conversation-test.c:256 | 757 | #: src/conversation/gnunet-conversation-test.c:256 |
758 | #: src/revocation/gnunet-revocation.c:569 src/template/gnunet-template.c:75 | 758 | #: src/revocation/gnunet-revocation.c:564 src/template/gnunet-template.c:75 |
759 | msgid "help text" | 759 | msgid "help text" |
760 | msgstr "" | 760 | msgstr "" |
761 | 761 | ||
@@ -1329,7 +1329,7 @@ msgstr "未知错误" | |||
1329 | msgid "%24s: %-30s %4s (timeout in %6s)\n" | 1329 | msgid "%24s: %-30s %4s (timeout in %6s)\n" |
1330 | msgstr "" | 1330 | msgstr "" |
1331 | 1331 | ||
1332 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:696 | 1332 | #: src/core/gnunet-core.c:157 src/peerinfo-tool/gnunet-peerinfo.c:697 |
1333 | #, fuzzy, c-format | 1333 | #, fuzzy, c-format |
1334 | msgid "Invalid command line argument `%s'\n" | 1334 | msgid "Invalid command line argument `%s'\n" |
1335 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" | 1335 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" |
@@ -1600,7 +1600,7 @@ msgstr "sqlite æ•°æ®ä»“库" | |||
1600 | #: src/testbed/generate-underlay-topology.c:48 | 1600 | #: src/testbed/generate-underlay-topology.c:48 |
1601 | #: src/testbed/gnunet-daemon-latency-logger.c:53 | 1601 | #: src/testbed/gnunet-daemon-latency-logger.c:53 |
1602 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 | 1602 | #: src/testbed/gnunet-daemon-testbed-underlay.c:57 |
1603 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:62 | 1603 | #: src/testbed/testbed_api_hosts.c:72 src/util/crypto_ecc.c:78 |
1604 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 | 1604 | #: src/util/crypto_ecc_setup.c:47 src/util/crypto_mpi.c:40 |
1605 | #, fuzzy, c-format | 1605 | #, fuzzy, c-format |
1606 | msgid "`%s' failed at %s:%d with error: %s\n" | 1606 | msgid "`%s' failed at %s:%d with error: %s\n" |
@@ -2041,7 +2041,7 @@ msgstr "" | |||
2041 | msgid "Exiting as the number of peers is %u\n" | 2041 | msgid "Exiting as the number of peers is %u\n" |
2042 | msgstr "å¢žåŠ TCP/IP 的最大连接数" | 2042 | msgstr "å¢žåŠ TCP/IP 的最大连接数" |
2043 | 2043 | ||
2044 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3194 | 2044 | #: src/dht/gnunet_dht_profiler.c:955 src/rps/gnunet-rps-profiler.c:3136 |
2045 | #, fuzzy | 2045 | #, fuzzy |
2046 | msgid "number of peers to start" | 2046 | msgid "number of peers to start" |
2047 | msgstr "è¿ä»£æ¬¡æ•°" | 2047 | msgstr "è¿ä»£æ¬¡æ•°" |
@@ -3186,7 +3186,7 @@ msgid "Downloading `%s' done (%s/s).\n" | |||
3186 | msgstr "" | 3186 | msgstr "" |
3187 | 3187 | ||
3188 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 | 3188 | #: src/fs/gnunet-download.c:206 src/fs/gnunet-publish.c:299 |
3189 | #: src/fs/gnunet-search.c:226 src/fs/gnunet-unindex.c:117 | 3189 | #: src/fs/gnunet-search.c:229 src/fs/gnunet-unindex.c:117 |
3190 | #, c-format | 3190 | #, c-format |
3191 | msgid "Unexpected status: %d\n" | 3191 | msgid "Unexpected status: %d\n" |
3192 | msgstr "" | 3192 | msgstr "" |
@@ -3210,12 +3210,12 @@ msgid "Target filename must be specified.\n" | |||
3210 | msgstr "" | 3210 | msgstr "" |
3211 | 3211 | ||
3212 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 | 3212 | #: src/fs/gnunet-download.c:271 src/fs/gnunet-publish.c:869 |
3213 | #: src/fs/gnunet-search.c:291 src/fs/gnunet-unindex.c:154 | 3213 | #: src/fs/gnunet-search.c:294 src/fs/gnunet-unindex.c:154 |
3214 | #, fuzzy, c-format | 3214 | #, fuzzy, c-format |
3215 | msgid "Could not initialize `%s' subsystem.\n" | 3215 | msgid "Could not initialize `%s' subsystem.\n" |
3216 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 3216 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
3217 | 3217 | ||
3218 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:331 | 3218 | #: src/fs/gnunet-download.c:318 src/fs/gnunet-search.c:334 |
3219 | msgid "set the desired LEVEL of receiver-anonymity" | 3219 | msgid "set the desired LEVEL of receiver-anonymity" |
3220 | msgstr "" | 3220 | msgstr "" |
3221 | 3221 | ||
@@ -3223,7 +3223,7 @@ msgstr "" | |||
3223 | msgid "delete incomplete downloads (when aborted with CTRL-C)" | 3223 | msgid "delete incomplete downloads (when aborted with CTRL-C)" |
3224 | msgstr "" | 3224 | msgstr "" |
3225 | 3225 | ||
3226 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:336 | 3226 | #: src/fs/gnunet-download.c:330 src/fs/gnunet-search.c:339 |
3227 | msgid "only search the local peer (no P2P network search)" | 3227 | msgid "only search the local peer (no P2P network search)" |
3228 | msgstr "" | 3228 | msgstr "" |
3229 | 3229 | ||
@@ -3461,37 +3461,37 @@ msgstr "" | |||
3461 | msgid "Publish a file or directory on GNUnet" | 3461 | msgid "Publish a file or directory on GNUnet" |
3462 | msgstr "" | 3462 | msgstr "" |
3463 | 3463 | ||
3464 | #: src/fs/gnunet-search.c:127 | 3464 | #: src/fs/gnunet-search.c:130 |
3465 | #, c-format | 3465 | #, c-format |
3466 | msgid "Failed to write directory with search results to `%s'\n" | 3466 | msgid "Failed to write directory with search results to `%s'\n" |
3467 | msgstr "" | 3467 | msgstr "" |
3468 | 3468 | ||
3469 | #: src/fs/gnunet-search.c:216 | 3469 | #: src/fs/gnunet-search.c:219 |
3470 | #, fuzzy, c-format | 3470 | #, fuzzy, c-format |
3471 | msgid "Error searching: %s.\n" | 3471 | msgid "Error searching: %s.\n" |
3472 | msgstr "创建用户出错" | 3472 | msgstr "创建用户出错" |
3473 | 3473 | ||
3474 | #: src/fs/gnunet-search.c:278 | 3474 | #: src/fs/gnunet-search.c:281 |
3475 | msgid "Could not create keyword URI from arguments.\n" | 3475 | msgid "Could not create keyword URI from arguments.\n" |
3476 | msgstr "" | 3476 | msgstr "" |
3477 | 3477 | ||
3478 | #: src/fs/gnunet-search.c:305 | 3478 | #: src/fs/gnunet-search.c:308 |
3479 | msgid "Could not start searching.\n" | 3479 | msgid "Could not start searching.\n" |
3480 | msgstr "" | 3480 | msgstr "" |
3481 | 3481 | ||
3482 | #: src/fs/gnunet-search.c:342 | 3482 | #: src/fs/gnunet-search.c:345 |
3483 | msgid "write search results to file starting with PREFIX" | 3483 | msgid "write search results to file starting with PREFIX" |
3484 | msgstr "" | 3484 | msgstr "" |
3485 | 3485 | ||
3486 | #: src/fs/gnunet-search.c:348 | 3486 | #: src/fs/gnunet-search.c:351 |
3487 | msgid "automatically terminate search after DELAY" | 3487 | msgid "automatically terminate search after DELAY" |
3488 | msgstr "" | 3488 | msgstr "" |
3489 | 3489 | ||
3490 | #: src/fs/gnunet-search.c:354 | 3490 | #: src/fs/gnunet-search.c:357 |
3491 | msgid "automatically terminate search after VALUE results are found" | 3491 | msgid "automatically terminate search after VALUE results are found" |
3492 | msgstr "" | 3492 | msgstr "" |
3493 | 3493 | ||
3494 | #: src/fs/gnunet-search.c:368 | 3494 | #: src/fs/gnunet-search.c:371 |
3495 | msgid "Search GNUnet for files that were published on GNUnet" | 3495 | msgid "Search GNUnet for files that were published on GNUnet" |
3496 | msgstr "" | 3496 | msgstr "" |
3497 | 3497 | ||
@@ -3851,7 +3851,7 @@ msgstr "" | |||
3851 | msgid "Expected a base32-encoded public zone key\n" | 3851 | msgid "Expected a base32-encoded public zone key\n" |
3852 | msgstr "" | 3852 | msgstr "" |
3853 | 3853 | ||
3854 | #: src/gns/gnunet-bcd.c:133 | 3854 | #: src/gns/gnunet-bcd.c:134 |
3855 | #, c-format | 3855 | #, c-format |
3856 | msgid "Refusing `%s' request to HTTP server\n" | 3856 | msgid "Refusing `%s' request to HTTP server\n" |
3857 | msgstr "" | 3857 | msgstr "" |
@@ -3884,34 +3884,39 @@ msgstr "" | |||
3884 | msgid "Failed to pack DNS response into UDP packet!\n" | 3884 | msgid "Failed to pack DNS response into UDP packet!\n" |
3885 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" | 3885 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" |
3886 | 3886 | ||
3887 | #: src/gns/gnunet-dns2gns.c:444 | 3887 | #: src/gns/gnunet-dns2gns.c:315 |
3888 | #, fuzzy | ||
3889 | msgid "Failed to parse DNS response!\n" | ||
3890 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" | ||
3891 | |||
3892 | #: src/gns/gnunet-dns2gns.c:452 | ||
3888 | #, c-format | 3893 | #, c-format |
3889 | msgid "Cannot parse DNS request from %s\n" | 3894 | msgid "Cannot parse DNS request from %s\n" |
3890 | msgstr "" | 3895 | msgstr "" |
3891 | 3896 | ||
3892 | #: src/gns/gnunet-dns2gns.c:460 | 3897 | #: src/gns/gnunet-dns2gns.c:468 |
3893 | #, c-format | 3898 | #, c-format |
3894 | msgid "Received malformed DNS request from %s\n" | 3899 | msgid "Received malformed DNS request from %s\n" |
3895 | msgstr "" | 3900 | msgstr "" |
3896 | 3901 | ||
3897 | #: src/gns/gnunet-dns2gns.c:468 | 3902 | #: src/gns/gnunet-dns2gns.c:476 |
3898 | #, c-format | 3903 | #, c-format |
3899 | msgid "Received unsupported DNS request from %s\n" | 3904 | msgid "Received unsupported DNS request from %s\n" |
3900 | msgstr "" | 3905 | msgstr "" |
3901 | 3906 | ||
3902 | #: src/gns/gnunet-dns2gns.c:629 | 3907 | #: src/gns/gnunet-dns2gns.c:637 |
3903 | msgid "No DNS server specified!\n" | 3908 | msgid "No DNS server specified!\n" |
3904 | msgstr "" | 3909 | msgstr "" |
3905 | 3910 | ||
3906 | #: src/gns/gnunet-dns2gns.c:778 | 3911 | #: src/gns/gnunet-dns2gns.c:786 |
3907 | msgid "IP of recursive DNS resolver to use (required)" | 3912 | msgid "IP of recursive DNS resolver to use (required)" |
3908 | msgstr "" | 3913 | msgstr "" |
3909 | 3914 | ||
3910 | #: src/gns/gnunet-dns2gns.c:784 | 3915 | #: src/gns/gnunet-dns2gns.c:792 |
3911 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" | 3916 | msgid "UDP port to listen on for inbound DNS requests; default: 2853" |
3912 | msgstr "" | 3917 | msgstr "" |
3913 | 3918 | ||
3914 | #: src/gns/gnunet-dns2gns.c:801 | 3919 | #: src/gns/gnunet-dns2gns.c:809 |
3915 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" | 3920 | msgid "GNUnet DNS-to-GNS proxy (a DNS server)" |
3916 | msgstr "" | 3921 | msgstr "" |
3917 | 3922 | ||
@@ -4030,64 +4035,64 @@ msgstr "" | |||
4030 | msgid "Cookie domain `%s' supplied by server is invalid\n" | 4035 | msgid "Cookie domain `%s' supplied by server is invalid\n" |
4031 | msgstr "" | 4036 | msgstr "" |
4032 | 4037 | ||
4033 | #: src/gns/gnunet-gns-proxy.c:2133 | 4038 | #: src/gns/gnunet-gns-proxy.c:2134 |
4034 | #, fuzzy, c-format | 4039 | #, fuzzy, c-format |
4035 | msgid "Unsupported HTTP method `%s'\n" | 4040 | msgid "Unsupported HTTP method `%s'\n" |
4036 | msgstr "未知的命令“%sâ€ã€‚\n" | 4041 | msgstr "未知的命令“%sâ€ã€‚\n" |
4037 | 4042 | ||
4038 | #: src/gns/gnunet-gns-proxy.c:2657 | 4043 | #: src/gns/gnunet-gns-proxy.c:2658 |
4039 | #, fuzzy, c-format | 4044 | #, fuzzy, c-format |
4040 | msgid "Unable to import private key from file `%s'\n" | 4045 | msgid "Unable to import private key from file `%s'\n" |
4041 | msgstr "æ— æ³•åˆ›å»ºç”¨æˆ·è´¦æˆ·ï¼š" | 4046 | msgstr "æ— æ³•åˆ›å»ºç”¨æˆ·è´¦æˆ·ï¼š" |
4042 | 4047 | ||
4043 | #: src/gns/gnunet-gns-proxy.c:2689 | 4048 | #: src/gns/gnunet-gns-proxy.c:2690 |
4044 | #, fuzzy, c-format | 4049 | #, fuzzy, c-format |
4045 | msgid "Unable to import certificate from `%s'\n" | 4050 | msgid "Unable to import certificate from `%s'\n" |
4046 | msgstr "æ— æ³•ä¿å˜é…置文件“%sâ€ï¼š" | 4051 | msgstr "æ— æ³•ä¿å˜é…置文件“%sâ€ï¼š" |
4047 | 4052 | ||
4048 | #: src/gns/gnunet-gns-proxy.c:2898 | 4053 | #: src/gns/gnunet-gns-proxy.c:2899 |
4049 | #, fuzzy, c-format | 4054 | #, fuzzy, c-format |
4050 | msgid "Failed to start HTTPS server for `%s'\n" | 4055 | msgid "Failed to start HTTPS server for `%s'\n" |
4051 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 4056 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
4052 | 4057 | ||
4053 | #: src/gns/gnunet-gns-proxy.c:2922 src/rest/gnunet-rest-server.c:917 | 4058 | #: src/gns/gnunet-gns-proxy.c:2923 src/rest/gnunet-rest-server.c:917 |
4054 | #, fuzzy | 4059 | #, fuzzy |
4055 | msgid "Failed to pass client to MHD\n" | 4060 | msgid "Failed to pass client to MHD\n" |
4056 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 4061 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
4057 | 4062 | ||
4058 | #: src/gns/gnunet-gns-proxy.c:3271 | 4063 | #: src/gns/gnunet-gns-proxy.c:3272 |
4059 | #, fuzzy, c-format | 4064 | #, fuzzy, c-format |
4060 | msgid "Unsupported socks version %d\n" | 4065 | msgid "Unsupported socks version %d\n" |
4061 | msgstr "未知的命令“%sâ€ã€‚\n" | 4066 | msgstr "未知的命令“%sâ€ã€‚\n" |
4062 | 4067 | ||
4063 | #: src/gns/gnunet-gns-proxy.c:3303 | 4068 | #: src/gns/gnunet-gns-proxy.c:3304 |
4064 | #, fuzzy, c-format | 4069 | #, fuzzy, c-format |
4065 | msgid "Unsupported socks command %d\n" | 4070 | msgid "Unsupported socks command %d\n" |
4066 | msgstr "未知的命令“%sâ€ã€‚\n" | 4071 | msgstr "未知的命令“%sâ€ã€‚\n" |
4067 | 4072 | ||
4068 | #: src/gns/gnunet-gns-proxy.c:3389 | 4073 | #: src/gns/gnunet-gns-proxy.c:3390 |
4069 | #, fuzzy, c-format | 4074 | #, fuzzy, c-format |
4070 | msgid "Unsupported socks address type %d\n" | 4075 | msgid "Unsupported socks address type %d\n" |
4071 | msgstr "未知的命令“%sâ€ã€‚\n" | 4076 | msgstr "未知的命令“%sâ€ã€‚\n" |
4072 | 4077 | ||
4073 | #: src/gns/gnunet-gns-proxy.c:3730 | 4078 | #: src/gns/gnunet-gns-proxy.c:3731 |
4074 | #, fuzzy, c-format | 4079 | #, fuzzy, c-format |
4075 | msgid "Failed to load X.509 key and certificate from `%s'\n" | 4080 | msgid "Failed to load X.509 key and certificate from `%s'\n" |
4076 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 4081 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
4077 | 4082 | ||
4078 | #: src/gns/gnunet-gns-proxy.c:3864 | 4083 | #: src/gns/gnunet-gns-proxy.c:3865 |
4079 | msgid "listen on specified port (default: 7777)" | 4084 | msgid "listen on specified port (default: 7777)" |
4080 | msgstr "" | 4085 | msgstr "" |
4081 | 4086 | ||
4082 | #: src/gns/gnunet-gns-proxy.c:3869 | 4087 | #: src/gns/gnunet-gns-proxy.c:3870 |
4083 | msgid "pem file to use as CA" | 4088 | msgid "pem file to use as CA" |
4084 | msgstr "" | 4089 | msgstr "" |
4085 | 4090 | ||
4086 | #: src/gns/gnunet-gns-proxy.c:3873 | 4091 | #: src/gns/gnunet-gns-proxy.c:3874 |
4087 | msgid "disable use of IPv6" | 4092 | msgid "disable use of IPv6" |
4088 | msgstr "" | 4093 | msgstr "" |
4089 | 4094 | ||
4090 | #: src/gns/gnunet-gns-proxy.c:3899 | 4095 | #: src/gns/gnunet-gns-proxy.c:3900 |
4091 | msgid "GNUnet GNS proxy" | 4096 | msgid "GNUnet GNS proxy" |
4092 | msgstr "" | 4097 | msgstr "" |
4093 | 4098 | ||
@@ -4112,7 +4117,7 @@ msgstr "æ— æ³•è¿žæŽ¥åˆ° %s:%u:%s\n" | |||
4112 | msgid "Error converting GNS response to DNS response!\n" | 4117 | msgid "Error converting GNS response to DNS response!\n" |
4113 | msgstr "" | 4118 | msgstr "" |
4114 | 4119 | ||
4115 | #: src/gns/gnunet-service-gns_interceptor.c:387 | 4120 | #: src/gns/gnunet-service-gns_interceptor.c:386 |
4116 | #, fuzzy | 4121 | #, fuzzy |
4117 | msgid "Failed to connect to the DNS service!\n" | 4122 | msgid "Failed to connect to the DNS service!\n" |
4118 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" | 4123 | msgstr "åˆå§‹åŒ–“%sâ€æœåŠ¡å¤±è´¥ã€‚\n" |
@@ -4147,36 +4152,36 @@ msgstr "" | |||
4147 | msgid "VPN returned empty result for `%s'\n" | 4152 | msgid "VPN returned empty result for `%s'\n" |
4148 | msgstr "" | 4153 | msgstr "" |
4149 | 4154 | ||
4150 | #: src/gns/gnunet-service-gns_resolver.c:1910 | 4155 | #: src/gns/gnunet-service-gns_resolver.c:1919 |
4151 | #, c-format | 4156 | #, c-format |
4152 | msgid "Name `%s' cannot be converted to IDNA." | 4157 | msgid "Name `%s' cannot be converted to IDNA." |
4153 | msgstr "" | 4158 | msgstr "" |
4154 | 4159 | ||
4155 | #: src/gns/gnunet-service-gns_resolver.c:1923 | 4160 | #: src/gns/gnunet-service-gns_resolver.c:1934 |
4156 | #, c-format | 4161 | #, c-format |
4157 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" | 4162 | msgid "GNS lookup resulted in DNS name that is too long (`%s')\n" |
4158 | msgstr "" | 4163 | msgstr "" |
4159 | 4164 | ||
4160 | #: src/gns/gnunet-service-gns_resolver.c:1966 | 4165 | #: src/gns/gnunet-service-gns_resolver.c:1979 |
4161 | #, fuzzy, c-format | 4166 | #, fuzzy, c-format |
4162 | msgid "GNS lookup failed (zero records found for `%s')\n" | 4167 | msgid "GNS lookup failed (zero records found for `%s')\n" |
4163 | msgstr "è¿è¡Œ %s失败:%s %d\n" | 4168 | msgstr "è¿è¡Œ %s失败:%s %d\n" |
4164 | 4169 | ||
4165 | #: src/gns/gnunet-service-gns_resolver.c:2393 | 4170 | #: src/gns/gnunet-service-gns_resolver.c:2406 |
4166 | msgid "GNS lookup recursion failed (no delegation record found)\n" | 4171 | msgid "GNS lookup recursion failed (no delegation record found)\n" |
4167 | msgstr "" | 4172 | msgstr "" |
4168 | 4173 | ||
4169 | #: src/gns/gnunet-service-gns_resolver.c:2416 | 4174 | #: src/gns/gnunet-service-gns_resolver.c:2429 |
4170 | #, fuzzy, c-format | 4175 | #, fuzzy, c-format |
4171 | msgid "Failed to cache GNS resolution: %s\n" | 4176 | msgid "Failed to cache GNS resolution: %s\n" |
4172 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" | 4177 | msgstr "打开日志文件“%sâ€å¤±è´¥ï¼š%s\n" |
4173 | 4178 | ||
4174 | #: src/gns/gnunet-service-gns_resolver.c:2581 | 4179 | #: src/gns/gnunet-service-gns_resolver.c:2594 |
4175 | #, c-format | 4180 | #, c-format |
4176 | msgid "GNS namecache returned empty result for `%s'\n" | 4181 | msgid "GNS namecache returned empty result for `%s'\n" |
4177 | msgstr "" | 4182 | msgstr "" |
4178 | 4183 | ||
4179 | #: src/gns/gnunet-service-gns_resolver.c:2721 | 4184 | #: src/gns/gnunet-service-gns_resolver.c:2734 |
4180 | #, c-format | 4185 | #, c-format |
4181 | msgid "Zone %s was revoked, resolution fails\n" | 4186 | msgid "Zone %s was revoked, resolution fails\n" |
4182 | msgstr "" | 4187 | msgstr "" |
@@ -4210,7 +4215,7 @@ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | |||
4210 | msgid "Unable to parse BOX record string `%s'\n" | 4215 | msgid "Unable to parse BOX record string `%s'\n" |
4211 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 4216 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
4212 | 4217 | ||
4213 | #: src/gns/plugin_rest_gns.c:448 | 4218 | #: src/gns/plugin_rest_gns.c:450 |
4214 | msgid "Gns REST API initialized\n" | 4219 | msgid "Gns REST API initialized\n" |
4215 | msgstr "" | 4220 | msgstr "" |
4216 | 4221 | ||
@@ -4546,7 +4551,7 @@ msgstr "" | |||
4546 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 | 4551 | #: src/hostlist/gnunet-daemon-hostlist_server.c:236 |
4547 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 | 4552 | #: src/hostlist/gnunet-daemon-hostlist_server.c:527 |
4548 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 | 4553 | #: src/peerinfo-tool/gnunet-peerinfo.c:379 |
4549 | #: src/peerinfo-tool/gnunet-peerinfo.c:515 | 4554 | #: src/peerinfo-tool/gnunet-peerinfo.c:516 |
4550 | #: src/topology/gnunet-daemon-topology.c:799 | 4555 | #: src/topology/gnunet-daemon-topology.c:799 |
4551 | #, c-format | 4556 | #, c-format |
4552 | msgid "Error in communication with PEERINFO service: %s\n" | 4557 | msgid "Error in communication with PEERINFO service: %s\n" |
@@ -4711,8 +4716,8 @@ msgid "default configured, but ego unknown (internal error)" | |||
4711 | msgstr "" | 4716 | msgstr "" |
4712 | 4717 | ||
4713 | #: src/identity/gnunet-service-identity.c:621 | 4718 | #: src/identity/gnunet-service-identity.c:621 |
4714 | #: src/identity/gnunet-service-identity.c:898 | 4719 | #: src/identity/gnunet-service-identity.c:896 |
4715 | #: src/identity/gnunet-service-identity.c:1018 | 4720 | #: src/identity/gnunet-service-identity.c:1016 |
4716 | #, fuzzy, c-format | 4721 | #, fuzzy, c-format |
4717 | msgid "Failed to write subsystem default identifier map to `%s'.\n" | 4722 | msgid "Failed to write subsystem default identifier map to `%s'.\n" |
4718 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 4723 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
@@ -4721,30 +4726,30 @@ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | |||
4721 | msgid "Unknown ego specified for service (internal error)" | 4726 | msgid "Unknown ego specified for service (internal error)" |
4722 | msgstr "" | 4727 | msgstr "" |
4723 | 4728 | ||
4724 | #: src/identity/gnunet-service-identity.c:726 | 4729 | #: src/identity/gnunet-service-identity.c:725 |
4725 | msgid "identifier already in use for another ego" | 4730 | msgid "identifier already in use for another ego" |
4726 | msgstr "" | 4731 | msgstr "" |
4727 | 4732 | ||
4728 | #: src/identity/gnunet-service-identity.c:874 | 4733 | #: src/identity/gnunet-service-identity.c:872 |
4729 | msgid "target name already exists" | 4734 | msgid "target name already exists" |
4730 | msgstr "" | 4735 | msgstr "" |
4731 | 4736 | ||
4732 | #: src/identity/gnunet-service-identity.c:916 | 4737 | #: src/identity/gnunet-service-identity.c:914 |
4733 | #: src/identity/gnunet-service-identity.c:1035 | 4738 | #: src/identity/gnunet-service-identity.c:1033 |
4734 | msgid "no matching ego found" | 4739 | msgid "no matching ego found" |
4735 | msgstr "" | 4740 | msgstr "" |
4736 | 4741 | ||
4737 | #: src/identity/gnunet-service-identity.c:1133 | 4742 | #: src/identity/gnunet-service-identity.c:1131 |
4738 | #, fuzzy, c-format | 4743 | #, fuzzy, c-format |
4739 | msgid "Failed to parse ego information in `%s'\n" | 4744 | msgid "Failed to parse ego information in `%s'\n" |
4740 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 4745 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
4741 | 4746 | ||
4742 | #: src/identity/gnunet-service-identity.c:1191 | 4747 | #: src/identity/gnunet-service-identity.c:1189 |
4743 | #, fuzzy, c-format | 4748 | #, fuzzy, c-format |
4744 | msgid "Failed to parse subsystem identity configuration file `%s'\n" | 4749 | msgid "Failed to parse subsystem identity configuration file `%s'\n" |
4745 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 4750 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
4746 | 4751 | ||
4747 | #: src/identity/gnunet-service-identity.c:1200 | 4752 | #: src/identity/gnunet-service-identity.c:1198 |
4748 | #, fuzzy, c-format | 4753 | #, fuzzy, c-format |
4749 | msgid "Failed to create directory `%s' for storing egos\n" | 4754 | msgid "Failed to create directory `%s' for storing egos\n" |
4750 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 4755 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
@@ -4979,7 +4984,7 @@ msgid "Invalid public key for reverse lookup `%s'\n" | |||
4979 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" | 4984 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" |
4980 | 4985 | ||
4981 | #: src/namestore/gnunet-namestore.c:1220 | 4986 | #: src/namestore/gnunet-namestore.c:1220 |
4982 | #: src/peerinfo-tool/gnunet-peerinfo.c:736 | 4987 | #: src/peerinfo-tool/gnunet-peerinfo.c:737 |
4983 | #, fuzzy, c-format | 4988 | #, fuzzy, c-format |
4984 | msgid "Invalid URI `%s'\n" | 4989 | msgid "Invalid URI `%s'\n" |
4985 | msgstr "æ— æ•ˆæ¡ç›®ã€‚\n" | 4990 | msgstr "æ— æ•ˆæ¡ç›®ã€‚\n" |
@@ -5165,7 +5170,7 @@ msgstr "" | |||
5165 | msgid "GNU Name System First Come First Serve name registration service" | 5170 | msgid "GNU Name System First Come First Serve name registration service" |
5166 | msgstr "" | 5171 | msgstr "" |
5167 | 5172 | ||
5168 | #: src/namestore/gnunet-service-namestore.c:866 | 5173 | #: src/namestore/gnunet-service-namestore.c:871 |
5169 | #, fuzzy, c-format | 5174 | #, fuzzy, c-format |
5170 | msgid "Failed to replicate block in namecache: %s\n" | 5175 | msgid "Failed to replicate block in namecache: %s\n" |
5171 | msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n" | 5176 | msgstr "å‘é€æ¶ˆæ¯å¤±è´¥ã€‚\n" |
@@ -5197,7 +5202,7 @@ msgstr "" | |||
5197 | msgid "Flat file database running\n" | 5202 | msgid "Flat file database running\n" |
5198 | msgstr "sqlite æ•°æ®ä»“库" | 5203 | msgstr "sqlite æ•°æ®ä»“库" |
5199 | 5204 | ||
5200 | #: src/namestore/plugin_rest_namestore.c:1103 | 5205 | #: src/namestore/plugin_rest_namestore.c:1105 |
5201 | msgid "Namestore REST API initialized\n" | 5206 | msgid "Namestore REST API initialized\n" |
5202 | msgstr "" | 5207 | msgstr "" |
5203 | 5208 | ||
@@ -5509,8 +5514,8 @@ msgstr "" | |||
5509 | msgid "Measure quality and performance of the NSE service." | 5514 | msgid "Measure quality and performance of the NSE service." |
5510 | msgstr "æ— æ³•è®¿é—®è¯¥æœåŠ¡" | 5515 | msgstr "æ— æ³•è®¿é—®è¯¥æœåŠ¡" |
5511 | 5516 | ||
5512 | #: src/nse/gnunet-service-nse.c:1443 | 5517 | #: src/nse/gnunet-service-nse.c:1450 |
5513 | #: src/revocation/gnunet-service-revocation.c:875 src/util/gnunet-scrypt.c:257 | 5518 | #: src/revocation/gnunet-service-revocation.c:883 src/util/gnunet-scrypt.c:260 |
5514 | #, fuzzy | 5519 | #, fuzzy |
5515 | msgid "Value is too large.\n" | 5520 | msgid "Value is too large.\n" |
5516 | msgstr "值ä¸åœ¨åˆæ³•èŒƒå›´å†…。" | 5521 | msgstr "值ä¸åœ¨åˆæ³•èŒƒå›´å†…。" |
@@ -5551,17 +5556,17 @@ msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | |||
5551 | msgid "Still no peers found in `%s'!\n" | 5556 | msgid "Still no peers found in `%s'!\n" |
5552 | msgstr "" | 5557 | msgstr "" |
5553 | 5558 | ||
5554 | #: src/peerinfo/gnunet-service-peerinfo.c:1024 | 5559 | #: src/peerinfo/gnunet-service-peerinfo.c:1027 |
5555 | #, fuzzy, c-format | 5560 | #, fuzzy, c-format |
5556 | msgid "Cleaning up directory `%s'\n" | 5561 | msgid "Cleaning up directory `%s'\n" |
5557 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 5562 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
5558 | 5563 | ||
5559 | #: src/peerinfo/gnunet-service-peerinfo.c:1319 | 5564 | #: src/peerinfo/gnunet-service-peerinfo.c:1322 |
5560 | #, c-format | 5565 | #, c-format |
5561 | msgid "Importing HELLOs from `%s'\n" | 5566 | msgid "Importing HELLOs from `%s'\n" |
5562 | msgstr "" | 5567 | msgstr "" |
5563 | 5568 | ||
5564 | #: src/peerinfo/gnunet-service-peerinfo.c:1332 | 5569 | #: src/peerinfo/gnunet-service-peerinfo.c:1335 |
5565 | msgid "Skipping import of included HELLOs\n" | 5570 | msgid "Skipping import of included HELLOs\n" |
5566 | msgstr "" | 5571 | msgstr "" |
5567 | 5572 | ||
@@ -5580,7 +5585,7 @@ msgid "\tExpires: %s \t %s\n" | |||
5580 | msgstr "" | 5585 | msgstr "" |
5581 | 5586 | ||
5582 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 | 5587 | #: src/peerinfo-tool/gnunet-peerinfo.c:292 |
5583 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:523 | 5588 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:525 |
5584 | #, fuzzy, c-format | 5589 | #, fuzzy, c-format |
5585 | msgid "Failure: Cannot convert address to string for peer `%s'\n" | 5590 | msgid "Failure: Cannot convert address to string for peer `%s'\n" |
5586 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | 5591 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" |
@@ -5590,55 +5595,55 @@ msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | |||
5590 | msgid "Failure: Received invalid %s\n" | 5595 | msgid "Failure: Received invalid %s\n" |
5591 | msgstr "" | 5596 | msgstr "" |
5592 | 5597 | ||
5593 | #: src/peerinfo-tool/gnunet-peerinfo.c:463 | 5598 | #: src/peerinfo-tool/gnunet-peerinfo.c:464 |
5594 | #, fuzzy, c-format | 5599 | #, fuzzy, c-format |
5595 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" | 5600 | msgid "Failed to write HELLO with %u bytes to file `%s'\n" |
5596 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 5601 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
5597 | 5602 | ||
5598 | #: src/peerinfo-tool/gnunet-peerinfo.c:479 | 5603 | #: src/peerinfo-tool/gnunet-peerinfo.c:480 |
5599 | #, c-format | 5604 | #, c-format |
5600 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" | 5605 | msgid "Wrote %s HELLO containing %u addresses with %u bytes to file `%s'\n" |
5601 | msgstr "" | 5606 | msgstr "" |
5602 | 5607 | ||
5603 | #: src/peerinfo-tool/gnunet-peerinfo.c:758 | 5608 | #: src/peerinfo-tool/gnunet-peerinfo.c:759 |
5604 | #, c-format | 5609 | #, c-format |
5605 | msgid "I am peer `%s'.\n" | 5610 | msgid "I am peer `%s'.\n" |
5606 | msgstr "" | 5611 | msgstr "" |
5607 | 5612 | ||
5608 | #: src/peerinfo-tool/gnunet-peerinfo.c:799 | 5613 | #: src/peerinfo-tool/gnunet-peerinfo.c:800 |
5609 | msgid "don't resolve host names" | 5614 | msgid "don't resolve host names" |
5610 | msgstr "" | 5615 | msgstr "" |
5611 | 5616 | ||
5612 | #: src/peerinfo-tool/gnunet-peerinfo.c:805 | 5617 | #: src/peerinfo-tool/gnunet-peerinfo.c:806 |
5613 | msgid "output only the identity strings" | 5618 | msgid "output only the identity strings" |
5614 | msgstr "" | 5619 | msgstr "" |
5615 | 5620 | ||
5616 | #: src/peerinfo-tool/gnunet-peerinfo.c:810 | 5621 | #: src/peerinfo-tool/gnunet-peerinfo.c:811 |
5617 | msgid "include friend-only information" | 5622 | msgid "include friend-only information" |
5618 | msgstr "" | 5623 | msgstr "" |
5619 | 5624 | ||
5620 | #: src/peerinfo-tool/gnunet-peerinfo.c:815 | 5625 | #: src/peerinfo-tool/gnunet-peerinfo.c:816 |
5621 | msgid "output our own identity only" | 5626 | msgid "output our own identity only" |
5622 | msgstr "" | 5627 | msgstr "" |
5623 | 5628 | ||
5624 | #: src/peerinfo-tool/gnunet-peerinfo.c:820 | 5629 | #: src/peerinfo-tool/gnunet-peerinfo.c:821 |
5625 | #, fuzzy | 5630 | #, fuzzy |
5626 | msgid "list all known peers" | 5631 | msgid "list all known peers" |
5627 | msgstr "列出所有网络适é…器" | 5632 | msgstr "列出所有网络适é…器" |
5628 | 5633 | ||
5629 | #: src/peerinfo-tool/gnunet-peerinfo.c:826 | 5634 | #: src/peerinfo-tool/gnunet-peerinfo.c:827 |
5630 | msgid "dump hello to file" | 5635 | msgid "dump hello to file" |
5631 | msgstr "" | 5636 | msgstr "" |
5632 | 5637 | ||
5633 | #: src/peerinfo-tool/gnunet-peerinfo.c:831 | 5638 | #: src/peerinfo-tool/gnunet-peerinfo.c:832 |
5634 | msgid "also output HELLO uri(s)" | 5639 | msgid "also output HELLO uri(s)" |
5635 | msgstr "" | 5640 | msgstr "" |
5636 | 5641 | ||
5637 | #: src/peerinfo-tool/gnunet-peerinfo.c:838 | 5642 | #: src/peerinfo-tool/gnunet-peerinfo.c:839 |
5638 | msgid "add given HELLO uri to the database" | 5643 | msgid "add given HELLO uri to the database" |
5639 | msgstr "" | 5644 | msgstr "" |
5640 | 5645 | ||
5641 | #: src/peerinfo-tool/gnunet-peerinfo.c:852 | 5646 | #: src/peerinfo-tool/gnunet-peerinfo.c:853 |
5642 | #, fuzzy | 5647 | #, fuzzy |
5643 | msgid "Print information about peers." | 5648 | msgid "Print information about peers." |
5644 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" | 5649 | msgstr "æ— æ³•èŽ·å–有关用户“%sâ€çš„ä¿¡æ¯ï¼š%s\n" |
@@ -5661,7 +5666,7 @@ msgstr "" | |||
5661 | msgid "Failed to load transport plugin for `%s'\n" | 5666 | msgid "Failed to load transport plugin for `%s'\n" |
5662 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 5667 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
5663 | 5668 | ||
5664 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:809 | 5669 | #: src/peerinfo-tool/plugin_rest_peerinfo.c:811 |
5665 | msgid "Peerinfo REST API initialized\n" | 5670 | msgid "Peerinfo REST API initialized\n" |
5666 | msgstr "" | 5671 | msgstr "" |
5667 | 5672 | ||
@@ -5669,7 +5674,7 @@ msgstr "" | |||
5669 | msgid "peerstore" | 5674 | msgid "peerstore" |
5670 | msgstr "" | 5675 | msgstr "" |
5671 | 5676 | ||
5672 | #: src/peerstore/gnunet-service-peerstore.c:561 | 5677 | #: src/peerstore/gnunet-service-peerstore.c:570 |
5673 | #, fuzzy, c-format | 5678 | #, fuzzy, c-format |
5674 | msgid "Could not load database backend `%s'\n" | 5679 | msgid "Could not load database backend `%s'\n" |
5675 | msgstr "æ— æ³•è§£æžâ€œ%sâ€(%s):%s\n" | 5680 | msgstr "æ— æ³•è§£æžâ€œ%sâ€(%s):%s\n" |
@@ -5851,11 +5856,11 @@ msgstr "" | |||
5851 | msgid "re:claimID command line tool" | 5856 | msgid "re:claimID command line tool" |
5852 | msgstr "" | 5857 | msgstr "" |
5853 | 5858 | ||
5854 | #: src/reclaim/plugin_rest_openid_connect.c:2613 | 5859 | #: src/reclaim/plugin_rest_openid_connect.c:2788 |
5855 | msgid "OpenID Connect REST API initialized\n" | 5860 | msgid "OpenID Connect REST API initialized\n" |
5856 | msgstr "" | 5861 | msgstr "" |
5857 | 5862 | ||
5858 | #: src/reclaim/plugin_rest_reclaim.c:1502 | 5863 | #: src/reclaim/plugin_rest_reclaim.c:1521 |
5859 | msgid "Identity Provider REST API initialized\n" | 5864 | msgid "Identity Provider REST API initialized\n" |
5860 | msgstr "" | 5865 | msgstr "" |
5861 | 5866 | ||
@@ -6011,115 +6016,115 @@ msgstr "" | |||
6011 | msgid "Cancelling calculation.\n" | 6016 | msgid "Cancelling calculation.\n" |
6012 | msgstr "" | 6017 | msgstr "" |
6013 | 6018 | ||
6014 | #: src/revocation/gnunet-revocation.c:299 | 6019 | #: src/revocation/gnunet-revocation.c:302 |
6015 | #, c-format | 6020 | #, c-format |
6016 | msgid "Revocation certificate for `%s' stored in `%s'\n" | 6021 | msgid "Revocation certificate for `%s' stored in `%s'\n" |
6017 | msgstr "" | 6022 | msgstr "" |
6018 | 6023 | ||
6019 | #: src/revocation/gnunet-revocation.c:339 | 6024 | #: src/revocation/gnunet-revocation.c:334 |
6020 | #, c-format | 6025 | #, c-format |
6021 | msgid "Ego `%s' not found.\n" | 6026 | msgid "Ego `%s' not found.\n" |
6022 | msgstr "" | 6027 | msgstr "" |
6023 | 6028 | ||
6024 | #: src/revocation/gnunet-revocation.c:356 | 6029 | #: src/revocation/gnunet-revocation.c:351 |
6025 | #, c-format | 6030 | #, c-format |
6026 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" | 6031 | msgid "Error: revocation certificate in `%s' is not for `%s'\n" |
6027 | msgstr "" | 6032 | msgstr "" |
6028 | 6033 | ||
6029 | #: src/revocation/gnunet-revocation.c:366 | 6034 | #: src/revocation/gnunet-revocation.c:361 |
6030 | msgid "Revocation certificate ready\n" | 6035 | msgid "Revocation certificate ready\n" |
6031 | msgstr "" | 6036 | msgstr "" |
6032 | 6037 | ||
6033 | #: src/revocation/gnunet-revocation.c:378 | 6038 | #: src/revocation/gnunet-revocation.c:373 |
6034 | msgid "Continuing calculation where left off...\n" | 6039 | msgid "Continuing calculation where left off...\n" |
6035 | msgstr "" | 6040 | msgstr "" |
6036 | 6041 | ||
6037 | #: src/revocation/gnunet-revocation.c:385 | 6042 | #: src/revocation/gnunet-revocation.c:380 |
6038 | msgid "Revocation certificate not ready, calculating proof of work\n" | 6043 | msgid "Revocation certificate not ready, calculating proof of work\n" |
6039 | msgstr "" | 6044 | msgstr "" |
6040 | 6045 | ||
6041 | #: src/revocation/gnunet-revocation.c:423 | 6046 | #: src/revocation/gnunet-revocation.c:418 |
6042 | #, fuzzy, c-format | 6047 | #, fuzzy, c-format |
6043 | msgid "Public key `%s' malformed\n" | 6048 | msgid "Public key `%s' malformed\n" |
6044 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" | 6049 | msgstr "“%sâ€çš„å‚æ•°æ— æ•ˆã€‚\n" |
6045 | 6050 | ||
6046 | #: src/revocation/gnunet-revocation.c:433 | 6051 | #: src/revocation/gnunet-revocation.c:428 |
6047 | msgid "" | 6052 | msgid "" |
6048 | "Testing and revoking at the same time is not allowed, only executing test.\n" | 6053 | "Testing and revoking at the same time is not allowed, only executing test.\n" |
6049 | msgstr "" | 6054 | msgstr "" |
6050 | 6055 | ||
6051 | #: src/revocation/gnunet-revocation.c:463 | 6056 | #: src/revocation/gnunet-revocation.c:458 |
6052 | #, fuzzy | 6057 | #, fuzzy |
6053 | msgid "No filename to store revocation certificate given.\n" | 6058 | msgid "No filename to store revocation certificate given.\n" |
6054 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 6059 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
6055 | 6060 | ||
6056 | #: src/revocation/gnunet-revocation.c:480 | 6061 | #: src/revocation/gnunet-revocation.c:475 |
6057 | #, fuzzy, c-format | 6062 | #, fuzzy, c-format |
6058 | msgid "Failed to read revocation certificate from `%s'\n" | 6063 | msgid "Failed to read revocation certificate from `%s'\n" |
6059 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 6064 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
6060 | 6065 | ||
6061 | #: src/revocation/gnunet-revocation.c:488 | 6066 | #: src/revocation/gnunet-revocation.c:483 |
6062 | #, fuzzy, c-format | 6067 | #, fuzzy, c-format |
6063 | msgid "Revocation certificate corrupted in `%s'\n" | 6068 | msgid "Revocation certificate corrupted in `%s'\n" |
6064 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 6069 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
6065 | 6070 | ||
6066 | #: src/revocation/gnunet-revocation.c:510 | 6071 | #: src/revocation/gnunet-revocation.c:505 |
6067 | #, fuzzy | 6072 | #, fuzzy |
6068 | msgid "No action specified. Nothing to do.\n" | 6073 | msgid "No action specified. Nothing to do.\n" |
6069 | msgstr "没有指定接å£ï¼Œå°†ä½¿ç”¨é»˜è®¤ã€‚\n" | 6074 | msgstr "没有指定接å£ï¼Œå°†ä½¿ç”¨é»˜è®¤ã€‚\n" |
6070 | 6075 | ||
6071 | #: src/revocation/gnunet-revocation.c:529 | 6076 | #: src/revocation/gnunet-revocation.c:524 |
6072 | msgid "use NAME for the name of the revocation file" | 6077 | msgid "use NAME for the name of the revocation file" |
6073 | msgstr "" | 6078 | msgstr "" |
6074 | 6079 | ||
6075 | #: src/revocation/gnunet-revocation.c:537 | 6080 | #: src/revocation/gnunet-revocation.c:532 |
6076 | msgid "" | 6081 | msgid "" |
6077 | "revoke the private key associated for the the private key associated with " | 6082 | "revoke the private key associated for the the private key associated with " |
6078 | "the ego NAME " | 6083 | "the ego NAME " |
6079 | msgstr "" | 6084 | msgstr "" |
6080 | 6085 | ||
6081 | #: src/revocation/gnunet-revocation.c:544 | 6086 | #: src/revocation/gnunet-revocation.c:539 |
6082 | msgid "actually perform revocation, otherwise we just do the precomputation" | 6087 | msgid "actually perform revocation, otherwise we just do the precomputation" |
6083 | msgstr "" | 6088 | msgstr "" |
6084 | 6089 | ||
6085 | #: src/revocation/gnunet-revocation.c:551 | 6090 | #: src/revocation/gnunet-revocation.c:546 |
6086 | msgid "test if the public key KEY has been revoked" | 6091 | msgid "test if the public key KEY has been revoked" |
6087 | msgstr "" | 6092 | msgstr "" |
6088 | 6093 | ||
6089 | #: src/revocation/gnunet-revocation.c:557 | 6094 | #: src/revocation/gnunet-revocation.c:552 |
6090 | #, fuzzy | 6095 | #, fuzzy |
6091 | msgid "number of epochs to calculate for" | 6096 | msgid "number of epochs to calculate for" |
6092 | msgstr "è¿ä»£æ¬¡æ•°" | 6097 | msgstr "è¿ä»£æ¬¡æ•°" |
6093 | 6098 | ||
6094 | #: src/revocation/gnunet-service-revocation.c:494 | 6099 | #: src/revocation/gnunet-service-revocation.c:502 |
6095 | msgid "# unsupported revocations received via set union" | 6100 | msgid "# unsupported revocations received via set union" |
6096 | msgstr "" | 6101 | msgstr "" |
6097 | 6102 | ||
6098 | #: src/revocation/gnunet-service-revocation.c:504 | 6103 | #: src/revocation/gnunet-service-revocation.c:512 |
6099 | msgid "# revocation messages received via set union" | 6104 | msgid "# revocation messages received via set union" |
6100 | msgstr "" | 6105 | msgstr "" |
6101 | 6106 | ||
6102 | #: src/revocation/gnunet-service-revocation.c:509 | 6107 | #: src/revocation/gnunet-service-revocation.c:517 |
6103 | #, c-format | 6108 | #, c-format |
6104 | msgid "Error computing revocation set union with %s\n" | 6109 | msgid "Error computing revocation set union with %s\n" |
6105 | msgstr "" | 6110 | msgstr "" |
6106 | 6111 | ||
6107 | #: src/revocation/gnunet-service-revocation.c:513 | 6112 | #: src/revocation/gnunet-service-revocation.c:521 |
6108 | #, fuzzy | 6113 | #, fuzzy |
6109 | msgid "# revocation set unions failed" | 6114 | msgid "# revocation set unions failed" |
6110 | msgstr "" | 6115 | msgstr "" |
6111 | "\n" | 6116 | "\n" |
6112 | "按任æ„键继ç»\n" | 6117 | "按任æ„键继ç»\n" |
6113 | 6118 | ||
6114 | #: src/revocation/gnunet-service-revocation.c:521 | 6119 | #: src/revocation/gnunet-service-revocation.c:529 |
6115 | msgid "# revocation set unions completed" | 6120 | msgid "# revocation set unions completed" |
6116 | msgstr "" | 6121 | msgstr "" |
6117 | 6122 | ||
6118 | #: src/revocation/gnunet-service-revocation.c:559 | 6123 | #: src/revocation/gnunet-service-revocation.c:567 |
6119 | msgid "SET service crashed, terminating revocation service\n" | 6124 | msgid "SET service crashed, terminating revocation service\n" |
6120 | msgstr "" | 6125 | msgstr "" |
6121 | 6126 | ||
6122 | #: src/revocation/gnunet-service-revocation.c:912 | 6127 | #: src/revocation/gnunet-service-revocation.c:920 |
6123 | #, fuzzy | 6128 | #, fuzzy |
6124 | msgid "Could not open revocation database file!" | 6129 | msgid "Could not open revocation database file!" |
6125 | msgstr "æ— æ³•è¿žæŽ¥åˆ° %s:%u:%s\n" | 6130 | msgstr "æ— æ³•è¿žæŽ¥åˆ° %s:%u:%s\n" |
@@ -6136,20 +6141,20 @@ msgstr "" | |||
6136 | msgid "Get peers from biased stream" | 6141 | msgid "Get peers from biased stream" |
6137 | msgstr "" | 6142 | msgstr "" |
6138 | 6143 | ||
6139 | #: src/rps/gnunet-rps-profiler.c:3200 | 6144 | #: src/rps/gnunet-rps-profiler.c:3142 |
6140 | msgid "duration of the profiling" | 6145 | msgid "duration of the profiling" |
6141 | msgstr "" | 6146 | msgstr "" |
6142 | 6147 | ||
6143 | #: src/rps/gnunet-rps-profiler.c:3206 | 6148 | #: src/rps/gnunet-rps-profiler.c:3148 |
6144 | msgid "timeout for the profiling" | 6149 | msgid "timeout for the profiling" |
6145 | msgstr "" | 6150 | msgstr "" |
6146 | 6151 | ||
6147 | #: src/rps/gnunet-rps-profiler.c:3211 | 6152 | #: src/rps/gnunet-rps-profiler.c:3153 |
6148 | #, fuzzy | 6153 | #, fuzzy |
6149 | msgid "number of PeerIDs to request" | 6154 | msgid "number of PeerIDs to request" |
6150 | msgstr "è¿ä»£æ¬¡æ•°" | 6155 | msgstr "è¿ä»£æ¬¡æ•°" |
6151 | 6156 | ||
6152 | #: src/rps/gnunet-rps-profiler.c:3228 | 6157 | #: src/rps/gnunet-rps-profiler.c:3170 |
6153 | #, fuzzy | 6158 | #, fuzzy |
6154 | msgid "Measure quality and performance of the RPS service." | 6159 | msgid "Measure quality and performance of the RPS service." |
6155 | msgstr "æ— æ³•è®¿é—®è¯¥æœåŠ¡" | 6160 | msgstr "æ— æ³•è®¿é—®è¯¥æœåŠ¡" |
@@ -6238,7 +6243,7 @@ msgid "also profile decryption" | |||
6238 | msgstr "" | 6243 | msgstr "" |
6239 | 6244 | ||
6240 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 | 6245 | #: src/set/gnunet-service-set.c:1916 src/seti/gnunet-service-seti.c:2467 |
6241 | #: src/setu/gnunet-service-setu.c:3633 | 6246 | #: src/setu/gnunet-service-setu.c:3832 |
6242 | #, fuzzy | 6247 | #, fuzzy |
6243 | msgid "Could not connect to CADET service\n" | 6248 | msgid "Could not connect to CADET service\n" |
6244 | msgstr "æ— æ³•è¿žæŽ¥åˆ° %s:%u:%s\n" | 6249 | msgstr "æ— æ³•è¿žæŽ¥åˆ° %s:%u:%s\n" |
@@ -6809,12 +6814,12 @@ msgstr "è¿è¡Œ %s失败:%s %d\n" | |||
6809 | msgid "Failed to load configuration from %s\n" | 6814 | msgid "Failed to load configuration from %s\n" |
6810 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 6815 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
6811 | 6816 | ||
6812 | #: src/topology/friends.c:127 | 6817 | #: src/topology/friends.c:118 |
6813 | #, fuzzy, c-format | 6818 | #, fuzzy, c-format |
6814 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" | 6819 | msgid "Syntax error in FRIENDS file at offset %llu, skipping bytes `%.*s'.\n" |
6815 | msgstr "é…置文件“%sâ€ç¬¬ %d 行有è¯æ³•é”™è¯¯ã€‚\n" | 6820 | msgstr "é…置文件“%sâ€ç¬¬ %d 行有è¯æ³•é”™è¯¯ã€‚\n" |
6816 | 6821 | ||
6817 | #: src/topology/friends.c:181 | 6822 | #: src/topology/friends.c:172 |
6818 | #, c-format | 6823 | #, c-format |
6819 | msgid "Directory for file `%s' does not seem to be writable.\n" | 6824 | msgid "Directory for file `%s' does not seem to be writable.\n" |
6820 | msgstr "" | 6825 | msgstr "" |
@@ -6883,19 +6888,19 @@ msgstr "" | |||
6883 | msgid "GNUnet topology control" | 6888 | msgid "GNUnet topology control" |
6884 | msgstr "" | 6889 | msgstr "" |
6885 | 6890 | ||
6886 | #: src/transport/gnunet-communicator-tcp.c:3221 | 6891 | #: src/transport/gnunet-communicator-tcp.c:3331 |
6887 | #: src/transport/gnunet-communicator-udp.c:3076 | 6892 | #: src/transport/gnunet-communicator-udp.c:3790 |
6888 | #: src/transport/gnunet-service-tng.c:10014 | 6893 | #: src/transport/gnunet-service-tng.c:10220 |
6889 | #: src/transport/gnunet-service-transport.c:2627 | 6894 | #: src/transport/gnunet-service-transport.c:2627 |
6890 | #, fuzzy | 6895 | #, fuzzy |
6891 | msgid "Transport service is lacking key configuration settings. Exiting.\n" | 6896 | msgid "Transport service is lacking key configuration settings. Exiting.\n" |
6892 | msgstr "ç«‹å³ä¿å˜é…置?" | 6897 | msgstr "ç«‹å³ä¿å˜é…置?" |
6893 | 6898 | ||
6894 | #: src/transport/gnunet-communicator-tcp.c:3553 | 6899 | #: src/transport/gnunet-communicator-tcp.c:3668 |
6895 | msgid "GNUnet TCP communicator" | 6900 | msgid "GNUnet TCP communicator" |
6896 | msgstr "" | 6901 | msgstr "" |
6897 | 6902 | ||
6898 | #: src/transport/gnunet-communicator-udp.c:3148 | 6903 | #: src/transport/gnunet-communicator-udp.c:3862 |
6899 | msgid "GNUnet UDP communicator" | 6904 | msgid "GNUnet UDP communicator" |
6900 | msgstr "" | 6905 | msgstr "" |
6901 | 6906 | ||
@@ -7944,7 +7949,7 @@ msgstr "" | |||
7944 | msgid "Service process failed to report status\n" | 7949 | msgid "Service process failed to report status\n" |
7945 | msgstr "" | 7950 | msgstr "" |
7946 | 7951 | ||
7947 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1176 | 7952 | #: src/transport/tcp_service_legacy.c:1253 src/util/disk.c:1040 |
7948 | #: src/util/service.c:1637 | 7953 | #: src/util/service.c:1637 |
7949 | #, c-format | 7954 | #, c-format |
7950 | msgid "Cannot obtain information about user `%s': %s\n" | 7955 | msgid "Cannot obtain information about user `%s': %s\n" |
@@ -7964,7 +7969,7 @@ msgid "do daemonize (detach from terminal)" | |||
7964 | msgstr "" | 7969 | msgstr "" |
7965 | 7970 | ||
7966 | #: src/transport/tcp_service_legacy.c:1397 | 7971 | #: src/transport/tcp_service_legacy.c:1397 |
7967 | #: src/transport/transport-testing2.c:985 src/util/service.c:2072 | 7972 | #: src/transport/transport-testing-communicator.c:1045 src/util/service.c:2072 |
7968 | #: src/util/service.c:2084 | 7973 | #: src/util/service.c:2084 |
7969 | #, fuzzy, c-format | 7974 | #, fuzzy, c-format |
7970 | msgid "Malformed configuration file `%s', exit ...\n" | 7975 | msgid "Malformed configuration file `%s', exit ...\n" |
@@ -8129,39 +8134,39 @@ msgid "" | |||
8129 | "Configuration specifies invalid value for option `%s' in section `%s': %s\n" | 8134 | "Configuration specifies invalid value for option `%s' in section `%s': %s\n" |
8130 | msgstr "é…ç½®ä¸æ»¡è¶³é…置规范文件“%sâ€çš„约æŸï¼\n" | 8135 | msgstr "é…ç½®ä¸æ»¡è¶³é…置规范文件“%sâ€çš„约æŸï¼\n" |
8131 | 8136 | ||
8132 | #: src/util/configuration.c:402 | 8137 | #: src/util/configuration.c:370 |
8133 | #, fuzzy, c-format | 8138 | #, fuzzy, c-format |
8134 | msgid "Syntax error while deserializing in line %u\n" | 8139 | msgid "Syntax error while deserializing in line %u\n" |
8135 | msgstr "é…置文件“%sâ€ç¬¬ %d 行有è¯æ³•é”™è¯¯ã€‚\n" | 8140 | msgstr "é…置文件“%sâ€ç¬¬ %d 行有è¯æ³•é”™è¯¯ã€‚\n" |
8136 | 8141 | ||
8137 | #: src/util/configuration.c:460 | 8142 | #: src/util/configuration.c:420 |
8138 | #, fuzzy, c-format | 8143 | #, fuzzy, c-format |
8139 | msgid "Error while reading file `%s'\n" | 8144 | msgid "Error while reading file `%s'\n" |
8140 | msgstr "è§£æž dscl 输出时出错。\n" | 8145 | msgstr "è§£æž dscl 输出时出错。\n" |
8141 | 8146 | ||
8142 | #: src/util/configuration.c:1063 | 8147 | #: src/util/configuration.c:980 |
8143 | #, fuzzy | 8148 | #, fuzzy |
8144 | msgid "Not a valid relative time specification" | 8149 | msgid "Not a valid relative time specification" |
8145 | msgstr "é…置文件“%sâ€å·²å†™å…¥ã€‚\n" | 8150 | msgstr "é…置文件“%sâ€å·²å†™å…¥ã€‚\n" |
8146 | 8151 | ||
8147 | #: src/util/configuration.c:1154 | 8152 | #: src/util/configuration.c:1050 |
8148 | #, c-format | 8153 | #, c-format |
8149 | msgid "" | 8154 | msgid "" |
8150 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " | 8155 | "Configuration value '%s' for '%s' in section '%s' is not in set of legal " |
8151 | "choices\n" | 8156 | "choices\n" |
8152 | msgstr "" | 8157 | msgstr "" |
8153 | 8158 | ||
8154 | #: src/util/configuration.c:1269 | 8159 | #: src/util/configuration.c:1145 |
8155 | #, c-format | 8160 | #, c-format |
8156 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" | 8161 | msgid "Recursive expansion suspected, aborting $-expansion for term `%s'\n" |
8157 | msgstr "" | 8162 | msgstr "" |
8158 | 8163 | ||
8159 | #: src/util/configuration.c:1301 | 8164 | #: src/util/configuration.c:1177 |
8160 | #, fuzzy, c-format | 8165 | #, fuzzy, c-format |
8161 | msgid "Missing closing `%s' in option `%s'\n" | 8166 | msgid "Missing closing `%s' in option `%s'\n" |
8162 | msgstr "é…置文件“%sâ€å·²å†™å…¥ã€‚\n" | 8167 | msgstr "é…置文件“%sâ€å·²å†™å…¥ã€‚\n" |
8163 | 8168 | ||
8164 | #: src/util/configuration.c:1367 | 8169 | #: src/util/configuration.c:1243 |
8165 | #, c-format | 8170 | #, c-format |
8166 | msgid "" | 8171 | msgid "" |
8167 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " | 8172 | "Failed to expand `%s' in `%s' as it is neither found in [PATHS] nor defined " |
@@ -8175,37 +8180,37 @@ msgid "" | |||
8175 | "%llu)\n" | 8180 | "%llu)\n" |
8176 | msgstr "" | 8181 | msgstr "" |
8177 | 8182 | ||
8178 | #: src/util/crypto_ecc.c:663 | 8183 | #: src/util/crypto_ecc.c:567 |
8179 | #, fuzzy, c-format | 8184 | #, fuzzy, c-format |
8180 | msgid "ECC signing failed at %s:%d: %s\n" | 8185 | msgid "ECC signing failed at %s:%d: %s\n" |
8181 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | 8186 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" |
8182 | 8187 | ||
8183 | #: src/util/crypto_ecc.c:791 | 8188 | #: src/util/crypto_ecc.c:669 |
8184 | #, fuzzy, c-format | 8189 | #, fuzzy, c-format |
8185 | msgid "ECDSA signature verification failed at %s:%d: %s\n" | 8190 | msgid "ECDSA signature verification failed at %s:%d: %s\n" |
8186 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | 8191 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" |
8187 | 8192 | ||
8188 | #: src/util/crypto_ecc_setup.c:369 | 8193 | #: src/util/crypto_ecc_setup.c:273 |
8189 | #, fuzzy | 8194 | #, fuzzy |
8190 | msgid "Could not load peer's private key\n" | 8195 | msgid "Could not load peer's private key\n" |
8191 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" | 8196 | msgstr "找ä¸åˆ°æŽ¥å£â€œ%sâ€çš„一个 IP 地å€ã€‚\n" |
8192 | 8197 | ||
8193 | #: src/util/crypto_random.c:345 | 8198 | #: src/util/crypto_random.c:381 |
8194 | #, c-format | 8199 | #, c-format |
8195 | msgid "libgcrypt has not the expected version (version %s is required).\n" | 8200 | msgid "libgcrypt has not the expected version (version %s is required).\n" |
8196 | msgstr "libgcrypt 的版本ä¸ç¬¦åˆé¢„期(è¦æ±‚版本 %s)。\n" | 8201 | msgstr "libgcrypt 的版本ä¸ç¬¦åˆé¢„期(è¦æ±‚版本 %s)。\n" |
8197 | 8202 | ||
8198 | #: src/util/crypto_rsa.c:959 | 8203 | #: src/util/crypto_rsa.c:862 |
8199 | #, fuzzy, c-format | 8204 | #, fuzzy, c-format |
8200 | msgid "RSA signing failed at %s:%d: %s\n" | 8205 | msgid "RSA signing failed at %s:%d: %s\n" |
8201 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | 8206 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" |
8202 | 8207 | ||
8203 | #: src/util/crypto_rsa.c:1318 | 8208 | #: src/util/crypto_rsa.c:1162 |
8204 | #, fuzzy, c-format | 8209 | #, fuzzy, c-format |
8205 | msgid "RSA signature verification failed at %s:%d: %s\n" | 8210 | msgid "RSA signature verification failed at %s:%d: %s\n" |
8206 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" | 8211 | msgstr "对驱动器“%2$sâ€çš„“%1$sâ€æ“作失败:%3$u\n" |
8207 | 8212 | ||
8208 | #: src/util/disk.c:940 | 8213 | #: src/util/disk.c:823 |
8209 | #, c-format | 8214 | #, c-format |
8210 | msgid "Expected `%s' to be a directory!\n" | 8215 | msgid "Expected `%s' to be a directory!\n" |
8211 | msgstr "“%sâ€åº”为目录ï¼\n" | 8216 | msgstr "“%sâ€åº”为目录ï¼\n" |
@@ -8290,17 +8295,17 @@ msgstr "%s:选项“-W %sâ€æœ‰æ§ä¹‰\n" | |||
8290 | msgid "%s: option `-W %s' does not allow an argument\n" | 8295 | msgid "%s: option `-W %s' does not allow an argument\n" |
8291 | msgstr "%s:选项“-W %s†ä¸å…许有å‚æ•°\n" | 8296 | msgstr "%s:选项“-W %s†ä¸å…许有å‚æ•°\n" |
8292 | 8297 | ||
8293 | #: src/util/getopt.c:974 | 8298 | #: src/util/getopt.c:970 |
8294 | #, fuzzy, c-format | 8299 | #, fuzzy, c-format |
8295 | msgid "Use %s to get a list of options.\n" | 8300 | msgid "Use %s to get a list of options.\n" |
8296 | msgstr "请使用 --help 获å–选项列表。\n" | 8301 | msgstr "请使用 --help 获å–选项列表。\n" |
8297 | 8302 | ||
8298 | #: src/util/getopt.c:986 | 8303 | #: src/util/getopt.c:983 |
8299 | #, c-format | 8304 | #, c-format |
8300 | msgid "Option `%s' can't be used with other options.\n" | 8305 | msgid "Option `%s' can't be used with other options.\n" |
8301 | msgstr "" | 8306 | msgstr "" |
8302 | 8307 | ||
8303 | #: src/util/getopt.c:998 | 8308 | #: src/util/getopt.c:995 |
8304 | #, fuzzy, c-format | 8309 | #, fuzzy, c-format |
8305 | msgid "Missing mandatory option `%s'.\n" | 8310 | msgid "Missing mandatory option `%s'.\n" |
8306 | msgstr "é…置文件“%sâ€å·²å†™å…¥ã€‚\n" | 8311 | msgstr "é…置文件“%sâ€å·²å†™å…¥ã€‚\n" |
@@ -8386,6 +8391,10 @@ msgstr "您必须å‘“%sâ€é€‰é¡¹ä¼ 递一个数å—。\n" | |||
8386 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" | 8391 | msgid "Argument `%s' malformed. Expected base32 (Crockford) encoded value.\n" |
8387 | msgstr "" | 8392 | msgstr "" |
8388 | 8393 | ||
8394 | #: src/util/gnunet-base32.c:45 | ||
8395 | msgid "run decoder modus, otherwise runs as encoder" | ||
8396 | msgstr "" | ||
8397 | |||
8389 | #: src/util/gnunet-config.c:167 | 8398 | #: src/util/gnunet-config.c:167 |
8390 | #, fuzzy, c-format | 8399 | #, fuzzy, c-format |
8391 | msgid "failed to load configuration defaults" | 8400 | msgid "failed to load configuration defaults" |
@@ -8440,6 +8449,10 @@ msgstr "" | |||
8440 | msgid "Manipulate GNUnet configuration files" | 8449 | msgid "Manipulate GNUnet configuration files" |
8441 | msgstr "更改é…置文件ä¸çš„一个值" | 8450 | msgstr "更改é…置文件ä¸çš„一个值" |
8442 | 8451 | ||
8452 | #: src/util/gnunet-crypto-tvg.c:1072 | ||
8453 | msgid "verify a test vector from stdin" | ||
8454 | msgstr "" | ||
8455 | |||
8443 | #: src/util/gnunet-ecc.c:94 | 8456 | #: src/util/gnunet-ecc.c:94 |
8444 | #, fuzzy, c-format | 8457 | #, fuzzy, c-format |
8445 | msgid "Failed to open `%s': %s\n" | 8458 | msgid "Failed to open `%s': %s\n" |
@@ -8560,31 +8573,31 @@ msgid "perform a reverse lookup" | |||
8560 | msgstr "" | 8573 | msgstr "" |
8561 | 8574 | ||
8562 | #: src/util/gnunet-resolver.c:182 | 8575 | #: src/util/gnunet-resolver.c:182 |
8563 | msgid "Use build-in GNUnet stub resolver" | 8576 | msgid "Use built-in GNUnet stub resolver" |
8564 | msgstr "" | 8577 | msgstr "" |
8565 | 8578 | ||
8566 | #: src/util/gnunet-scrypt.c:229 | 8579 | #: src/util/gnunet-scrypt.c:232 |
8567 | #, c-format | 8580 | #, c-format |
8568 | msgid "Loading hostkey from `%s' failed.\n" | 8581 | msgid "Loading hostkey from `%s' failed.\n" |
8569 | msgstr "" | 8582 | msgstr "" |
8570 | 8583 | ||
8571 | #: src/util/gnunet-scrypt.c:295 | 8584 | #: src/util/gnunet-scrypt.c:298 |
8572 | msgid "number of bits to require for the proof of work" | 8585 | msgid "number of bits to require for the proof of work" |
8573 | msgstr "" | 8586 | msgstr "" |
8574 | 8587 | ||
8575 | #: src/util/gnunet-scrypt.c:301 | 8588 | #: src/util/gnunet-scrypt.c:304 |
8576 | msgid "file with private key, otherwise default is used" | 8589 | msgid "file with private key, otherwise default is used" |
8577 | msgstr "" | 8590 | msgstr "" |
8578 | 8591 | ||
8579 | #: src/util/gnunet-scrypt.c:307 | 8592 | #: src/util/gnunet-scrypt.c:310 |
8580 | msgid "file with proof of work, otherwise default is used" | 8593 | msgid "file with proof of work, otherwise default is used" |
8581 | msgstr "" | 8594 | msgstr "" |
8582 | 8595 | ||
8583 | #: src/util/gnunet-scrypt.c:313 | 8596 | #: src/util/gnunet-scrypt.c:316 |
8584 | msgid "time to wait between calculations" | 8597 | msgid "time to wait between calculations" |
8585 | msgstr "" | 8598 | msgstr "" |
8586 | 8599 | ||
8587 | #: src/util/gnunet-scrypt.c:326 | 8600 | #: src/util/gnunet-scrypt.c:330 |
8588 | #, fuzzy | 8601 | #, fuzzy |
8589 | msgid "Manipulate GNUnet proof of work files" | 8602 | msgid "Manipulate GNUnet proof of work files" |
8590 | msgstr "更改é…置文件ä¸çš„一个值" | 8603 | msgstr "更改é…置文件ä¸çš„一个值" |
@@ -8622,25 +8635,25 @@ msgstr "创建用户出错" | |||
8622 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" | 8635 | msgid "Unable to shorten unix path `%s' while keeping name unique\n" |
8623 | msgstr "" | 8636 | msgstr "" |
8624 | 8637 | ||
8625 | #: src/util/network.c:1364 | 8638 | #: src/util/network.c:1361 |
8626 | #, c-format | 8639 | #, c-format |
8627 | msgid "" | 8640 | msgid "" |
8628 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" | 8641 | "Fatal internal logic error, process hangs in `%s' (abort with CTRL-C)!\n" |
8629 | msgstr "" | 8642 | msgstr "" |
8630 | 8643 | ||
8631 | #: src/util/os_installation.c:411 | 8644 | #: src/util/os_installation.c:415 |
8632 | #, fuzzy, c-format | 8645 | #, fuzzy, c-format |
8633 | msgid "" | 8646 | msgid "" |
8634 | "Could not determine installation path for %s. Set `%s' environment " | 8647 | "Could not determine installation path for %s. Set `%s' environment " |
8635 | "variable.\n" | 8648 | "variable.\n" |
8636 | msgstr "æ— æ³•ç¡®å®šå®‰è£…è·¯å¾„ã€‚è¯·å°è¯•è®¾ç½®â€œ%sâ€\n" | 8649 | msgstr "æ— æ³•ç¡®å®šå®‰è£…è·¯å¾„ã€‚è¯·å°è¯•è®¾ç½®â€œ%sâ€\n" |
8637 | 8650 | ||
8638 | #: src/util/os_installation.c:794 | 8651 | #: src/util/os_installation.c:802 |
8639 | #, fuzzy, c-format | 8652 | #, fuzzy, c-format |
8640 | msgid "Could not find binary `%s' in PATH!\n" | 8653 | msgid "Could not find binary `%s' in PATH!\n" |
8641 | msgstr "找ä¸åˆ°ä¸»æœºâ€œ%sâ€çš„ IP:%s\n" | 8654 | msgstr "找ä¸åˆ°ä¸»æœºâ€œ%sâ€çš„ IP:%s\n" |
8642 | 8655 | ||
8643 | #: src/util/os_installation.c:827 | 8656 | #: src/util/os_installation.c:835 |
8644 | #, c-format | 8657 | #, c-format |
8645 | msgid "Binary `%s' exists, but is not SUID\n" | 8658 | msgid "Binary `%s' exists, but is not SUID\n" |
8646 | msgstr "" | 8659 | msgstr "" |
@@ -8650,32 +8663,32 @@ msgstr "" | |||
8650 | msgid "Initialization of plugin mechanism failed: %s!\n" | 8663 | msgid "Initialization of plugin mechanism failed: %s!\n" |
8651 | msgstr "æ’件机构åˆå§‹åŒ–失败:%sï¼\n" | 8664 | msgstr "æ’件机构åˆå§‹åŒ–失败:%sï¼\n" |
8652 | 8665 | ||
8653 | #: src/util/plugin.c:147 | 8666 | #: src/util/plugin.c:156 |
8654 | #, c-format | 8667 | #, c-format |
8655 | msgid "`%s' failed to resolve method '%s' with error: %s\n" | 8668 | msgid "`%s' failed to resolve method '%s' with error: %s\n" |
8656 | msgstr "" | 8669 | msgstr "" |
8657 | 8670 | ||
8658 | #: src/util/plugin.c:223 | 8671 | #: src/util/plugin.c:234 |
8659 | #, c-format | 8672 | #, c-format |
8660 | msgid "`%s' failed for library `%s' with error: %s\n" | 8673 | msgid "`%s' failed for library `%s' with error: %s\n" |
8661 | msgstr "" | 8674 | msgstr "" |
8662 | 8675 | ||
8663 | #: src/util/plugin.c:384 | 8676 | #: src/util/plugin.c:409 |
8664 | #, fuzzy | 8677 | #, fuzzy |
8665 | msgid "Could not determine plugin installation path.\n" | 8678 | msgid "Could not determine plugin installation path.\n" |
8666 | msgstr "æ— æ³•ç¡®å®šç”¨æˆ·ç•Œé¢å®šä¹‰æ–‡ä»¶ã€‚" | 8679 | msgstr "æ— æ³•ç¡®å®šç”¨æˆ·ç•Œé¢å®šä¹‰æ–‡ä»¶ã€‚" |
8667 | 8680 | ||
8668 | #: src/util/program.c:267 | 8681 | #: src/util/program.c:259 |
8669 | #, fuzzy, c-format | 8682 | #, fuzzy, c-format |
8670 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" | 8683 | msgid "Unreadable or malformed configuration file `%s', exit ...\n" |
8671 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 8684 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
8672 | 8685 | ||
8673 | #: src/util/program.c:284 | 8686 | #: src/util/program.c:276 |
8674 | #, fuzzy, c-format | 8687 | #, fuzzy, c-format |
8675 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" | 8688 | msgid "Unreadable or malformed default configuration file `%s', exit ...\n" |
8676 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 8689 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
8677 | 8690 | ||
8678 | #: src/util/program.c:299 | 8691 | #: src/util/program.c:291 |
8679 | #, fuzzy | 8692 | #, fuzzy |
8680 | msgid "Unreadable or malformed configuration, exit ...\n" | 8693 | msgid "Unreadable or malformed configuration, exit ...\n" |
8681 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" | 8694 | msgstr "解æžé…置文件“%sâ€å¤±è´¥\n" |
@@ -8810,12 +8823,12 @@ msgstr "网络掩ç çš„æ ¼å¼â€œ%sâ€é”™è¯¯\n" | |||
8810 | msgid "Wrong format `%s' for network\n" | 8823 | msgid "Wrong format `%s' for network\n" |
8811 | msgstr "ç½‘ç»œçš„æ ¼å¼â€œ%sâ€é”™è¯¯\n" | 8824 | msgstr "ç½‘ç»œçš„æ ¼å¼â€œ%sâ€é”™è¯¯\n" |
8812 | 8825 | ||
8813 | #: src/util/time.c:848 src/util/time.c:876 | 8826 | #: src/util/time.c:878 src/util/time.c:906 |
8814 | #, c-format | 8827 | #, c-format |
8815 | msgid "Failed to map `%s', cannot assure monotonic time!\n" | 8828 | msgid "Failed to map `%s', cannot assure monotonic time!\n" |
8816 | msgstr "" | 8829 | msgstr "" |
8817 | 8830 | ||
8818 | #: src/util/time.c:884 | 8831 | #: src/util/time.c:914 |
8819 | #, c-format | 8832 | #, c-format |
8820 | msgid "" | 8833 | msgid "" |
8821 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" | 8834 | "Failed to setup monotonic time file `%s', cannot assure monotonic time!\n" |
diff --git a/src/Makefile.am b/src/Makefile.am index d8a869acb..564923e28 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -45,6 +45,10 @@ if HAVE_POSTGRESQL | |||
45 | POSTGRES_DIR = pq | 45 | POSTGRES_DIR = pq |
46 | endif | 46 | endif |
47 | 47 | ||
48 | if HAVE_NOLIBGCRYPT19 | ||
49 | SCALARPRODUCT_DIR = scalarproduct | ||
50 | endif | ||
51 | |||
48 | REST_DIR = rest | 52 | REST_DIR = rest |
49 | 53 | ||
50 | 54 | ||
@@ -93,7 +97,7 @@ SUBDIRS = \ | |||
93 | seti \ | 97 | seti \ |
94 | setu \ | 98 | setu \ |
95 | consensus \ | 99 | consensus \ |
96 | scalarproduct \ | 100 | $(SCALARPRODUCT_DIR) \ |
97 | revocation \ | 101 | revocation \ |
98 | vpn \ | 102 | vpn \ |
99 | gns \ | 103 | gns \ |
diff --git a/src/arm/arm_api.c b/src/arm/arm_api.c index 899b6f152..2ec913a0a 100644 --- a/src/arm/arm_api.c +++ b/src/arm/arm_api.c | |||
@@ -951,7 +951,8 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, | |||
951 | * 2) We're not connected to ARM. | 951 | * 2) We're not connected to ARM. |
952 | * Cancel any reconnection attempts temporarily, then perform | 952 | * Cancel any reconnection attempts temporarily, then perform |
953 | * a service test. | 953 | * a service test. |
954 | */if (GNUNET_YES == h->currently_up) | 954 | */ |
955 | if (GNUNET_YES == h->currently_up) | ||
955 | { | 956 | { |
956 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 957 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
957 | "ARM is already running\n"); | 958 | "ARM is already running\n"); |
@@ -970,7 +971,8 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, | |||
970 | yet complete the MQ handshake. However, given that users | 971 | yet complete the MQ handshake. However, given that users |
971 | are unlikely to hammer 'gnunet-arm -s' on a busy system, | 972 | are unlikely to hammer 'gnunet-arm -s' on a busy system, |
972 | the above check should catch 99.99% of the cases where ARM | 973 | the above check should catch 99.99% of the cases where ARM |
973 | is already running. */LOG (GNUNET_ERROR_TYPE_DEBUG, | 974 | is already running. */ |
975 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
974 | "Starting ARM service\n"); | 976 | "Starting ARM service\n"); |
975 | if (NULL == (sig = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) | 977 | if (NULL == (sig = GNUNET_DISK_pipe (GNUNET_DISK_PF_NONE))) |
976 | { | 978 | { |
@@ -1003,13 +1005,13 @@ GNUNET_ARM_request_service_start (struct GNUNET_ARM_Handle *h, | |||
1003 | op->rfd, | 1005 | op->rfd, |
1004 | ¬ify_starting, | 1006 | ¬ify_starting, |
1005 | op); | 1007 | op); |
1008 | GNUNET_DISK_pipe_close (sig); | ||
1006 | } | 1009 | } |
1007 | else | 1010 | else |
1008 | { | 1011 | { |
1009 | op->async = GNUNET_SCHEDULER_add_now (¬ify_starting, | 1012 | op->async = GNUNET_SCHEDULER_add_now (¬ify_starting, |
1010 | op); | 1013 | op); |
1011 | } | 1014 | } |
1012 | GNUNET_DISK_pipe_close (sig); | ||
1013 | return op; | 1015 | return op; |
1014 | } | 1016 | } |
1015 | 1017 | ||
diff --git a/src/ats-tests/Makefile.am b/src/ats-tests/Makefile.am index cc30f660a..00a312a72 100644 --- a/src/ats-tests/Makefile.am +++ b/src/ats-tests/Makefile.am | |||
@@ -41,6 +41,7 @@ libgnunetatstesting_la_SOURCES = \ | |||
41 | ats-testing-experiment.c ats-testing-preferences.c | 41 | ats-testing-experiment.c ats-testing-preferences.c |
42 | libgnunetatstesting_la_LIBADD = \ | 42 | libgnunetatstesting_la_LIBADD = \ |
43 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | 43 | $(top_builddir)/src/testbed/libgnunettestbed.la \ |
44 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
44 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 45 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
45 | $(top_builddir)/src/core/libgnunetcore.la \ | 46 | $(top_builddir)/src/core/libgnunetcore.la \ |
46 | $(top_builddir)/src/transport/libgnunettransport.la \ | 47 | $(top_builddir)/src/transport/libgnunettransport.la \ |
diff --git a/src/block/block.c b/src/block/block.c index 5abe64e69..975c0f747 100644 --- a/src/block/block.c +++ b/src/block/block.c | |||
@@ -134,10 +134,11 @@ GNUNET_BLOCK_context_create (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
134 | 134 | ||
135 | ctx = GNUNET_new (struct GNUNET_BLOCK_Context); | 135 | ctx = GNUNET_new (struct GNUNET_BLOCK_Context); |
136 | ctx->cfg = cfg; | 136 | ctx->cfg = cfg; |
137 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_block_", | 137 | GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (), |
138 | (void *) cfg, | 138 | "libgnunet_plugin_block_", |
139 | &add_plugin, | 139 | (void *) cfg, |
140 | ctx); | 140 | &add_plugin, |
141 | ctx); | ||
141 | return ctx; | 142 | return ctx; |
142 | } | 143 | } |
143 | 144 | ||
diff --git a/src/cadet/gnunet-service-cadet.c b/src/cadet/gnunet-service-cadet.c index 2d3b548dd..c8d69e43d 100644 --- a/src/cadet/gnunet-service-cadet.c +++ b/src/cadet/gnunet-service-cadet.c | |||
@@ -1027,7 +1027,8 @@ handle_drop_message (void *cls, | |||
1027 | ch = lookup_channel (c, | 1027 | ch = lookup_channel (c, |
1028 | message->ccn); | 1028 | message->ccn); |
1029 | 1029 | ||
1030 | GCCH_assign_type_to_drop (ch, message); | 1030 | if (NULL != ch) |
1031 | GCCH_assign_type_to_drop (ch, message); | ||
1031 | 1032 | ||
1032 | GNUNET_SERVICE_client_continue (c->client); | 1033 | GNUNET_SERVICE_client_continue (c->client); |
1033 | } | 1034 | } |
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c index 6b22ae2b4..ae5d9210f 100644 --- a/src/cadet/gnunet-service-cadet_channel.c +++ b/src/cadet/gnunet-service-cadet_channel.c | |||
@@ -1858,6 +1858,7 @@ GCCH_handle_local_data (struct CadetChannel *ch, | |||
1858 | } | 1858 | } |
1859 | else | 1859 | else |
1860 | { | 1860 | { |
1861 | GNUNET_free (env); | ||
1861 | GNUNET_break (0); | 1862 | GNUNET_break (0); |
1862 | return GNUNET_SYSERR; | 1863 | return GNUNET_SYSERR; |
1863 | } | 1864 | } |
diff --git a/src/datacache/datacache.c b/src/datacache/datacache.c index 1ae228b86..5fc5a7481 100644 --- a/src/datacache/datacache.c +++ b/src/datacache/datacache.c | |||
@@ -138,6 +138,7 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
138 | struct GNUNET_DATACACHE_Handle *ret; | 138 | struct GNUNET_DATACACHE_Handle *ret; |
139 | char *libname; | 139 | char *libname; |
140 | char *name; | 140 | char *name; |
141 | const struct GNUNET_OS_ProjectData *pd; | ||
141 | 142 | ||
142 | if (GNUNET_OK != | 143 | if (GNUNET_OK != |
143 | GNUNET_CONFIGURATION_get_value_size (cfg, section, "QUOTA", "a)) | 144 | GNUNET_CONFIGURATION_get_value_size (cfg, section, "QUOTA", "a)) |
@@ -190,14 +191,25 @@ GNUNET_DATACACHE_create (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
190 | GNUNET_asprintf (&libname, "libgnunet_plugin_datacache_%s", name); | 191 | GNUNET_asprintf (&libname, "libgnunet_plugin_datacache_%s", name); |
191 | ret->short_name = name; | 192 | ret->short_name = name; |
192 | ret->lib_name = libname; | 193 | ret->lib_name = libname; |
194 | /* Load the plugin within GNUnet's default context */ | ||
195 | pd = GNUNET_OS_project_data_get (); | ||
196 | GNUNET_OS_init(GNUNET_OS_project_data_default ()); | ||
193 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); | 197 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); |
194 | if (ret->api == NULL) | 198 | GNUNET_OS_init(pd); |
199 | if (NULL == ret->api) | ||
195 | { | 200 | { |
196 | LOG (GNUNET_ERROR_TYPE_ERROR, | 201 | /* Try to load the plugin within the application's context |
197 | _ ("Failed to load datacache plugin for `%s'\n"), | 202 | This normally happens when the application is not GNUnet itself but a |
198 | name); | 203 | third party; inside GNUnet this is effectively a double failure. */ |
199 | GNUNET_DATACACHE_destroy (ret); | 204 | ret->api = GNUNET_PLUGIN_load (libname, &ret->env); |
200 | return NULL; | 205 | if (NULL == ret->api) |
206 | { | ||
207 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
208 | _ ("Failed to load datacache plugin for `%s'\n"), | ||
209 | name); | ||
210 | GNUNET_DATACACHE_destroy (ret); | ||
211 | return NULL; | ||
212 | } | ||
201 | } | 213 | } |
202 | return ret; | 214 | return ret; |
203 | } | 215 | } |
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 9f03311e1..3aaa734f2 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am | |||
@@ -80,9 +80,7 @@ bin_PROGRAMS = \ | |||
80 | noinst_PROGRAMS = \ | 80 | noinst_PROGRAMS = \ |
81 | gnunet-gns-benchmark | 81 | gnunet-gns-benchmark |
82 | 82 | ||
83 | if LINUX | ||
84 | bin_PROGRAMS += gnunet-bcd | 83 | bin_PROGRAMS += gnunet-bcd |
85 | endif | ||
86 | 84 | ||
87 | REST_PLUGIN = libgnunet_plugin_rest_gns.la | 85 | REST_PLUGIN = libgnunet_plugin_rest_gns.la |
88 | 86 | ||
@@ -156,6 +154,7 @@ gnunet_bcd_SOURCES = \ | |||
156 | gnunet-bcd.c | 154 | gnunet-bcd.c |
157 | gnunet_bcd_LDADD = \ | 155 | gnunet_bcd_LDADD = \ |
158 | $(top_builddir)/src/util/libgnunetutil.la \ | 156 | $(top_builddir)/src/util/libgnunetutil.la \ |
157 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
159 | $(GN_LIBINTL) $(MHD_LIBS) | 158 | $(GN_LIBINTL) $(MHD_LIBS) |
160 | gnunet_bcd_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) | 159 | gnunet_bcd_CFLAGS = $(MHD_CFLAGS) $(AM_CFLAGS) |
161 | 160 | ||
diff --git a/src/gns/gns.conf.in b/src/gns/gns.conf.in index 829a52d63..a458f69a2 100644 --- a/src/gns/gns.conf.in +++ b/src/gns/gns.conf.in | |||
@@ -25,8 +25,7 @@ INTERCEPT_DNS = NO | |||
25 | # PREFIX = valgrind --leak-check=full --track-origins=yes | 25 | # PREFIX = valgrind --leak-check=full --track-origins=yes |
26 | 26 | ||
27 | # Zones | 27 | # Zones |
28 | .pin = DWJASSPE33MRN8T6Q0PENRNBTQY0E6ZYGTRCDP5DGPBF2CRJMJEG | 28 | .pin = 000G001MF6DVMZZ4Y8XRZQDXM1PB3D3VGEK29ZHXBA57EPSNW1QBPKT8J0 |
29 | #.fr = TFDAXBXMAN40MCG4E8Y9Y1C6D16JCMDPH2VMD30KMB92SECEMYGG | ||
30 | 29 | ||
31 | [gns-proxy] | 30 | [gns-proxy] |
32 | BINARY = gnunet-gns-proxy | 31 | BINARY = gnunet-gns-proxy |
diff --git a/src/gns/gnunet-bcd.c b/src/gns/gnunet-bcd.c index f71f477ef..a2e94089c 100644 --- a/src/gns/gnunet-bcd.c +++ b/src/gns/gnunet-bcd.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | #include <microhttpd.h> | 28 | #include <microhttpd.h> |
29 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
30 | #include "gnunet_identity_service.h" | ||
30 | #include "gnunet_mhd_compat.h" | 31 | #include "gnunet_mhd_compat.h" |
31 | 32 | ||
32 | /** | 33 | /** |
@@ -148,7 +149,7 @@ access_handler_callback (void *cls, | |||
148 | char *p; | 149 | char *p; |
149 | char *tmp; | 150 | char *tmp; |
150 | char *deffile; | 151 | char *deffile; |
151 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 152 | struct GNUNET_IDENTITY_PublicKey pub; |
152 | size_t slen; | 153 | size_t slen; |
153 | FILE *f; | 154 | FILE *f; |
154 | struct stat st; | 155 | struct stat st; |
@@ -166,9 +167,8 @@ access_handler_callback (void *cls, | |||
166 | MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "gnskey"); | 167 | MHD_lookup_connection_value (connection, MHD_GET_ARGUMENT_KIND, "gnskey"); |
167 | if ((NULL == gnskey) || | 168 | if ((NULL == gnskey) || |
168 | (GNUNET_OK != | 169 | (GNUNET_OK != |
169 | GNUNET_CRYPTO_ecdsa_public_key_from_string (gnskey, | 170 | GNUNET_IDENTITY_public_key_from_string (gnskey, |
170 | strlen (gnskey), | 171 | &pub))) |
171 | &pub))) | ||
172 | { | 172 | { |
173 | return MHD_queue_response (connection, | 173 | return MHD_queue_response (connection, |
174 | MHD_HTTP_OK, | 174 | MHD_HTTP_OK, |
@@ -218,10 +218,10 @@ access_handler_callback (void *cls, | |||
218 | (NULL == gns_nick) ? "" : gns_nick); | 218 | (NULL == gns_nick) ? "" : gns_nick); |
219 | fclose (f); | 219 | fclose (f); |
220 | GNUNET_asprintf ( | 220 | GNUNET_asprintf ( |
221 | &p, | 221 | &p, |
222 | "cd %s; cp %s gns-bcd.tex | pdflatex --enable-write18 gns-bcd.tex > /dev/null 2> /dev/null", | 222 | "cd %s; cp %s gns-bcd.tex | pdflatex --enable-write18 gns-bcd.tex > /dev/null 2> /dev/null", |
223 | tmp, | 223 | tmp, |
224 | resfile); | 224 | resfile); |
225 | GNUNET_free (deffile); | 225 | GNUNET_free (deffile); |
226 | ret = system (p); | 226 | ret = system (p); |
227 | if (WIFSIGNALED (ret) || (0 != WEXITSTATUS (ret))) | 227 | if (WIFSIGNALED (ret) || (0 != WEXITSTATUS (ret))) |
@@ -506,7 +506,7 @@ main (int argc, char *const *argv) | |||
506 | "port", | 506 | "port", |
507 | "PORT", | 507 | "PORT", |
508 | gettext_noop ( | 508 | gettext_noop ( |
509 | "Run HTTP serve on port PORT (default is 8888)"), | 509 | "Run HTTP serve on port PORT (default is 8888)"), |
510 | &port), | 510 | &port), |
511 | GNUNET_GETOPT_OPTION_END | 511 | GNUNET_GETOPT_OPTION_END |
512 | }; | 512 | }; |
@@ -523,8 +523,8 @@ main (int argc, char *const *argv) | |||
523 | options, | 523 | options, |
524 | &run, | 524 | &run, |
525 | NULL)) | 525 | NULL)) |
526 | ? 0 | 526 | ? 0 |
527 | : 1; | 527 | : 1; |
528 | GNUNET_free_nz ((void *) argv); | 528 | GNUNET_free_nz ((void *) argv); |
529 | return ret; | 529 | return ret; |
530 | } | 530 | } |
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index 0a9b7c861..06f4c9841 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c | |||
@@ -309,6 +309,14 @@ dns_result_processor (void *cls, | |||
309 | } | 309 | } |
310 | request->packet = GNUNET_DNSPARSER_parse ((char *) dns, | 310 | request->packet = GNUNET_DNSPARSER_parse ((char *) dns, |
311 | r); | 311 | r); |
312 | if (NULL == request->packet) | ||
313 | { | ||
314 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
315 | _ ("Failed to parse DNS response!\n")); | ||
316 | GNUNET_SCHEDULER_cancel (request->timeout_task); | ||
317 | do_timeout (request); | ||
318 | return; | ||
319 | } | ||
312 | GNUNET_DNSSTUB_resolve_cancel (request->dns_lookup); | 320 | GNUNET_DNSSTUB_resolve_cancel (request->dns_lookup); |
313 | send_response (request); | 321 | send_response (request); |
314 | } | 322 | } |
diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index 833a8da01..d02f0f576 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c | |||
@@ -1841,6 +1841,7 @@ create_response (void *cls, | |||
1841 | char *curlurl; | 1841 | char *curlurl; |
1842 | char ipstring[INET6_ADDRSTRLEN]; | 1842 | char ipstring[INET6_ADDRSTRLEN]; |
1843 | char ipaddr[INET6_ADDRSTRLEN + 2]; | 1843 | char ipaddr[INET6_ADDRSTRLEN + 2]; |
1844 | char *curl_hosts; | ||
1844 | const struct sockaddr *sa; | 1845 | const struct sockaddr *sa; |
1845 | const struct sockaddr_in *s4; | 1846 | const struct sockaddr_in *s4; |
1846 | const struct sockaddr_in6 *s6; | 1847 | const struct sockaddr_in6 *s6; |
@@ -1900,6 +1901,14 @@ create_response (void *cls, | |||
1900 | GNUNET_break (0); | 1901 | GNUNET_break (0); |
1901 | return MHD_NO; | 1902 | return MHD_NO; |
1902 | } | 1903 | } |
1904 | GNUNET_asprintf (&curl_hosts, | ||
1905 | "%s:%d:%s", | ||
1906 | s5r->leho, | ||
1907 | port, | ||
1908 | ipaddr); | ||
1909 | s5r->hosts = curl_slist_append (NULL, | ||
1910 | curl_hosts); | ||
1911 | GNUNET_free (curl_hosts); | ||
1903 | } | 1912 | } |
1904 | else | 1913 | else |
1905 | { | 1914 | { |
@@ -1949,21 +1958,13 @@ create_response (void *cls, | |||
1949 | * Pre-populate cache to resolve Hostname. | 1958 | * Pre-populate cache to resolve Hostname. |
1950 | * This is necessary as the DNS name in the CURLOPT_URL is used | 1959 | * This is necessary as the DNS name in the CURLOPT_URL is used |
1951 | * for SNI http://de.wikipedia.org/wiki/Server_Name_Indication | 1960 | * for SNI http://de.wikipedia.org/wiki/Server_Name_Indication |
1952 | */if (NULL != s5r->leho) | 1961 | */ |
1962 | if ((NULL != s5r->leho) && | ||
1963 | (NULL != s5r->hosts)) | ||
1953 | { | 1964 | { |
1954 | char *curl_hosts; | ||
1955 | |||
1956 | GNUNET_asprintf (&curl_hosts, | ||
1957 | "%s:%d:%s", | ||
1958 | s5r->leho, | ||
1959 | port, | ||
1960 | ipaddr); | ||
1961 | s5r->hosts = curl_slist_append (NULL, | ||
1962 | curl_hosts); | ||
1963 | curl_easy_setopt (s5r->curl, | 1965 | curl_easy_setopt (s5r->curl, |
1964 | CURLOPT_RESOLVE, | 1966 | CURLOPT_RESOLVE, |
1965 | s5r->hosts); | 1967 | s5r->hosts); |
1966 | GNUNET_free (curl_hosts); | ||
1967 | } | 1968 | } |
1968 | if (s5r->is_gns) | 1969 | if (s5r->is_gns) |
1969 | { | 1970 | { |
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index b53f4af6b..255f85598 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -323,7 +323,6 @@ handle_dns_request (void *cls, | |||
323 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 323 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
324 | "Received malformed DNS packet, leaving it untouched.\n"); | 324 | "Received malformed DNS packet, leaving it untouched.\n"); |
325 | GNUNET_DNS_request_forward (rh); | 325 | GNUNET_DNS_request_forward (rh); |
326 | GNUNET_DNSPARSER_free_packet (p); | ||
327 | return; | 326 | return; |
328 | } | 327 | } |
329 | 328 | ||
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 49c1b340a..2f8a55804 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -764,6 +764,7 @@ transmit_lookup_dns_result (struct GNS_ResolverHandle *rh) | |||
764 | rd[i].data = pos->data; | 764 | rd[i].data = pos->data; |
765 | rd[i].data_size = pos->data_size; | 765 | rd[i].data_size = pos->data_size; |
766 | rd[i].record_type = pos->record_type; | 766 | rd[i].record_type = pos->record_type; |
767 | rd[i].flags = GNUNET_GNSRECORD_RF_NONE; | ||
767 | /** | 768 | /** |
768 | * If this is a LEHO, we added this before. It must be a supplemental | 769 | * If this is a LEHO, we added this before. It must be a supplemental |
769 | * record #LSD0001 | 770 | * record #LSD0001 |
@@ -772,12 +773,11 @@ transmit_lookup_dns_result (struct GNS_ResolverHandle *rh) | |||
772 | rd[i].flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL; | 773 | rd[i].flags |= GNUNET_GNSRECORD_RF_SUPPLEMENTAL; |
773 | if (0 == pos->expiration_time) | 774 | if (0 == pos->expiration_time) |
774 | { | 775 | { |
775 | rd[i].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 776 | rd[i].flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
776 | rd[i].expiration_time = 0; | 777 | rd[i].expiration_time = 0; |
777 | } | 778 | } |
778 | else | 779 | else |
779 | { | 780 | { |
780 | rd[i].flags = GNUNET_GNSRECORD_RF_NONE; | ||
781 | rd[i].expiration_time = pos->expiration_time; | 781 | rd[i].expiration_time = pos->expiration_time; |
782 | } | 782 | } |
783 | i++; | 783 | i++; |
@@ -1764,6 +1764,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh, | |||
1764 | /** | 1764 | /** |
1765 | * Records other than GNS2DNS not allowed | 1765 | * Records other than GNS2DNS not allowed |
1766 | */ | 1766 | */ |
1767 | if (NULL != ns) | ||
1768 | GNUNET_free (ns); | ||
1767 | return GNUNET_SYSERR; | 1769 | return GNUNET_SYSERR; |
1768 | } | 1770 | } |
1769 | off = 0; | 1771 | off = 0; |
@@ -1771,15 +1773,22 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh, | |||
1771 | rd[i].data_size, | 1773 | rd[i].data_size, |
1772 | &off); | 1774 | &off); |
1773 | ip = GNUNET_strdup (&((const char *) rd[i].data)[off]); | 1775 | ip = GNUNET_strdup (&((const char *) rd[i].data)[off]); |
1776 | if ((NULL == n) || | ||
1777 | (NULL == ip)) | ||
1778 | { | ||
1779 | GNUNET_break_op (0); | ||
1780 | if (NULL != n) | ||
1781 | GNUNET_free (n); | ||
1782 | if (NULL != ip) | ||
1783 | GNUNET_free (ip); | ||
1784 | continue; | ||
1785 | } | ||
1786 | |||
1774 | off += strlen (ip) + 1; | 1787 | off += strlen (ip) + 1; |
1775 | 1788 | ||
1776 | if ((NULL == n) || | 1789 | if (off != rd[i].data_size) |
1777 | (NULL == ip) || | ||
1778 | (off != rd[i].data_size)) | ||
1779 | { | 1790 | { |
1780 | GNUNET_break_op (0); | 1791 | GNUNET_break_op (0); |
1781 | GNUNET_free (n); | ||
1782 | GNUNET_free (ip); | ||
1783 | continue; | 1792 | continue; |
1784 | } | 1793 | } |
1785 | /* resolve 'ip' to determine the IP(s) of the DNS | 1794 | /* resolve 'ip' to determine the IP(s) of the DNS |
@@ -1909,6 +1918,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh, | |||
1909 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1918 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1910 | _ ("Name `%s' cannot be converted to IDNA."), | 1919 | _ ("Name `%s' cannot be converted to IDNA."), |
1911 | tmp); | 1920 | tmp); |
1921 | GNUNET_free (tmp); | ||
1922 | GNUNET_free (ac); | ||
1912 | return GNUNET_SYSERR; | 1923 | return GNUNET_SYSERR; |
1913 | } | 1924 | } |
1914 | GNUNET_free (tmp); | 1925 | GNUNET_free (tmp); |
@@ -1922,6 +1933,8 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh, | |||
1922 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1933 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
1923 | _ ("GNS lookup resulted in DNS name that is too long (`%s')\n"), | 1934 | _ ("GNS lookup resulted in DNS name that is too long (`%s')\n"), |
1924 | ac->label); | 1935 | ac->label); |
1936 | GNUNET_free (ac->label); | ||
1937 | GNUNET_free (ac); | ||
1925 | return GNUNET_SYSERR; | 1938 | return GNUNET_SYSERR; |
1926 | } | 1939 | } |
1927 | continue_with_gns2dns (ac); | 1940 | continue_with_gns2dns (ac); |
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c index 2ccb5be2b..3a35c9999 100644 --- a/src/gns/plugin_rest_gns.c +++ b/src/gns/plugin_rest_gns.c | |||
@@ -270,7 +270,9 @@ handle_gns_response (void *cls, | |||
270 | result = json_dumps (result_obj, 0); | 270 | result = json_dumps (result_obj, 0); |
271 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); | 271 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result); |
272 | resp = GNUNET_REST_create_response (result); | 272 | resp = GNUNET_REST_create_response (result); |
273 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 273 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
274 | "Content-Type", | ||
275 | "application/json")); | ||
274 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 276 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
275 | GNUNET_free (result); | 277 | GNUNET_free (result); |
276 | json_decref (result_obj); | 278 | json_decref (result_obj); |
diff --git a/src/gnsrecord/gnsrecord.c b/src/gnsrecord/gnsrecord.c index 8d5a6d95b..31749a629 100644 --- a/src/gnsrecord/gnsrecord.c +++ b/src/gnsrecord/gnsrecord.c | |||
@@ -102,15 +102,12 @@ init () | |||
102 | if (1 == once) | 102 | if (1 == once) |
103 | return; | 103 | return; |
104 | once = 1; | 104 | once = 1; |
105 | const struct GNUNET_OS_ProjectData *pd = GNUNET_OS_project_data_get (); | ||
106 | const struct GNUNET_OS_ProjectData *dpd = GNUNET_OS_project_data_default (); | ||
107 | 105 | ||
108 | if (pd != dpd) | 106 | GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (), |
109 | GNUNET_OS_init (dpd); | 107 | "libgnunet_plugin_gnsrecord_", |
110 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_gnsrecord_", NULL, | 108 | NULL, |
111 | &add_plugin, NULL); | 109 | &add_plugin, |
112 | if (pd != dpd) | 110 | NULL); |
113 | GNUNET_OS_init (pd); | ||
114 | } | 111 | } |
115 | 112 | ||
116 | 113 | ||
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c index 82c38f19a..b907eed27 100644 --- a/src/gnsrecord/gnsrecord_misc.c +++ b/src/gnsrecord/gnsrecord_misc.c | |||
@@ -296,15 +296,20 @@ GNUNET_GNSRECORD_data_from_identity (const struct | |||
296 | size_t *data_size, | 296 | size_t *data_size, |
297 | uint32_t *type) | 297 | uint32_t *type) |
298 | { | 298 | { |
299 | char *tmp; | ||
299 | *type = ntohl (key->type); | 300 | *type = ntohl (key->type); |
300 | *data_size = GNUNET_IDENTITY_key_get_length (key); | 301 | *data_size = GNUNET_IDENTITY_key_get_length (key); |
301 | if (0 == *data_size) | 302 | if (0 == *data_size) |
302 | return GNUNET_SYSERR; | 303 | return GNUNET_SYSERR; |
303 | *data = GNUNET_malloc (*data_size); | 304 | tmp = GNUNET_malloc (*data_size); |
304 | return (GNUNET_IDENTITY_write_key_to_buffer (key, *data, *data_size) == | 305 | if (GNUNET_IDENTITY_write_key_to_buffer (key, tmp, *data_size) |
305 | *data_size? | 306 | != *data_size) { |
306 | GNUNET_OK : | 307 | GNUNET_free (tmp); |
307 | GNUNET_SYSERR); | 308 | *data_size = 0; |
309 | return GNUNET_SYSERR; | ||
310 | } | ||
311 | *data = tmp; | ||
312 | return GNUNET_OK; | ||
308 | } | 313 | } |
309 | 314 | ||
310 | 315 | ||
@@ -350,7 +355,7 @@ GNUNET_GNSRECORD_block_get_expiration (const struct | |||
350 | case GNUNET_GNSRECORD_TYPE_PKEY: | 355 | case GNUNET_GNSRECORD_TYPE_PKEY: |
351 | return GNUNET_TIME_absolute_ntoh (block->ecdsa_block.expiration_time); | 356 | return GNUNET_TIME_absolute_ntoh (block->ecdsa_block.expiration_time); |
352 | default: | 357 | default: |
353 | return GNUNET_TIME_absolute_get_zero_ (); | 358 | GNUNET_break (0); /* Hopefully we never get here, but we might */ |
354 | } | 359 | } |
355 | return GNUNET_TIME_absolute_get_zero_ (); | 360 | return GNUNET_TIME_absolute_get_zero_ (); |
356 | 361 | ||
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c index 47b13bdab..d6b35544c 100644 --- a/src/gnsrecord/gnunet-gnsrecord-tvg.c +++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c | |||
@@ -172,7 +172,7 @@ run (void *cls, | |||
172 | fprintf (stdout, "RRBLOCK:\n"); | 172 | fprintf (stdout, "RRBLOCK:\n"); |
173 | print_bytes (rrblock, block_size, 8); | 173 | print_bytes (rrblock, block_size, 8); |
174 | fprintf (stdout, "\n"); | 174 | fprintf (stdout, "\n"); |
175 | 175 | GNUNET_free (rdata); | |
176 | } | 176 | } |
177 | 177 | ||
178 | 178 | ||
diff --git a/src/hello/hello-ng.c b/src/hello/hello-ng.c index 85b304e18..96856a692 100644 --- a/src/hello/hello-ng.c +++ b/src/hello/hello-ng.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "gnunet_util_lib.h" | 30 | #include "gnunet_util_lib.h" |
31 | #include "gnunet_ats_service.h" | 31 | #include "gnunet_ats_service.h" |
32 | 32 | ||
33 | GNUNET_NETWORK_STRUCT_BEGIN | ||
33 | /** | 34 | /** |
34 | * Binary block we sign when we sign an address. | 35 | * Binary block we sign when we sign an address. |
35 | */ | 36 | */ |
@@ -48,9 +49,9 @@ struct SignedAddress | |||
48 | /** | 49 | /** |
49 | * Hash of the address. | 50 | * Hash of the address. |
50 | */ | 51 | */ |
51 | struct GNUNET_HashCode h_addr; | 52 | struct GNUNET_HashCode addr_hash GNUNET_PACKED; |
52 | }; | 53 | }; |
53 | 54 | GNUNET_NETWORK_STRUCT_END | |
54 | 55 | ||
55 | /** | 56 | /** |
56 | * Build address record by signing raw information with private key. | 57 | * Build address record by signing raw information with private key. |
@@ -78,7 +79,7 @@ GNUNET_HELLO_sign_address ( | |||
78 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); | 79 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); |
79 | sa.purpose.size = htonl (sizeof(sa)); | 80 | sa.purpose.size = htonl (sizeof(sa)); |
80 | sa.mono_time = GNUNET_TIME_absolute_hton (mono_time); | 81 | sa.mono_time = GNUNET_TIME_absolute_hton (mono_time); |
81 | GNUNET_CRYPTO_hash (address, strlen (address), &sa.h_addr); | 82 | GNUNET_CRYPTO_hash (address, strlen (address), &sa.addr_hash); |
82 | GNUNET_CRYPTO_eddsa_sign (private_key, &sa, &sig); | 83 | GNUNET_CRYPTO_eddsa_sign (private_key, &sa, &sig); |
83 | sig_str = NULL; | 84 | sig_str = NULL; |
84 | (void) GNUNET_STRINGS_base64_encode (&sig, sizeof(sig), &sig_str); | 85 | (void) GNUNET_STRINGS_base64_encode (&sig, sizeof(sig), &sig_str); |
@@ -161,7 +162,7 @@ GNUNET_HELLO_extract_address (const void *raw, | |||
161 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); | 162 | sa.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS); |
162 | sa.purpose.size = htonl (sizeof(sa)); | 163 | sa.purpose.size = htonl (sizeof(sa)); |
163 | sa.mono_time = GNUNET_TIME_absolute_hton (raw_mono_time); | 164 | sa.mono_time = GNUNET_TIME_absolute_hton (raw_mono_time); |
164 | GNUNET_CRYPTO_hash (raw_addr, strlen (raw_addr), &sa.h_addr); | 165 | GNUNET_CRYPTO_hash (raw_addr, strlen (raw_addr), &sa.addr_hash); |
165 | if (GNUNET_YES != | 166 | if (GNUNET_YES != |
166 | GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS, | 167 | GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_ADDRESS, |
167 | &sa, | 168 | &sa, |
diff --git a/src/hello/test_hello-ng.c b/src/hello/test_hello-ng.c index 82b1ab6c6..e6b1d42a0 100644 --- a/src/hello/test_hello-ng.c +++ b/src/hello/test_hello-ng.c | |||
@@ -26,7 +26,7 @@ main (int argc, | |||
26 | (void**)&res, | 26 | (void**)&res, |
27 | &res_len); | 27 | &res_len); |
28 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | 28 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, |
29 | "%s", res); | 29 | "%s\n", res); |
30 | GNUNET_assert (NULL != | 30 | GNUNET_assert (NULL != |
31 | GNUNET_HELLO_extract_address ((void**)res, | 31 | GNUNET_HELLO_extract_address ((void**)res, |
32 | res_len, | 32 | res_len, |
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index 5569c87ed..faef696a7 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -53,6 +53,7 @@ gnunetinclude_HEADERS = \ | |||
53 | gnunet_gnsrecord_lib.h \ | 53 | gnunet_gnsrecord_lib.h \ |
54 | gnunet_gnsrecord_json_lib.h \ | 54 | gnunet_gnsrecord_json_lib.h \ |
55 | gnunet_gnsrecord_plugin.h \ | 55 | gnunet_gnsrecord_plugin.h \ |
56 | gnu_name_system_record_types.h \ | ||
56 | gnunet_hello_lib.h \ | 57 | gnunet_hello_lib.h \ |
57 | gnunet_helper_lib.h \ | 58 | gnunet_helper_lib.h \ |
58 | gnunet_identity_service.h \ | 59 | gnunet_identity_service.h \ |
@@ -112,7 +113,9 @@ gnunetinclude_HEADERS = \ | |||
112 | gnunet_strings_lib.h \ | 113 | gnunet_strings_lib.h \ |
113 | gnunet_testbed_service.h \ | 114 | gnunet_testbed_service.h \ |
114 | gnunet_testbed_logger_service.h \ | 115 | gnunet_testbed_logger_service.h \ |
116 | gnunet_testbed_ng_service.h \ | ||
115 | gnunet_testing_lib.h \ | 117 | gnunet_testing_lib.h \ |
118 | gnunet_testing_ng_lib.h \ | ||
116 | gnunet_time_lib.h \ | 119 | gnunet_time_lib.h \ |
117 | gnunet_transport_service.h \ | 120 | gnunet_transport_service.h \ |
118 | gnunet_transport_application_service.h \ | 121 | gnunet_transport_application_service.h \ |
diff --git a/src/include/gnu_name_system_record_types.h b/src/include/gnu_name_system_record_types.h new file mode 100644 index 000000000..b2cf45dc8 --- /dev/null +++ b/src/include/gnu_name_system_record_types.h | |||
@@ -0,0 +1,138 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2012-2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | #ifndef GNU_NAME_SYSTEM_RECORD_TYPES_H | ||
21 | #define GNU_NAME_SYSTEM_RECORD_TYPES_H | ||
22 | |||
23 | /** | ||
24 | * WARNING: | ||
25 | * This header is generated! | ||
26 | * In order to add GNS record types, you must register | ||
27 | * them in GANA, and then use the header generation script | ||
28 | * to create an update of this file. You may then replace this | ||
29 | * file with the update. | ||
30 | */ | ||
31 | |||
32 | #ifdef __cplusplus | ||
33 | extern "C" { | ||
34 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
35 | } | ||
36 | #endif | ||
37 | #endif | ||
38 | |||
39 | |||
40 | /** | ||
41 | * GNS zone transfer | ||
42 | */ | ||
43 | #define GNUNET_GNSRECORD_TYPE_PKEY 65536 | ||
44 | |||
45 | /** | ||
46 | * GNS nick names | ||
47 | */ | ||
48 | #define GNUNET_GNSRECORD_TYPE_NICK 65537 | ||
49 | |||
50 | /** | ||
51 | * legacy hostnames | ||
52 | */ | ||
53 | #define GNUNET_GNSRECORD_TYPE_LEHO 65538 | ||
54 | |||
55 | /** | ||
56 | * VPN resolution | ||
57 | */ | ||
58 | #define GNUNET_GNSRECORD_TYPE_VPN 65539 | ||
59 | |||
60 | /** | ||
61 | * Delegation to DNS | ||
62 | */ | ||
63 | #define GNUNET_GNSRECORD_TYPE_GNS2DNS 65540 | ||
64 | |||
65 | /** | ||
66 | * Boxed records (see TLSA/SRV handling in GNS) | ||
67 | */ | ||
68 | #define GNUNET_GNSRECORD_TYPE_BOX 65541 | ||
69 | |||
70 | /** | ||
71 | * social place for SecuShare | ||
72 | */ | ||
73 | #define GNUNET_GNSRECORD_TYPE_PLACE 65542 | ||
74 | |||
75 | /** | ||
76 | * Endpoint for conversation | ||
77 | */ | ||
78 | #define GNUNET_GNSRECORD_TYPE_PHONE 65543 | ||
79 | |||
80 | /** | ||
81 | * identity attribute | ||
82 | */ | ||
83 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE 65544 | ||
84 | |||
85 | /** | ||
86 | * local ticket reference | ||
87 | */ | ||
88 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET 65545 | ||
89 | |||
90 | /** | ||
91 | * For ABD policies | ||
92 | */ | ||
93 | #define GNUNET_GNSRECORD_TYPE_DELEGATE 65548 | ||
94 | |||
95 | /** | ||
96 | * For ABD reverse lookups | ||
97 | */ | ||
98 | #define GNUNET_GNSRECORD_TYPE_ATTRIBUTE 65549 | ||
99 | |||
100 | /** | ||
101 | * for reclaim records | ||
102 | */ | ||
103 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF 65550 | ||
104 | |||
105 | /** | ||
106 | * For reclaim OIDC client names. | ||
107 | */ | ||
108 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT 65552 | ||
109 | |||
110 | /** | ||
111 | * Used reclaimID OIDC client redirect URIs. | ||
112 | */ | ||
113 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553 | ||
114 | |||
115 | /** | ||
116 | * Record type for an attribute attestation (e.g. JWT). | ||
117 | */ | ||
118 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL 65554 | ||
119 | |||
120 | /** | ||
121 | * Record type for a presentation of a credential. | ||
122 | */ | ||
123 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555 | ||
124 | |||
125 | /** | ||
126 | * Record type for EDKEY zone delegations. | ||
127 | */ | ||
128 | #define GNUNET_GNSRECORD_TYPE_EDKEY 65556 | ||
129 | |||
130 | |||
131 | #if 0 /* keep Emacsens' auto-indent happy */ | ||
132 | { | ||
133 | #endif | ||
134 | #ifdef __cplusplus | ||
135 | } | ||
136 | #endif | ||
137 | |||
138 | #endif | ||
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 0bf2ceed7..aff56146e 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -55,109 +55,9 @@ extern "C" { | |||
55 | #define GNUNET_GNSRECORD_TYPE_ANY 0 | 55 | #define GNUNET_GNSRECORD_TYPE_ANY 0 |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Record type for GNS zone transfer ("PKEY"). | 58 | * Include the record types generated from GANA |
59 | */ | 59 | */ |
60 | #define GNUNET_GNSRECORD_TYPE_PKEY GNUNET_IDENTITY_TYPE_ECDSA | 60 | #include "gnu_name_system_record_types.h" |
61 | |||
62 | /** | ||
63 | * Record type for GNS nick names ("NICK"). | ||
64 | */ | ||
65 | #define GNUNET_GNSRECORD_TYPE_NICK 65537 | ||
66 | |||
67 | /** | ||
68 | * Record type for GNS legacy hostnames ("LEHO"). | ||
69 | */ | ||
70 | #define GNUNET_GNSRECORD_TYPE_LEHO 65538 | ||
71 | |||
72 | /** | ||
73 | * Record type for VPN resolution | ||
74 | */ | ||
75 | #define GNUNET_GNSRECORD_TYPE_VPN 65539 | ||
76 | |||
77 | /** | ||
78 | * Record type for delegation to DNS. | ||
79 | */ | ||
80 | #define GNUNET_GNSRECORD_TYPE_GNS2DNS 65540 | ||
81 | |||
82 | /** | ||
83 | * Record type for a boxed record (see TLSA/SRV handling in GNS). | ||
84 | */ | ||
85 | #define GNUNET_GNSRECORD_TYPE_BOX 65541 | ||
86 | |||
87 | /** | ||
88 | * Record type for a social place. | ||
89 | */ | ||
90 | #define GNUNET_GNSRECORD_TYPE_PLACE 65542 | ||
91 | |||
92 | /** | ||
93 | * Record type for a phone (of CONVERSATION). | ||
94 | */ | ||
95 | #define GNUNET_GNSRECORD_TYPE_PHONE 65543 | ||
96 | |||
97 | /** | ||
98 | * Record type for identity attributes (of RECLAIM). | ||
99 | */ | ||
100 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE 65544 | ||
101 | |||
102 | /** | ||
103 | * Record type for local ticket references | ||
104 | */ | ||
105 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET 65545 | ||
106 | |||
107 | /** | ||
108 | * 65546 reserved | ||
109 | */ | ||
110 | |||
111 | /** | ||
112 | * 65547 deleted, free to use | ||
113 | */ | ||
114 | |||
115 | /** | ||
116 | * Record type for policies | ||
117 | */ | ||
118 | #define GNUNET_GNSRECORD_TYPE_DELEGATE 65548 | ||
119 | |||
120 | /** | ||
121 | * Record type for reverse lookups | ||
122 | */ | ||
123 | #define GNUNET_GNSRECORD_TYPE_ATTRIBUTE 65549 | ||
124 | |||
125 | /** | ||
126 | * Record type for reclaim records | ||
127 | */ | ||
128 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF 65550 | ||
129 | |||
130 | /** | ||
131 | * Record type for RECLAIM master | ||
132 | */ | ||
133 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER 65551 | ||
134 | |||
135 | /** | ||
136 | * Record type for reclaim OIDC clients | ||
137 | */ | ||
138 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT 65552 | ||
139 | |||
140 | /** | ||
141 | * Record type for reclaim OIDC redirect URIs | ||
142 | */ | ||
143 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553 | ||
144 | |||
145 | /** | ||
146 | * Record type for an attribute attestation | ||
147 | */ | ||
148 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL 65554 | ||
149 | |||
150 | /** | ||
151 | * Record type for a presentation of a credential (used | ||
152 | * in a ticket record set) | ||
153 | */ | ||
154 | #define GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION 65555 | ||
155 | |||
156 | /** | ||
157 | * Record type for EDKEY delegations. | ||
158 | */ | ||
159 | #define GNUNET_GNSRECORD_TYPE_EDKEY GNUNET_IDENTITY_TYPE_EDDSA | ||
160 | |||
161 | 61 | ||
162 | /** | 62 | /** |
163 | * Flags that can be set for a record. | 63 | * Flags that can be set for a record. |
diff --git a/src/include/gnunet_messenger_service.h b/src/include/gnunet_messenger_service.h index 389b6b8fd..99d4cf267 100644 --- a/src/include/gnunet_messenger_service.h +++ b/src/include/gnunet_messenger_service.h | |||
@@ -48,6 +48,14 @@ extern "C" { | |||
48 | #include "gnunet_scheduler_lib.h" | 48 | #include "gnunet_scheduler_lib.h" |
49 | #include "gnunet_time_lib.h" | 49 | #include "gnunet_time_lib.h" |
50 | 50 | ||
51 | /** | ||
52 | * Version number of GNUnet Messenger API. | ||
53 | */ | ||
54 | #define GNUNET_MESSENGER_VERSION 0x00000001 | ||
55 | |||
56 | /** | ||
57 | * Identifier of GNUnet MESSENGER Service. | ||
58 | */ | ||
51 | #define GNUNET_MESSENGER_SERVICE_NAME "messenger" | 59 | #define GNUNET_MESSENGER_SERVICE_NAME "messenger" |
52 | 60 | ||
53 | /** | 61 | /** |
@@ -141,11 +149,18 @@ enum GNUNET_MESSENGER_MessageKind | |||
141 | GNUNET_MESSENGER_KIND_PRIVATE = 14, | 149 | GNUNET_MESSENGER_KIND_PRIVATE = 14, |
142 | 150 | ||
143 | /** | 151 | /** |
152 | * The delete kind. The message contains a #GNUNET_MESSENGER_MessageDelete body. | ||
153 | */ | ||
154 | GNUNET_MESSENGER_KIND_DELETE = 15, | ||
155 | |||
156 | /** | ||
144 | * The unknown kind. The message contains an unknown body. | 157 | * The unknown kind. The message contains an unknown body. |
145 | */ | 158 | */ |
146 | GNUNET_MESSENGER_KIND_UNKNOWN = 0 | 159 | GNUNET_MESSENGER_KIND_UNKNOWN = 0 |
147 | }; | 160 | }; |
148 | 161 | ||
162 | #define GNUNET_MESSENGER_KIND_MAX (GNUNET_MESSENGER_KIND_DELETE) | ||
163 | |||
149 | /** | 164 | /** |
150 | * Get the name of a message <i>kind</i>. | 165 | * Get the name of a message <i>kind</i>. |
151 | * | 166 | * |
@@ -157,6 +172,9 @@ GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind); | |||
157 | 172 | ||
158 | /** | 173 | /** |
159 | * The header of a #GNUNET_MESSENGER_Message. | 174 | * The header of a #GNUNET_MESSENGER_Message. |
175 | * This allows authentification of the sender, temporal ordering and finding potentially missed messages. | ||
176 | * | ||
177 | * Message-header-size: 40+ bytes | ||
160 | */ | 178 | */ |
161 | struct GNUNET_MESSENGER_MessageHeader | 179 | struct GNUNET_MESSENGER_MessageHeader |
162 | { | 180 | { |
@@ -188,6 +206,9 @@ struct GNUNET_MESSENGER_MessageHeader | |||
188 | 206 | ||
189 | /** | 207 | /** |
190 | * An info message body. | 208 | * An info message body. |
209 | * This allows ensuring member ids are unique and this first message can be verified. | ||
210 | * | ||
211 | * Message-body-size: 8+ bytes | ||
191 | */ | 212 | */ |
192 | struct GNUNET_MESSENGER_MessageInfo | 213 | struct GNUNET_MESSENGER_MessageInfo |
193 | { | 214 | { |
@@ -197,13 +218,16 @@ struct GNUNET_MESSENGER_MessageInfo | |||
197 | struct GNUNET_IDENTITY_PublicKey host_key; | 218 | struct GNUNET_IDENTITY_PublicKey host_key; |
198 | 219 | ||
199 | /** | 220 | /** |
200 | * The new unique id for the receiver in a room. | 221 | * The version of GNUnet Messenger API. |
201 | */ | 222 | */ |
202 | struct GNUNET_ShortHashCode unique_id; | 223 | uint32_t messenger_version; |
203 | }; | 224 | }; |
204 | 225 | ||
205 | /** | 226 | /** |
206 | * A join message body. | 227 | * A join message body. |
228 | * This allows informing others about joining the room with a given key pair. | ||
229 | * | ||
230 | * Message-body-size: 4+ bytes | ||
207 | */ | 231 | */ |
208 | struct GNUNET_MESSENGER_MessageJoin | 232 | struct GNUNET_MESSENGER_MessageJoin |
209 | { | 233 | { |
@@ -215,6 +239,9 @@ struct GNUNET_MESSENGER_MessageJoin | |||
215 | 239 | ||
216 | /** | 240 | /** |
217 | * A leave message body. | 241 | * A leave message body. |
242 | * This allows informing others about leaving the room. | ||
243 | * | ||
244 | * Message-body-size: 0 bytes | ||
218 | */ | 245 | */ |
219 | struct GNUNET_MESSENGER_MessageLeave | 246 | struct GNUNET_MESSENGER_MessageLeave |
220 | { | 247 | { |
@@ -222,6 +249,9 @@ struct GNUNET_MESSENGER_MessageLeave | |||
222 | 249 | ||
223 | /** | 250 | /** |
224 | * A name message body. | 251 | * A name message body. |
252 | * This allows replacing the current name with another one. | ||
253 | * | ||
254 | * Message-body-size: 0+ bytes | ||
225 | */ | 255 | */ |
226 | struct GNUNET_MESSENGER_MessageName | 256 | struct GNUNET_MESSENGER_MessageName |
227 | { | 257 | { |
@@ -233,6 +263,9 @@ struct GNUNET_MESSENGER_MessageName | |||
233 | 263 | ||
234 | /** | 264 | /** |
235 | * A key message body. | 265 | * A key message body. |
266 | * This allows replacing the current key pair with another one. | ||
267 | * | ||
268 | * Message-body-size: 4+ bytes | ||
236 | */ | 269 | */ |
237 | struct GNUNET_MESSENGER_MessageKey | 270 | struct GNUNET_MESSENGER_MessageKey |
238 | { | 271 | { |
@@ -244,6 +277,9 @@ struct GNUNET_MESSENGER_MessageKey | |||
244 | 277 | ||
245 | /** | 278 | /** |
246 | * A peer message body. | 279 | * A peer message body. |
280 | * This allows informing others to open a peer as a door to the current room. | ||
281 | * | ||
282 | * Message-body-size: 32 bytes | ||
247 | */ | 283 | */ |
248 | struct GNUNET_MESSENGER_MessagePeer | 284 | struct GNUNET_MESSENGER_MessagePeer |
249 | { | 285 | { |
@@ -255,6 +291,9 @@ struct GNUNET_MESSENGER_MessagePeer | |||
255 | 291 | ||
256 | /** | 292 | /** |
257 | * An id message body. | 293 | * An id message body. |
294 | * This allows replacing the member id with a newly unique generated one. | ||
295 | * | ||
296 | * Message-body-size: 8 bytes | ||
258 | */ | 297 | */ |
259 | struct GNUNET_MESSENGER_MessageId | 298 | struct GNUNET_MESSENGER_MessageId |
260 | { | 299 | { |
@@ -266,6 +305,9 @@ struct GNUNET_MESSENGER_MessageId | |||
266 | 305 | ||
267 | /** | 306 | /** |
268 | * A miss message body. | 307 | * A miss message body. |
308 | * This allows informing others about a disconnection of any door. | ||
309 | * | ||
310 | * Message-body-size: 32 bytes | ||
269 | */ | 311 | */ |
270 | struct GNUNET_MESSENGER_MessageMiss | 312 | struct GNUNET_MESSENGER_MessageMiss |
271 | { | 313 | { |
@@ -277,6 +319,9 @@ struct GNUNET_MESSENGER_MessageMiss | |||
277 | 319 | ||
278 | /** | 320 | /** |
279 | * A merge message body. | 321 | * A merge message body. |
322 | * This allows merging message history branches together. | ||
323 | * | ||
324 | * Message-body-size: 16 bytes | ||
280 | */ | 325 | */ |
281 | struct GNUNET_MESSENGER_MessageMerge | 326 | struct GNUNET_MESSENGER_MessageMerge |
282 | { | 327 | { |
@@ -288,6 +333,9 @@ struct GNUNET_MESSENGER_MessageMerge | |||
288 | 333 | ||
289 | /** | 334 | /** |
290 | * A request message body. | 335 | * A request message body. |
336 | * This allows requesting the content of a specific message which is currently missing. | ||
337 | * | ||
338 | * Message-body-size: 16 bytes | ||
291 | */ | 339 | */ |
292 | struct GNUNET_MESSENGER_MessageRequest | 340 | struct GNUNET_MESSENGER_MessageRequest |
293 | { | 341 | { |
@@ -299,6 +347,9 @@ struct GNUNET_MESSENGER_MessageRequest | |||
299 | 347 | ||
300 | /** | 348 | /** |
301 | * An invite message body. | 349 | * An invite message body. |
350 | * This allows sharing information about other rooms in form of an invitation. | ||
351 | * | ||
352 | * Message-body-size: 48 bytes | ||
302 | */ | 353 | */ |
303 | struct GNUNET_MESSENGER_MessageInvite | 354 | struct GNUNET_MESSENGER_MessageInvite |
304 | { | 355 | { |
@@ -315,6 +366,9 @@ struct GNUNET_MESSENGER_MessageInvite | |||
315 | 366 | ||
316 | /** | 367 | /** |
317 | * A text message body. | 368 | * A text message body. |
369 | * This allows general communication in text form. | ||
370 | * | ||
371 | * Message-body-size: 0+ bytes | ||
318 | */ | 372 | */ |
319 | struct GNUNET_MESSENGER_MessageText | 373 | struct GNUNET_MESSENGER_MessageText |
320 | { | 374 | { |
@@ -326,6 +380,9 @@ struct GNUNET_MESSENGER_MessageText | |||
326 | 380 | ||
327 | /** | 381 | /** |
328 | * A file message body. | 382 | * A file message body. |
383 | * This allows sending necessary details about an uploaded encrypted file to allow access to it. | ||
384 | * | ||
385 | * Message-body-size: 335+ bytes | ||
329 | */ | 386 | */ |
330 | struct GNUNET_MESSENGER_MessageFile | 387 | struct GNUNET_MESSENGER_MessageFile |
331 | { | 388 | { |
@@ -352,6 +409,9 @@ struct GNUNET_MESSENGER_MessageFile | |||
352 | 409 | ||
353 | /** | 410 | /** |
354 | * A private message body. | 411 | * A private message body. |
412 | * This allows to encapsulate any message to be encrypted for only one specific member to receive in a room. | ||
413 | * | ||
414 | * Message-body-size: 32+ bytes | ||
355 | */ | 415 | */ |
356 | struct GNUNET_MESSENGER_MessagePrivate | 416 | struct GNUNET_MESSENGER_MessagePrivate |
357 | { | 417 | { |
@@ -372,6 +432,25 @@ struct GNUNET_MESSENGER_MessagePrivate | |||
372 | }; | 432 | }; |
373 | 433 | ||
374 | /** | 434 | /** |
435 | * A delete message body | ||
436 | * This allows deletion of an own previous message with any custom automatic delay. | ||
437 | * | ||
438 | * Message-body-size: 24 bytes | ||
439 | */ | ||
440 | struct GNUNET_MESSENGER_MessageDelete | ||
441 | { | ||
442 | /** | ||
443 | * The hash of the message to delete. | ||
444 | */ | ||
445 | struct GNUNET_HashCode hash; | ||
446 | |||
447 | /** | ||
448 | * The delay of the delete operation to get processed. | ||
449 | */ | ||
450 | struct GNUNET_TIME_RelativeNBO delay; | ||
451 | }; | ||
452 | |||
453 | /** | ||
375 | * The unified body of a #GNUNET_MESSENGER_Message. | 454 | * The unified body of a #GNUNET_MESSENGER_Message. |
376 | */ | 455 | */ |
377 | struct GNUNET_MESSENGER_MessageBody | 456 | struct GNUNET_MESSENGER_MessageBody |
@@ -392,6 +471,7 @@ struct GNUNET_MESSENGER_MessageBody | |||
392 | struct GNUNET_MESSENGER_MessageText text; | 471 | struct GNUNET_MESSENGER_MessageText text; |
393 | struct GNUNET_MESSENGER_MessageFile file; | 472 | struct GNUNET_MESSENGER_MessageFile file; |
394 | struct GNUNET_MESSENGER_MessagePrivate private; | 473 | struct GNUNET_MESSENGER_MessagePrivate private; |
474 | struct GNUNET_MESSENGER_MessageDelete delete; | ||
395 | }; | 475 | }; |
396 | }; | 476 | }; |
397 | 477 | ||
@@ -412,11 +492,27 @@ struct GNUNET_MESSENGER_Message | |||
412 | }; | 492 | }; |
413 | 493 | ||
414 | /** | 494 | /** |
495 | * Enum for the different supported flags used by message handling | ||
496 | */ | ||
497 | enum GNUNET_MESSENGER_MessageFlags | ||
498 | { | ||
499 | /** | ||
500 | * The none flag. The flag indicates that the message is not affected by any special context. | ||
501 | */ | ||
502 | GNUNET_MESSENGER_FLAG_NONE = 0, | ||
503 | |||
504 | /** | ||
505 | * The private flag. The flag indicates that the message was privately encrypted. | ||
506 | */ | ||
507 | GNUNET_MESSENGER_FLAG_PRIVATE = 1, | ||
508 | }; | ||
509 | |||
510 | /** | ||
415 | * Method called whenever the EGO of a <i>handle</i> changes or if the first connection fails | 511 | * Method called whenever the EGO of a <i>handle</i> changes or if the first connection fails |
416 | * to load a valid EGO and the anonymous key pair will be used instead. | 512 | * to load a valid EGO and the anonymous key pair will be used instead. |
417 | * | 513 | * |
418 | * @param cls Closure from <i>GNUNET_MESSENGER_connect</i> | 514 | * @param[in/out] cls Closure from #GNUNET_MESSENGER_connect |
419 | * @param handle Messenger handle | 515 | * @param[in/out] handle Messenger handle |
420 | */ | 516 | */ |
421 | typedef void | 517 | typedef void |
422 | (*GNUNET_MESSENGER_IdentityCallback) (void *cls, struct GNUNET_MESSENGER_Handle *handle); | 518 | (*GNUNET_MESSENGER_IdentityCallback) (void *cls, struct GNUNET_MESSENGER_Handle *handle); |
@@ -424,25 +520,45 @@ typedef void | |||
424 | /** | 520 | /** |
425 | * Method called whenever a message is sent or received from a <i>room</i>. | 521 | * Method called whenever a message is sent or received from a <i>room</i>. |
426 | * | 522 | * |
427 | * @param cls Closure from <i>GNUNET_MESSENGER_connect</i> | 523 | * The flag <i>private_message</i> will be #GNUNET_YES if a message was |
428 | * @param room Room handle | 524 | * received privately, otherwise #GNUNET_NO. |
429 | * @param message Newly received or sent message | 525 | * |
430 | * @param hash Hash identifying the message | 526 | * @param[in/out] cls Closure from #GNUNET_MESSENGER_connect |
527 | * @param[in] room Room handle | ||
528 | * @param[in] sender Sender of message | ||
529 | * @param[in] message Newly received or sent message | ||
530 | * @param[in] hash Hash identifying the message | ||
531 | * @param[in] flags Flags of the message | ||
431 | */ | 532 | */ |
432 | typedef void | 533 | typedef void |
433 | (*GNUNET_MESSENGER_MessageCallback) (void *cls, const struct GNUNET_MESSENGER_Room *room, | 534 | (*GNUNET_MESSENGER_MessageCallback) (void *cls, struct GNUNET_MESSENGER_Room *room, |
434 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 535 | const struct GNUNET_MESSENGER_Contact *sender, |
536 | const struct GNUNET_MESSENGER_Message *message, | ||
537 | const struct GNUNET_HashCode *hash, | ||
538 | enum GNUNET_MESSENGER_MessageFlags flags); | ||
539 | |||
540 | /** | ||
541 | * Method called for each member in a <i>room</i> during iteration. If the method returns | ||
542 | * #GNUNET_YES the iteration continues, otherwise it will quit the iteration. | ||
543 | * | ||
544 | * @param[in/out] cls Closure from #GNUNET_MESSENGER_iterate_members | ||
545 | * @param[in] room Room handle | ||
546 | * @param[in] contact Contact handle | ||
547 | */ | ||
548 | typedef int | ||
549 | (*GNUNET_MESSENGER_MemberCallback) (void* cls, struct GNUNET_MESSENGER_Room *room, | ||
550 | const struct GNUNET_MESSENGER_Contact *contact); | ||
435 | 551 | ||
436 | /** | 552 | /** |
437 | * Set up a handle for the messenger related functions and connects to all necessary services. It will look up the ego | 553 | * Set up a handle for the messenger related functions and connects to all necessary services. It will look up the ego |
438 | * key identified by its <i>name</i> and use it for signing all messages from the handle. | 554 | * key identified by its <i>name</i> and use it for signing all messages from the handle. |
439 | * | 555 | * |
440 | * @param cfg Configuration to use | 556 | * @param[in] cfg Configuration to use |
441 | * @param name Name to look up an ego or NULL to stay anonymous | 557 | * @param[in] name Name to look up an ego or NULL to stay anonymous |
442 | * @param identity_callback Function called when the EGO of the handle changes | 558 | * @param[in] identity_callback Function called when the EGO of the handle changes |
443 | * @param identity_cls Closure for the <i>identity_callback</i> handler | 559 | * @param[in/out] identity_cls Closure for the <i>identity_callback</i> handler |
444 | * @param msg_callback Function called when a new message is sent or received | 560 | * @param[in] msg_callback Function called when a new message is sent or received |
445 | * @param msg_cls Closure for the <i>msg_callback</i> handler | 561 | * @param[in/out] msg_cls Closure for the <i>msg_callback</i> handler |
446 | * @return Messenger handle to use, NULL on error | 562 | * @return Messenger handle to use, NULL on error |
447 | */ | 563 | */ |
448 | struct GNUNET_MESSENGER_Handle* | 564 | struct GNUNET_MESSENGER_Handle* |
@@ -458,8 +574,8 @@ GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const c | |||
458 | * Keep in mind that this will fully delete the old ego key (if any is used) even if any other service wants to use it | 574 | * Keep in mind that this will fully delete the old ego key (if any is used) even if any other service wants to use it |
459 | * as default. | 575 | * as default. |
460 | * | 576 | * |
461 | * @param handle Messenger handle to use | 577 | * @param[in/out] handle Messenger handle to use |
462 | * @return GNUNET_OK on success, GNUNET_SYSERR on failure | 578 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure |
463 | */ | 579 | */ |
464 | int | 580 | int |
465 | GNUNET_MESSENGER_update (struct GNUNET_MESSENGER_Handle *handle); | 581 | GNUNET_MESSENGER_update (struct GNUNET_MESSENGER_Handle *handle); |
@@ -467,7 +583,7 @@ GNUNET_MESSENGER_update (struct GNUNET_MESSENGER_Handle *handle); | |||
467 | /** | 583 | /** |
468 | * Disconnect all of the messengers used services and clears up its used memory. | 584 | * Disconnect all of the messengers used services and clears up its used memory. |
469 | * | 585 | * |
470 | * @param handle Messenger handle to use | 586 | * @param[in/out] handle Messenger handle to use |
471 | */ | 587 | */ |
472 | void | 588 | void |
473 | GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle); | 589 | GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle); |
@@ -475,7 +591,7 @@ GNUNET_MESSENGER_disconnect (struct GNUNET_MESSENGER_Handle *handle); | |||
475 | /** | 591 | /** |
476 | * Get the name (if specified, otherwise NULL) used by the messenger. | 592 | * Get the name (if specified, otherwise NULL) used by the messenger. |
477 | * | 593 | * |
478 | * @param handle Messenger handle to use | 594 | * @param[in] handle Messenger handle to use |
479 | * @return Name used by the messenger or NULL | 595 | * @return Name used by the messenger or NULL |
480 | */ | 596 | */ |
481 | const char* | 597 | const char* |
@@ -483,21 +599,21 @@ GNUNET_MESSENGER_get_name (const struct GNUNET_MESSENGER_Handle *handle); | |||
483 | 599 | ||
484 | /** | 600 | /** |
485 | * Set the name for the messenger. This will rename the currently used ego and move all stored files related to the current | 601 | * Set the name for the messenger. This will rename the currently used ego and move all stored files related to the current |
486 | * name to its new directory. If anything fails during this process the function returns GNUNET_NO and the name for | 602 | * name to its new directory. If anything fails during this process the function returns #GNUNET_NO and the name for |
487 | * the messenger won't change as specified. | 603 | * the messenger won't change as specified. |
488 | * | 604 | * |
489 | * @param handle Messenger handle to use | 605 | * @param[in/out] handle Messenger handle to use |
490 | * @param name Name for the messenger to change to | 606 | * @param[in] name Name for the messenger to change to |
491 | * @return GNUNET_YES on success, GNUNET_NO on failure and GNUNET_SYSERR if <i>handle</i> is NULL | 607 | * @return #GNUNET_YES on success, #GNUNET_NO on failure and #GNUNET_SYSERR if <i>handle</i> is NULL |
492 | */ | 608 | */ |
493 | int | 609 | int |
494 | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); | 610 | GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); |
495 | 611 | ||
496 | /** | 612 | /** |
497 | * Get the public key used by the messenger. | 613 | * Get the public key used by the messenger or NULL if the anonymous key was used. |
498 | * | 614 | * |
499 | * @param handle Messenger handle to use | 615 | * @param[in] handle Messenger handle to use |
500 | * @return Used ego's public key | 616 | * @return Used ego's public key or NULL |
501 | */ | 617 | */ |
502 | const struct GNUNET_IDENTITY_PublicKey* | 618 | const struct GNUNET_IDENTITY_PublicKey* |
503 | GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle); | 619 | GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle); |
@@ -509,38 +625,38 @@ GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle); | |||
509 | * Notice that there can only be one room related to a specific <i>key</i>. So trying to open two rooms with the same | 625 | * Notice that there can only be one room related to a specific <i>key</i>. So trying to open two rooms with the same |
510 | * <i>key</i> will result in opening the room once but returning the handle both times because the room stays open. | 626 | * <i>key</i> will result in opening the room once but returning the handle both times because the room stays open. |
511 | * | 627 | * |
512 | * You can also open a room after entering it through a <b>door</b> using <i>GNUNET_MESSENGER_entry_room(...)</i>. This | 628 | * You can also open a room after entering it through a <b>door</b> using #GNUNET_MESSENGER_enter_room. This |
513 | * will notify all entered <b>doors</b> to list you as new <b>door</b>. | 629 | * will notify all entered <b>doors</b> to list you as new <b>door</b>. |
514 | * | 630 | * |
515 | * ( All <b>doors</b> form a ring structured network to shorten the latency sending and receiving messages. ) | 631 | * ( All <b>doors</b> form a ring structured network to shorten the latency sending and receiving messages. ) |
516 | * | 632 | * |
517 | * @param handle Messenger handle to use | 633 | * @param[in/out] handle Messenger handle to use |
518 | * @param key Hash identifying the port | 634 | * @param[in] key Hash identifying the port |
519 | * @return Room handle, NULL on error | 635 | * @return Room handle, NULL on error |
520 | */ | 636 | */ |
521 | struct GNUNET_MESSENGER_Room* | 637 | struct GNUNET_MESSENGER_Room* |
522 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | 638 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); |
523 | 639 | ||
524 | /** | 640 | /** |
525 | * Enter a room to send and receive messages through a <b>door</b> opened using <i>GNUNET_MESSENGER_open_room(...)</i>. | 641 | * Enter a room to send and receive messages through a <b>door</b> opened using #GNUNET_MESSENGER_open_room. |
526 | * | 642 | * |
527 | * Notice that there can only be one room related to a specific <i>key</i>. So trying to enter two rooms with the same | 643 | * Notice that there can only be one room related to a specific <i>key</i>. So trying to enter two rooms with the same |
528 | * <i>key</i> will result in entering the room once but returning the handle both times because the room stays entered. | 644 | * <i>key</i> will result in entering the room once but returning the handle both times because the room stays entered. |
529 | * You can however enter a room through multiple <b>doors</b> in parallel which results in connecting both ends. But | 645 | * You can however enter a room through multiple <b>doors</b> in parallel which results in connecting both ends. But |
530 | * entering the room through the same <b>door</b> won't have any effect after the first time. | 646 | * entering the room through the same <b>door</b> won't have any effect after the first time. |
531 | * | 647 | * |
532 | * You can also enter a room through a <b>door</b> after opening it using <i>GNUNET_MESSENGER_open_room(...)</i>. But the | 648 | * You can also enter a room through a <b>door</b> after opening it using #GNUNET_MESSENGER_open_room. But the |
533 | * <b>door</b> may not be your own peer identity. | 649 | * <b>door</b> may not be your own peer identity. |
534 | * | 650 | * |
535 | * ( All <b>doors</b> form a ring structured network to shorten the latency sending and receiving messages. ) | 651 | * ( All <b>doors</b> form a ring structured network to shorten the latency sending and receiving messages. ) |
536 | * | 652 | * |
537 | * @param handle Messenger handle to use | 653 | * @param[in/out] handle Messenger handle to use |
538 | * @param door Peer identity of an open <b>door</b> | 654 | * @param[in] door Peer identity of an open <b>door</b> |
539 | * @param key Hash identifying the port | 655 | * @param[in] key Hash identifying the port |
540 | * @return Room handle, NULL on error | 656 | * @return Room handle, NULL on error |
541 | */ | 657 | */ |
542 | struct GNUNET_MESSENGER_Room* | 658 | struct GNUNET_MESSENGER_Room* |
543 | GNUNET_MESSENGER_entry_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 659 | GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, |
544 | const struct GNUNET_HashCode *key); | 660 | const struct GNUNET_HashCode *key); |
545 | 661 | ||
546 | /** | 662 | /** |
@@ -550,37 +666,37 @@ GNUNET_MESSENGER_entry_room (struct GNUNET_MESSENGER_Handle *handle, const struc | |||
550 | * ( After a member closes a <b>door</b>, all members entered through that specific <b>door</b> have to use another one | 666 | * ( After a member closes a <b>door</b>, all members entered through that specific <b>door</b> have to use another one |
551 | * or open the room on their own. ) | 667 | * or open the room on their own. ) |
552 | * | 668 | * |
553 | * @param room Room handle | 669 | * @param[in/out] room Room handle |
554 | */ | 670 | */ |
555 | void | 671 | void |
556 | GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room); | 672 | GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room); |
557 | 673 | ||
558 | /** | 674 | /** |
559 | * Get the contact of a member in a <i>room</i> identified by their <i>id</i>. | 675 | * Get the contact of a member in a <i>room</i> which sent a specific message identified with a given <i>hash</i>. |
560 | * | 676 | * |
561 | * Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed. | 677 | * Notice that contacts are independent of rooms but will be removed if all rooms containing these contacts get closed. |
562 | * | 678 | * |
563 | * @param room Room handle | 679 | * @param[in] room Room handle |
564 | * @param id Hash identifying a member | 680 | * @param[in] hash Hash identifying a message |
565 | * @return Contact handle, NULL if <i>id</i> is not in use | 681 | * @return Contact handle, NULL otherwise |
566 | */ | 682 | */ |
567 | struct GNUNET_MESSENGER_Contact* | 683 | struct GNUNET_MESSENGER_Contact* |
568 | GNUNET_MESSENGER_get_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ShortHashCode *id); | 684 | GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); |
569 | 685 | ||
570 | /** | 686 | /** |
571 | * Get the name used by the <i>contact</i>. | 687 | * Get the name used by the <i>contact</i>. |
572 | * | 688 | * |
573 | * @param contact Contact handle | 689 | * @param[in] contact Contact handle |
574 | * @return Name of <i>contact</i> or NULL | 690 | * @return Name of <i>contact</i> or NULL |
575 | */ | 691 | */ |
576 | const char* | 692 | const char* |
577 | GNUNET_MESSENGER_contact_get_name (const struct GNUNET_MESSENGER_Contact *contact); | 693 | GNUNET_MESSENGER_contact_get_name (const struct GNUNET_MESSENGER_Contact *contact); |
578 | 694 | ||
579 | /** | 695 | /** |
580 | * Get the public key used by the <i>contact</i>. | 696 | * Get the public key used by the <i>contact</i> or NULL if the anonymous key was used. |
581 | * | 697 | * |
582 | * @param contact Contact handle | 698 | * @param[in] contact Contact handle |
583 | * @return Public key of the ego used by <i>contact</i> | 699 | * @return Public key of the ego used by <i>contact</i> or NULL |
584 | */ | 700 | */ |
585 | const struct GNUNET_IDENTITY_PublicKey* | 701 | const struct GNUNET_IDENTITY_PublicKey* |
586 | GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact); | 702 | GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact); |
@@ -593,22 +709,44 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact | |||
593 | * | 709 | * |
594 | * Notice that all messages sent and received are also stored and can be propagated to new members entering the room. | 710 | * Notice that all messages sent and received are also stored and can be propagated to new members entering the room. |
595 | * | 711 | * |
596 | * @param room Room handle | 712 | * If you provide a specific <i>contact</i> as receiver of the given message, the message will automatically be |
597 | * @param message New message to send | 713 | * encrypted and sent as a private message (see #GNUNET_MESSENGER_MessagePrivate). Therefore the selected contact |
714 | * will be the only member receiving the actual message. | ||
715 | * | ||
716 | * Sending a message to all members in a given room can be done by providing NULL as contact. | ||
717 | * | ||
718 | * @param[in/out] room Room handle | ||
719 | * @param[in] message New message to send | ||
720 | * @param[in] contact Contact or NULL | ||
598 | */ | 721 | */ |
599 | void | 722 | void |
600 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message); | 723 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, |
724 | const struct GNUNET_MESSENGER_Contact* contact); | ||
601 | 725 | ||
602 | /** | 726 | /** |
603 | * Get the message in a <i>room</i> identified by its <i>hash</i>. | 727 | * Get the message in a <i>room</i> identified by its <i>hash</i>. |
604 | * | 728 | * |
605 | * @param room Room handle | 729 | * @param[in] room Room handle |
606 | * @param hash Hash identifying a message | 730 | * @param[in] hash Hash identifying a message |
607 | * @return Message struct or NULL if no message with that hash is known | 731 | * @return Message struct or NULL if no message with that hash is known |
608 | */ | 732 | */ |
609 | const struct GNUNET_MESSENGER_Message* | 733 | const struct GNUNET_MESSENGER_Message* |
610 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); | 734 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); |
611 | 735 | ||
736 | /** | ||
737 | * Iterates through all members of a given <i>room</i> and calls a selected <i>callback</i> | ||
738 | * for each of them with a provided closure. The callback will receive the contact of each | ||
739 | * member. The function returns the amount of members iterated with the given callback. | ||
740 | * | ||
741 | * @param[in] room Room handle | ||
742 | * @param[in] callback Function called for each member | ||
743 | * @param[in] cls Closure for the <i>callback</i> handler | ||
744 | * @return Amount of members iterated | ||
745 | */ | ||
746 | int | ||
747 | GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | ||
748 | void* cls); | ||
749 | |||
612 | #if 0 /* keep Emacsens' auto-indent happy */ | 750 | #if 0 /* keep Emacsens' auto-indent happy */ |
613 | { | 751 | { |
614 | #endif | 752 | #endif |
diff --git a/src/include/gnunet_plugin_lib.h b/src/include/gnunet_plugin_lib.h index ffffcab8b..d265eb343 100644 --- a/src/include/gnunet_plugin_lib.h +++ b/src/include/gnunet_plugin_lib.h | |||
@@ -122,6 +122,28 @@ GNUNET_PLUGIN_load_all (const char *basename, | |||
122 | 122 | ||
123 | 123 | ||
124 | /** | 124 | /** |
125 | * Load all compatible plugins with the given base name while inside the given | ||
126 | * context (i.e. a specific project data structure.) | ||
127 | * | ||
128 | * Note that the library must export symbols called `basename_ANYTHING_init` | ||
129 | * and `basename_ANYTHING__done`. These will be called when the library is | ||
130 | * loaded and unloaded respectively. | ||
131 | * | ||
132 | * @param ctx the context used to find the plugins | ||
133 | * @param basename basename of the plugins to load | ||
134 | * @param arg argument to the plugin initialization function | ||
135 | * @param cb function to call for each plugin found | ||
136 | * @param cb_cls closure for @a cb | ||
137 | */ | ||
138 | void | ||
139 | GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx, | ||
140 | const char *basename, | ||
141 | void *arg, | ||
142 | GNUNET_PLUGIN_LoaderCallback cb, | ||
143 | void *cb_cls); | ||
144 | |||
145 | |||
146 | /** | ||
125 | * Unload plugin (runs the "done" callback and returns whatever "done" | 147 | * Unload plugin (runs the "done" callback and returns whatever "done" |
126 | * returned). The plugin is then unloaded. | 148 | * returned). The plugin is then unloaded. |
127 | * | 149 | * |
diff --git a/src/include/gnunet_testbed_ng_service.h b/src/include/gnunet_testbed_ng_service.h new file mode 100644 index 000000000..370617e68 --- /dev/null +++ b/src/include/gnunet_testbed_ng_service.h | |||
@@ -0,0 +1,216 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author t3sserakt | ||
23 | * | ||
24 | * @file | ||
25 | * API for writing tests and creating large-scale emulation testbeds for GNUnet with command pattern. | ||
26 | * | ||
27 | * @defgroup testbed Testbed service | ||
28 | * Writing tests and creating large-scale emulation testbeds for GNUnet with command pattern. | ||
29 | * | ||
30 | * @see [Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-NG-Subsystem) | ||
31 | * | ||
32 | * @{ | ||
33 | */ | ||
34 | |||
35 | #ifndef GNUNET_TESTBED_NG_SERVICE_H | ||
36 | #define GNUNET_TESTBED_NG_SERVICE_H | ||
37 | |||
38 | #include "gnunet_util_lib.h" | ||
39 | #include "gnunet_testing_ng_lib.h" | ||
40 | |||
41 | struct TngState; | ||
42 | |||
43 | struct PeerCmdState | ||
44 | { | ||
45 | /** | ||
46 | * The label of a controller command. | ||
47 | */ | ||
48 | const char *controller_label; | ||
49 | |||
50 | /** | ||
51 | * Handle to operation | ||
52 | */ | ||
53 | struct GNUNET_TESTBED_Operation *operation; | ||
54 | |||
55 | /** | ||
56 | * Name of the host, use "NULL" for localhost. | ||
57 | */ | ||
58 | const char *hostname; | ||
59 | |||
60 | /** | ||
61 | * Username to use for the login; may be NULL. | ||
62 | */ | ||
63 | const char *username; | ||
64 | |||
65 | /** | ||
66 | * Port number to use for ssh; use 0 to let ssh decide. | ||
67 | */ | ||
68 | uint16_t port; | ||
69 | |||
70 | /** | ||
71 | * The configuration to use as a template while starting a controller | ||
72 | * on this host. Operation queue sizes specific to a host are also | ||
73 | * read from this configuration handle. | ||
74 | */ | ||
75 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
76 | |||
77 | /** | ||
78 | * The host to run peers and controllers on | ||
79 | */ | ||
80 | struct GNUNET_TESTBED_Host *host; | ||
81 | |||
82 | /** | ||
83 | * Abort task identifier | ||
84 | */ | ||
85 | struct GNUNET_SCHEDULER_Task *abort_task; | ||
86 | |||
87 | /** | ||
88 | * Flag indicating if peer is ready. | ||
89 | */ | ||
90 | int peer_ready; | ||
91 | |||
92 | /** | ||
93 | * Flag indicating controller is going down. | ||
94 | */ | ||
95 | int peer_going_down; | ||
96 | |||
97 | /** | ||
98 | * Interpreter state. | ||
99 | */ | ||
100 | struct GNUNET_TESTING_Interpreter *is; | ||
101 | |||
102 | /** | ||
103 | * Peer to start | ||
104 | */ | ||
105 | struct GNUNET_TESTBED_Peer *peer; | ||
106 | }; | ||
107 | |||
108 | struct ControllerState | ||
109 | { | ||
110 | /** | ||
111 | * The ip address of the controller which will be set as TRUSTED | ||
112 | * HOST(all connections form this ip are permitted by the testbed) when | ||
113 | * starting testbed controller at host. This can either be a single ip | ||
114 | * address or a network address in CIDR notation. | ||
115 | */ | ||
116 | const char *trusted_ip; | ||
117 | |||
118 | /** | ||
119 | * Name of the host, use "NULL" for localhost. | ||
120 | */ | ||
121 | const char *hostname; | ||
122 | |||
123 | /** | ||
124 | * Username to use for the login; may be NULL. | ||
125 | */ | ||
126 | const char *username; | ||
127 | |||
128 | /** | ||
129 | * Port number to use for ssh; use 0 to let ssh decide. | ||
130 | */ | ||
131 | uint16_t port; | ||
132 | |||
133 | /** | ||
134 | * The configuration to use as a template while starting a controller | ||
135 | * on this host. Operation queue sizes specific to a host are also | ||
136 | * read from this configuration handle. | ||
137 | */ | ||
138 | struct GNUNET_CONFIGURATION_Handle *cfg; | ||
139 | |||
140 | /** | ||
141 | * The host to run peers and controllers on | ||
142 | */ | ||
143 | struct GNUNET_TESTBED_Host *host; | ||
144 | |||
145 | /** | ||
146 | * The controller process | ||
147 | */ | ||
148 | struct GNUNET_TESTBED_ControllerProc *cp; | ||
149 | |||
150 | /** | ||
151 | * The controller handle | ||
152 | */ | ||
153 | struct GNUNET_TESTBED_Controller *controller; | ||
154 | |||
155 | /** | ||
156 | * A bit mask with set of events to call the controller for. | ||
157 | */ | ||
158 | uint64_t event_mask; | ||
159 | |||
160 | /** | ||
161 | * Abort task identifier | ||
162 | */ | ||
163 | struct GNUNET_SCHEDULER_Task *abort_task; | ||
164 | |||
165 | /** | ||
166 | * Handle for host registration | ||
167 | */ | ||
168 | struct GNUNET_TESTBED_HostRegistrationHandle *reg_handle; | ||
169 | |||
170 | /** | ||
171 | * Flag indicating if host create with controller is ready. | ||
172 | */ | ||
173 | int host_ready; | ||
174 | |||
175 | /** | ||
176 | * Flag indicating controller is going down. | ||
177 | */ | ||
178 | int controller_going_down; | ||
179 | |||
180 | /** | ||
181 | * Interpreter state. | ||
182 | */ | ||
183 | struct GNUNET_TESTING_Interpreter *is; | ||
184 | }; | ||
185 | |||
186 | /** | ||
187 | * Offer data from trait | ||
188 | * | ||
189 | * @param cmd command to extract the controller from. | ||
190 | * @param pt pointer to controller. | ||
191 | * @return #GNUNET_OK on success. | ||
192 | */ | ||
193 | int | ||
194 | GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd, | ||
195 | struct GNUNET_TESTBED_Controller ** | ||
196 | controller); | ||
197 | |||
198 | struct GNUNET_TESTING_Command | ||
199 | GNUNET_TESTBED_cmd_controller (const char *label, | ||
200 | const char *trusted_ip, | ||
201 | const char *hostname, | ||
202 | const char *username, | ||
203 | uint16_t port, | ||
204 | struct GNUNET_CONFIGURATION_Handle *cfg, | ||
205 | uint64_t event_mask); | ||
206 | |||
207 | void | ||
208 | GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs); | ||
209 | |||
210 | void | ||
211 | GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps); | ||
212 | |||
213 | void | ||
214 | GNUNET_TESTBED_shutdown_service (struct TngState *ss); | ||
215 | |||
216 | #endif | ||
diff --git a/src/include/gnunet_testbed_service.h b/src/include/gnunet_testbed_service.h index 70cbfa90d..acdfb2034 100644 --- a/src/include/gnunet_testbed_service.h +++ b/src/include/gnunet_testbed_service.h | |||
@@ -27,7 +27,7 @@ | |||
27 | * @defgroup testbed Testbed service | 27 | * @defgroup testbed Testbed service |
28 | * Writing tests and creating large-scale emulation testbeds for GNUnet. | 28 | * Writing tests and creating large-scale emulation testbeds for GNUnet. |
29 | * | 29 | * |
30 | * @see [Documentation](https://gnunet.org/gnunet-testbed-subsystem) | 30 | * @see [Documentation](https://docs.gnunet.org/handbook/gnunet.html#TESTBED-Subsystem) |
31 | * | 31 | * |
32 | * @{ | 32 | * @{ |
33 | */ | 33 | */ |
diff --git a/src/include/gnunet_testing_ng_lib.h b/src/include/gnunet_testing_ng_lib.h new file mode 100644 index 000000000..001d92aad --- /dev/null +++ b/src/include/gnunet_testing_ng_lib.h | |||
@@ -0,0 +1,833 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @brief API for writing an interpreter to test GNUnet components | ||
23 | * @author Christian Grothoff <christian@grothoff.org> | ||
24 | * @author Marcello Stanisci | ||
25 | * @author t3sserakt | ||
26 | */ | ||
27 | #ifndef GNUNET_TESTING_NG_LIB_H | ||
28 | #define GNUNET_TESTING_NG_LIB_H | ||
29 | |||
30 | #include "gnunet_util_lib.h" | ||
31 | |||
32 | |||
33 | /* ********************* Helper functions ********************* */ | ||
34 | |||
35 | /** | ||
36 | * Print failing line number and trigger shutdown. Useful | ||
37 | * quite any time after the command "run" method has been called. | ||
38 | */ | ||
39 | #define GNUNET_TESTING_FAIL(is) \ | ||
40 | do \ | ||
41 | { \ | ||
42 | GNUNET_break (0); \ | ||
43 | GNUNET_TESTING_interpreter_fail (is); \ | ||
44 | return; \ | ||
45 | } while (0) | ||
46 | |||
47 | |||
48 | /* ******************* Generic interpreter logic ************ */ | ||
49 | |||
50 | /** | ||
51 | * Global state of the interpreter, used by a command | ||
52 | * to access information about other commands. | ||
53 | */ | ||
54 | struct GNUNET_TESTING_Interpreter; | ||
55 | |||
56 | /** | ||
57 | * A command to be run by the interpreter. | ||
58 | */ | ||
59 | struct GNUNET_TESTING_Command | ||
60 | { | ||
61 | |||
62 | /** | ||
63 | * Closure for all commands with command-specific context information. | ||
64 | */ | ||
65 | void *cls; | ||
66 | |||
67 | /** | ||
68 | * Label for the command. | ||
69 | */ | ||
70 | const char *label; | ||
71 | |||
72 | /** | ||
73 | * Runs the command. Note that upon return, the interpreter | ||
74 | * will not automatically run the next command, as the command | ||
75 | * may continue asynchronously in other scheduler tasks. Thus, | ||
76 | * the command must ensure to eventually call | ||
77 | * #GNUNET_TESTING_interpreter_next() or | ||
78 | * #GNUNET_TESTING_interpreter_fail(). | ||
79 | * | ||
80 | * If this function creates some asynchronous activity, it should | ||
81 | * initialize @e finish to a function that can be used to wait for | ||
82 | * the asynchronous activity to terminate. | ||
83 | * | ||
84 | * @param cls closure | ||
85 | * @param cmd command being run | ||
86 | * @param i interpreter state | ||
87 | */ | ||
88 | void | ||
89 | (*run)(void *cls, | ||
90 | const struct GNUNET_TESTING_Command *cmd, | ||
91 | struct GNUNET_TESTING_Interpreter *i); | ||
92 | |||
93 | /** | ||
94 | * Wait for any asynchronous execution of @e run to conclude, | ||
95 | * then call finish_cont. Finish may only be called once per command. | ||
96 | * | ||
97 | * This member may be NULL if this command is a synchronous command, | ||
98 | * and also should be set to NULL once the command has finished. | ||
99 | * | ||
100 | * @param cls closure | ||
101 | * @param cont function to call upon completion, can be NULL | ||
102 | * @param cont_cls closure for @a cont | ||
103 | */ | ||
104 | bool | ||
105 | (*finish)(void *cls, | ||
106 | GNUNET_SCHEDULER_TaskCallback cont, | ||
107 | void *cont_cls); | ||
108 | |||
109 | /** | ||
110 | * Task for running the finish function. | ||
111 | */ | ||
112 | struct GNUNET_SCHEDULER_Task *finish_task; | ||
113 | |||
114 | /** | ||
115 | * Clean up after the command. Run during forced termination | ||
116 | * (CTRL-C) or test failure or test success. | ||
117 | * | ||
118 | * @param cls closure | ||
119 | * @param cmd command being cleaned up | ||
120 | */ | ||
121 | void | ||
122 | (*cleanup)(void *cls, | ||
123 | const struct GNUNET_TESTING_Command *cmd); | ||
124 | |||
125 | /** | ||
126 | * Extract information from a command that is useful for other | ||
127 | * commands. | ||
128 | * | ||
129 | * @param cls closure | ||
130 | * @param[out] ret result (could be anything) | ||
131 | * @param trait name of the trait | ||
132 | * @param index index number of the object to extract. | ||
133 | * @return #GNUNET_OK on success | ||
134 | */ | ||
135 | int | ||
136 | (*traits)(void *cls, | ||
137 | const void **ret, | ||
138 | const char *trait, | ||
139 | unsigned int index); | ||
140 | |||
141 | /** | ||
142 | * When did the execution of this command start? | ||
143 | */ | ||
144 | struct GNUNET_TIME_Absolute start_time; | ||
145 | |||
146 | /** | ||
147 | * When did the execution of this command finish? | ||
148 | */ | ||
149 | struct GNUNET_TIME_Absolute finish_time; | ||
150 | |||
151 | /** | ||
152 | * When did we start the last run of this command? Delta to @e finish_time | ||
153 | * gives the latency for the last successful run. Useful in case @e | ||
154 | * num_tries was positive and the command was run multiple times. In that | ||
155 | * case, the @e start_time gives the time when we first tried to run the | ||
156 | * command, so the difference between @e start_time and @e finish_time would | ||
157 | * be the time all of the @e num_tries took, while the delta to @e | ||
158 | * last_req_time is the time the last (successful) execution took. | ||
159 | */ | ||
160 | struct GNUNET_TIME_Absolute last_req_time; | ||
161 | |||
162 | /** | ||
163 | * How often did we try to execute this command? (In case it is a request | ||
164 | * that is repated.) Note that a command must have some build-in retry | ||
165 | * mechanism for this value to be useful. | ||
166 | */ | ||
167 | unsigned int num_tries; | ||
168 | |||
169 | /** | ||
170 | * In case @e asynchronous_finish is true, how long should we wait for this | ||
171 | * command to complete? If @e finish did not complete after this amount of | ||
172 | * time, the interpreter will fail. Should be set generously to ensure | ||
173 | * tests do not fail on slow systems. | ||
174 | */ | ||
175 | struct GNUNET_TIME_Relative default_timeout; | ||
176 | |||
177 | /** | ||
178 | * If "true", the interpreter should not immediately call | ||
179 | * @e finish, even if @e finish is non-NULL. Otherwise, | ||
180 | * #TALER_TESTING_cmd_finish() must be used | ||
181 | * to ensure that a command actually completed. | ||
182 | */ | ||
183 | bool asynchronous_finish; | ||
184 | |||
185 | }; | ||
186 | |||
187 | |||
188 | /** | ||
189 | * Struct to use for command-specific context information closure of a command waiting | ||
190 | * for another command. | ||
191 | */ | ||
192 | struct SyncState | ||
193 | { | ||
194 | /** | ||
195 | * Closure for all commands with command-specific context information. | ||
196 | */ | ||
197 | void *cls; | ||
198 | |||
199 | /** | ||
200 | * The asynchronous command the synchronous command of this closure waits for. | ||
201 | */ | ||
202 | const struct GNUNET_TESTING_Command *async_cmd; | ||
203 | |||
204 | /** | ||
205 | * Task for running the finish method of the asynchronous task the command is waiting for. | ||
206 | */ | ||
207 | struct GNUNET_SCHEDULER_Task *finish_task; | ||
208 | |||
209 | /** | ||
210 | * When did the execution of this commands finish function start? | ||
211 | */ | ||
212 | struct GNUNET_TIME_Absolute start_finish_time; | ||
213 | }; | ||
214 | |||
215 | /** | ||
216 | * Lookup command by label. | ||
217 | * | ||
218 | * @param label label of the command to lookup. | ||
219 | * @return the command, if it is found, or NULL. | ||
220 | */ | ||
221 | const struct GNUNET_TESTING_Command * | ||
222 | GNUNET_TESTING_interpreter_lookup_command ( | ||
223 | const char *label); | ||
224 | |||
225 | |||
226 | /** | ||
227 | * Obtain label of the command being now run. | ||
228 | * | ||
229 | * @param is interpreter state. | ||
230 | * @return the label. | ||
231 | */ | ||
232 | const char * | ||
233 | GNUNET_TESTING_interpreter_get_current_label ( | ||
234 | struct GNUNET_TESTING_Interpreter *is); | ||
235 | |||
236 | |||
237 | /** | ||
238 | * Current command failed, clean up and fail the test case. | ||
239 | * | ||
240 | * @param is interpreter state. | ||
241 | */ | ||
242 | void | ||
243 | GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is); | ||
244 | |||
245 | |||
246 | /** | ||
247 | * Create command array terminator. | ||
248 | * | ||
249 | * @return a end-command. | ||
250 | */ | ||
251 | struct GNUNET_TESTING_Command | ||
252 | GNUNET_TESTING_cmd_end (void); | ||
253 | |||
254 | |||
255 | /** | ||
256 | * Turn asynchronous command into non blocking command by setting asynchronous_finish to true. | ||
257 | * | ||
258 | * @param cmd command to make synchronous. | ||
259 | * @return a finish-command. | ||
260 | */ | ||
261 | const struct GNUNET_TESTING_Command | ||
262 | GNUNET_TESTING_cmd_make_unblocking (const struct GNUNET_TESTING_Command cmd); | ||
263 | |||
264 | |||
265 | /** | ||
266 | * Create (synchronous) command that waits for another command to finish. | ||
267 | * If @a cmd_ref did not finish after @a timeout, this command will fail | ||
268 | * the test case. | ||
269 | * | ||
270 | * @param finish_label label for this command | ||
271 | * @param cmd_ref reference to a previous command which we should | ||
272 | * wait for (call `finish()` on) | ||
273 | * @param timeout how long to wait at most for @a cmd_ref to finish | ||
274 | * @return a finish-command. | ||
275 | */ | ||
276 | const struct GNUNET_TESTING_Command | ||
277 | GNUNET_TESTING_cmd_finish (const char *finish_label, | ||
278 | const char *cmd_ref, | ||
279 | struct GNUNET_TIME_Relative timeout); | ||
280 | |||
281 | |||
282 | /** | ||
283 | * Make the instruction pointer point to @a target_label | ||
284 | * only if @a counter is greater than zero. | ||
285 | * | ||
286 | * @param label command label | ||
287 | * @param target_label label of the new instruction pointer's destination after the jump; | ||
288 | * must be before the current instruction | ||
289 | * @param counter counts how many times the rewinding is to happen. | ||
290 | */ | ||
291 | struct GNUNET_TESTING_Command | ||
292 | GNUNET_TESTING_cmd_rewind_ip (const char *label, | ||
293 | const char *target_label, | ||
294 | unsigned int counter); | ||
295 | |||
296 | |||
297 | /** | ||
298 | * Wait until we receive SIGCHLD signal. Then obtain the process trait of the | ||
299 | * current command, wait on the the zombie and continue with the next command. | ||
300 | * | ||
301 | * @param is interpreter state. | ||
302 | */ | ||
303 | // void | ||
304 | // GNUNET_TESTING_wait_for_sigchld (struct GNUNET_TESTING_Interpreter *is); | ||
305 | // => replace with child_management.c | ||
306 | |||
307 | |||
308 | /** | ||
309 | * Start scheduling loop with signal handlers and run the | ||
310 | * test suite with the @a commands. | ||
311 | * | ||
312 | * @param cfg_name name of configuration file to use | ||
313 | * @param commands the list of command to execute | ||
314 | * @param timeout how long to wait for each command to execute | ||
315 | * @return #GNUNET_OK if all is okay, != #GNUNET_OK otherwise. | ||
316 | * non-GNUNET_OK codes are #GNUNET_SYSERR most of the | ||
317 | * times. | ||
318 | */ | ||
319 | int | ||
320 | GNUNET_TESTING_run (const char *cfg_filename, | ||
321 | struct GNUNET_TESTING_Command *commands, | ||
322 | struct GNUNET_TIME_Relative timeout); | ||
323 | |||
324 | |||
325 | /** | ||
326 | * Look for substring in a programs' name. | ||
327 | * | ||
328 | * @param prog program's name to look into | ||
329 | * @param marker chunk to find in @a prog | ||
330 | */ | ||
331 | int | ||
332 | GNUNET_TESTING_has_in_name (const char *prog, | ||
333 | const char *marker); | ||
334 | |||
335 | |||
336 | /* ************** Specific interpreter commands ************ */ | ||
337 | |||
338 | /** | ||
339 | * Create a "signal" CMD. | ||
340 | * | ||
341 | * @param label command label. | ||
342 | * @param process_label label of a command that has a process trait | ||
343 | * @param process_index index of the process trait at @a process_label | ||
344 | * @param signal signal to send to @a process. | ||
345 | * @return the command. | ||
346 | */ | ||
347 | struct GNUNET_TESTING_Command | ||
348 | GNUNET_TESTING_cmd_signal (const char *label, | ||
349 | const char *process_label, | ||
350 | unsigned int process_index, | ||
351 | int signal); | ||
352 | |||
353 | |||
354 | /** | ||
355 | * Sleep for @a duration. | ||
356 | * | ||
357 | * @param label command label. | ||
358 | * @param duration time to sleep | ||
359 | * @return the command. | ||
360 | */ | ||
361 | struct GNUNET_TESTING_Command | ||
362 | GNUNET_TESTING_cmd_sleep (const char *label, | ||
363 | struct GNUNET_TIME_Relative duration); | ||
364 | |||
365 | |||
366 | /** | ||
367 | * Create a "batch" command. Such command takes a end_CMD-terminated array of | ||
368 | * CMDs and executed them. Once it hits the end CMD, it passes the control to | ||
369 | * the next top-level CMD, regardless of it being another batch or ordinary | ||
370 | * CMD. | ||
371 | * | ||
372 | * @param label the command label. | ||
373 | * @param batch array of CMDs to execute. | ||
374 | * @return the command. | ||
375 | */ | ||
376 | struct GNUNET_TESTING_Command | ||
377 | GNUNET_TESTING_cmd_batch (const char *label, | ||
378 | struct GNUNET_TESTING_Command *batch); | ||
379 | |||
380 | |||
381 | /** | ||
382 | * Test if this command is a batch command. | ||
383 | * | ||
384 | * @return false if not, true if it is a batch command | ||
385 | */ | ||
386 | // TODO: figure out if this needs to be exposed in the public API. | ||
387 | int | ||
388 | GNUNET_TESTING_cmd_is_batch (const struct GNUNET_TESTING_Command *cmd); | ||
389 | |||
390 | |||
391 | /** | ||
392 | * Advance internal pointer to next command. | ||
393 | * | ||
394 | * @param is interpreter state. | ||
395 | */ | ||
396 | // TODO: figure out if this needs to be exposed in the public API. | ||
397 | void | ||
398 | GNUNET_TESTING_cmd_batch_next (struct GNUNET_TESTING_Interpreter *is); | ||
399 | |||
400 | |||
401 | /** | ||
402 | * Obtain what command the batch is at. | ||
403 | * | ||
404 | * @return cmd current batch command | ||
405 | */ | ||
406 | // TODO: figure out if this needs to be exposed in the public API. | ||
407 | struct GNUNET_TESTING_Command * | ||
408 | GNUNET_TESTING_cmd_batch_get_current (const struct GNUNET_TESTING_Command *cmd); | ||
409 | |||
410 | |||
411 | /** | ||
412 | * Set what command the batch should be at. | ||
413 | * | ||
414 | * @param cmd current batch command | ||
415 | * @param new_ip where to move the IP | ||
416 | */ | ||
417 | // TODO: figure out if this needs to be exposed in the public API. | ||
418 | void | ||
419 | GNUNET_TESTING_cmd_batch_set_current (const struct GNUNET_TESTING_Command *cmd, | ||
420 | unsigned int new_ip); | ||
421 | |||
422 | |||
423 | /** | ||
424 | * Performance counter. | ||
425 | */ | ||
426 | struct GNUNET_TESTING_Timer | ||
427 | { | ||
428 | /** | ||
429 | * For which type of commands. | ||
430 | */ | ||
431 | const char *prefix; | ||
432 | |||
433 | /** | ||
434 | * Total time spend in all commands of this type. | ||
435 | */ | ||
436 | struct GNUNET_TIME_Relative total_duration; | ||
437 | |||
438 | /** | ||
439 | * Total time spend waiting for the *successful* exeuction | ||
440 | * in all commands of this type. | ||
441 | */ | ||
442 | struct GNUNET_TIME_Relative success_latency; | ||
443 | |||
444 | /** | ||
445 | * Number of commands summed up. | ||
446 | */ | ||
447 | unsigned int num_commands; | ||
448 | |||
449 | /** | ||
450 | * Number of retries summed up. | ||
451 | */ | ||
452 | unsigned int num_retries; | ||
453 | }; | ||
454 | |||
455 | |||
456 | /** | ||
457 | * Obtain performance data from the interpreter. | ||
458 | * | ||
459 | * @param timers what commands (by label) to obtain runtimes for | ||
460 | * @return the command | ||
461 | */ | ||
462 | struct GNUNET_TESTING_Command | ||
463 | GNUNET_TESTING_cmd_stat (struct GNUNET_TESTING_Timer *timers); | ||
464 | |||
465 | |||
466 | /* *** Generic trait logic for implementing traits ********* */ | ||
467 | |||
468 | /** | ||
469 | * A trait. | ||
470 | */ | ||
471 | struct GNUNET_TESTING_Trait | ||
472 | { | ||
473 | /** | ||
474 | * Index number associated with the trait. This gives the | ||
475 | * possibility to have _multiple_ traits on offer under the | ||
476 | * same name. | ||
477 | */ | ||
478 | unsigned int index; | ||
479 | |||
480 | /** | ||
481 | * Trait type, for example "reserve-pub" or "coin-priv". | ||
482 | */ | ||
483 | const char *trait_name; | ||
484 | |||
485 | /** | ||
486 | * Pointer to the piece of data to offer. | ||
487 | */ | ||
488 | const void *ptr; | ||
489 | }; | ||
490 | |||
491 | |||
492 | /** | ||
493 | * "end" trait. Because traits are offered into arrays, | ||
494 | * this type of trait is used to mark the end of such arrays; | ||
495 | * useful when iterating over those. | ||
496 | */ | ||
497 | struct GNUNET_TESTING_Trait | ||
498 | GNUNET_TESTING_trait_end (void); | ||
499 | |||
500 | |||
501 | /** | ||
502 | * Extract a trait. | ||
503 | * | ||
504 | * @param traits the array of all the traits. | ||
505 | * @param[out] ret where to store the result. | ||
506 | * @param trait type of the trait to extract. | ||
507 | * @param index index number of the trait to extract. | ||
508 | * @return #GNUNET_OK when the trait is found. | ||
509 | */ | ||
510 | int | ||
511 | GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | ||
512 | const void **ret, | ||
513 | const char *trait, | ||
514 | unsigned int index); | ||
515 | |||
516 | |||
517 | /* ****** Specific traits supported by this component ******* */ | ||
518 | |||
519 | /** | ||
520 | * Obtain location where a command stores a pointer to a process. | ||
521 | * | ||
522 | * @param cmd command to extract trait from. | ||
523 | * @param index which process to pick if @a cmd | ||
524 | * has multiple on offer. | ||
525 | * @param[out] processp set to the address of the pointer to the | ||
526 | * process. | ||
527 | * @return #GNUNET_OK on success. | ||
528 | */ | ||
529 | int | ||
530 | GNUNET_TESTING_get_trait_process (const struct GNUNET_TESTING_Command *cmd, | ||
531 | unsigned int index, | ||
532 | struct GNUNET_OS_Process ***processp); | ||
533 | |||
534 | |||
535 | /** | ||
536 | * Offer location where a command stores a pointer to a process. | ||
537 | * | ||
538 | * @param index offered location index number, in case there are | ||
539 | * multiple on offer. | ||
540 | * @param processp process location to offer. | ||
541 | * @return the trait. | ||
542 | */ | ||
543 | struct GNUNET_TESTING_Trait | ||
544 | GNUNET_TESTING_make_trait_process (unsigned int index, | ||
545 | struct GNUNET_OS_Process **processp); | ||
546 | |||
547 | |||
548 | /** | ||
549 | * Offer number trait, 32-bit version. | ||
550 | * | ||
551 | * @param index the number's index number. | ||
552 | * @param n number to offer. | ||
553 | */ | ||
554 | struct GNUNET_TESTING_Trait | ||
555 | GNUNET_TESTING_make_trait_uint32 (unsigned int index, | ||
556 | const uint32_t *n); | ||
557 | |||
558 | |||
559 | /** | ||
560 | * Obtain a "number" value from @a cmd, 32-bit version. | ||
561 | * | ||
562 | * @param cmd command to extract the number from. | ||
563 | * @param index the number's index number. | ||
564 | * @param[out] n set to the number coming from @a cmd. | ||
565 | * @return #GNUNET_OK on success. | ||
566 | */ | ||
567 | int | ||
568 | GNUNET_TESTING_get_trait_uint32 (const struct GNUNET_TESTING_Command *cmd, | ||
569 | unsigned int index, | ||
570 | const uint32_t **n); | ||
571 | |||
572 | |||
573 | /** | ||
574 | * Offer number trait, 64-bit version. | ||
575 | * | ||
576 | * @param index the number's index number. | ||
577 | * @param n number to offer. | ||
578 | */ | ||
579 | struct GNUNET_TESTING_Trait | ||
580 | GNUNET_TESTING_make_trait_uint64 (unsigned int index, | ||
581 | const uint64_t *n); | ||
582 | |||
583 | |||
584 | /** | ||
585 | * Obtain a "number" value from @a cmd, 64-bit version. | ||
586 | * | ||
587 | * @param cmd command to extract the number from. | ||
588 | * @param index the number's index number. | ||
589 | * @param[out] n set to the number coming from @a cmd. | ||
590 | * @return #GNUNET_OK on success. | ||
591 | */ | ||
592 | int | ||
593 | GNUNET_TESTING_get_trait_uint64 (const struct GNUNET_TESTING_Command *cmd, | ||
594 | unsigned int index, | ||
595 | const uint64_t **n); | ||
596 | |||
597 | |||
598 | /** | ||
599 | * Offer number trait, 64-bit signed version. | ||
600 | * | ||
601 | * @param index the number's index number. | ||
602 | * @param n number to offer. | ||
603 | */ | ||
604 | struct GNUNET_TESTING_Trait | ||
605 | GNUNET_TESTING_make_trait_int64 (unsigned int index, | ||
606 | const int64_t *n); | ||
607 | |||
608 | |||
609 | /** | ||
610 | * Obtain a "number" value from @a cmd, 64-bit signed version. | ||
611 | * | ||
612 | * @param cmd command to extract the number from. | ||
613 | * @param index the number's index number. | ||
614 | * @param[out] n set to the number coming from @a cmd. | ||
615 | * @return #GNUNET_OK on success. | ||
616 | */ | ||
617 | int | ||
618 | GNUNET_TESTING_get_trait_int64 (const struct GNUNET_TESTING_Command *cmd, | ||
619 | unsigned int index, | ||
620 | const int64_t **n); | ||
621 | |||
622 | |||
623 | /** | ||
624 | * Offer a number. | ||
625 | * | ||
626 | * @param index the number's index number. | ||
627 | * @param n the number to offer. | ||
628 | * @return #GNUNET_OK on success. | ||
629 | */ | ||
630 | struct GNUNET_TESTING_Trait | ||
631 | GNUNET_TESTING_make_trait_uint (unsigned int index, | ||
632 | const unsigned int *i); | ||
633 | |||
634 | |||
635 | /** | ||
636 | * Obtain a number from @a cmd. | ||
637 | * | ||
638 | * @param cmd command to extract the number from. | ||
639 | * @param index the number's index number. | ||
640 | * @param[out] n set to the number coming from @a cmd. | ||
641 | * @return #GNUNET_OK on success. | ||
642 | */ | ||
643 | int | ||
644 | GNUNET_TESTING_get_trait_uint (const struct GNUNET_TESTING_Command *cmd, | ||
645 | unsigned int index, | ||
646 | const unsigned int **n); | ||
647 | |||
648 | /** | ||
649 | * Obtain a string from @a cmd. | ||
650 | * | ||
651 | * @param cmd command to extract the subject from. | ||
652 | * @param index index number associated with the transfer | ||
653 | * subject to offer. | ||
654 | * @param[out] s where to write the offered | ||
655 | * string. | ||
656 | * @return #GNUNET_OK on success. | ||
657 | */ | ||
658 | int | ||
659 | GNUNET_TESTING_get_trait_string ( | ||
660 | const struct GNUNET_TESTING_Command *cmd, | ||
661 | unsigned int index, | ||
662 | const char **s); | ||
663 | |||
664 | |||
665 | /** | ||
666 | * Offer string subject. | ||
667 | * | ||
668 | * @param index index number associated with the transfer | ||
669 | * subject being offered. | ||
670 | * @param s string to offer. | ||
671 | * @return the trait. | ||
672 | */ | ||
673 | struct GNUNET_TESTING_Trait | ||
674 | GNUNET_TESTING_make_trait_string (unsigned int index, | ||
675 | const char *s); | ||
676 | |||
677 | /** | ||
678 | * Offer a command in a trait. | ||
679 | * | ||
680 | * @param index always zero. Commands offering this | ||
681 | * kind of traits do not need this index. For | ||
682 | * example, a "meta" CMD returns always the | ||
683 | * CMD currently being executed. | ||
684 | * @param cmd wire details to offer. | ||
685 | * | ||
686 | * @return the trait. | ||
687 | */ | ||
688 | struct GNUNET_TESTING_Trait | ||
689 | GNUNET_TESTING_make_trait_cmd (unsigned int index, | ||
690 | const struct GNUNET_TESTING_Command *cmd); | ||
691 | |||
692 | |||
693 | /** | ||
694 | * Obtain a command from @a cmd. | ||
695 | * | ||
696 | * @param cmd command to extract the command from. | ||
697 | * @param index always zero. Commands offering this | ||
698 | * kind of traits do not need this index. For | ||
699 | * example, a "meta" CMD returns always the | ||
700 | * CMD currently being executed. | ||
701 | * @param[out] _cmd where to write the wire details. | ||
702 | * @return #GNUNET_OK on success. | ||
703 | */ | ||
704 | int | ||
705 | GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd, | ||
706 | unsigned int index, | ||
707 | struct GNUNET_TESTING_Command **_cmd); | ||
708 | |||
709 | |||
710 | /** | ||
711 | * Obtain a uuid from @a cmd. | ||
712 | * | ||
713 | * @param cmd command to extract the uuid from. | ||
714 | * @param index which amount to pick if @a cmd has multiple | ||
715 | * on offer | ||
716 | * @param[out] uuid where to write the uuid. | ||
717 | * @return #GNUNET_OK on success. | ||
718 | */ | ||
719 | int | ||
720 | GNUNET_TESTING_get_trait_uuid (const struct GNUNET_TESTING_Command *cmd, | ||
721 | unsigned int index, | ||
722 | struct GNUNET_Uuid **uuid); | ||
723 | |||
724 | |||
725 | /** | ||
726 | * Offer a uuid in a trait. | ||
727 | * | ||
728 | * @param index which uuid to offer, in case there are | ||
729 | * multiple available. | ||
730 | * @param uuid the uuid to offer. | ||
731 | * | ||
732 | * @return the trait. | ||
733 | */ | ||
734 | struct GNUNET_TESTING_Trait | ||
735 | GNUNET_TESTING_make_trait_uuid (unsigned int index, | ||
736 | const struct GNUNET_Uuid *uuid); | ||
737 | |||
738 | |||
739 | /** | ||
740 | * Obtain a absolute time from @a cmd. | ||
741 | * | ||
742 | * @param cmd command to extract trait from | ||
743 | * @param index which time stamp to pick if | ||
744 | * @a cmd has multiple on offer. | ||
745 | * @param[out] time set to the wanted WTID. | ||
746 | * @return #GNUNET_OK on success | ||
747 | */ | ||
748 | int | ||
749 | GNUNET_TESTING_get_trait_absolute_time ( | ||
750 | const struct GNUNET_TESTING_Command *cmd, | ||
751 | unsigned int index, | ||
752 | const struct GNUNET_TIME_Absolute **time); | ||
753 | |||
754 | |||
755 | /** | ||
756 | * Offer a absolute time. | ||
757 | * | ||
758 | * @param index associate the object with this index | ||
759 | * @param time which object should be returned | ||
760 | * @return the trait. | ||
761 | */ | ||
762 | struct GNUNET_TESTING_Trait | ||
763 | GNUNET_TESTING_make_trait_absolute_time ( | ||
764 | unsigned int index, | ||
765 | const struct GNUNET_TIME_Absolute *time); | ||
766 | |||
767 | |||
768 | /** | ||
769 | * Obtain a relative time from @a cmd. | ||
770 | * | ||
771 | * @param cmd command to extract trait from | ||
772 | * @param index which time to pick if | ||
773 | * @a cmd has multiple on offer. | ||
774 | * @param[out] time set to the wanted WTID. | ||
775 | * @return #GNUNET_OK on success | ||
776 | */ | ||
777 | int | ||
778 | GNUNET_TESTING_get_trait_relative_time ( | ||
779 | const struct GNUNET_TESTING_Command *cmd, | ||
780 | unsigned int index, | ||
781 | const struct GNUNET_TIME_Relative **time); | ||
782 | |||
783 | |||
784 | /** | ||
785 | * Offer a relative time. | ||
786 | * | ||
787 | * @param index associate the object with this index | ||
788 | * @param time which object should be returned | ||
789 | * @return the trait. | ||
790 | */ | ||
791 | struct GNUNET_TESTING_Trait | ||
792 | GNUNET_TESTING_make_trait_relative_time ( | ||
793 | unsigned int index, | ||
794 | const struct GNUNET_TIME_Relative *time); | ||
795 | |||
796 | |||
797 | /** | ||
798 | * Create command. | ||
799 | * | ||
800 | * @param label name for command. | ||
801 | * @param now when the command was started. | ||
802 | * @return command. | ||
803 | */ | ||
804 | struct GNUNET_TESTING_Command | ||
805 | GNUNET_TESTING_cmd_hello_world_birth (const char *label, | ||
806 | struct GNUNET_TIME_Absolute *now); | ||
807 | |||
808 | /** | ||
809 | * Create command. | ||
810 | * | ||
811 | * @param label name for command. | ||
812 | * @param message initial message. | ||
813 | * @return command. | ||
814 | */ | ||
815 | struct GNUNET_TESTING_Command | ||
816 | GNUNET_TESTING_cmd_hello_world (const char *label, | ||
817 | const char *birthLabel, | ||
818 | char *message); | ||
819 | |||
820 | /** | ||
821 | * Offer data from trait | ||
822 | * | ||
823 | * @param cmd command to extract the url from. | ||
824 | * @param pt which url is to be picked, in case | ||
825 | * multiple are offered. | ||
826 | * @param[out] url where to write the url. | ||
827 | * @return #GNUNET_OK on success. | ||
828 | */ | ||
829 | int | ||
830 | GNUNET_TESTING_get_trait_what_am_i (const struct GNUNET_TESTING_Command *cmd, | ||
831 | char **what_am_i); | ||
832 | |||
833 | #endif | ||
diff --git a/src/json/json_helper.c b/src/json/json_helper.c index 621487f0a..32b262a87 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c | |||
@@ -28,9 +28,6 @@ | |||
28 | #include "gnunet_json_lib.h" | 28 | #include "gnunet_json_lib.h" |
29 | 29 | ||
30 | 30 | ||
31 | /** | ||
32 | * End of a parser specification. | ||
33 | */ | ||
34 | struct GNUNET_JSON_Specification | 31 | struct GNUNET_JSON_Specification |
35 | GNUNET_JSON_spec_end () | 32 | GNUNET_JSON_spec_end () |
36 | { | 33 | { |
@@ -84,14 +81,6 @@ parse_fixed_data (void *cls, | |||
84 | } | 81 | } |
85 | 82 | ||
86 | 83 | ||
87 | /** | ||
88 | * Variable size object (in network byte order, encoded using Crockford | ||
89 | * Base32hex encoding). | ||
90 | * | ||
91 | * @param name name of the JSON field | ||
92 | * @param[out] obj pointer where to write the data, must have @a size bytes | ||
93 | * @param size number of bytes expected in @a obj | ||
94 | */ | ||
95 | struct GNUNET_JSON_Specification | 84 | struct GNUNET_JSON_Specification |
96 | GNUNET_JSON_spec_fixed (const char *name, | 85 | GNUNET_JSON_spec_fixed (const char *name, |
97 | void *obj, | 86 | void *obj, |
@@ -168,6 +157,7 @@ static void | |||
168 | clean_variable_data (void *cls, | 157 | clean_variable_data (void *cls, |
169 | struct GNUNET_JSON_Specification *spec) | 158 | struct GNUNET_JSON_Specification *spec) |
170 | { | 159 | { |
160 | (void) cls; | ||
171 | if (0 != *spec->size_ptr) | 161 | if (0 != *spec->size_ptr) |
172 | { | 162 | { |
173 | GNUNET_free (*(void **) spec->ptr); | 163 | GNUNET_free (*(void **) spec->ptr); |
@@ -177,14 +167,6 @@ clean_variable_data (void *cls, | |||
177 | } | 167 | } |
178 | 168 | ||
179 | 169 | ||
180 | /** | ||
181 | * Variable size object (in network byte order, encoded using | ||
182 | * Crockford Base32hex encoding). | ||
183 | * | ||
184 | * @param name name of the JSON field | ||
185 | * @param[out] obj pointer where to write the data, will be allocated | ||
186 | * @param[out] size where to store the number of bytes allocated for @a obj | ||
187 | */ | ||
188 | struct GNUNET_JSON_Specification | 170 | struct GNUNET_JSON_Specification |
189 | GNUNET_JSON_spec_varsize (const char *name, | 171 | GNUNET_JSON_spec_varsize (const char *name, |
190 | void **obj, | 172 | void **obj, |
@@ -221,6 +203,7 @@ parse_string (void *cls, | |||
221 | { | 203 | { |
222 | const char *str; | 204 | const char *str; |
223 | 205 | ||
206 | (void) cls; | ||
224 | str = json_string_value (root); | 207 | str = json_string_value (root); |
225 | if (NULL == str) | 208 | if (NULL == str) |
226 | { | 209 | { |
@@ -232,12 +215,6 @@ parse_string (void *cls, | |||
232 | } | 215 | } |
233 | 216 | ||
234 | 217 | ||
235 | /** | ||
236 | * The expected field stores a string. | ||
237 | * | ||
238 | * @param name name of the JSON field | ||
239 | * @param strptr where to store a pointer to the field | ||
240 | */ | ||
241 | struct GNUNET_JSON_Specification | 218 | struct GNUNET_JSON_Specification |
242 | GNUNET_JSON_spec_string (const char *name, | 219 | GNUNET_JSON_spec_string (const char *name, |
243 | const char **strptr) | 220 | const char **strptr) |
@@ -301,12 +278,6 @@ clean_object (void *cls, | |||
301 | } | 278 | } |
302 | 279 | ||
303 | 280 | ||
304 | /** | ||
305 | * JSON object. | ||
306 | * | ||
307 | * @param name name of the JSON field | ||
308 | * @param[out] jsonp where to store the JSON found under @a name | ||
309 | */ | ||
310 | struct GNUNET_JSON_Specification | 281 | struct GNUNET_JSON_Specification |
311 | GNUNET_JSON_spec_json (const char *name, | 282 | GNUNET_JSON_spec_json (const char *name, |
312 | json_t **jsonp) | 283 | json_t **jsonp) |
@@ -356,12 +327,6 @@ parse_bool (void *cls, | |||
356 | } | 327 | } |
357 | 328 | ||
358 | 329 | ||
359 | /** | ||
360 | * boolean. | ||
361 | * | ||
362 | * @param name name of the JSON field | ||
363 | * @param[out] b where to store the boolean found under @a name | ||
364 | */ | ||
365 | struct GNUNET_JSON_Specification | 330 | struct GNUNET_JSON_Specification |
366 | GNUNET_JSON_spec_bool (const char *name, | 331 | GNUNET_JSON_spec_bool (const char *name, |
367 | bool *b) | 332 | bool *b) |
@@ -412,12 +377,6 @@ parse_u8 (void *cls, | |||
412 | } | 377 | } |
413 | 378 | ||
414 | 379 | ||
415 | /** | ||
416 | * 8-bit integer. | ||
417 | * | ||
418 | * @param name name of the JSON field | ||
419 | * @param[out] u8 where to store the integer found under @a name | ||
420 | */ | ||
421 | struct GNUNET_JSON_Specification | 380 | struct GNUNET_JSON_Specification |
422 | GNUNET_JSON_spec_uint8 (const char *name, | 381 | GNUNET_JSON_spec_uint8 (const char *name, |
423 | uint8_t *u8) | 382 | uint8_t *u8) |
@@ -468,12 +427,6 @@ parse_u16 (void *cls, | |||
468 | } | 427 | } |
469 | 428 | ||
470 | 429 | ||
471 | /** | ||
472 | * 16-bit integer. | ||
473 | * | ||
474 | * @param name name of the JSON field | ||
475 | * @param[out] u16 where to store the integer found under @a name | ||
476 | */ | ||
477 | struct GNUNET_JSON_Specification | 430 | struct GNUNET_JSON_Specification |
478 | GNUNET_JSON_spec_uint16 (const char *name, | 431 | GNUNET_JSON_spec_uint16 (const char *name, |
479 | uint16_t *u16) | 432 | uint16_t *u16) |
@@ -524,12 +477,6 @@ parse_u32 (void *cls, | |||
524 | } | 477 | } |
525 | 478 | ||
526 | 479 | ||
527 | /** | ||
528 | * 32-bit integer. | ||
529 | * | ||
530 | * @param name name of the JSON field | ||
531 | * @param[out] u32 where to store the integer found under @a name | ||
532 | */ | ||
533 | struct GNUNET_JSON_Specification | 480 | struct GNUNET_JSON_Specification |
534 | GNUNET_JSON_spec_uint32 (const char *name, | 481 | GNUNET_JSON_spec_uint32 (const char *name, |
535 | uint32_t *u32) | 482 | uint32_t *u32) |
@@ -575,12 +522,6 @@ parse_u64 (void *cls, | |||
575 | } | 522 | } |
576 | 523 | ||
577 | 524 | ||
578 | /** | ||
579 | * 64-bit integer. | ||
580 | * | ||
581 | * @param name name of the JSON field | ||
582 | * @param[out] u64 where to store the integer found under @a name | ||
583 | */ | ||
584 | struct GNUNET_JSON_Specification | 525 | struct GNUNET_JSON_Specification |
585 | GNUNET_JSON_spec_uint64 (const char *name, | 526 | GNUNET_JSON_spec_uint64 (const char *name, |
586 | uint64_t *u64) | 527 | uint64_t *u64) |
@@ -626,12 +567,6 @@ parse_i64 (void *cls, | |||
626 | } | 567 | } |
627 | 568 | ||
628 | 569 | ||
629 | /** | ||
630 | * 64-bit signed integer. | ||
631 | * | ||
632 | * @param name name of the JSON field | ||
633 | * @param[out] i64 where to store the integer found under @a name | ||
634 | */ | ||
635 | struct GNUNET_JSON_Specification | 570 | struct GNUNET_JSON_Specification |
636 | GNUNET_JSON_spec_int64 (const char *name, | 571 | GNUNET_JSON_spec_int64 (const char *name, |
637 | int64_t *i64) | 572 | int64_t *i64) |
@@ -705,12 +640,6 @@ parse_abs_time (void *cls, | |||
705 | } | 640 | } |
706 | 641 | ||
707 | 642 | ||
708 | /** | ||
709 | * Absolute time. | ||
710 | * | ||
711 | * @param name name of the JSON field | ||
712 | * @param[out] at where to store the absolute time found under @a name | ||
713 | */ | ||
714 | struct GNUNET_JSON_Specification | 643 | struct GNUNET_JSON_Specification |
715 | GNUNET_JSON_spec_absolute_time (const char *name, | 644 | GNUNET_JSON_spec_absolute_time (const char *name, |
716 | struct GNUNET_TIME_Absolute *at) | 645 | struct GNUNET_TIME_Absolute *at) |
@@ -759,12 +688,6 @@ parse_abs_time_nbo (void *cls, | |||
759 | } | 688 | } |
760 | 689 | ||
761 | 690 | ||
762 | /** | ||
763 | * Absolute time in network byte order. | ||
764 | * | ||
765 | * @param name name of the JSON field | ||
766 | * @param[out] at where to store the absolute time found under @a name | ||
767 | */ | ||
768 | struct GNUNET_JSON_Specification | 691 | struct GNUNET_JSON_Specification |
769 | GNUNET_JSON_spec_absolute_time_nbo (const char *name, | 692 | GNUNET_JSON_spec_absolute_time_nbo (const char *name, |
770 | struct GNUNET_TIME_AbsoluteNBO *at) | 693 | struct GNUNET_TIME_AbsoluteNBO *at) |
@@ -836,12 +759,6 @@ parse_rel_time (void *cls, | |||
836 | } | 759 | } |
837 | 760 | ||
838 | 761 | ||
839 | /** | ||
840 | * Relative time. | ||
841 | * | ||
842 | * @param name name of the JSON field | ||
843 | * @param[out] rt where to store the relative time found under @a name | ||
844 | */ | ||
845 | struct GNUNET_JSON_Specification | 762 | struct GNUNET_JSON_Specification |
846 | GNUNET_JSON_spec_relative_time (const char *name, | 763 | GNUNET_JSON_spec_relative_time (const char *name, |
847 | struct GNUNET_TIME_Relative *rt) | 764 | struct GNUNET_TIME_Relative *rt) |
@@ -929,12 +846,6 @@ clean_rsa_public_key (void *cls, | |||
929 | } | 846 | } |
930 | 847 | ||
931 | 848 | ||
932 | /** | ||
933 | * Specification for parsing an RSA public key. | ||
934 | * | ||
935 | * @param name name of the JSON field | ||
936 | * @param pk where to store the RSA key found under @a name | ||
937 | */ | ||
938 | struct GNUNET_JSON_Specification | 849 | struct GNUNET_JSON_Specification |
939 | GNUNET_JSON_spec_rsa_public_key (const char *name, | 850 | GNUNET_JSON_spec_rsa_public_key (const char *name, |
940 | struct GNUNET_CRYPTO_RsaPublicKey **pk) | 851 | struct GNUNET_CRYPTO_RsaPublicKey **pk) |
@@ -1023,12 +934,6 @@ clean_rsa_signature (void *cls, | |||
1023 | } | 934 | } |
1024 | 935 | ||
1025 | 936 | ||
1026 | /** | ||
1027 | * Specification for parsing an RSA signature. | ||
1028 | * | ||
1029 | * @param name name of the JSON field | ||
1030 | * @param sig where to store the RSA signature found under @a name | ||
1031 | */ | ||
1032 | struct GNUNET_JSON_Specification | 937 | struct GNUNET_JSON_Specification |
1033 | GNUNET_JSON_spec_rsa_signature (const char *name, | 938 | GNUNET_JSON_spec_rsa_signature (const char *name, |
1034 | struct GNUNET_CRYPTO_RsaSignature **sig) | 939 | struct GNUNET_CRYPTO_RsaSignature **sig) |
@@ -1073,12 +978,6 @@ parse_boolean (void *cls, | |||
1073 | } | 978 | } |
1074 | 979 | ||
1075 | 980 | ||
1076 | /** | ||
1077 | * Boolean (true mapped to GNUNET_YES, false mapped to GNUNET_NO). | ||
1078 | * | ||
1079 | * @param name name of the JSON field | ||
1080 | * @param[out] boolean where to store the boolean found under @a name | ||
1081 | */ | ||
1082 | struct GNUNET_JSON_Specification | 981 | struct GNUNET_JSON_Specification |
1083 | GNUNET_JSON_spec_boolean (const char *name, | 982 | GNUNET_JSON_spec_boolean (const char *name, |
1084 | int *boolean) | 983 | int *boolean) |
diff --git a/src/messenger/.gitignore b/src/messenger/.gitignore index 9de3fb304..ed78c5562 100644 --- a/src/messenger/.gitignore +++ b/src/messenger/.gitignore | |||
@@ -2,3 +2,13 @@ gnunet-service-messenger | |||
2 | gnunet-messenger | 2 | gnunet-messenger |
3 | test_messenger_api | 3 | test_messenger_api |
4 | test_messenger_anonymous | 4 | test_messenger_anonymous |
5 | test_messenger_sync_client | ||
6 | test_messenger_async_client | ||
7 | test_messenger_worst_client | ||
8 | test_messenger_sync_p2p | ||
9 | test_messenger_async_p2p | ||
10 | test_messenger_worst_p2p | ||
11 | test_messenger_server | ||
12 | test_messenger_growth | ||
13 | test_messenger_ring | ||
14 | test_messenger_adapt | ||
diff --git a/src/messenger/Makefile.am b/src/messenger/Makefile.am index d9694420b..3fc532e7e 100644 --- a/src/messenger/Makefile.am +++ b/src/messenger/Makefile.am | |||
@@ -25,32 +25,23 @@ bin_PROGRAMS = \ | |||
25 | gnunet-messenger | 25 | gnunet-messenger |
26 | 26 | ||
27 | lib_LTLIBRARIES = \ | 27 | lib_LTLIBRARIES = \ |
28 | libgnunetmessenger_common.la \ | ||
29 | libgnunetmessenger.la \ | 28 | libgnunetmessenger.la \ |
30 | $(EXP_LIB) | 29 | $(EXP_LIB) |
31 | 30 | ||
32 | libgnunetmessenger_common_la_SOURCES = \ | ||
33 | messenger_api_ego.h \ | ||
34 | messenger_api_message.c messenger_api_message.h \ | ||
35 | messenger_api_list_tunnels.c messenger_api_list_tunnels.h | ||
36 | libgnunetmessenger_common_la_LIBADD = \ | ||
37 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
38 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
39 | $(XLIB) \ | ||
40 | $(LTLIBINTL) | ||
41 | libgnunetmessenger_common_la_LDFLAGS = \ | ||
42 | $(GN_LIB_LDFLAGS) \ | ||
43 | -version-info 0:0:0 | ||
44 | |||
45 | libgnunetmessenger_la_SOURCES = \ | 31 | libgnunetmessenger_la_SOURCES = \ |
46 | messenger_api.c \ | 32 | messenger_api.c \ |
33 | messenger_api_ego.h \ | ||
47 | messenger_api_contact.c messenger_api_contact.h \ | 34 | messenger_api_contact.c messenger_api_contact.h \ |
35 | messenger_api_contact_store.c messenger_api_contact_store.h \ | ||
36 | messenger_api_message.c messenger_api_message.h \ | ||
37 | messenger_api_list_tunnels.c messenger_api_list_tunnels.h \ | ||
38 | messenger_api_util.c messenger_api_util.h \ | ||
48 | messenger_api_handle.c messenger_api_handle.h \ | 39 | messenger_api_handle.c messenger_api_handle.h \ |
49 | messenger_api_room.c messenger_api_room.h | 40 | messenger_api_room.c messenger_api_room.h |
50 | libgnunetmessenger_la_LIBADD = \ | 41 | libgnunetmessenger_la_LIBADD = \ |
51 | $(top_builddir)/src/util/libgnunetutil.la \ | 42 | $(top_builddir)/src/util/libgnunetutil.la \ |
43 | $(top_builddir)/src/cadet/libgnunetcadet.la \ | ||
52 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 44 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
53 | libgnunetmessenger_common.la \ | ||
54 | $(XLIB) \ | 45 | $(XLIB) \ |
55 | $(LTLIBINTL) | 46 | $(LTLIBINTL) |
56 | libgnunetmessenger_la_LDFLAGS = \ | 47 | libgnunetmessenger_la_LDFLAGS = \ |
@@ -60,10 +51,8 @@ libgnunetmessenger_la_LDFLAGS = \ | |||
60 | gnunet_messenger_SOURCES = \ | 51 | gnunet_messenger_SOURCES = \ |
61 | gnunet-messenger.c | 52 | gnunet-messenger.c |
62 | gnunet_messenger_LDADD = \ | 53 | gnunet_messenger_LDADD = \ |
63 | libgnunetmessenger_common.la \ | ||
64 | libgnunetmessenger.la \ | 54 | libgnunetmessenger.la \ |
65 | $(top_builddir)/src/util/libgnunetutil.la \ | 55 | $(top_builddir)/src/util/libgnunetutil.la |
66 | $(top_builddir)/src/identity/libgnunetidentity.la | ||
67 | gnunet_messenger_LDFLAGS = \ | 56 | gnunet_messenger_LDFLAGS = \ |
68 | $(GN_LIBINTL) | 57 | $(GN_LIBINTL) |
69 | 58 | ||
@@ -72,29 +61,42 @@ gnunet_service_messenger_SOURCES = \ | |||
72 | gnunet-service-messenger_service.c gnunet-service-messenger_service.h \ | 61 | gnunet-service-messenger_service.c gnunet-service-messenger_service.h \ |
73 | gnunet-service-messenger_list_handles.c gnunet-service-messenger_list_handles.h \ | 62 | gnunet-service-messenger_list_handles.c gnunet-service-messenger_list_handles.h \ |
74 | gnunet-service-messenger_list_messages.c gnunet-service-messenger_list_messages.h \ | 63 | gnunet-service-messenger_list_messages.c gnunet-service-messenger_list_messages.h \ |
64 | gnunet-service-messenger_member_session.c gnunet-service-messenger_member_session.h \ | ||
65 | gnunet-service-messenger_member.c gnunet-service-messenger_member.h \ | ||
66 | gnunet-service-messenger_member_store.c gnunet-service-messenger_member_store.h \ | ||
75 | gnunet-service-messenger_message_handle.c gnunet-service-messenger_message_handle.h \ | 67 | gnunet-service-messenger_message_handle.c gnunet-service-messenger_message_handle.h \ |
76 | gnunet-service-messenger_message_kind.c gnunet-service-messenger_message_kind.h \ | 68 | gnunet-service-messenger_message_kind.c gnunet-service-messenger_message_kind.h \ |
77 | gnunet-service-messenger_message_recv.c gnunet-service-messenger_message_recv.h \ | 69 | gnunet-service-messenger_message_recv.c gnunet-service-messenger_message_recv.h \ |
78 | gnunet-service-messenger_message_send.c gnunet-service-messenger_message_send.h \ | 70 | gnunet-service-messenger_message_send.c gnunet-service-messenger_message_send.h \ |
71 | gnunet-service-messenger_message_state.c gnunet-service-messenger_message_state.h \ | ||
79 | gnunet-service-messenger_message_store.c gnunet-service-messenger_message_store.h \ | 72 | gnunet-service-messenger_message_store.c gnunet-service-messenger_message_store.h \ |
73 | gnunet-service-messenger_operation_store.c gnunet-service-messenger_operation_store.h \ | ||
74 | gnunet-service-messenger_operation.c gnunet-service-messenger_operation.h \ | ||
80 | gnunet-service-messenger_basement.c gnunet-service-messenger_basement.h \ | 75 | gnunet-service-messenger_basement.c gnunet-service-messenger_basement.h \ |
81 | gnunet-service-messenger_contact.c gnunet-service-messenger_contact.h \ | 76 | gnunet-service-messenger_ego_store.c gnunet-service-messenger_ego_store.h \ |
82 | gnunet-service-messenger_handle.c gnunet-service-messenger_handle.h \ | 77 | gnunet-service-messenger_handle.c gnunet-service-messenger_handle.h \ |
83 | gnunet-service-messenger_room.c gnunet-service-messenger_room.h \ | 78 | gnunet-service-messenger_room.c gnunet-service-messenger_room.h \ |
84 | gnunet-service-messenger_tunnel.c gnunet-service-messenger_tunnel.h \ | 79 | gnunet-service-messenger_tunnel.c gnunet-service-messenger_tunnel.h |
85 | gnunet-service-messenger_util.c gnunet-service-messenger_util.h | ||
86 | gnunet_service_messenger_LDADD = \ | 80 | gnunet_service_messenger_LDADD = \ |
81 | libgnunetmessenger.la \ | ||
87 | $(top_builddir)/src/util/libgnunetutil.la \ | 82 | $(top_builddir)/src/util/libgnunetutil.la \ |
88 | $(top_builddir)/src/cadet/libgnunetcadet.la \ | 83 | $(top_builddir)/src/cadet/libgnunetcadet.la \ |
89 | $(top_builddir)/src/identity/libgnunetidentity.la \ | 84 | $(top_builddir)/src/identity/libgnunetidentity.la \ |
90 | libgnunetmessenger_common.la \ | ||
91 | libgnunetmessenger.la \ | ||
92 | $(GN_LIBINTL) | 85 | $(GN_LIBINTL) |
93 | 86 | ||
94 | check_PROGRAMS = \ | 87 | check_PROGRAMS = \ |
95 | test_messenger_api \ | 88 | test_messenger_api \ |
96 | test_messenger_anonymous \ | 89 | test_messenger_anonymous \ |
97 | test_messenger_comm0 | 90 | test_messenger_sync_client \ |
91 | test_messenger_async_client \ | ||
92 | test_messenger_worst_client \ | ||
93 | test_messenger_sync_p2p \ | ||
94 | test_messenger_async_p2p \ | ||
95 | test_messenger_worst_p2p \ | ||
96 | test_messenger_server \ | ||
97 | test_messenger_growth \ | ||
98 | test_messenger_ring \ | ||
99 | test_messenger_adapt | ||
98 | 100 | ||
99 | if ENABLE_TEST_RUN | 101 | if ENABLE_TEST_RUN |
100 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 102 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; |
@@ -105,7 +107,6 @@ endif | |||
105 | test_messenger_api_SOURCES = \ | 107 | test_messenger_api_SOURCES = \ |
106 | test_messenger.c | 108 | test_messenger.c |
107 | test_messenger_api_LDADD = \ | 109 | test_messenger_api_LDADD = \ |
108 | libgnunetmessenger_common.la \ | ||
109 | libgnunetmessenger.la \ | 110 | libgnunetmessenger.la \ |
110 | $(top_builddir)/src/testing/libgnunettesting.la \ | 111 | $(top_builddir)/src/testing/libgnunettesting.la \ |
111 | $(top_builddir)/src/util/libgnunetutil.la | 112 | $(top_builddir)/src/util/libgnunetutil.la |
@@ -113,18 +114,107 @@ test_messenger_api_LDADD = \ | |||
113 | test_messenger_anonymous_SOURCES = \ | 114 | test_messenger_anonymous_SOURCES = \ |
114 | test_messenger_anonymous.c | 115 | test_messenger_anonymous.c |
115 | test_messenger_anonymous_LDADD = \ | 116 | test_messenger_anonymous_LDADD = \ |
116 | libgnunetmessenger_common.la \ | ||
117 | libgnunetmessenger.la \ | 117 | libgnunetmessenger.la \ |
118 | $(top_builddir)/src/testing/libgnunettesting.la \ | 118 | $(top_builddir)/src/testing/libgnunettesting.la \ |
119 | $(top_builddir)/src/util/libgnunetutil.la | 119 | $(top_builddir)/src/util/libgnunetutil.la |
120 | 120 | ||
121 | test_messenger_comm0_SOURCES = \ | 121 | test_messenger_sync_client_SOURCES = \ |
122 | test_messenger_comm0.c | 122 | test_messenger_sync_client.c \ |
123 | test_messenger_comm0_LDADD = \ | 123 | testing_messenger_barrier.c testing_messenger_barrier.h \ |
124 | libgnunetmessenger_common.la \ | 124 | testing_messenger_setup.c testing_messenger_setup.h |
125 | test_messenger_sync_client_LDADD = \ | ||
126 | libgnunetmessenger.la \ | ||
127 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
128 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
129 | $(top_builddir)/src/util/libgnunetutil.la | ||
130 | |||
131 | test_messenger_async_client_SOURCES = \ | ||
132 | test_messenger_async_client.c \ | ||
133 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
134 | testing_messenger_setup.c testing_messenger_setup.h | ||
135 | test_messenger_async_client_LDADD = \ | ||
136 | libgnunetmessenger.la \ | ||
137 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
138 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
139 | $(top_builddir)/src/util/libgnunetutil.la | ||
140 | |||
141 | test_messenger_worst_client_SOURCES = \ | ||
142 | test_messenger_worst_client.c \ | ||
143 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
144 | testing_messenger_setup.c testing_messenger_setup.h | ||
145 | test_messenger_worst_client_LDADD = \ | ||
146 | libgnunetmessenger.la \ | ||
147 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
148 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
149 | $(top_builddir)/src/util/libgnunetutil.la | ||
150 | |||
151 | test_messenger_sync_p2p_SOURCES = \ | ||
152 | test_messenger_sync_p2p.c \ | ||
153 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
154 | testing_messenger_setup.c testing_messenger_setup.h | ||
155 | test_messenger_sync_p2p_LDADD = \ | ||
156 | libgnunetmessenger.la \ | ||
157 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
158 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
159 | $(top_builddir)/src/util/libgnunetutil.la | ||
160 | |||
161 | test_messenger_async_p2p_SOURCES = \ | ||
162 | test_messenger_async_p2p.c \ | ||
163 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
164 | testing_messenger_setup.c testing_messenger_setup.h | ||
165 | test_messenger_async_p2p_LDADD = \ | ||
166 | libgnunetmessenger.la \ | ||
167 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
168 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
169 | $(top_builddir)/src/util/libgnunetutil.la | ||
170 | |||
171 | test_messenger_worst_p2p_SOURCES = \ | ||
172 | test_messenger_worst_p2p.c \ | ||
173 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
174 | testing_messenger_setup.c testing_messenger_setup.h | ||
175 | test_messenger_worst_p2p_LDADD = \ | ||
176 | libgnunetmessenger.la \ | ||
177 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
178 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
179 | $(top_builddir)/src/util/libgnunetutil.la | ||
180 | |||
181 | test_messenger_server_SOURCES = \ | ||
182 | test_messenger_server.c \ | ||
183 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
184 | testing_messenger_setup.c testing_messenger_setup.h | ||
185 | test_messenger_server_LDADD = \ | ||
186 | libgnunetmessenger.la \ | ||
187 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
188 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
189 | $(top_builddir)/src/util/libgnunetutil.la | ||
190 | |||
191 | test_messenger_growth_SOURCES = \ | ||
192 | test_messenger_growth.c \ | ||
193 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
194 | testing_messenger_setup.c testing_messenger_setup.h | ||
195 | test_messenger_growth_LDADD = \ | ||
196 | libgnunetmessenger.la \ | ||
197 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
198 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
199 | $(top_builddir)/src/util/libgnunetutil.la | ||
200 | |||
201 | test_messenger_ring_SOURCES = \ | ||
202 | test_messenger_ring.c \ | ||
203 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
204 | testing_messenger_setup.c testing_messenger_setup.h | ||
205 | test_messenger_ring_LDADD = \ | ||
206 | libgnunetmessenger.la \ | ||
207 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | ||
208 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
209 | $(top_builddir)/src/util/libgnunetutil.la | ||
210 | |||
211 | test_messenger_adapt_SOURCES = \ | ||
212 | test_messenger_adapt.c \ | ||
213 | testing_messenger_barrier.c testing_messenger_barrier.h \ | ||
214 | testing_messenger_setup.c testing_messenger_setup.h | ||
215 | test_messenger_adapt_LDADD = \ | ||
125 | libgnunetmessenger.la \ | 216 | libgnunetmessenger.la \ |
126 | $(top_builddir)/src/testbed/libgnunettestbed.la \ | 217 | $(top_builddir)/src/testbed/libgnunettestbed.la \ |
127 | $(top_builddir)/src/testbed-logger/libgnunettestbedlogger.la \ | ||
128 | $(top_builddir)/src/testing/libgnunettesting.la \ | 218 | $(top_builddir)/src/testing/libgnunettesting.la \ |
129 | $(top_builddir)/src/util/libgnunetutil.la | 219 | $(top_builddir)/src/util/libgnunetutil.la |
130 | 220 | ||
diff --git a/src/messenger/gnunet-messenger.c b/src/messenger/gnunet-messenger.c index 579e5c3ad..094ae398d 100644..100755 --- a/src/messenger/gnunet-messenger.c +++ b/src/messenger/gnunet-messenger.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -34,29 +34,38 @@ struct GNUNET_MESSENGER_Handle *messenger; | |||
34 | /** | 34 | /** |
35 | * Function called whenever a message is received or sent. | 35 | * Function called whenever a message is received or sent. |
36 | * | 36 | * |
37 | * @param cls Closure | 37 | * @param[in/out] cls Closure |
38 | * @param room Room | 38 | * @param[in] room Room |
39 | * @param message Message | 39 | * @param[in] sender Sender of message |
40 | * @param hash Hash of message | 40 | * @param[in] message Message |
41 | * @param[in] hash Hash of message | ||
42 | * @param[in] flags Flags of message | ||
41 | */ | 43 | */ |
42 | void | 44 | void |
43 | on_message (void *cls, const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 45 | on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, |
44 | const struct GNUNET_HashCode *hash) | 46 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, |
47 | enum GNUNET_MESSENGER_MessageFlags flags) | ||
45 | { | 48 | { |
46 | struct GNUNET_MESSENGER_Contact *sender = GNUNET_MESSENGER_get_member (room, &(message->header.sender_id)); | ||
47 | |||
48 | const char *sender_name = GNUNET_MESSENGER_contact_get_name (sender); | 49 | const char *sender_name = GNUNET_MESSENGER_contact_get_name (sender); |
49 | 50 | ||
50 | if (!sender_name) | 51 | if (!sender_name) |
51 | sender_name = "anonymous"; | 52 | sender_name = "anonymous"; |
52 | 53 | ||
54 | printf ("[%s] ", GNUNET_sh2s(&(message->header.sender_id))); | ||
55 | |||
56 | if (flags & GNUNET_MESSENGER_FLAG_PRIVATE) | ||
57 | printf ("*"); | ||
58 | |||
53 | switch (message->header.kind) | 59 | switch (message->header.kind) |
54 | { | 60 | { |
55 | case GNUNET_MESSENGER_KIND_JOIN: | 61 | case GNUNET_MESSENGER_KIND_JOIN: |
56 | { | 62 | { |
57 | printf ("* '%s' joined the room! [ %u %u %u %u ]\n", sender_name, message->body.join.key.ecdsa_key.q_y[0], | 63 | printf ("* '%s' joined the room!\n", sender_name); |
58 | message->body.join.key.ecdsa_key.q_y[1], message->body.join.key.ecdsa_key.q_y[2], | 64 | break; |
59 | message->body.join.key.ecdsa_key.q_y[3]); | 65 | } |
66 | case GNUNET_MESSENGER_KIND_NAME: | ||
67 | { | ||
68 | printf ("* '%s' gets renamed to '%s'\n", sender_name, message->body.name.name); | ||
60 | break; | 69 | break; |
61 | } | 70 | } |
62 | case GNUNET_MESSENGER_KIND_LEAVE: | 71 | case GNUNET_MESSENGER_KIND_LEAVE: |
@@ -76,6 +85,7 @@ on_message (void *cls, const struct GNUNET_MESSENGER_Room *room, const struct GN | |||
76 | } | 85 | } |
77 | default: | 86 | default: |
78 | { | 87 | { |
88 | printf ("~ message: %s\n", GNUNET_MESSENGER_name_of_kind(message->header.kind)); | ||
79 | break; | 89 | break; |
80 | } | 90 | } |
81 | } | 91 | } |
@@ -86,7 +96,7 @@ struct GNUNET_SCHEDULER_Task *read_task; | |||
86 | /** | 96 | /** |
87 | * Task to shut down this application. | 97 | * Task to shut down this application. |
88 | * | 98 | * |
89 | * @param cls Closure | 99 | * @param[in/out] cls Closure |
90 | */ | 100 | */ |
91 | static void | 101 | static void |
92 | shutdown_hook (void *cls) | 102 | shutdown_hook (void *cls) |
@@ -108,10 +118,24 @@ listen_stdio (void *cls); | |||
108 | 118 | ||
109 | #define MAX_BUFFER_SIZE 60000 | 119 | #define MAX_BUFFER_SIZE 60000 |
110 | 120 | ||
121 | static int | ||
122 | iterate_send_private_message (void *cls, struct GNUNET_MESSENGER_Room *room, | ||
123 | const struct GNUNET_MESSENGER_Contact *contact) | ||
124 | { | ||
125 | struct GNUNET_MESSENGER_Message *message = cls; | ||
126 | |||
127 | if (GNUNET_MESSENGER_contact_get_key(contact)) | ||
128 | GNUNET_MESSENGER_send_message (room, message, contact); | ||
129 | |||
130 | return GNUNET_YES; | ||
131 | } | ||
132 | |||
133 | int private_mode; | ||
134 | |||
111 | /** | 135 | /** |
112 | * Task run in stdio mode, after some data is available at stdin. | 136 | * Task run in stdio mode, after some data is available at stdin. |
113 | * | 137 | * |
114 | * @param cls Closure | 138 | * @param[in/out] cls Closure |
115 | */ | 139 | */ |
116 | static void | 140 | static void |
117 | read_stdio (void *cls) | 141 | read_stdio (void *cls) |
@@ -140,7 +164,10 @@ read_stdio (void *cls) | |||
140 | message.header.kind = GNUNET_MESSENGER_KIND_TEXT; | 164 | message.header.kind = GNUNET_MESSENGER_KIND_TEXT; |
141 | message.body.text.text = buffer; | 165 | message.body.text.text = buffer; |
142 | 166 | ||
143 | GNUNET_MESSENGER_send_message (room, &message); | 167 | if (GNUNET_YES == private_mode) |
168 | GNUNET_MESSENGER_iterate_members(room, iterate_send_private_message, &message); | ||
169 | else | ||
170 | GNUNET_MESSENGER_send_message (room, &message, NULL); | ||
144 | 171 | ||
145 | read_task = GNUNET_SCHEDULER_add_now (listen_stdio, cls); | 172 | read_task = GNUNET_SCHEDULER_add_now (listen_stdio, cls); |
146 | } | 173 | } |
@@ -148,7 +175,7 @@ read_stdio (void *cls) | |||
148 | /** | 175 | /** |
149 | * Wait for input on STDIO and send it out over the #ch. | 176 | * Wait for input on STDIO and send it out over the #ch. |
150 | * | 177 | * |
151 | * @param cls Closure | 178 | * @param[in/out] cls Closure |
152 | */ | 179 | */ |
153 | static void | 180 | static void |
154 | listen_stdio (void *cls) | 181 | listen_stdio (void *cls) |
@@ -160,10 +187,8 @@ listen_stdio (void *cls) | |||
160 | GNUNET_NETWORK_fdset_set_native (rs, 0); | 187 | GNUNET_NETWORK_fdset_set_native (rs, 0); |
161 | 188 | ||
162 | read_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 189 | read_task = GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
163 | GNUNET_TIME_UNIT_FOREVER_REL, | 190 | GNUNET_TIME_UNIT_FOREVER_REL, rs, |
164 | rs, | 191 | NULL, &read_stdio, cls); |
165 | NULL, | ||
166 | &read_stdio, cls); | ||
167 | 192 | ||
168 | GNUNET_NETWORK_fdset_destroy (rs); | 193 | GNUNET_NETWORK_fdset_destroy (rs); |
169 | } | 194 | } |
@@ -171,7 +196,7 @@ listen_stdio (void *cls) | |||
171 | /** | 196 | /** |
172 | * Initial task to startup application. | 197 | * Initial task to startup application. |
173 | * | 198 | * |
174 | * @param cls Closure | 199 | * @param[in/out] cls Closure |
175 | */ | 200 | */ |
176 | static void | 201 | static void |
177 | idle (void *cls) | 202 | idle (void *cls) |
@@ -192,8 +217,8 @@ struct GNUNET_SCHEDULER_Task *shutdown_task; | |||
192 | /** | 217 | /** |
193 | * Function called when an identity is retrieved. | 218 | * Function called when an identity is retrieved. |
194 | * | 219 | * |
195 | * @param cls Closure | 220 | * @param[in/out] cls Closure |
196 | * @param handle Handle of messenger service | 221 | * @param[in/out] handle Handle of messenger service |
197 | */ | 222 | */ |
198 | static void | 223 | static void |
199 | on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | 224 | on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) |
@@ -204,18 +229,12 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
204 | if (room_key) | 229 | if (room_key) |
205 | GNUNET_CRYPTO_hash (room_key, strlen (room_key), &key); | 230 | GNUNET_CRYPTO_hash (room_key, strlen (room_key), &key); |
206 | 231 | ||
232 | struct GNUNET_PeerIdentity door_peer; | ||
207 | struct GNUNET_PeerIdentity *door = NULL; | 233 | struct GNUNET_PeerIdentity *door = NULL; |
208 | 234 | ||
209 | if (door_id) | 235 | if ((door_id) && |
210 | { | 236 | (GNUNET_OK == GNUNET_CRYPTO_eddsa_public_key_from_string (door_id, strlen (door_id), &(door_peer.public_key)))) |
211 | door = GNUNET_new(struct GNUNET_PeerIdentity); | 237 | door = &door_peer; |
212 | |||
213 | if (GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string (door_id, strlen (door_id), &(door->public_key))) | ||
214 | { | ||
215 | GNUNET_free(door); | ||
216 | door = NULL; | ||
217 | } | ||
218 | } | ||
219 | 238 | ||
220 | const char *name = GNUNET_MESSENGER_get_name (handle); | 239 | const char *name = GNUNET_MESSENGER_get_name (handle); |
221 | 240 | ||
@@ -230,7 +249,7 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
230 | { | 249 | { |
231 | printf ("* You try to entry a room...\n"); | 250 | printf ("* You try to entry a room...\n"); |
232 | 251 | ||
233 | room = GNUNET_MESSENGER_entry_room (messenger, door, &key); | 252 | room = GNUNET_MESSENGER_enter_room (messenger, door, &key); |
234 | } | 253 | } |
235 | else | 254 | else |
236 | { | 255 | { |
@@ -246,17 +265,26 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
246 | if (!room) | 265 | if (!room) |
247 | GNUNET_SCHEDULER_shutdown (); | 266 | GNUNET_SCHEDULER_shutdown (); |
248 | else | 267 | else |
268 | { | ||
269 | struct GNUNET_MESSENGER_Message message; | ||
270 | message.header.kind = GNUNET_MESSENGER_KIND_NAME; | ||
271 | message.body.name.name = GNUNET_strdup(name); | ||
272 | |||
273 | GNUNET_MESSENGER_send_message (room, &message, NULL); | ||
274 | GNUNET_free(message.body.name.name); | ||
275 | |||
249 | GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_relative_get_zero_ (), GNUNET_SCHEDULER_PRIORITY_IDLE, idle, | 276 | GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_relative_get_zero_ (), GNUNET_SCHEDULER_PRIORITY_IDLE, idle, |
250 | room); | 277 | room); |
278 | } | ||
251 | } | 279 | } |
252 | 280 | ||
253 | /** | 281 | /** |
254 | * Main function that will be run by the scheduler. | 282 | * Main function that will be run by the scheduler. |
255 | * | 283 | * |
256 | * @param cls closure | 284 | * @param[in/out] cls closure |
257 | * @param args remaining command-line arguments | 285 | * @param[in] args remaining command-line arguments |
258 | * @param cfgfile name of the configuration file used (for saving, can be NULL!) | 286 | * @param[in] cfgfile name of the configuration file used (for saving, can be NULL!) |
259 | * @param cfg configuration | 287 | * @param[in] cfg configuration |
260 | */ | 288 | */ |
261 | static void | 289 | static void |
262 | run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) | 290 | run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) |
@@ -269,38 +297,24 @@ run (void *cls, char *const*args, const char *cfgfile, const struct GNUNET_CONFI | |||
269 | /** | 297 | /** |
270 | * The main function to obtain messenger information. | 298 | * The main function to obtain messenger information. |
271 | * | 299 | * |
272 | * @param argc number of arguments from the command line | 300 | * @param[in] argc number of arguments from the command line |
273 | * @param argv command line arguments | 301 | * @param[in] argv command line arguments |
274 | * @return 0 ok, 1 on error | 302 | * @return #EXIT_SUCCESS ok, #EXIT_FAILURE on error |
275 | */ | 303 | */ |
276 | int | 304 | int |
277 | main (int argc, char **argv) | 305 | main (int argc, char **argv) |
278 | { | 306 | { |
279 | const char *description = "Open and connect to rooms using the MESSENGER to chat."; | 307 | const char *description = "Open and connect to rooms using the MESSENGER to chat."; |
280 | 308 | ||
281 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 309 | struct GNUNET_GETOPT_CommandLineOption options[] = |
282 | GNUNET_GETOPT_option_string ('d', | 310 | { |
283 | "door", | 311 | GNUNET_GETOPT_option_string ('d', "door", "PEERIDENTITY", "peer identity to entry into the room", &door_id), |
284 | "PEERIDENTITY", | 312 | GNUNET_GETOPT_option_string ('e', "ego", "IDENTITY", "identity to use for messaging", &ego_name), |
285 | "peer identity to entry into the room", | 313 | GNUNET_GETOPT_option_string ('r', "room", "ROOMKEY", "key of the room to connect to", &room_key), |
286 | &door_id), | 314 | GNUNET_GETOPT_option_flag ('p', "private", "flag to enable private mode", &private_mode), |
287 | GNUNET_GETOPT_option_string ('e', | 315 | GNUNET_GETOPT_OPTION_END |
288 | "ego", | 316 | }; |
289 | "IDENTITY", | 317 | |
290 | "identity to use for messaging", | 318 | return (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "gnunet-messenger\0", gettext_noop(description), options, &run, |
291 | &ego_name), | 319 | NULL) ? EXIT_SUCCESS : EXIT_FAILURE); |
292 | GNUNET_GETOPT_option_string ('r', | ||
293 | "room", | ||
294 | "ROOMKEY", | ||
295 | "key of the room to connect to", | ||
296 | &room_key), | ||
297 | GNUNET_GETOPT_OPTION_END }; | ||
298 | |||
299 | return (GNUNET_OK == GNUNET_PROGRAM_run (argc, | ||
300 | argv, | ||
301 | "gnunet-messenger\0", | ||
302 | gettext_noop(description), | ||
303 | options, | ||
304 | &run, | ||
305 | NULL) ? EXIT_SUCCESS : EXIT_FAILURE); | ||
306 | } | 320 | } |
diff --git a/src/messenger/gnunet-service-messenger.c b/src/messenger/gnunet-service-messenger.c index 2c92305c4..7edd76d32 100644..100755 --- a/src/messenger/gnunet-service-messenger.c +++ b/src/messenger/gnunet-service-messenger.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -25,6 +25,8 @@ | |||
25 | 25 | ||
26 | #include "gnunet-service-messenger.h" | 26 | #include "gnunet-service-messenger.h" |
27 | 27 | ||
28 | #include "gnunet-service-messenger_handle.h" | ||
29 | #include "gnunet-service-messenger_message_kind.h" | ||
28 | #include "gnunet-service-messenger_service.h" | 30 | #include "gnunet-service-messenger_service.h" |
29 | #include "messenger_api_message.h" | 31 | #include "messenger_api_message.h" |
30 | 32 | ||
@@ -52,7 +54,7 @@ handle_create (void *cls, const struct GNUNET_MESSENGER_CreateMessage *msg) | |||
52 | 54 | ||
53 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Handle created with name: %s\n", name); | 55 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Handle created with name: %s\n", name); |
54 | 56 | ||
55 | setup_handle_name (msg_client->handle, strlen (name) > 0? name : NULL); | 57 | setup_handle_name (msg_client->handle, strlen (name) > 0 ? name : NULL); |
56 | 58 | ||
57 | GNUNET_SERVICE_client_continue (msg_client->client); | 59 | GNUNET_SERVICE_client_continue (msg_client->client); |
58 | } | 60 | } |
@@ -62,8 +64,7 @@ handle_update (void *cls, const struct GNUNET_MESSENGER_UpdateMessage *msg) | |||
62 | { | 64 | { |
63 | struct GNUNET_MESSENGER_Client *msg_client = cls; | 65 | struct GNUNET_MESSENGER_Client *msg_client = cls; |
64 | 66 | ||
65 | if (GNUNET_OK != update_handle (msg_client->handle)) | 67 | update_handle (msg_client->handle); |
66 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Name is required to update key!\n"); | ||
67 | 68 | ||
68 | GNUNET_SERVICE_client_continue (msg_client->client); | 69 | GNUNET_SERVICE_client_continue (msg_client->client); |
69 | } | 70 | } |
@@ -92,8 +93,7 @@ handle_set_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | |||
92 | 93 | ||
93 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Handles name is now: %s\n", name); | 94 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Handles name is now: %s\n", name); |
94 | 95 | ||
95 | if (GNUNET_YES != set_handle_name (msg_client->handle, name)) | 96 | set_handle_name (msg_client->handle, name); |
96 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "No valid name: %s\n", name); | ||
97 | 97 | ||
98 | GNUNET_SERVICE_client_continue (msg_client->client); | 98 | GNUNET_SERVICE_client_continue (msg_client->client); |
99 | } | 99 | } |
@@ -103,15 +103,13 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
103 | { | 103 | { |
104 | struct GNUNET_MESSENGER_Client *msg_client = cls; | 104 | struct GNUNET_MESSENGER_Client *msg_client = cls; |
105 | 105 | ||
106 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Opening room: %s\n", | 106 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Opening room: %s\n", GNUNET_h2s (&(msg->key))); |
107 | GNUNET_h2s (&(msg->key))); | ||
108 | 107 | ||
109 | if (GNUNET_YES == open_handle_room (msg_client->handle, &(msg->key))) | 108 | if (GNUNET_YES == open_handle_room (msg_client->handle, &(msg->key))) |
110 | { | 109 | { |
111 | const struct GNUNET_ShortHashCode* member_id = get_handle_member_id(msg_client->handle, &(msg->key)); | 110 | const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (msg_client->handle, &(msg->key)); |
112 | 111 | ||
113 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Opening room with member id: %s\n", | 112 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Opening room with member id: %s\n", GNUNET_sh2s (member_id)); |
114 | GNUNET_sh2s (member_id)); | ||
115 | 113 | ||
116 | struct GNUNET_MESSENGER_RoomMessage *response; | 114 | struct GNUNET_MESSENGER_RoomMessage *response; |
117 | struct GNUNET_MQ_Envelope *env; | 115 | struct GNUNET_MQ_Envelope *env; |
@@ -121,8 +119,7 @@ handle_room_open (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
121 | GNUNET_MQ_send (msg_client->handle->mq, env); | 119 | GNUNET_MQ_send (msg_client->handle->mq, env); |
122 | } | 120 | } |
123 | else | 121 | else |
124 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Opening room failed: %s\n", | 122 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Opening room failed: %s\n", GNUNET_h2s (&(msg->key))); |
125 | GNUNET_h2s (&(msg->key))); | ||
126 | 123 | ||
127 | GNUNET_SERVICE_client_continue (msg_client->client); | 124 | GNUNET_SERVICE_client_continue (msg_client->client); |
128 | } | 125 | } |
@@ -132,15 +129,13 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
132 | { | 129 | { |
133 | struct GNUNET_MESSENGER_Client *msg_client = cls; | 130 | struct GNUNET_MESSENGER_Client *msg_client = cls; |
134 | 131 | ||
135 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Entering room: %s, %s\n", | 132 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Entering room: %s, %s\n", GNUNET_h2s (&(msg->key)), GNUNET_i2s (&(msg->door))); |
136 | GNUNET_h2s (&(msg->key)), GNUNET_i2s (&(msg->door))); | ||
137 | 133 | ||
138 | if (GNUNET_YES == entry_handle_room (msg_client->handle, &(msg->door), &(msg->key))) | 134 | if (GNUNET_YES == entry_handle_room (msg_client->handle, &(msg->door), &(msg->key))) |
139 | { | 135 | { |
140 | const struct GNUNET_ShortHashCode* member_id = get_handle_member_id(msg_client->handle, &(msg->key)); | 136 | const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (msg_client->handle, &(msg->key)); |
141 | 137 | ||
142 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Entering room with member id: %s\n", | 138 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Entering room with member id: %s\n", GNUNET_sh2s (member_id)); |
143 | GNUNET_sh2s (member_id)); | ||
144 | 139 | ||
145 | struct GNUNET_MESSENGER_RoomMessage *response; | 140 | struct GNUNET_MESSENGER_RoomMessage *response; |
146 | struct GNUNET_MQ_Envelope *env; | 141 | struct GNUNET_MQ_Envelope *env; |
@@ -151,8 +146,8 @@ handle_room_entry (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
151 | GNUNET_MQ_send (msg_client->handle->mq, env); | 146 | GNUNET_MQ_send (msg_client->handle->mq, env); |
152 | } | 147 | } |
153 | else | 148 | else |
154 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Entrance into room failed: %s, %s\n", | 149 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Entrance into room failed: %s, %s\n", GNUNET_h2s (&(msg->key)), |
155 | GNUNET_h2s (&(msg->key)), GNUNET_i2s (&(msg->door))); | 150 | GNUNET_i2s (&(msg->door))); |
156 | 151 | ||
157 | GNUNET_SERVICE_client_continue (msg_client->client); | 152 | GNUNET_SERVICE_client_continue (msg_client->client); |
158 | } | 153 | } |
@@ -166,10 +161,9 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
166 | 161 | ||
167 | if (GNUNET_YES == close_handle_room (msg_client->handle, &(msg->key))) | 162 | if (GNUNET_YES == close_handle_room (msg_client->handle, &(msg->key))) |
168 | { | 163 | { |
169 | const struct GNUNET_ShortHashCode* member_id = get_handle_member_id(msg_client->handle, &(msg->key)); | 164 | const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (msg_client->handle, &(msg->key)); |
170 | 165 | ||
171 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Closing room with member id: %s\n", | 166 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Closing room with member id: %s\n", GNUNET_sh2s (member_id)); |
172 | GNUNET_sh2s (member_id)); | ||
173 | 167 | ||
174 | struct GNUNET_MESSENGER_RoomMessage *response; | 168 | struct GNUNET_MESSENGER_RoomMessage *response; |
175 | struct GNUNET_MQ_Envelope *env; | 169 | struct GNUNET_MQ_Envelope *env; |
@@ -187,17 +181,43 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
187 | static int | 181 | static int |
188 | check_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) | 182 | check_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) |
189 | { | 183 | { |
190 | const uint16_t full_length = ntohs (msg->header.size) - sizeof(msg->header); | 184 | const uint16_t full_length = ntohs (msg->header.size); |
191 | 185 | ||
192 | if (full_length < sizeof(msg->key)) | 186 | if (full_length < sizeof(*msg)) |
193 | return GNUNET_NO; | 187 | return GNUNET_NO; |
194 | 188 | ||
195 | const uint16_t length = full_length - sizeof(msg->key); | 189 | const enum GNUNET_MESSENGER_MessageFlags flags = ( |
190 | (enum GNUNET_MESSENGER_MessageFlags) (msg->flags) | ||
191 | ); | ||
192 | |||
193 | const uint16_t length = full_length - sizeof(*msg); | ||
196 | const char *buffer = ((const char*) msg) + sizeof(*msg); | 194 | const char *buffer = ((const char*) msg) + sizeof(*msg); |
197 | 195 | ||
196 | ssize_t key_length = 0; | ||
197 | |||
198 | if (!(flags & GNUNET_MESSENGER_FLAG_PRIVATE)) | ||
199 | goto check_for_message; | ||
200 | |||
201 | struct GNUNET_IDENTITY_PublicKey public_key; | ||
202 | |||
203 | key_length = GNUNET_IDENTITY_read_key_from_buffer(&public_key, buffer, length); | ||
204 | |||
205 | check_for_message: | ||
206 | if (key_length < 0) | ||
207 | return GNUNET_NO; | ||
208 | |||
209 | const uint16_t msg_length = length - key_length; | ||
210 | const char* msg_buffer = buffer + key_length; | ||
211 | |||
198 | struct GNUNET_MESSENGER_Message message; | 212 | struct GNUNET_MESSENGER_Message message; |
199 | 213 | ||
200 | if (GNUNET_YES != decode_message (&message, length, buffer)) | 214 | if (length < get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN)) |
215 | return GNUNET_NO; | ||
216 | |||
217 | if (GNUNET_YES != decode_message (&message, msg_length, msg_buffer, GNUNET_NO, NULL)) | ||
218 | return GNUNET_NO; | ||
219 | |||
220 | if (GNUNET_YES != filter_message_sending(&message)) | ||
201 | return GNUNET_NO; | 221 | return GNUNET_NO; |
202 | 222 | ||
203 | return GNUNET_OK; | 223 | return GNUNET_OK; |
@@ -208,42 +228,115 @@ handle_send_message (void *cls, const struct GNUNET_MESSENGER_SendMessage *msg) | |||
208 | { | 228 | { |
209 | struct GNUNET_MESSENGER_Client *msg_client = cls; | 229 | struct GNUNET_MESSENGER_Client *msg_client = cls; |
210 | 230 | ||
231 | const enum GNUNET_MESSENGER_MessageFlags flags = ( | ||
232 | (enum GNUNET_MESSENGER_MessageFlags) (msg->flags) | ||
233 | ); | ||
234 | |||
211 | const struct GNUNET_HashCode *key = &(msg->key); | 235 | const struct GNUNET_HashCode *key = &(msg->key); |
212 | const char *buffer = ((const char*) msg) + sizeof(*msg); | 236 | const char *buffer = ((const char*) msg) + sizeof(*msg); |
213 | 237 | ||
214 | const uint16_t length = ntohs (msg->header.size) - sizeof(*msg); | 238 | const uint16_t length = ntohs (msg->header.size) - sizeof(*msg); |
239 | ssize_t key_length = 0; | ||
240 | |||
241 | struct GNUNET_IDENTITY_PublicKey public_key; | ||
242 | |||
243 | if (flags & GNUNET_MESSENGER_FLAG_PRIVATE) | ||
244 | key_length = GNUNET_IDENTITY_read_key_from_buffer( | ||
245 | &public_key, buffer, length | ||
246 | ); | ||
247 | |||
248 | const uint16_t msg_length = length - key_length; | ||
249 | const char* msg_buffer = buffer + key_length; | ||
215 | 250 | ||
216 | struct GNUNET_MESSENGER_Message message; | 251 | struct GNUNET_MESSENGER_Message message; |
217 | decode_message (&message, length, buffer); | 252 | decode_message (&message, msg_length, msg_buffer, GNUNET_NO, NULL); |
253 | |||
254 | if ((flags & GNUNET_MESSENGER_FLAG_PRIVATE) && | ||
255 | (GNUNET_YES != encrypt_message(&message, &public_key))) | ||
256 | { | ||
257 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Encrypting message failed: Message got dropped!\n"); | ||
258 | |||
259 | goto end_handling; | ||
260 | } | ||
218 | 261 | ||
219 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending message: %s to %s\n", | 262 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending message: %s to %s\n", |
220 | GNUNET_MESSENGER_name_of_kind (message.header.kind), | 263 | GNUNET_MESSENGER_name_of_kind (message.header.kind), GNUNET_h2s (key)); |
221 | GNUNET_h2s (key)); | ||
222 | 264 | ||
223 | if (GNUNET_YES != send_handle_message (msg_client->handle, key, &message)) | 265 | if (GNUNET_YES != send_handle_message (msg_client->handle, key, &message)) |
224 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Sending message failed: %s to %s\n", | 266 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Sending message failed: %s to %s\n", |
225 | GNUNET_MESSENGER_name_of_kind (message.header.kind), | 267 | GNUNET_MESSENGER_name_of_kind (message.header.kind), GNUNET_h2s (key)); |
226 | GNUNET_h2s (key)); | ||
227 | 268 | ||
269 | end_handling: | ||
228 | GNUNET_SERVICE_client_continue (msg_client->client); | 270 | GNUNET_SERVICE_client_continue (msg_client->client); |
229 | } | 271 | } |
230 | 272 | ||
231 | static void | 273 | static void |
232 | handle_get_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | 274 | callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, |
275 | const struct GNUNET_MESSENGER_Message *message, | ||
276 | const struct GNUNET_HashCode *hash) | ||
277 | { | ||
278 | struct GNUNET_MESSENGER_Client *msg_client = cls; | ||
279 | |||
280 | if (!message) | ||
281 | { | ||
282 | send_room_message(room, msg_client->handle, create_message_request(hash)); | ||
283 | return; | ||
284 | } | ||
285 | |||
286 | struct GNUNET_MESSENGER_MemberStore *store = get_room_member_store(room); | ||
287 | |||
288 | struct GNUNET_MESSENGER_Member *member = get_store_member_of(store, message); | ||
289 | |||
290 | if (!member) | ||
291 | { | ||
292 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Sender of message (%s) unknown!\n", GNUNET_h2s (hash)); | ||
293 | return; | ||
294 | } | ||
295 | |||
296 | struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of(member, message, hash); | ||
297 | |||
298 | if (session) | ||
299 | notify_handle_message (msg_client->handle, get_room_key(room), session, message, hash); | ||
300 | } | ||
301 | |||
302 | static void | ||
303 | handle_get_message (void *cls, const struct GNUNET_MESSENGER_GetMessage *msg) | ||
233 | { | 304 | { |
234 | struct GNUNET_MESSENGER_Client *msg_client = cls; | 305 | struct GNUNET_MESSENGER_Client *msg_client = cls; |
235 | 306 | ||
236 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Requesting message from room: %s\n", | 307 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Requesting message from room: %s\n", GNUNET_h2s (&(msg->key))); |
237 | GNUNET_h2s (&(msg->key))); | ||
238 | 308 | ||
239 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (messenger, &(msg->key)); | 309 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (messenger, &(msg->key)); |
240 | 310 | ||
241 | if (room) | 311 | if (!room) |
242 | get_room_message (room, msg_client->handle, &(msg->hash), GNUNET_YES); | 312 | { |
243 | else | 313 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Room not found: %s\n", GNUNET_h2s (&(msg->key))); |
244 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Room not found: %s\n", | 314 | goto end_handling; |
245 | GNUNET_h2s (&(msg->key))); | 315 | } |
316 | |||
317 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); | ||
318 | |||
319 | struct GNUNET_MESSENGER_Member *member = get_store_member(member_store, get_handle_member_id( | ||
320 | msg_client->handle, &(msg->key) | ||
321 | )); | ||
322 | |||
323 | if (!member) | ||
324 | { | ||
325 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Member not valid to request a message!\n"); | ||
326 | goto end_handling; | ||
327 | } | ||
328 | |||
329 | struct GNUNET_MESSENGER_MemberSession *session = get_member_session(member, &(get_handle_ego(msg_client->handle)->pub)); | ||
330 | |||
331 | if (!session) | ||
332 | { | ||
333 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Session not valid to request a message!\n"); | ||
334 | goto end_handling; | ||
335 | } | ||
336 | |||
337 | request_room_message (room, &(msg->hash), session, callback_found_message, msg_client); | ||
246 | 338 | ||
339 | end_handling: | ||
247 | GNUNET_SERVICE_client_continue (msg_client->client); | 340 | GNUNET_SERVICE_client_continue (msg_client->client); |
248 | } | 341 | } |
249 | 342 | ||
@@ -271,16 +364,16 @@ callback_client_disconnect (void *cls, struct GNUNET_SERVICE_Client *client, voi | |||
271 | /** | 364 | /** |
272 | * Setup MESSENGER internals. | 365 | * Setup MESSENGER internals. |
273 | * | 366 | * |
274 | * @param cls closure | 367 | * @param[in/out] cls closure |
275 | * @param config configuration to use | 368 | * @param[in] config configuration to use |
276 | * @param service the initialized service | 369 | * @param[in/out] service the initialized service |
277 | */ | 370 | */ |
278 | static void | 371 | static void |
279 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service) | 372 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service) |
280 | { | 373 | { |
281 | messenger = create_service (config, service); | 374 | messenger = create_service (config, service); |
282 | 375 | ||
283 | if ((!messenger) || (!messenger->cadet) || (!messenger->identity)) | 376 | if (!messenger) |
284 | GNUNET_SCHEDULER_shutdown (); | 377 | GNUNET_SCHEDULER_shutdown (); |
285 | } | 378 | } |
286 | 379 | ||
@@ -302,5 +395,5 @@ GNUNET_SERVICE_MAIN( | |||
302 | GNUNET_MQ_hd_fixed_size( room_entry, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY, struct GNUNET_MESSENGER_RoomMessage, NULL ), | 395 | GNUNET_MQ_hd_fixed_size( room_entry, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY, struct GNUNET_MESSENGER_RoomMessage, NULL ), |
303 | GNUNET_MQ_hd_fixed_size( room_close, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE, struct GNUNET_MESSENGER_RoomMessage, NULL ), | 396 | GNUNET_MQ_hd_fixed_size( room_close, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE, struct GNUNET_MESSENGER_RoomMessage, NULL ), |
304 | GNUNET_MQ_hd_var_size( send_message, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SEND_MESSAGE, struct GNUNET_MESSENGER_SendMessage, NULL ), | 397 | GNUNET_MQ_hd_var_size( send_message, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SEND_MESSAGE, struct GNUNET_MESSENGER_SendMessage, NULL ), |
305 | GNUNET_MQ_hd_fixed_size( get_message, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_GET_MESSAGE, struct GNUNET_MESSENGER_RecvMessage, NULL ), | 398 | GNUNET_MQ_hd_fixed_size( get_message, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_GET_MESSAGE, struct GNUNET_MESSENGER_GetMessage, NULL ), |
306 | GNUNET_MQ_handler_end()); | 399 | GNUNET_MQ_handler_end()); |
diff --git a/src/messenger/gnunet-service-messenger.h b/src/messenger/gnunet-service-messenger.h index 85a1d2549..253fbaadb 100644 --- a/src/messenger/gnunet-service-messenger.h +++ b/src/messenger/gnunet-service-messenger.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -74,7 +74,6 @@ struct GNUNET_MESSENGER_NameMessage | |||
74 | struct GNUNET_MESSENGER_KeyMessage | 74 | struct GNUNET_MESSENGER_KeyMessage |
75 | { | 75 | { |
76 | struct GNUNET_MessageHeader header; | 76 | struct GNUNET_MessageHeader header; |
77 | struct GNUNET_IDENTITY_PublicKey pubkey; | ||
78 | }; | 77 | }; |
79 | 78 | ||
80 | /** | 79 | /** |
@@ -105,7 +104,20 @@ struct GNUNET_MESSENGER_MemberMessage | |||
105 | struct GNUNET_MESSENGER_SendMessage | 104 | struct GNUNET_MESSENGER_SendMessage |
106 | { | 105 | { |
107 | struct GNUNET_MessageHeader header; | 106 | struct GNUNET_MessageHeader header; |
107 | |||
108 | struct GNUNET_HashCode key; | 108 | struct GNUNET_HashCode key; |
109 | uint32_t flags; | ||
110 | }; | ||
111 | |||
112 | /** | ||
113 | * Message to request something from a room | ||
114 | */ | ||
115 | struct GNUNET_MESSENGER_GetMessage | ||
116 | { | ||
117 | struct GNUNET_MessageHeader header; | ||
118 | |||
119 | struct GNUNET_HashCode key; | ||
120 | struct GNUNET_HashCode hash; | ||
109 | }; | 121 | }; |
110 | 122 | ||
111 | /** | 123 | /** |
@@ -114,8 +126,12 @@ struct GNUNET_MESSENGER_SendMessage | |||
114 | struct GNUNET_MESSENGER_RecvMessage | 126 | struct GNUNET_MESSENGER_RecvMessage |
115 | { | 127 | { |
116 | struct GNUNET_MessageHeader header; | 128 | struct GNUNET_MessageHeader header; |
129 | |||
117 | struct GNUNET_HashCode key; | 130 | struct GNUNET_HashCode key; |
131 | struct GNUNET_HashCode sender; | ||
132 | struct GNUNET_HashCode context; | ||
118 | struct GNUNET_HashCode hash; | 133 | struct GNUNET_HashCode hash; |
134 | uint32_t flags; | ||
119 | }; | 135 | }; |
120 | 136 | ||
121 | #endif //GNUNET_SERVICE_MESSENGER_H | 137 | #endif //GNUNET_SERVICE_MESSENGER_H |
diff --git a/src/messenger/gnunet-service-messenger_basement.c b/src/messenger/gnunet-service-messenger_basement.c index 190cf2de5..f302c8d66 100644 --- a/src/messenger/gnunet-service-messenger_basement.c +++ b/src/messenger/gnunet-service-messenger_basement.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -28,6 +28,8 @@ | |||
28 | size_t | 28 | size_t |
29 | count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels) | 29 | count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels) |
30 | { | 30 | { |
31 | GNUNET_assert(tunnels); | ||
32 | |||
31 | const struct GNUNET_MESSENGER_ListTunnel *element; | 33 | const struct GNUNET_MESSENGER_ListTunnel *element; |
32 | size_t count = 0; | 34 | size_t count = 0; |
33 | 35 | ||
diff --git a/src/messenger/gnunet-service-messenger_basement.h b/src/messenger/gnunet-service-messenger_basement.h index 0a1a9b126..b19aec405 100644 --- a/src/messenger/gnunet-service-messenger_basement.h +++ b/src/messenger/gnunet-service-messenger_basement.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -31,34 +31,34 @@ | |||
31 | /** | 31 | /** |
32 | * Returns the count of peers in a list (typically from the basement of a room). | 32 | * Returns the count of peers in a list (typically from the basement of a room). |
33 | * | 33 | * |
34 | * @param tunnels List of peer identities | 34 | * @param[in] tunnels List of peer identities |
35 | * @return Count of the entries in the list | 35 | * @return Count of the entries in the list |
36 | */ | 36 | */ |
37 | size_t | 37 | size_t |
38 | count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels); | 38 | count_of_tunnels (const struct GNUNET_MESSENGER_ListTunnels *tunnels); |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Returns GNUNET_YES or GNUNET_NO to determine if the peer at index <i>src</i> should | 41 | * Returns #GNUNET_YES or #GNUNET_NO to determine if the peer at index <i>src</i> should |
42 | * or should not connect outgoing to the peer at index <i>dst</i> to construct a complete | 42 | * or should not connect outgoing to the peer at index <i>dst</i> to construct a complete |
43 | * basement with a given <i>count</i> of peers. | 43 | * basement with a given <i>count</i> of peers. |
44 | * | 44 | * |
45 | * @param count Count of peers | 45 | * @param[in] count Count of peers |
46 | * @param src Source index | 46 | * @param[in] src Source index |
47 | * @param dst Destination index | 47 | * @param[in] dst Destination index |
48 | * @return GNUNET_YES or GNUNET_NO based on topologic requirement | 48 | * @return #GNUNET_YES or #GNUNET_NO based on topologic requirement |
49 | */ | 49 | */ |
50 | int | 50 | int |
51 | should_connect_tunnel_to (size_t count, size_t src, size_t dst); | 51 | should_connect_tunnel_to (size_t count, size_t src, size_t dst); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Returns GNUNET_YES or GNUNET_NO to determine if the peers of index <i>src</i> and | 54 | * Returns #GNUNET_YES or #GNUNET_NO to determine if the peers of index <i>src</i> and |
55 | * index <i>dst</i> should be connected in any direction to construct a complete | 55 | * index <i>dst</i> should be connected in any direction to construct a complete |
56 | * basement with a given <i>count</i> of peers. | 56 | * basement with a given <i>count</i> of peers. |
57 | * | 57 | * |
58 | * @param count Count of peers | 58 | * @param[in] count Count of peers |
59 | * @param src Source index | 59 | * @param[in] src Source index |
60 | * @param dst Destination index | 60 | * @param[in] dst Destination index |
61 | * @return GNUNET_YES or GNUNET_NO based on topologic requirement | 61 | * @return #GNUNET_YES or #GNUNET_NO based on topologic requirement |
62 | */ | 62 | */ |
63 | int | 63 | int |
64 | required_connection_between (size_t count, size_t src, size_t dst); | 64 | required_connection_between (size_t count, size_t src, size_t dst); |
diff --git a/src/messenger/gnunet-service-messenger_contact.c b/src/messenger/gnunet-service-messenger_contact.c deleted file mode 100644 index 1ec125402..000000000 --- a/src/messenger/gnunet-service-messenger_contact.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_contact.c | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "gnunet-service-messenger_contact.h" | ||
27 | |||
28 | struct GNUNET_MESSENGER_SrvContact* | ||
29 | create_contact (const struct GNUNET_IDENTITY_PublicKey *key) | ||
30 | { | ||
31 | struct GNUNET_MESSENGER_SrvContact *contact = GNUNET_new(struct GNUNET_MESSENGER_SrvContact); | ||
32 | |||
33 | contact->name = NULL; | ||
34 | contact->rc = 0; | ||
35 | |||
36 | GNUNET_memcpy(&(contact->public_key), key, sizeof(contact->public_key)); | ||
37 | |||
38 | return contact; | ||
39 | } | ||
40 | |||
41 | void | ||
42 | destroy_contact (struct GNUNET_MESSENGER_SrvContact *contact) | ||
43 | { | ||
44 | if (contact->name) | ||
45 | GNUNET_free(contact->name); | ||
46 | |||
47 | GNUNET_free(contact); | ||
48 | } | ||
49 | |||
50 | const char* | ||
51 | get_contact_name (const struct GNUNET_MESSENGER_SrvContact *contact) | ||
52 | { | ||
53 | return contact->name; | ||
54 | } | ||
55 | |||
56 | void | ||
57 | set_contact_name (struct GNUNET_MESSENGER_SrvContact *contact, const char *name) | ||
58 | { | ||
59 | GNUNET_assert(name); | ||
60 | |||
61 | if (contact->name) | ||
62 | GNUNET_free(contact->name); | ||
63 | |||
64 | contact->name = GNUNET_strdup(name); | ||
65 | } | ||
66 | |||
67 | const struct GNUNET_IDENTITY_PublicKey* | ||
68 | get_contact_key (const struct GNUNET_MESSENGER_SrvContact *contact) | ||
69 | { | ||
70 | return &(contact->public_key); | ||
71 | } | ||
72 | |||
73 | void | ||
74 | increase_contact_rc (struct GNUNET_MESSENGER_SrvContact *contact) | ||
75 | { | ||
76 | contact->rc++; | ||
77 | } | ||
78 | |||
79 | int | ||
80 | decrease_contact_rc (struct GNUNET_MESSENGER_SrvContact *contact) | ||
81 | { | ||
82 | if (contact->rc > 0) | ||
83 | contact->rc--; | ||
84 | |||
85 | return contact->rc ? GNUNET_NO : GNUNET_YES; | ||
86 | } | ||
87 | |||
88 | const struct GNUNET_HashCode* | ||
89 | get_contact_id_from_key (const struct GNUNET_MESSENGER_SrvContact *contact) | ||
90 | { | ||
91 | static struct GNUNET_HashCode id; | ||
92 | |||
93 | GNUNET_CRYPTO_hash (&(contact->public_key), sizeof(contact->public_key), &id); | ||
94 | |||
95 | return &id; | ||
96 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_contact.h b/src/messenger/gnunet-service-messenger_contact.h deleted file mode 100644 index 4a4f8bf0f..000000000 --- a/src/messenger/gnunet-service-messenger_contact.h +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_contact.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_CONTACT_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_CONTACT_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_crypto_lib.h" | ||
31 | #include "gnunet_identity_service.h" | ||
32 | |||
33 | struct GNUNET_MESSENGER_SrvContact | ||
34 | { | ||
35 | char *name; | ||
36 | size_t rc; | ||
37 | |||
38 | struct GNUNET_IDENTITY_PublicKey public_key; | ||
39 | }; | ||
40 | |||
41 | /** | ||
42 | * Creates and allocates a new contact with a given public <i>key</i> from an EGO. | ||
43 | * | ||
44 | * @param key Public key | ||
45 | * @return New contact | ||
46 | */ | ||
47 | struct GNUNET_MESSENGER_SrvContact* | ||
48 | create_contact (const struct GNUNET_IDENTITY_PublicKey *key); | ||
49 | |||
50 | /** | ||
51 | * Destroys a contact and frees its memory fully. | ||
52 | * | ||
53 | * @param contact Contact | ||
54 | */ | ||
55 | void | ||
56 | destroy_contact (struct GNUNET_MESSENGER_SrvContact *contact); | ||
57 | |||
58 | /** | ||
59 | * Returns the current name of a given <i>contact</i> or NULL if no valid name was assigned yet. | ||
60 | * | ||
61 | * @param contact Contact | ||
62 | * @return Name of the contact or NULL | ||
63 | */ | ||
64 | const char* | ||
65 | get_contact_name (const struct GNUNET_MESSENGER_SrvContact *contact); | ||
66 | |||
67 | /** | ||
68 | * Changes the current name of a given <i>contact</i> by copying it from the parameter <i>name</i>. | ||
69 | * | ||
70 | * @param contact Contact | ||
71 | * @param name Valid name (may not be NULL!) | ||
72 | */ | ||
73 | void | ||
74 | set_contact_name (struct GNUNET_MESSENGER_SrvContact *contact, const char *name); | ||
75 | |||
76 | /** | ||
77 | * Returns the public key of a given <i>contact</i>. | ||
78 | * | ||
79 | * @param contact Contact | ||
80 | * @return Public key of the contact | ||
81 | */ | ||
82 | const struct GNUNET_IDENTITY_PublicKey* | ||
83 | get_contact_key (const struct GNUNET_MESSENGER_SrvContact *contact); | ||
84 | |||
85 | /** | ||
86 | * Increases the reference counter of a given <i>contact</i> which is zero as default. | ||
87 | * | ||
88 | * @param contact Contact | ||
89 | */ | ||
90 | void | ||
91 | increase_contact_rc (struct GNUNET_MESSENGER_SrvContact *contact); | ||
92 | |||
93 | /** | ||
94 | * Decreases the reference counter if possible (can not underflow!) of a given <i>contact</i> | ||
95 | * and returns GNUNET_YES if the counter is equal to zero, otherwise GNUNET_NO. | ||
96 | * | ||
97 | * @param contact Contact | ||
98 | * @return GNUNET_YES or GNUNET_NO depending on the reference counter | ||
99 | */ | ||
100 | int | ||
101 | decrease_contact_rc (struct GNUNET_MESSENGER_SrvContact *contact); | ||
102 | |||
103 | /** | ||
104 | * Returns the resulting hashcode of the public key from a given <i>contact</i>. | ||
105 | * | ||
106 | * @param contact Contact | ||
107 | * @return Hash of the contacts public key | ||
108 | */ | ||
109 | const struct GNUNET_HashCode* | ||
110 | get_contact_id_from_key (const struct GNUNET_MESSENGER_SrvContact *contact); | ||
111 | |||
112 | #endif //GNUNET_SERVICE_MESSENGER_CONTACT_H | ||
diff --git a/src/messenger/gnunet-service-messenger_ego_store.c b/src/messenger/gnunet-service-messenger_ego_store.c new file mode 100644 index 000000000..3b069fcf5 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_ego_store.c | |||
@@ -0,0 +1,295 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_ego_store.c | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "gnunet-service-messenger_ego_store.h" | ||
27 | |||
28 | #include "gnunet-service-messenger_handle.h" | ||
29 | |||
30 | static void | ||
31 | callback_update_ego (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *identifier) | ||
32 | { | ||
33 | if ((!ego) || (!identifier)) | ||
34 | return; | ||
35 | |||
36 | struct GNUNET_MESSENGER_EgoStore *store = cls; | ||
37 | |||
38 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "New ego in use: '%s'\n", identifier); | ||
39 | |||
40 | update_store_ego (store, identifier, GNUNET_IDENTITY_ego_get_private_key (ego)); | ||
41 | } | ||
42 | |||
43 | void | ||
44 | init_ego_store(struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config) | ||
45 | { | ||
46 | GNUNET_assert ((store) && (config)); | ||
47 | |||
48 | store->cfg = config; | ||
49 | store->identity = GNUNET_IDENTITY_connect (config, &callback_update_ego, store); | ||
50 | store->egos = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | ||
51 | |||
52 | store->lu_start = NULL; | ||
53 | store->lu_end = NULL; | ||
54 | |||
55 | store->op_start = NULL; | ||
56 | store->op_end = NULL; | ||
57 | } | ||
58 | |||
59 | |||
60 | static int | ||
61 | iterate_destroy_egos (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
62 | { | ||
63 | struct GNUNET_MESSENGER_Ego *ego = value; | ||
64 | GNUNET_free(ego); | ||
65 | return GNUNET_YES; | ||
66 | } | ||
67 | |||
68 | void | ||
69 | clear_ego_store(struct GNUNET_MESSENGER_EgoStore *store) | ||
70 | { | ||
71 | GNUNET_assert (store); | ||
72 | |||
73 | struct GNUNET_MESSENGER_EgoOperation *op; | ||
74 | |||
75 | while (store->op_start) | ||
76 | { | ||
77 | op = store->op_start; | ||
78 | |||
79 | GNUNET_IDENTITY_cancel (op->operation); | ||
80 | GNUNET_CONTAINER_DLL_remove (store->op_start, store->op_end, op); | ||
81 | |||
82 | if (op->identifier) | ||
83 | GNUNET_free (op->identifier); | ||
84 | |||
85 | GNUNET_free (op); | ||
86 | } | ||
87 | |||
88 | struct GNUNET_MESSENGER_EgoLookup *lu; | ||
89 | |||
90 | while (store->lu_start) | ||
91 | { | ||
92 | lu = store->lu_start; | ||
93 | |||
94 | GNUNET_IDENTITY_ego_lookup_cancel(lu->lookup); | ||
95 | GNUNET_CONTAINER_DLL_remove (store->lu_start, store->lu_end, lu); | ||
96 | |||
97 | if (lu->identifier) | ||
98 | GNUNET_free(lu->identifier); | ||
99 | |||
100 | GNUNET_free (lu); | ||
101 | } | ||
102 | |||
103 | GNUNET_CONTAINER_multihashmap_iterate (store->egos, iterate_destroy_egos, NULL); | ||
104 | GNUNET_CONTAINER_multihashmap_destroy (store->egos); | ||
105 | |||
106 | if (store->identity) | ||
107 | { | ||
108 | GNUNET_IDENTITY_disconnect (store->identity); | ||
109 | |||
110 | store->identity = NULL; | ||
111 | } | ||
112 | } | ||
113 | |||
114 | static void | ||
115 | callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, const char *emsg) | ||
116 | { | ||
117 | struct GNUNET_MESSENGER_EgoOperation *element = cls; | ||
118 | struct GNUNET_MESSENGER_EgoStore *store = element->store; | ||
119 | |||
120 | GNUNET_assert(element->identifier); | ||
121 | |||
122 | if (emsg) | ||
123 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s\n", emsg); | ||
124 | |||
125 | if (key) | ||
126 | { | ||
127 | struct GNUNET_MESSENGER_SrvHandle *handle = element->handle; | ||
128 | |||
129 | struct GNUNET_MESSENGER_Ego *msg_ego = update_store_ego (store, element->identifier, key); | ||
130 | |||
131 | set_handle_ego (handle, msg_ego); | ||
132 | } | ||
133 | else | ||
134 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Creating ego failed!\n"); | ||
135 | |||
136 | GNUNET_CONTAINER_DLL_remove (store->op_start, store->op_end, element); | ||
137 | GNUNET_free (element->identifier); | ||
138 | GNUNET_free (element); | ||
139 | } | ||
140 | |||
141 | void | ||
142 | create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | ||
143 | void *handle) | ||
144 | { | ||
145 | GNUNET_assert ((store) && (identifier)); | ||
146 | |||
147 | struct GNUNET_MESSENGER_EgoOperation *element = GNUNET_new (struct GNUNET_MESSENGER_EgoOperation); | ||
148 | |||
149 | element->store = store; | ||
150 | element->handle = handle; | ||
151 | |||
152 | element->identifier = GNUNET_strdup (identifier); | ||
153 | |||
154 | element->operation = GNUNET_IDENTITY_create (store->identity, identifier, NULL, | ||
155 | GNUNET_IDENTITY_TYPE_ECDSA, callback_ego_create, element); | ||
156 | |||
157 | GNUNET_CONTAINER_DLL_insert (store->op_start, store->op_end, element); | ||
158 | } | ||
159 | |||
160 | static void | ||
161 | callback_ego_lookup (void *cls, struct GNUNET_IDENTITY_Ego *ego) | ||
162 | { | ||
163 | struct GNUNET_MESSENGER_EgoLookup *element = cls; | ||
164 | struct GNUNET_MESSENGER_EgoStore *store = element->store; | ||
165 | |||
166 | GNUNET_assert(element->identifier); | ||
167 | |||
168 | struct GNUNET_MESSENGER_Ego *msg_ego; | ||
169 | |||
170 | if (ego) | ||
171 | msg_ego = update_store_ego ( | ||
172 | store, element->identifier, GNUNET_IDENTITY_ego_get_private_key(ego) | ||
173 | ); | ||
174 | else | ||
175 | msg_ego = NULL; | ||
176 | |||
177 | if (element->cb) | ||
178 | element->cb(element->cls, element->identifier, msg_ego); | ||
179 | |||
180 | GNUNET_CONTAINER_DLL_remove (store->lu_start, store->lu_end, element); | ||
181 | GNUNET_free (element->identifier); | ||
182 | GNUNET_free (element); | ||
183 | } | ||
184 | |||
185 | void | ||
186 | lookup_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | ||
187 | GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls) | ||
188 | { | ||
189 | GNUNET_assert (store); | ||
190 | |||
191 | if (!identifier) | ||
192 | { | ||
193 | lookup(cls, identifier, NULL); | ||
194 | return; | ||
195 | } | ||
196 | |||
197 | struct GNUNET_HashCode hash; | ||
198 | GNUNET_CRYPTO_hash (identifier, strlen (identifier), &hash); | ||
199 | |||
200 | struct GNUNET_MESSENGER_Ego *ego = GNUNET_CONTAINER_multihashmap_get (store->egos, &hash); | ||
201 | |||
202 | if (ego) | ||
203 | lookup(cls, identifier, ego); | ||
204 | else | ||
205 | { | ||
206 | struct GNUNET_MESSENGER_EgoLookup *element = GNUNET_new (struct GNUNET_MESSENGER_EgoLookup); | ||
207 | |||
208 | element->store = store; | ||
209 | |||
210 | element->cb = lookup; | ||
211 | element->cls = cls; | ||
212 | |||
213 | element->identifier = GNUNET_strdup (identifier); | ||
214 | |||
215 | element->lookup = GNUNET_IDENTITY_ego_lookup(store->cfg, identifier, callback_ego_lookup, element); | ||
216 | |||
217 | GNUNET_CONTAINER_DLL_insert (store->lu_start, store->lu_end, element); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | struct GNUNET_MESSENGER_Ego* | ||
222 | update_store_ego(struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | ||
223 | const struct GNUNET_IDENTITY_PrivateKey *key) | ||
224 | { | ||
225 | GNUNET_assert ((store) && (identifier) && (key)); | ||
226 | |||
227 | struct GNUNET_HashCode hash; | ||
228 | GNUNET_CRYPTO_hash (identifier, strlen (identifier), &hash); | ||
229 | |||
230 | struct GNUNET_MESSENGER_Ego *ego = GNUNET_CONTAINER_multihashmap_get (store->egos, &hash); | ||
231 | |||
232 | if (!ego) | ||
233 | { | ||
234 | ego = GNUNET_new(struct GNUNET_MESSENGER_Ego); | ||
235 | GNUNET_CONTAINER_multihashmap_put (store->egos, &hash, ego, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
236 | } | ||
237 | |||
238 | GNUNET_memcpy(&(ego->priv), key, sizeof(*key)); | ||
239 | |||
240 | if (GNUNET_OK != GNUNET_IDENTITY_key_get_public (key, &(ego->pub))) | ||
241 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Updating invalid ego key failed!\n"); | ||
242 | |||
243 | return ego; | ||
244 | } | ||
245 | |||
246 | static void | ||
247 | callback_ego_rename (void *cls, const char *emsg) | ||
248 | { | ||
249 | struct GNUNET_MESSENGER_EgoOperation *element = cls; | ||
250 | struct GNUNET_MESSENGER_EgoStore *store = element->store; | ||
251 | |||
252 | GNUNET_assert(element->identifier); | ||
253 | |||
254 | if (emsg) | ||
255 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s\n", emsg); | ||
256 | |||
257 | struct GNUNET_HashCode hash; | ||
258 | GNUNET_CRYPTO_hash (element->identifier, strlen (element->identifier), &hash); | ||
259 | |||
260 | struct GNUNET_MESSENGER_Ego *ego = GNUNET_CONTAINER_multihashmap_get (store->egos, &hash); | ||
261 | |||
262 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (store->egos, &hash, ego)) | ||
263 | { | ||
264 | GNUNET_CRYPTO_hash ((char*) element->handle, strlen ((char*) element->handle), &hash); | ||
265 | |||
266 | GNUNET_CONTAINER_multihashmap_put (store->egos, &hash, ego, | ||
267 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
268 | } | ||
269 | else | ||
270 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Renaming ego failed!\n"); | ||
271 | |||
272 | GNUNET_free (element->handle); | ||
273 | |||
274 | GNUNET_CONTAINER_DLL_remove (store->op_start, store->op_end, element); | ||
275 | GNUNET_free (element->identifier); | ||
276 | GNUNET_free (element); | ||
277 | } | ||
278 | |||
279 | void | ||
280 | rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, | ||
281 | const char *new_identifier) | ||
282 | { | ||
283 | GNUNET_assert ((store) && (old_identifier) && (new_identifier)); | ||
284 | |||
285 | struct GNUNET_MESSENGER_EgoOperation *element = GNUNET_new (struct GNUNET_MESSENGER_EgoOperation); | ||
286 | |||
287 | element->store = store; | ||
288 | element->handle = GNUNET_strdup (new_identifier); | ||
289 | |||
290 | element->identifier = GNUNET_strdup (old_identifier); | ||
291 | |||
292 | element->operation = GNUNET_IDENTITY_rename (store->identity, old_identifier, new_identifier, callback_ego_rename, element); | ||
293 | |||
294 | GNUNET_CONTAINER_DLL_insert (store->op_start, store->op_end, element); | ||
295 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_ego_store.h b/src/messenger/gnunet-service-messenger_ego_store.h new file mode 100644 index 000000000..41f14fff2 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_ego_store.h | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_ego_store.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_EGO_STORE_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_EGO_STORE_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_container_lib.h" | ||
31 | |||
32 | #include "messenger_api_ego.h" | ||
33 | |||
34 | struct GNUNET_MESSENGER_Ego; | ||
35 | struct GNUNET_MESSENGER_EgoStore; | ||
36 | |||
37 | typedef void | ||
38 | (*GNUNET_MESSENGER_EgoLookupCallback) (void *cls, const char *identifier, | ||
39 | const struct GNUNET_MESSENGER_Ego *ego); | ||
40 | |||
41 | struct GNUNET_MESSENGER_EgoLookup | ||
42 | { | ||
43 | struct GNUNET_MESSENGER_EgoLookup *prev; | ||
44 | struct GNUNET_MESSENGER_EgoLookup *next; | ||
45 | |||
46 | struct GNUNET_IDENTITY_EgoLookup *lookup; | ||
47 | |||
48 | struct GNUNET_MESSENGER_EgoStore *store; | ||
49 | |||
50 | GNUNET_MESSENGER_EgoLookupCallback cb; | ||
51 | void *cls; | ||
52 | |||
53 | char *identifier; | ||
54 | }; | ||
55 | |||
56 | struct GNUNET_MESSENGER_EgoOperation | ||
57 | { | ||
58 | struct GNUNET_MESSENGER_EgoOperation *prev; | ||
59 | struct GNUNET_MESSENGER_EgoOperation *next; | ||
60 | |||
61 | struct GNUNET_IDENTITY_Operation *operation; | ||
62 | |||
63 | struct GNUNET_MESSENGER_EgoStore *store; | ||
64 | void *handle; | ||
65 | |||
66 | char *identifier; | ||
67 | }; | ||
68 | |||
69 | struct GNUNET_MESSENGER_EgoStore | ||
70 | { | ||
71 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
72 | |||
73 | struct GNUNET_IDENTITY_Handle *identity; | ||
74 | struct GNUNET_CONTAINER_MultiHashMap *egos; | ||
75 | |||
76 | struct GNUNET_MESSENGER_EgoLookup *lu_start; | ||
77 | struct GNUNET_MESSENGER_EgoLookup *lu_end; | ||
78 | |||
79 | struct GNUNET_MESSENGER_EgoOperation *op_start; | ||
80 | struct GNUNET_MESSENGER_EgoOperation *op_end; | ||
81 | }; | ||
82 | |||
83 | /** | ||
84 | * Initializes an EGO-store as fully empty. | ||
85 | * | ||
86 | * @param[out] store EGO-store | ||
87 | * @param[in] config Configuration handle | ||
88 | */ | ||
89 | void | ||
90 | init_ego_store (struct GNUNET_MESSENGER_EgoStore *store, const struct GNUNET_CONFIGURATION_Handle *config); | ||
91 | |||
92 | /** | ||
93 | * Clears an EGO-store, wipes its content and deallocates its memory. | ||
94 | * | ||
95 | * @param[in/out] store EGO-store | ||
96 | */ | ||
97 | void | ||
98 | clear_ego_store (struct GNUNET_MESSENGER_EgoStore *store); | ||
99 | |||
100 | /** | ||
101 | * Creates a new EGO which will be registered to a <i>store</i> under | ||
102 | * a specific <i>identifier</i>. A given <i>handle</i> will be informed | ||
103 | * about the creation and changes its EGO accordingly. | ||
104 | * | ||
105 | * @param[in/out] store EGO-store | ||
106 | * @param[in] identifier Identifier string | ||
107 | * @param[in/out] handle Handle or NULL | ||
108 | */ | ||
109 | void | ||
110 | create_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | ||
111 | void *handle); | ||
112 | |||
113 | /** | ||
114 | * Lookups an EGO which was registered to a <i>store</i> under | ||
115 | * a specific <i>identifier</i>. | ||
116 | * | ||
117 | * @param[in/out] store EGO-store | ||
118 | * @param[in] identifier Identifier string | ||
119 | * @param[in] lookup Lookup callback (non-NULL) | ||
120 | * @param[in] cls Closure | ||
121 | */ | ||
122 | void | ||
123 | lookup_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | ||
124 | GNUNET_MESSENGER_EgoLookupCallback lookup, void *cls); | ||
125 | |||
126 | /** | ||
127 | * Updates the registration of an EGO to a <i>store</i> under | ||
128 | * a specific <i>identifier</i> with a new <i>key</i>. | ||
129 | * | ||
130 | * @param[in/out] store EGO-store | ||
131 | * @param[in] identifier Identifier string | ||
132 | * @param[in] key Private EGO key | ||
133 | * @return Updated EGO | ||
134 | */ | ||
135 | struct GNUNET_MESSENGER_Ego* | ||
136 | update_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *identifier, | ||
137 | const struct GNUNET_IDENTITY_PrivateKey *key); | ||
138 | |||
139 | /** | ||
140 | * Updates the location of a registered EGO in a <i>store</i> to | ||
141 | * a different one under a specific <i>new_identifier<i> replacing | ||
142 | * its old one. | ||
143 | * | ||
144 | * @param[in/out] store EGO-store | ||
145 | * @param[in] old_identifier Old identifier string | ||
146 | * @param[in] new_identifier New identifier string | ||
147 | */ | ||
148 | void | ||
149 | rename_store_ego (struct GNUNET_MESSENGER_EgoStore *store, const char *old_identifier, | ||
150 | const char *new_identifier); | ||
151 | |||
152 | #endif //GNUNET_SERVICE_MESSENGER_EGO_STORE_H | ||
diff --git a/src/messenger/gnunet-service-messenger_handle.c b/src/messenger/gnunet-service-messenger_handle.c index 38ad6fbb4..4d2318d62 100644 --- a/src/messenger/gnunet-service-messenger_handle.c +++ b/src/messenger/gnunet-service-messenger_handle.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -28,18 +28,19 @@ | |||
28 | #include "gnunet-service-messenger.h" | 28 | #include "gnunet-service-messenger.h" |
29 | #include "gnunet-service-messenger_message_kind.h" | 29 | #include "gnunet-service-messenger_message_kind.h" |
30 | 30 | ||
31 | #include "messenger_api_util.h" | ||
32 | |||
31 | struct GNUNET_MESSENGER_SrvHandle* | 33 | struct GNUNET_MESSENGER_SrvHandle* |
32 | create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) | 34 | create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) |
33 | { | 35 | { |
36 | GNUNET_assert((service) && (mq)); | ||
37 | |||
34 | struct GNUNET_MESSENGER_SrvHandle *handle = GNUNET_new(struct GNUNET_MESSENGER_SrvHandle); | 38 | struct GNUNET_MESSENGER_SrvHandle *handle = GNUNET_new(struct GNUNET_MESSENGER_SrvHandle); |
35 | 39 | ||
36 | handle->service = service; | 40 | handle->service = service; |
37 | handle->mq = mq; | 41 | handle->mq = mq; |
38 | 42 | ||
39 | handle->name = NULL; | 43 | handle->name = NULL; |
40 | |||
41 | handle->operation = NULL; | ||
42 | |||
43 | handle->ego = NULL; | 44 | handle->ego = NULL; |
44 | 45 | ||
45 | handle->member_ids = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 46 | handle->member_ids = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); |
@@ -58,11 +59,10 @@ iterate_free_member_ids (void *cls, const struct GNUNET_HashCode *key, void *val | |||
58 | void | 59 | void |
59 | destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle) | 60 | destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle) |
60 | { | 61 | { |
61 | if (handle->service->dir) | 62 | GNUNET_assert(handle); |
62 | save_handle_configuration(handle); | ||
63 | 63 | ||
64 | if (handle->operation) | 64 | if (handle->service->dir) |
65 | GNUNET_IDENTITY_cancel (handle->operation); | 65 | save_handle_configuration (handle); |
66 | 66 | ||
67 | if (handle->name) | 67 | if (handle->name) |
68 | GNUNET_free(handle->name); | 68 | GNUNET_free(handle->name); |
@@ -74,8 +74,10 @@ destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle) | |||
74 | } | 74 | } |
75 | 75 | ||
76 | void | 76 | void |
77 | get_handle_data_subdir (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir) | 77 | get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir) |
78 | { | 78 | { |
79 | GNUNET_assert((handle) && (dir)); | ||
80 | |||
79 | if (name) | 81 | if (name) |
80 | GNUNET_asprintf (dir, "%s%s%c%s%c", handle->service->dir, "identities", | 82 | GNUNET_asprintf (dir, "%s%s%c%s%c", handle->service->dir, "identities", |
81 | DIR_SEPARATOR, name, DIR_SEPARATOR); | 83 | DIR_SEPARATOR, name, DIR_SEPARATOR); |
@@ -87,11 +89,15 @@ get_handle_data_subdir (struct GNUNET_MESSENGER_SrvHandle *handle, const char *n | |||
87 | static int | 89 | static int |
88 | create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 90 | create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) |
89 | { | 91 | { |
90 | struct GNUNET_ShortHashCode *random_id = generate_service_new_member_id (handle->service, key); | 92 | GNUNET_assert((handle) && (key)); |
93 | |||
94 | struct GNUNET_ShortHashCode *random_id = GNUNET_new(struct GNUNET_ShortHashCode); | ||
91 | 95 | ||
92 | if (!random_id) | 96 | if (!random_id) |
93 | return GNUNET_NO; | 97 | return GNUNET_NO; |
94 | 98 | ||
99 | generate_free_member_id (random_id, NULL); | ||
100 | |||
95 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (handle->member_ids, key, random_id, | 101 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (handle->member_ids, key, random_id, |
96 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 102 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
97 | { | 103 | { |
@@ -99,8 +105,8 @@ create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const | |||
99 | return GNUNET_NO; | 105 | return GNUNET_NO; |
100 | } | 106 | } |
101 | 107 | ||
102 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Created a new member id (%s) for room: %s\n", | 108 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Created a new member id (%s) for room: %s\n", GNUNET_sh2s (random_id), |
103 | GNUNET_sh2s(random_id), GNUNET_h2s(key)); | 109 | GNUNET_h2s (key)); |
104 | 110 | ||
105 | return GNUNET_YES; | 111 | return GNUNET_YES; |
106 | } | 112 | } |
@@ -108,48 +114,61 @@ create_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const | |||
108 | const struct GNUNET_ShortHashCode* | 114 | const struct GNUNET_ShortHashCode* |
109 | get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 115 | get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) |
110 | { | 116 | { |
117 | GNUNET_assert((handle) && (key)); | ||
118 | |||
111 | return GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key); | 119 | return GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key); |
112 | } | 120 | } |
113 | 121 | ||
114 | void | 122 | int |
115 | change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 123 | change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, |
116 | const struct GNUNET_ShortHashCode *unique_id) | 124 | const struct GNUNET_ShortHashCode *unique_id) |
117 | { | 125 | { |
118 | struct GNUNET_ShortHashCode *member_id = GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key); | 126 | GNUNET_assert((handle) && (key) && (unique_id)); |
119 | |||
120 | if (member_id) | ||
121 | { | ||
122 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Changed a member id (%s) for room (%s) ", | ||
123 | GNUNET_sh2s(member_id), GNUNET_h2s(key)); | ||
124 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "into (%s).\n", | ||
125 | GNUNET_sh2s(unique_id)); | ||
126 | |||
127 | GNUNET_memcpy(member_id, unique_id, sizeof(*unique_id)); | ||
128 | |||
129 | struct GNUNET_MESSENGER_MemberMessage *msg; | ||
130 | struct GNUNET_MQ_Envelope *env; | ||
131 | 127 | ||
132 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID); | 128 | struct GNUNET_ShortHashCode *member_id = GNUNET_CONTAINER_multihashmap_get (handle->member_ids, key); |
133 | |||
134 | GNUNET_memcpy(&(msg->key), key, sizeof(*key)); | ||
135 | GNUNET_memcpy(&(msg->id), member_id, sizeof(*member_id)); | ||
136 | 129 | ||
137 | GNUNET_MQ_send (handle->mq, env); | 130 | if (!member_id) |
138 | } | ||
139 | else | ||
140 | { | 131 | { |
141 | member_id = GNUNET_new(struct GNUNET_ShortHashCode); | 132 | member_id = GNUNET_new(struct GNUNET_ShortHashCode); |
142 | GNUNET_memcpy(member_id, unique_id, sizeof(*member_id)); | 133 | GNUNET_memcpy(member_id, unique_id, sizeof(*member_id)); |
143 | 134 | ||
144 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (handle->member_ids, key, member_id, | 135 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (handle->member_ids, key, member_id, |
145 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 136 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
137 | { | ||
146 | GNUNET_free(member_id); | 138 | GNUNET_free(member_id); |
139 | return GNUNET_SYSERR; | ||
140 | } | ||
147 | } | 141 | } |
142 | |||
143 | if (0 == GNUNET_memcmp(unique_id, member_id)) | ||
144 | goto send_message_to_client; | ||
145 | |||
146 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Change a member id (%s) for room (%s).\n", GNUNET_sh2s (member_id), | ||
147 | GNUNET_h2s (key)); | ||
148 | |||
149 | GNUNET_memcpy(member_id, unique_id, sizeof(*unique_id)); | ||
150 | |||
151 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member id changed to (%s).\n", GNUNET_sh2s (unique_id)); | ||
152 | |||
153 | struct GNUNET_MESSENGER_MemberMessage *msg; | ||
154 | struct GNUNET_MQ_Envelope *env; | ||
155 | |||
156 | send_message_to_client: | ||
157 | |||
158 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID); | ||
159 | |||
160 | GNUNET_memcpy(&(msg->key), key, sizeof(*key)); | ||
161 | GNUNET_memcpy(&(msg->id), member_id, sizeof(*member_id)); | ||
162 | |||
163 | GNUNET_MQ_send (handle->mq, env); | ||
164 | return GNUNET_OK; | ||
148 | } | 165 | } |
149 | 166 | ||
150 | static void | 167 | static void |
151 | change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | 168 | change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) |
152 | { | 169 | { |
170 | GNUNET_assert(handle); | ||
171 | |||
153 | if (handle->name) | 172 | if (handle->name) |
154 | GNUNET_free(handle->name); | 173 | GNUNET_free(handle->name); |
155 | 174 | ||
@@ -173,25 +192,67 @@ change_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | |||
173 | } | 192 | } |
174 | 193 | ||
175 | static void | 194 | static void |
176 | change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, struct GNUNET_MESSENGER_Ego *ego) | 195 | change_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego) |
177 | { | 196 | { |
197 | GNUNET_assert(handle); | ||
198 | |||
178 | handle->ego = ego; | 199 | handle->ego = ego; |
179 | 200 | ||
180 | ego = get_handle_ego(handle); | 201 | ego = get_handle_ego (handle); |
202 | |||
203 | const uint16_t length = GNUNET_IDENTITY_key_get_length(&(ego->pub)); | ||
181 | 204 | ||
182 | struct GNUNET_MESSENGER_KeyMessage *msg; | 205 | struct GNUNET_MESSENGER_KeyMessage *msg; |
183 | struct GNUNET_MQ_Envelope *env; | 206 | struct GNUNET_MQ_Envelope *env; |
184 | 207 | ||
185 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_KEY); | 208 | env = GNUNET_MQ_msg_extra(msg, length, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_KEY); |
186 | 209 | ||
187 | GNUNET_memcpy(&(msg->pubkey), &(ego->pub), sizeof(ego->pub)); | 210 | char *extra = ((char*) msg) + sizeof(*msg); |
211 | |||
212 | if (GNUNET_IDENTITY_write_key_to_buffer(&(ego->pub), extra, length) < 0) | ||
213 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Could not write key to buffer.\n"); | ||
188 | 214 | ||
189 | GNUNET_MQ_send (handle->mq, env); | 215 | GNUNET_MQ_send (handle->mq, env); |
190 | } | 216 | } |
191 | 217 | ||
192 | struct GNUNET_MESSENGER_Ego* | 218 | struct GNUNET_MESSENGER_MessageHandle |
193 | get_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle) | 219 | { |
220 | struct GNUNET_MESSENGER_SrvHandle *handle; | ||
221 | struct GNUNET_MESSENGER_Message *message; | ||
222 | }; | ||
223 | |||
224 | static int | ||
225 | iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
226 | { | ||
227 | struct GNUNET_MESSENGER_MessageHandle *msg_handle = cls; | ||
228 | |||
229 | send_handle_message (msg_handle->handle, key, msg_handle->message); | ||
230 | |||
231 | return GNUNET_YES; | ||
232 | } | ||
233 | |||
234 | void | ||
235 | set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego) | ||
236 | { | ||
237 | GNUNET_assert((handle) && (ego)); | ||
238 | |||
239 | struct GNUNET_MESSENGER_MessageHandle msg_handle; | ||
240 | |||
241 | msg_handle.handle = handle; | ||
242 | msg_handle.message = create_message_key (&(ego->priv)); | ||
243 | |||
244 | GNUNET_CONTAINER_multihashmap_iterate (handle->member_ids, iterate_send_message, &msg_handle); | ||
245 | |||
246 | destroy_message (msg_handle.message); | ||
247 | |||
248 | change_handle_ego (handle, ego); | ||
249 | } | ||
250 | |||
251 | const struct GNUNET_MESSENGER_Ego* | ||
252 | get_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle) | ||
194 | { | 253 | { |
254 | GNUNET_assert(handle); | ||
255 | |||
195 | static struct GNUNET_MESSENGER_Ego anonymous; | 256 | static struct GNUNET_MESSENGER_Ego anonymous; |
196 | static int read_keys = 0; | 257 | static int read_keys = 0; |
197 | 258 | ||
@@ -200,99 +261,86 @@ get_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle) | |||
200 | 261 | ||
201 | if (!read_keys) | 262 | if (!read_keys) |
202 | { | 263 | { |
203 | struct GNUNET_IDENTITY_Ego* ego = GNUNET_IDENTITY_ego_get_anonymous (); | 264 | struct GNUNET_IDENTITY_Ego *ego = GNUNET_IDENTITY_ego_get_anonymous (); |
204 | GNUNET_memcpy(&(anonymous.priv), GNUNET_IDENTITY_ego_get_private_key(ego), sizeof(anonymous.priv)); | 265 | GNUNET_memcpy(&(anonymous.priv), GNUNET_IDENTITY_ego_get_private_key (ego), sizeof(anonymous.priv)); |
205 | GNUNET_IDENTITY_ego_get_public_key(ego, &(anonymous.pub)); | 266 | GNUNET_IDENTITY_ego_get_public_key (ego, &(anonymous.pub)); |
206 | read_keys = 1; | 267 | read_keys = 1; |
207 | } | 268 | } |
208 | 269 | ||
209 | return &anonymous; | 270 | return &anonymous; |
210 | } | 271 | } |
211 | 272 | ||
212 | void | 273 | static void |
213 | setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | 274 | callback_setup_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) |
214 | { | 275 | { |
276 | struct GNUNET_MESSENGER_SrvHandle *handle = cls; | ||
277 | |||
278 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Setting up handle...\n"); | ||
279 | |||
215 | change_handle_name (handle, name); | 280 | change_handle_name (handle, name); |
216 | change_handle_ego (handle, handle->name? lookup_service_ego(handle->service, handle->name) : NULL); | 281 | change_handle_ego (handle, ego); |
217 | 282 | ||
218 | if (handle->service->dir) | 283 | if (handle->service->dir) |
219 | load_handle_configuration(handle); | 284 | load_handle_configuration (handle); |
220 | } | 285 | } |
221 | 286 | ||
222 | struct GNUNET_MESSENGER_MessageHandle | 287 | void |
223 | { | 288 | setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) |
224 | struct GNUNET_MESSENGER_SrvHandle *handle; | ||
225 | struct GNUNET_MESSENGER_Message *message; | ||
226 | }; | ||
227 | |||
228 | static int | ||
229 | iterate_send_message (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
230 | { | 289 | { |
231 | struct GNUNET_MESSENGER_MessageHandle *msg_handle = cls; | 290 | GNUNET_assert(handle); |
232 | 291 | ||
233 | send_handle_message (msg_handle->handle, key, msg_handle->message); | 292 | struct GNUNET_MESSENGER_EgoStore *store = get_service_ego_store(handle->service); |
234 | 293 | ||
235 | return GNUNET_YES; | 294 | lookup_store_ego (store, name, callback_setup_handle_name, handle); |
236 | } | 295 | } |
237 | 296 | ||
238 | static void | 297 | static void |
239 | callback_ego_create (void *cls, const struct GNUNET_IDENTITY_PrivateKey *key, const char *emsg) | 298 | callback_update_handle (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) |
240 | { | 299 | { |
241 | struct GNUNET_MESSENGER_SrvHandle *handle = cls; | 300 | struct GNUNET_MESSENGER_SrvHandle *handle = cls; |
242 | 301 | ||
243 | handle->operation = NULL; | 302 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Updating handle...\n"); |
244 | 303 | ||
245 | if (emsg) | 304 | struct GNUNET_MESSENGER_EgoStore *store = get_service_ego_store(handle->service); |
246 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "%s\n", emsg); | ||
247 | 305 | ||
248 | if (key) | 306 | if (!ego) |
249 | { | 307 | create_store_ego(store, handle->name, handle); |
250 | struct GNUNET_MESSENGER_MessageHandle msg_handle; | 308 | else |
251 | 309 | change_handle_ego (handle, ego); | |
252 | msg_handle.handle = handle; | ||
253 | msg_handle.message = create_message_key (key); | ||
254 | |||
255 | GNUNET_CONTAINER_multihashmap_iterate (handle->member_ids, iterate_send_message, &msg_handle); | ||
256 | |||
257 | destroy_message (msg_handle.message); | ||
258 | |||
259 | update_service_ego(handle->service, handle->name, key); | ||
260 | |||
261 | change_handle_ego (handle, lookup_service_ego(handle->service, handle->name)); | ||
262 | } | ||
263 | } | 310 | } |
264 | 311 | ||
265 | int | 312 | void |
266 | update_handle (struct GNUNET_MESSENGER_SrvHandle *handle) | 313 | update_handle (struct GNUNET_MESSENGER_SrvHandle *handle) |
267 | { | 314 | { |
268 | GNUNET_assert(handle); | 315 | GNUNET_assert(handle); |
269 | 316 | ||
270 | if (!handle->name) | 317 | if (!handle->name) |
271 | return GNUNET_SYSERR; | 318 | { |
272 | 319 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Updating handle failed: Name is required!\n"); | |
273 | struct GNUNET_MESSENGER_Ego *ego = lookup_service_ego(handle->service, handle->name); | 320 | return; |
321 | } | ||
274 | 322 | ||
275 | if (!ego) | 323 | struct GNUNET_MESSENGER_EgoStore *store = get_service_ego_store(handle->service); |
276 | handle->operation = GNUNET_IDENTITY_create (handle->service->identity, handle->name, NULL, | ||
277 | GNUNET_IDENTITY_TYPE_ECDSA, callback_ego_create, handle); | ||
278 | else | ||
279 | change_handle_ego (handle, ego); | ||
280 | 324 | ||
281 | return GNUNET_OK; | 325 | lookup_store_ego (store, handle->name, callback_update_handle, handle); |
282 | } | 326 | } |
283 | 327 | ||
284 | int | 328 | static void |
285 | set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | 329 | callback_set_handle_name (void *cls, const char *name, const struct GNUNET_MESSENGER_Ego *ego) |
286 | { | 330 | { |
287 | GNUNET_assert(handle); | 331 | struct GNUNET_MESSENGER_SrvHandle *handle = cls; |
288 | 332 | ||
289 | if ((name) && (lookup_service_ego(handle->service, name))) | 333 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Renaming handle...\n"); |
290 | return GNUNET_NO; | 334 | |
335 | if (ego) | ||
336 | { | ||
337 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Renaming handle failed: Name is occupied! (%s)\n", name); | ||
338 | return; | ||
339 | } | ||
291 | 340 | ||
292 | struct GNUNET_IDENTITY_Operation *operation = handle->operation; | 341 | struct GNUNET_MESSENGER_EgoStore *store = get_service_ego_store(handle->service); |
293 | 342 | ||
294 | if (handle->name) | 343 | int rename_ego_in_store = handle->ego? GNUNET_YES : GNUNET_NO; |
295 | handle->operation = GNUNET_IDENTITY_rename (handle->service->identity, handle->name, name, NULL, NULL); | ||
296 | 344 | ||
297 | char *old_dir; | 345 | char *old_dir; |
298 | get_handle_data_subdir (handle, handle->name, &old_dir); | 346 | get_handle_data_subdir (handle, handle->name, &old_dir); |
@@ -323,29 +371,42 @@ set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | |||
323 | destroy_message (msg_handle.message); | 371 | destroy_message (msg_handle.message); |
324 | 372 | ||
325 | change_handle_name (handle, name); | 373 | change_handle_name (handle, name); |
326 | |||
327 | if (operation) | ||
328 | GNUNET_IDENTITY_cancel (operation); | ||
329 | } | 374 | } |
330 | else | 375 | else |
376 | rename_ego_in_store = GNUNET_NO; | ||
377 | |||
378 | GNUNET_free(old_dir); | ||
379 | GNUNET_free(new_dir); | ||
380 | |||
381 | if (GNUNET_YES == rename_ego_in_store) | ||
382 | rename_store_ego(store, handle->name, name); | ||
383 | } | ||
384 | |||
385 | void | ||
386 | set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name) | ||
387 | { | ||
388 | GNUNET_assert(handle); | ||
389 | |||
390 | if (!name) | ||
331 | { | 391 | { |
332 | if (handle->operation) | 392 | if (handle->ego) |
333 | { | 393 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Renaming handle failed: Name is required!\n"); |
334 | GNUNET_IDENTITY_cancel (handle->operation); | 394 | else |
395 | change_handle_name (handle, name); | ||
335 | 396 | ||
336 | handle->operation = operation; | 397 | return; |
337 | } | ||
338 | } | 398 | } |
339 | 399 | ||
340 | GNUNET_free(old_dir); | 400 | struct GNUNET_MESSENGER_EgoStore *store = get_service_ego_store(handle->service); |
341 | GNUNET_free(new_dir); | ||
342 | 401 | ||
343 | return (result == 0 ? GNUNET_OK : GNUNET_NO); | 402 | lookup_store_ego (store, name, callback_set_handle_name, handle); |
344 | } | 403 | } |
345 | 404 | ||
346 | int | 405 | int |
347 | open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 406 | open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) |
348 | { | 407 | { |
408 | GNUNET_assert((handle) && (key)); | ||
409 | |||
349 | if ((!get_handle_member_id (handle, key)) && (GNUNET_YES != create_handle_member_id (handle, key))) | 410 | if ((!get_handle_member_id (handle, key)) && (GNUNET_YES != create_handle_member_id (handle, key))) |
350 | return GNUNET_NO; | 411 | return GNUNET_NO; |
351 | 412 | ||
@@ -356,6 +417,8 @@ int | |||
356 | entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, | 417 | entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, |
357 | const struct GNUNET_HashCode *key) | 418 | const struct GNUNET_HashCode *key) |
358 | { | 419 | { |
420 | GNUNET_assert((handle) && (door) && (key)); | ||
421 | |||
359 | if ((!get_handle_member_id (handle, key)) && (GNUNET_YES != create_handle_member_id (handle, key))) | 422 | if ((!get_handle_member_id (handle, key)) && (GNUNET_YES != create_handle_member_id (handle, key))) |
360 | return GNUNET_NO; | 423 | return GNUNET_NO; |
361 | 424 | ||
@@ -365,6 +428,8 @@ entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE | |||
365 | int | 428 | int |
366 | close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) | 429 | close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key) |
367 | { | 430 | { |
431 | GNUNET_assert((handle) && (key)); | ||
432 | |||
368 | if (!get_handle_member_id (handle, key)) | 433 | if (!get_handle_member_id (handle, key)) |
369 | return GNUNET_NO; | 434 | return GNUNET_NO; |
370 | 435 | ||
@@ -373,8 +438,10 @@ close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE | |||
373 | 438 | ||
374 | int | 439 | int |
375 | send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 440 | send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, |
376 | struct GNUNET_MESSENGER_Message *message) | 441 | const struct GNUNET_MESSENGER_Message *message) |
377 | { | 442 | { |
443 | GNUNET_assert((handle) && (key) && (message)); | ||
444 | |||
378 | const struct GNUNET_ShortHashCode *id = get_handle_member_id (handle, key); | 445 | const struct GNUNET_ShortHashCode *id = get_handle_member_id (handle, key); |
379 | 446 | ||
380 | if (!id) | 447 | if (!id) |
@@ -391,45 +458,120 @@ send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNU | |||
391 | return GNUNET_NO; | 458 | return GNUNET_NO; |
392 | } | 459 | } |
393 | 460 | ||
394 | struct GNUNET_HashCode hash; | 461 | struct GNUNET_MESSENGER_Message *msg = copy_message(message); |
395 | 462 | ||
396 | GNUNET_memcpy(&(message->header.sender_id), id, sizeof(*id)); | 463 | GNUNET_memcpy(&(msg->header.sender_id), id, sizeof(*id)); |
397 | 464 | ||
398 | send_room_message (room, handle, message, &hash); | 465 | return send_room_message (room, handle, msg); |
399 | return GNUNET_YES; | 466 | } |
467 | |||
468 | static const struct GNUNET_HashCode* | ||
469 | get_next_member_session_contect(const struct GNUNET_MESSENGER_MemberSession *session) | ||
470 | { | ||
471 | if (session->next) | ||
472 | return get_next_member_session_contect (session->next); | ||
473 | else | ||
474 | return get_member_session_context(session); | ||
475 | } | ||
476 | |||
477 | void | ||
478 | notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | ||
479 | const struct GNUNET_MESSENGER_MemberSession *session, | ||
480 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
481 | { | ||
482 | GNUNET_assert((handle) && (key) && (session) && (message) && (hash)); | ||
483 | |||
484 | if ((!handle->mq) || (!get_handle_member_id (handle, key))) | ||
485 | { | ||
486 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Notifying client about message requires membership!\n"); | ||
487 | return; | ||
488 | } | ||
489 | |||
490 | const struct GNUNET_IDENTITY_PublicKey *pubkey = get_contact_key(session->contact); | ||
491 | |||
492 | struct GNUNET_HashCode sender; | ||
493 | GNUNET_CRYPTO_hash(pubkey, sizeof(*pubkey), &sender); | ||
494 | |||
495 | const struct GNUNET_HashCode *context = get_next_member_session_contect (session); | ||
496 | |||
497 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Notifying client about message: %s\n", GNUNET_h2s (hash)); | ||
498 | |||
499 | struct GNUNET_MESSENGER_Message *private_message = NULL; | ||
500 | |||
501 | if (GNUNET_MESSENGER_KIND_PRIVATE == message->header.kind) | ||
502 | { | ||
503 | private_message = copy_message(message); | ||
504 | |||
505 | if (GNUNET_YES != decrypt_message(private_message, &(get_handle_ego(handle)->priv))) | ||
506 | { | ||
507 | destroy_message(private_message); | ||
508 | private_message = NULL; | ||
509 | } | ||
510 | else | ||
511 | message = private_message; | ||
512 | } | ||
513 | |||
514 | struct GNUNET_MESSENGER_RecvMessage *msg; | ||
515 | struct GNUNET_MQ_Envelope *env; | ||
516 | |||
517 | uint16_t length = get_message_size (message, GNUNET_YES); | ||
518 | |||
519 | env = GNUNET_MQ_msg_extra(msg, length, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE); | ||
520 | |||
521 | GNUNET_memcpy(&(msg->key), key, sizeof(msg->key)); | ||
522 | GNUNET_memcpy(&(msg->sender), &sender, sizeof(msg->sender)); | ||
523 | GNUNET_memcpy(&(msg->context), context, sizeof(msg->context)); | ||
524 | GNUNET_memcpy(&(msg->hash), hash, sizeof(msg->hash)); | ||
525 | |||
526 | msg->flags = (uint32_t) ( | ||
527 | private_message? GNUNET_MESSENGER_FLAG_PRIVATE : GNUNET_MESSENGER_FLAG_NONE | ||
528 | ); | ||
529 | |||
530 | char *buffer = ((char*) msg) + sizeof(*msg); | ||
531 | encode_message (message, length, buffer, GNUNET_YES); | ||
532 | |||
533 | if (private_message) | ||
534 | destroy_message(private_message); | ||
535 | |||
536 | GNUNET_MQ_send (handle->mq, env); | ||
400 | } | 537 | } |
401 | 538 | ||
402 | static int callback_scan_for_rooms(void* cls, const char *filename) { | 539 | static int |
403 | struct GNUNET_MESSENGER_SrvHandle* handle = cls; | 540 | callback_scan_for_rooms (void *cls, const char *filename) |
541 | { | ||
542 | struct GNUNET_MESSENGER_SrvHandle *handle = cls; | ||
404 | 543 | ||
405 | struct GNUNET_CONFIGURATION_Handle* cfg = GNUNET_CONFIGURATION_create(); | 544 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); |
406 | 545 | ||
407 | if ((GNUNET_YES == GNUNET_DISK_file_test(filename)) && | 546 | if ((GNUNET_YES == GNUNET_DISK_file_test (filename)) && (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, filename))) |
408 | (GNUNET_OK == GNUNET_CONFIGURATION_parse(cfg, filename))) | ||
409 | { | 547 | { |
410 | struct GNUNET_HashCode key; | 548 | struct GNUNET_HashCode key; |
411 | struct GNUNET_ShortHashCode member_id; | 549 | struct GNUNET_ShortHashCode member_id; |
412 | 550 | ||
413 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_data(cfg, "room", "key", &key, sizeof(key))) && | 551 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_data (cfg, "room", "key", &key, sizeof(key))) && |
414 | (GNUNET_OK == GNUNET_CONFIGURATION_get_data(cfg, "room", "member_id", &member_id, sizeof(member_id)))) | 552 | (GNUNET_OK == GNUNET_CONFIGURATION_get_data (cfg, "room", "member_id", &member_id, sizeof(member_id)))) |
415 | change_handle_member_id(handle, &key, &member_id); | 553 | change_handle_member_id (handle, &key, &member_id); |
416 | } | 554 | } |
417 | 555 | ||
418 | GNUNET_CONFIGURATION_destroy(cfg); | 556 | GNUNET_CONFIGURATION_destroy (cfg); |
419 | return GNUNET_OK; | 557 | return GNUNET_OK; |
420 | } | 558 | } |
421 | 559 | ||
422 | void load_handle_configuration(struct GNUNET_MESSENGER_SrvHandle *handle) { | 560 | void |
423 | char* id_dir; | 561 | load_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle) |
424 | get_handle_data_subdir(handle, handle->name, &id_dir); | 562 | { |
563 | GNUNET_assert(handle); | ||
425 | 564 | ||
426 | if (GNUNET_YES == GNUNET_DISK_directory_test(id_dir, GNUNET_YES)) | 565 | char *id_dir; |
566 | get_handle_data_subdir (handle, handle->name, &id_dir); | ||
567 | |||
568 | if (GNUNET_YES == GNUNET_DISK_directory_test (id_dir, GNUNET_YES)) | ||
427 | { | 569 | { |
428 | char* scan_dir; | 570 | char *scan_dir; |
429 | GNUNET_asprintf(&scan_dir, "%s%s%c", id_dir, "rooms", DIR_SEPARATOR); | 571 | GNUNET_asprintf (&scan_dir, "%s%s%c", id_dir, "rooms", DIR_SEPARATOR); |
430 | 572 | ||
431 | if (GNUNET_OK == GNUNET_DISK_directory_test(scan_dir, GNUNET_YES)) | 573 | if (GNUNET_OK == GNUNET_DISK_directory_test (scan_dir, GNUNET_YES)) |
432 | GNUNET_DISK_directory_scan(scan_dir, callback_scan_for_rooms, handle); | 574 | GNUNET_DISK_directory_scan (scan_dir, callback_scan_for_rooms, handle); |
433 | 575 | ||
434 | GNUNET_free(scan_dir); | 576 | GNUNET_free(scan_dir); |
435 | } | 577 | } |
@@ -438,63 +580,64 @@ void load_handle_configuration(struct GNUNET_MESSENGER_SrvHandle *handle) { | |||
438 | } | 580 | } |
439 | 581 | ||
440 | static int | 582 | static int |
441 | iterate_save_rooms(void* cls, const struct GNUNET_HashCode* key, void* value) | 583 | iterate_save_rooms (void *cls, const struct GNUNET_HashCode *key, void *value) |
442 | { | 584 | { |
443 | struct GNUNET_MESSENGER_SrvHandle* handle = cls; | 585 | struct GNUNET_MESSENGER_SrvHandle *handle = cls; |
444 | struct GNUNET_ShortHashCode* member_id = value; | 586 | struct GNUNET_ShortHashCode *member_id = value; |
445 | 587 | ||
446 | char* id_dir; | 588 | char *id_dir; |
447 | get_handle_data_subdir(handle, handle->name, &id_dir); | 589 | get_handle_data_subdir (handle, handle->name, &id_dir); |
448 | 590 | ||
449 | char* filename; | 591 | char *filename; |
450 | GNUNET_asprintf(&filename, "%s%s%c%s.cfg", | 592 | GNUNET_asprintf (&filename, "%s%s%c%s.cfg", id_dir, "rooms", DIR_SEPARATOR, GNUNET_h2s (key)); |
451 | id_dir, "rooms", DIR_SEPARATOR, | ||
452 | GNUNET_h2s(key)); | ||
453 | 593 | ||
454 | GNUNET_free(id_dir); | 594 | GNUNET_free(id_dir); |
455 | 595 | ||
456 | struct GNUNET_CONFIGURATION_Handle* cfg = GNUNET_CONFIGURATION_create(); | 596 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); |
457 | 597 | ||
458 | char* key_data = GNUNET_STRINGS_data_to_string_alloc(key, sizeof(*key)); | 598 | char *key_data = GNUNET_STRINGS_data_to_string_alloc (key, sizeof(*key)); |
459 | 599 | ||
460 | if (key_data) | 600 | if (key_data) |
461 | { | 601 | { |
462 | GNUNET_CONFIGURATION_set_value_string(cfg, "room", "key", key_data); | 602 | GNUNET_CONFIGURATION_set_value_string (cfg, "room", "key", key_data); |
463 | 603 | ||
464 | GNUNET_free(key_data); | 604 | GNUNET_free(key_data); |
465 | } | 605 | } |
466 | 606 | ||
467 | char* member_id_data = GNUNET_STRINGS_data_to_string_alloc(member_id, sizeof(*member_id)); | 607 | char *member_id_data = GNUNET_STRINGS_data_to_string_alloc (member_id, sizeof(*member_id)); |
468 | 608 | ||
469 | if (member_id_data) | 609 | if (member_id_data) |
470 | { | 610 | { |
471 | GNUNET_CONFIGURATION_set_value_string(cfg, "room", "member_id", member_id_data); | 611 | GNUNET_CONFIGURATION_set_value_string (cfg, "room", "member_id", member_id_data); |
472 | 612 | ||
473 | GNUNET_free(member_id_data); | 613 | GNUNET_free(member_id_data); |
474 | } | 614 | } |
475 | 615 | ||
476 | GNUNET_CONFIGURATION_write(cfg, filename); | 616 | GNUNET_CONFIGURATION_write (cfg, filename); |
477 | GNUNET_CONFIGURATION_destroy(cfg); | 617 | GNUNET_CONFIGURATION_destroy (cfg); |
478 | 618 | ||
479 | GNUNET_free(filename); | 619 | GNUNET_free(filename); |
480 | 620 | ||
481 | return GNUNET_YES; | 621 | return GNUNET_YES; |
482 | } | 622 | } |
483 | 623 | ||
484 | void save_handle_configuration(struct GNUNET_MESSENGER_SrvHandle *handle) | 624 | void |
625 | save_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle) | ||
485 | { | 626 | { |
486 | char* id_dir; | 627 | GNUNET_assert(handle); |
487 | get_handle_data_subdir(handle, handle->name, &id_dir); | 628 | |
629 | char *id_dir; | ||
630 | get_handle_data_subdir (handle, handle->name, &id_dir); | ||
488 | 631 | ||
489 | if ((GNUNET_YES == GNUNET_DISK_directory_test(id_dir, GNUNET_NO)) || | 632 | if ((GNUNET_YES == GNUNET_DISK_directory_test (id_dir, GNUNET_NO)) || (GNUNET_OK |
490 | (GNUNET_OK == GNUNET_DISK_directory_create(id_dir))) | 633 | == GNUNET_DISK_directory_create (id_dir))) |
491 | { | 634 | { |
492 | char* save_dir; | 635 | char *save_dir; |
493 | GNUNET_asprintf(&save_dir, "%s%s%c", id_dir, "rooms", DIR_SEPARATOR); | 636 | GNUNET_asprintf (&save_dir, "%s%s%c", id_dir, "rooms", DIR_SEPARATOR); |
494 | 637 | ||
495 | if ((GNUNET_YES == GNUNET_DISK_directory_test(save_dir, GNUNET_NO)) || | 638 | if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) || |
496 | (GNUNET_OK == GNUNET_DISK_directory_create(save_dir))) | 639 | (GNUNET_OK == GNUNET_DISK_directory_create (save_dir))) |
497 | GNUNET_CONTAINER_multihashmap_iterate(handle->member_ids, iterate_save_rooms, handle); | 640 | GNUNET_CONTAINER_multihashmap_iterate (handle->member_ids, iterate_save_rooms, handle); |
498 | 641 | ||
499 | GNUNET_free(save_dir); | 642 | GNUNET_free(save_dir); |
500 | } | 643 | } |
diff --git a/src/messenger/gnunet-service-messenger_handle.h b/src/messenger/gnunet-service-messenger_handle.h index 81cf377a8..70b2cac6d 100644 --- a/src/messenger/gnunet-service-messenger_handle.h +++ b/src/messenger/gnunet-service-messenger_handle.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -35,6 +35,7 @@ | |||
35 | #include "gnunet_mq_lib.h" | 35 | #include "gnunet_mq_lib.h" |
36 | 36 | ||
37 | #include "gnunet-service-messenger_service.h" | 37 | #include "gnunet-service-messenger_service.h" |
38 | #include "gnunet-service-messenger_member_session.h" | ||
38 | 39 | ||
39 | #include "messenger_api_ego.h" | 40 | #include "messenger_api_ego.h" |
40 | #include "messenger_api_message.h" | 41 | #include "messenger_api_message.h" |
@@ -46,9 +47,7 @@ struct GNUNET_MESSENGER_SrvHandle | |||
46 | 47 | ||
47 | char *name; | 48 | char *name; |
48 | 49 | ||
49 | struct GNUNET_IDENTITY_Operation *operation; | 50 | const struct GNUNET_MESSENGER_Ego *ego; |
50 | |||
51 | struct GNUNET_MESSENGER_Ego *ego; | ||
52 | 51 | ||
53 | struct GNUNET_CONTAINER_MultiHashMap *member_ids; | 52 | struct GNUNET_CONTAINER_MultiHashMap *member_ids; |
54 | }; | 53 | }; |
@@ -56,8 +55,8 @@ struct GNUNET_MESSENGER_SrvHandle | |||
56 | /** | 55 | /** |
57 | * Creates and allocates a new handle related to a <i>service</i> and using a given <i>mq</i> (message queue). | 56 | * Creates and allocates a new handle related to a <i>service</i> and using a given <i>mq</i> (message queue). |
58 | * | 57 | * |
59 | * @param service MESSENGER Service | 58 | * @param[in/out] service MESSENGER Service |
60 | * @param mq Message queue | 59 | * @param[in/out] mq Message queue |
61 | * @return New handle | 60 | * @return New handle |
62 | */ | 61 | */ |
63 | struct GNUNET_MESSENGER_SrvHandle* | 62 | struct GNUNET_MESSENGER_SrvHandle* |
@@ -66,7 +65,7 @@ create_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle | |||
66 | /** | 65 | /** |
67 | * Destroys a handle and frees its memory fully. | 66 | * Destroys a handle and frees its memory fully. |
68 | * | 67 | * |
69 | * @param handle Handle | 68 | * @param[in/out] handle Handle |
70 | */ | 69 | */ |
71 | void | 70 | void |
72 | destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle); | 71 | destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle); |
@@ -75,52 +74,63 @@ destroy_handle (struct GNUNET_MESSENGER_SrvHandle *handle); | |||
75 | * Writes the path of the directory for a given <i>handle</i> using a specific <i>name</i> to the parameter | 74 | * Writes the path of the directory for a given <i>handle</i> using a specific <i>name</i> to the parameter |
76 | * <i>dir</i>. This directory will be used to store data regarding the handle and its messages. | 75 | * <i>dir</i>. This directory will be used to store data regarding the handle and its messages. |
77 | * | 76 | * |
78 | * @param handle Handle | 77 | * @param[in] handle Handle |
79 | * @param name Potential name of the handle | 78 | * @param[in] name Potential name of the handle |
80 | * @param dir[out] Path to store data | 79 | * @param[out] dir Path to store data |
81 | */ | 80 | */ |
82 | void | 81 | void |
83 | get_handle_data_subdir (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir); | 82 | get_handle_data_subdir (const struct GNUNET_MESSENGER_SrvHandle *handle, const char *name, char **dir); |
84 | 83 | ||
85 | /** | 84 | /** |
86 | * Returns the member id of a given <i>handle</i> in a specific <i>room</i>. | 85 | * Returns the member id of a given <i>handle</i> in a specific <i>room</i>. |
87 | * | 86 | * |
88 | * If the handle is not a member of the specific <i>room</i>, NULL gets returned. | 87 | * If the handle is not a member of the specific <i>room</i>, NULL gets returned. |
89 | * | 88 | * |
90 | * @param handle Handle | 89 | * @param[in] handle Handle |
91 | * @param key Key of a room | 90 | * @param[in] key Key of a room |
92 | * @return Member id or NULL | 91 | * @return Member id or NULL |
93 | */ | 92 | */ |
94 | const struct GNUNET_ShortHashCode* | 93 | const struct GNUNET_ShortHashCode* |
95 | get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); | 94 | get_handle_member_id (const struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); |
96 | 95 | ||
97 | /** | 96 | /** |
98 | * Changes the member id of a given <i>handle</i> in a specific <i>room</i> to match a <i>unique_id</i>. | 97 | * Changes the member id of a given <i>handle</i> in a specific <i>room</i> to match a <i>unique_id</i> |
98 | * and returns GNUNET_OK on success. | ||
99 | * | 99 | * |
100 | * The client connected to the <i>handle</i> will be informed afterwards automatically. | 100 | * The client connected to the <i>handle</i> will be informed afterwards automatically. |
101 | * | 101 | * |
102 | * @param handle Handle | 102 | * @param[in/out] handle Handle |
103 | * @param key Key of a room | 103 | * @param[in] key Key of a room |
104 | * @param unique_id Unique member id | 104 | * @param[in] unique_id Unique member id |
105 | * @return GNUNET_OK on success, otherwise GNUNET_SYSERR | ||
105 | */ | 106 | */ |
106 | void | 107 | int |
107 | change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 108 | change_handle_member_id (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, |
108 | const struct GNUNET_ShortHashCode *unique_id); | 109 | const struct GNUNET_ShortHashCode *unique_id); |
109 | 110 | ||
110 | /** | 111 | /** |
112 | * Sets the EGO used by a given <i>handle</i>. | ||
113 | * | ||
114 | * @param[in/out] handle Handle | ||
115 | * @param[in] ego EGO keypair | ||
116 | */ | ||
117 | void | ||
118 | set_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_MESSENGER_Ego *ego); | ||
119 | |||
120 | /** | ||
111 | * Returns the EGO used by a given <i>handle</i>. | 121 | * Returns the EGO used by a given <i>handle</i>. |
112 | * | 122 | * |
113 | * @param handle Handle | 123 | * @param[in] handle Handle |
114 | * @return EGO keypair | 124 | * @return EGO keypair |
115 | */ | 125 | */ |
116 | struct GNUNET_MESSENGER_Ego* | 126 | const struct GNUNET_MESSENGER_Ego* |
117 | get_handle_ego (struct GNUNET_MESSENGER_SrvHandle *handle); | 127 | get_handle_ego (const struct GNUNET_MESSENGER_SrvHandle *handle); |
118 | 128 | ||
119 | /** | 129 | /** |
120 | * Tries to set the name and EGO key of a <i>handle</i> initially by looking up a specific <i>name</i>. | 130 | * Tries to set the name and EGO key of a <i>handle</i> initially by looking up a specific <i>name</i>. |
121 | * | 131 | * |
122 | * @param handle Handle | 132 | * @param[in/out] handle Handle |
123 | * @param name Name (optionally: valid EGO name) | 133 | * @param[in] name Name (optionally: valid EGO name) |
124 | */ | 134 | */ |
125 | void | 135 | void |
126 | setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); | 136 | setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); |
@@ -129,10 +139,9 @@ setup_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); | |||
129 | * Tries to change the keypair of an EGO of a <i>handle</i> under the same name and informs all rooms | 139 | * Tries to change the keypair of an EGO of a <i>handle</i> under the same name and informs all rooms |
130 | * about the change automatically. | 140 | * about the change automatically. |
131 | * | 141 | * |
132 | * @param handle Handle | 142 | * @param[in/out] handle Handle |
133 | * @return GNUNET_OK on success, otherwise GNUNET_SYSERR | ||
134 | */ | 143 | */ |
135 | int | 144 | void |
136 | update_handle (struct GNUNET_MESSENGER_SrvHandle *handle); | 145 | update_handle (struct GNUNET_MESSENGER_SrvHandle *handle); |
137 | 146 | ||
138 | /** | 147 | /** |
@@ -141,20 +150,19 @@ update_handle (struct GNUNET_MESSENGER_SrvHandle *handle); | |||
141 | * | 150 | * |
142 | * The client connected to the <i>handle</i> will be informed afterwards automatically. | 151 | * The client connected to the <i>handle</i> will be informed afterwards automatically. |
143 | * | 152 | * |
144 | * @param handle Handle | 153 | * @param[in/out] handle Handle |
145 | * @param name New name | 154 | * @param[in] name New name |
146 | * @return GNUNET_OK on success, otherwise GNUNET_NO | ||
147 | */ | 155 | */ |
148 | int | 156 | void |
149 | set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); | 157 | set_handle_name (struct GNUNET_MESSENGER_SrvHandle *handle, const char *name); |
150 | 158 | ||
151 | /** | 159 | /** |
152 | * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and opens the | 160 | * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and opens the |
153 | * room from the handles service. | 161 | * room from the handles service. |
154 | * | 162 | * |
155 | * @param handle Handle | 163 | * @param[in/out] handle Handle |
156 | * @param key Key of a room | 164 | * @param[in] key Key of a room |
157 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 165 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
158 | */ | 166 | */ |
159 | int | 167 | int |
160 | open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); | 168 | open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); |
@@ -163,10 +171,10 @@ open_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET | |||
163 | * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and enters the room | 171 | * Makes a given <i>handle</i> a member of the room using a specific <i>key</i> and enters the room |
164 | * through a tunnel to a peer identified by a given <i>door</i> (peer identity). | 172 | * through a tunnel to a peer identified by a given <i>door</i> (peer identity). |
165 | * | 173 | * |
166 | * @param handle Handle | 174 | * @param[in/out] handle Handle |
167 | * @param door Peer identity | 175 | * @param[in] door Peer identity |
168 | * @param key Key of a room | 176 | * @param[in] key Key of a room |
169 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 177 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
170 | */ | 178 | */ |
171 | int | 179 | int |
172 | entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, | 180 | entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_PeerIdentity *door, |
@@ -176,9 +184,9 @@ entry_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE | |||
176 | * Removes the membership of the room using a specific <i>key</i> and closes it if no other handle | 184 | * Removes the membership of the room using a specific <i>key</i> and closes it if no other handle |
177 | * from this service is still a member of it. | 185 | * from this service is still a member of it. |
178 | * | 186 | * |
179 | * @param handle Handle | 187 | * @param[in/out] handle Handle |
180 | * @param key Key of a room | 188 | * @param[in] key Key of a room |
181 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 189 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
182 | */ | 190 | */ |
183 | int | 191 | int |
184 | close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); | 192 | close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key); |
@@ -186,31 +194,45 @@ close_handle_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNE | |||
186 | /** | 194 | /** |
187 | * Sends a <i>message</i> from a given <i>handle</i> to the room using a specific <i>key</i>. | 195 | * Sends a <i>message</i> from a given <i>handle</i> to the room using a specific <i>key</i>. |
188 | * | 196 | * |
189 | * @param handle Handle | 197 | * @param[in/out] handle Handle |
190 | * @param key Key of a room | 198 | * @param[in] key Key of a room |
191 | * @param message Message | 199 | * @param[in] message Message |
192 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 200 | * @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise. |
193 | */ | 201 | */ |
194 | int | 202 | int |
195 | send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | 203 | send_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, |
196 | struct GNUNET_MESSENGER_Message *message); | 204 | const struct GNUNET_MESSENGER_Message *message); |
205 | |||
206 | /** | ||
207 | * Notifies the handle that a new message was received or sent. | ||
208 | * | ||
209 | * @param[in/out] handle Handle | ||
210 | * @param[in] key Key of room | ||
211 | * @param[in] session Member session | ||
212 | * @param[in] message Message | ||
213 | * @param[in] hash Hash of message | ||
214 | */ | ||
215 | void | ||
216 | notify_handle_message (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_HashCode *key, | ||
217 | const struct GNUNET_MESSENGER_MemberSession *session, | ||
218 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
197 | 219 | ||
198 | /** | 220 | /** |
199 | * Loads member ids and other potential configuration from a given <i>handle</i> which | 221 | * Loads member ids and other potential configuration from a given <i>handle</i> which |
200 | * depends on the given name the <i>handle</i> uses. | 222 | * depends on the given name the <i>handle</i> uses. |
201 | * | 223 | * |
202 | * @param handle Handle | 224 | * @param[out] handle Handle |
203 | */ | 225 | */ |
204 | void | 226 | void |
205 | load_handle_configuration(struct GNUNET_MESSENGER_SrvHandle *handle); | 227 | load_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle); |
206 | 228 | ||
207 | /** | 229 | /** |
208 | * Saves member ids and other potential configuration from a given <i>handle</i> which | 230 | * Saves member ids and other potential configuration from a given <i>handle</i> which |
209 | * depends on the given name the <i>handle</i> uses. | 231 | * depends on the given name the <i>handle</i> uses. |
210 | * | 232 | * |
211 | * @param handle Handle | 233 | * @param[in] handle Handle |
212 | */ | 234 | */ |
213 | void | 235 | void |
214 | save_handle_configuration(struct GNUNET_MESSENGER_SrvHandle *handle); | 236 | save_handle_configuration (struct GNUNET_MESSENGER_SrvHandle *handle); |
215 | 237 | ||
216 | #endif //GNUNET_SERVICE_MESSENGER_HANDLE_H | 238 | #endif //GNUNET_SERVICE_MESSENGER_HANDLE_H |
diff --git a/src/messenger/gnunet-service-messenger_list_handles.c b/src/messenger/gnunet-service-messenger_list_handles.c index 16a160dea..adcbf6a42 100644 --- a/src/messenger/gnunet-service-messenger_list_handles.c +++ b/src/messenger/gnunet-service-messenger_list_handles.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -55,8 +55,10 @@ clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles) | |||
55 | } | 55 | } |
56 | 56 | ||
57 | void | 57 | void |
58 | add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, void *handle) | 58 | add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle) |
59 | { | 59 | { |
60 | GNUNET_assert((handles) && (handle)); | ||
61 | |||
60 | struct GNUNET_MESSENGER_ListHandle *element = GNUNET_new(struct GNUNET_MESSENGER_ListHandle); | 62 | struct GNUNET_MESSENGER_ListHandle *element = GNUNET_new(struct GNUNET_MESSENGER_ListHandle); |
61 | 63 | ||
62 | element->handle = handle; | 64 | element->handle = handle; |
@@ -65,8 +67,10 @@ add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, void *handle) | |||
65 | } | 67 | } |
66 | 68 | ||
67 | int | 69 | int |
68 | remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, void *handle) | 70 | remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle) |
69 | { | 71 | { |
72 | GNUNET_assert((handles) && (handle)); | ||
73 | |||
70 | struct GNUNET_MESSENGER_ListHandle *element; | 74 | struct GNUNET_MESSENGER_ListHandle *element; |
71 | 75 | ||
72 | for (element = handles->head; element; element = element->next) | 76 | for (element = handles->head; element; element = element->next) |
@@ -82,9 +86,11 @@ remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, void *handle) | |||
82 | return GNUNET_YES; | 86 | return GNUNET_YES; |
83 | } | 87 | } |
84 | 88 | ||
85 | void* | 89 | struct GNUNET_MESSENGER_SrvHandle* |
86 | find_list_handle_by_member (struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key) | 90 | find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key) |
87 | { | 91 | { |
92 | GNUNET_assert((handles) && (key)); | ||
93 | |||
88 | struct GNUNET_MESSENGER_ListHandle *element; | 94 | struct GNUNET_MESSENGER_ListHandle *element; |
89 | 95 | ||
90 | for (element = handles->head; element; element = element->next) | 96 | for (element = handles->head; element; element = element->next) |
diff --git a/src/messenger/gnunet-service-messenger_list_handles.h b/src/messenger/gnunet-service-messenger_list_handles.h index fe92cc58a..9f7ca725f 100644 --- a/src/messenger/gnunet-service-messenger_list_handles.h +++ b/src/messenger/gnunet-service-messenger_list_handles.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -30,12 +30,14 @@ | |||
30 | #include "gnunet_crypto_lib.h" | 30 | #include "gnunet_crypto_lib.h" |
31 | #include "gnunet_container_lib.h" | 31 | #include "gnunet_container_lib.h" |
32 | 32 | ||
33 | struct GNUNET_MESSENGER_SrvHandle; | ||
34 | |||
33 | struct GNUNET_MESSENGER_ListHandle | 35 | struct GNUNET_MESSENGER_ListHandle |
34 | { | 36 | { |
35 | struct GNUNET_MESSENGER_ListHandle *prev; | 37 | struct GNUNET_MESSENGER_ListHandle *prev; |
36 | struct GNUNET_MESSENGER_ListHandle *next; | 38 | struct GNUNET_MESSENGER_ListHandle *next; |
37 | 39 | ||
38 | void *handle; | 40 | struct GNUNET_MESSENGER_SrvHandle *handle; |
39 | }; | 41 | }; |
40 | 42 | ||
41 | struct GNUNET_MESSENGER_ListHandles | 43 | struct GNUNET_MESSENGER_ListHandles |
@@ -45,17 +47,17 @@ struct GNUNET_MESSENGER_ListHandles | |||
45 | }; | 47 | }; |
46 | 48 | ||
47 | /** | 49 | /** |
48 | * Initializes list of handles as empty list. | 50 | * Initializes list of <i>handles</i> as empty list. |
49 | * | 51 | * |
50 | * @param handles List of handles | 52 | * @param[out] handles List of handles |
51 | */ | 53 | */ |
52 | void | 54 | void |
53 | init_list_handles (struct GNUNET_MESSENGER_ListHandles *handles); | 55 | init_list_handles (struct GNUNET_MESSENGER_ListHandles *handles); |
54 | 56 | ||
55 | /** | 57 | /** |
56 | * Destroys remaining handles and clears the list. | 58 | * Destroys remaining <i>handles</i> and clears the list. |
57 | * | 59 | * |
58 | * @param handles List of handles | 60 | * @param[in/out] handles List of handles |
59 | */ | 61 | */ |
60 | void | 62 | void |
61 | clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles); | 63 | clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles); |
@@ -63,34 +65,34 @@ clear_list_handles (struct GNUNET_MESSENGER_ListHandles *handles); | |||
63 | /** | 65 | /** |
64 | * Adds a specific <i>handle</i> to the end of the list. | 66 | * Adds a specific <i>handle</i> to the end of the list. |
65 | * | 67 | * |
66 | * @param handles List of handles | 68 | * @param[in/out] handles List of handles |
67 | * @param handle Handle | 69 | * @param[in/out] handle Handle |
68 | */ | 70 | */ |
69 | void | 71 | void |
70 | add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, void *handle); | 72 | add_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle); |
71 | 73 | ||
72 | /** | 74 | /** |
73 | * Removes the first entry matching with a specific <i>handle</i> from the list and | 75 | * Removes the first entry matching with a specific <i>handle</i> from the list of |
74 | * returns GNUNET_YES on success or GNUNET_NO on failure. | 76 | * <i>handles</i> and returns #GNUNET_YES on success or #GNUNET_NO on failure. |
75 | * | 77 | * |
76 | * @param handles List of handles | 78 | * @param[in/out] handles List of handles |
77 | * @param handle Handle | 79 | * @param[in/out] handle Handle |
78 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 80 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
79 | */ | 81 | */ |
80 | int | 82 | int |
81 | remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, void *handle); | 83 | remove_list_handle (struct GNUNET_MESSENGER_ListHandles *handles, struct GNUNET_MESSENGER_SrvHandle *handle); |
82 | 84 | ||
83 | /** | 85 | /** |
84 | * Searches linearly through the list of handles for members of a specific room | 86 | * Searches linearly through the list of <i>handles</i> for members of a specific room |
85 | * which is identified by a given <i>key</i>. | 87 | * which is identified by a given <i>key</i>. |
86 | * | 88 | * |
87 | * If no handle is found which is a current member, NULL gets returned. | 89 | * If no handle is found which is a current member, NULL gets returned. |
88 | * | 90 | * |
89 | * @param handles List of handles | 91 | * @param[in] handles List of handles |
90 | * @param key Common key of a room | 92 | * @param[in] key Common key of a room |
91 | * @return First handle which is a current member | 93 | * @return First handle which is a current member |
92 | */ | 94 | */ |
93 | void* | 95 | struct GNUNET_MESSENGER_SrvHandle* |
94 | find_list_handle_by_member (struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key); | 96 | find_list_handle_by_member (const struct GNUNET_MESSENGER_ListHandles *handles, const struct GNUNET_HashCode *key); |
95 | 97 | ||
96 | #endif //GNUNET_SERVICE_MESSENGER_LIST_HANDLES_H | 98 | #endif //GNUNET_SERVICE_MESSENGER_LIST_HANDLES_H |
diff --git a/src/messenger/gnunet-service-messenger_list_messages.c b/src/messenger/gnunet-service-messenger_list_messages.c index c4f1f7043..bb6086e41 100644 --- a/src/messenger/gnunet-service-messenger_list_messages.c +++ b/src/messenger/gnunet-service-messenger_list_messages.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -54,6 +54,8 @@ clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages) | |||
54 | void | 54 | void |
55 | add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) | 55 | add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) |
56 | { | 56 | { |
57 | GNUNET_assert((messages) && (hash)); | ||
58 | |||
57 | struct GNUNET_MESSENGER_ListMessage *element = GNUNET_new(struct GNUNET_MESSENGER_ListMessage); | 59 | struct GNUNET_MESSENGER_ListMessage *element = GNUNET_new(struct GNUNET_MESSENGER_ListMessage); |
58 | 60 | ||
59 | GNUNET_memcpy(&(element->hash), hash, sizeof(struct GNUNET_HashCode)); | 61 | GNUNET_memcpy(&(element->hash), hash, sizeof(struct GNUNET_HashCode)); |
@@ -62,8 +64,21 @@ add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const stru | |||
62 | } | 64 | } |
63 | 65 | ||
64 | void | 66 | void |
67 | copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin) | ||
68 | { | ||
69 | GNUNET_assert((messages) && (origin)); | ||
70 | |||
71 | struct GNUNET_MESSENGER_ListMessage *element; | ||
72 | |||
73 | for (element = origin->head; element; element = element->next) | ||
74 | add_to_list_messages (messages, &(element->hash)); | ||
75 | } | ||
76 | |||
77 | void | ||
65 | remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) | 78 | remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash) |
66 | { | 79 | { |
80 | GNUNET_assert((messages) && (hash)); | ||
81 | |||
67 | struct GNUNET_MESSENGER_ListMessage *element; | 82 | struct GNUNET_MESSENGER_ListMessage *element; |
68 | 83 | ||
69 | for (element = messages->head; element; element = element->next) | 84 | for (element = messages->head; element; element = element->next) |
@@ -74,3 +89,62 @@ remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const | |||
74 | break; | 89 | break; |
75 | } | 90 | } |
76 | } | 91 | } |
92 | |||
93 | void | ||
94 | load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path) | ||
95 | { | ||
96 | GNUNET_assert((messages) && (path)); | ||
97 | |||
98 | if (GNUNET_YES != GNUNET_DISK_file_test (path)) | ||
99 | return; | ||
100 | |||
101 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
102 | |||
103 | struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open( | ||
104 | path, GNUNET_DISK_OPEN_READ, permission | ||
105 | ); | ||
106 | |||
107 | if (!handle) | ||
108 | return; | ||
109 | |||
110 | GNUNET_DISK_file_seek(handle, 0, GNUNET_DISK_SEEK_SET); | ||
111 | |||
112 | struct GNUNET_HashCode hash; | ||
113 | ssize_t len; | ||
114 | |||
115 | do { | ||
116 | len = GNUNET_DISK_file_read(handle, &hash, sizeof(hash)); | ||
117 | |||
118 | if (len != sizeof(hash)) | ||
119 | break; | ||
120 | |||
121 | add_to_list_messages(messages, &hash); | ||
122 | } while (len == sizeof(hash)); | ||
123 | |||
124 | GNUNET_DISK_file_close(handle); | ||
125 | } | ||
126 | |||
127 | void | ||
128 | save_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path) | ||
129 | { | ||
130 | GNUNET_assert((messages) && (path)); | ||
131 | |||
132 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
133 | |||
134 | struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open( | ||
135 | path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission | ||
136 | ); | ||
137 | |||
138 | if (!handle) | ||
139 | return; | ||
140 | |||
141 | GNUNET_DISK_file_seek(handle, 0, GNUNET_DISK_SEEK_SET); | ||
142 | |||
143 | struct GNUNET_MESSENGER_ListMessage *element; | ||
144 | |||
145 | for (element = messages->head; element; element = element->next) | ||
146 | GNUNET_DISK_file_write(handle, &(element->hash), sizeof(element->hash)); | ||
147 | |||
148 | GNUNET_DISK_file_sync(handle); | ||
149 | GNUNET_DISK_file_close(handle); | ||
150 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_list_messages.h b/src/messenger/gnunet-service-messenger_list_messages.h index 266c30ec6..9ace84cbf 100644 --- a/src/messenger/gnunet-service-messenger_list_messages.h +++ b/src/messenger/gnunet-service-messenger_list_messages.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -29,6 +29,7 @@ | |||
29 | #include "platform.h" | 29 | #include "platform.h" |
30 | #include "gnunet_crypto_lib.h" | 30 | #include "gnunet_crypto_lib.h" |
31 | #include "gnunet_container_lib.h" | 31 | #include "gnunet_container_lib.h" |
32 | #include "gnunet_disk_lib.h" | ||
32 | 33 | ||
33 | struct GNUNET_MESSENGER_ListMessage | 34 | struct GNUNET_MESSENGER_ListMessage |
34 | { | 35 | { |
@@ -47,7 +48,7 @@ struct GNUNET_MESSENGER_ListMessages | |||
47 | /** | 48 | /** |
48 | * Initializes list of message hashes as empty list. | 49 | * Initializes list of message hashes as empty list. |
49 | * | 50 | * |
50 | * @param messages List of hashes | 51 | * @param[out] messages List of hashes |
51 | */ | 52 | */ |
52 | void | 53 | void |
53 | init_list_messages (struct GNUNET_MESSENGER_ListMessages *messages); | 54 | init_list_messages (struct GNUNET_MESSENGER_ListMessages *messages); |
@@ -55,7 +56,7 @@ init_list_messages (struct GNUNET_MESSENGER_ListMessages *messages); | |||
55 | /** | 56 | /** |
56 | * Clears the list of message hashes. | 57 | * Clears the list of message hashes. |
57 | * | 58 | * |
58 | * @param messages List of hashes | 59 | * @param[in/out] messages List of hashes |
59 | */ | 60 | */ |
60 | void | 61 | void |
61 | clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages); | 62 | clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages); |
@@ -63,19 +64,46 @@ clear_list_messages (struct GNUNET_MESSENGER_ListMessages *messages); | |||
63 | /** | 64 | /** |
64 | * Adds a specific <i>hash</i> from a message to the end of the list. | 65 | * Adds a specific <i>hash</i> from a message to the end of the list. |
65 | * | 66 | * |
66 | * @param messages List of hashes | 67 | * @param[in/out] messages List of hashes |
67 | * @param hash Hash of message | 68 | * @param[in] hash Hash of message |
68 | */ | 69 | */ |
69 | void | 70 | void |
70 | add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); | 71 | add_to_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); |
71 | 72 | ||
72 | /** | 73 | /** |
74 | * Copies all message hashes from an <i>origin</i> to another list. | ||
75 | * | ||
76 | * @param[in/out] messages Destination list of hashes | ||
77 | * @param[in] origin Source list of hashes | ||
78 | */ | ||
79 | void | ||
80 | copy_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_MESSENGER_ListMessages *origin); | ||
81 | |||
82 | /** | ||
73 | * Removes the first entry with a matching <i>hash</i> from the list. | 83 | * Removes the first entry with a matching <i>hash</i> from the list. |
74 | * | 84 | * |
75 | * @param messages List of hashes | 85 | * @param[in/out] messages List of hashes |
76 | * @param hash Hash of message | 86 | * @param[in] hash Hash of message |
77 | */ | 87 | */ |
78 | void | 88 | void |
79 | remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); | 89 | remove_from_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const struct GNUNET_HashCode *hash); |
80 | 90 | ||
91 | /** | ||
92 | * Loads the list of message hashes from a file under a given <i>path</i>. | ||
93 | * | ||
94 | * @param[out] messages List of hashes | ||
95 | * @param[in] path Path of file | ||
96 | */ | ||
97 | void | ||
98 | load_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path); | ||
99 | |||
100 | /** | ||
101 | * Saves the list of message hashes to a file under a given <i>path</i>. | ||
102 | * | ||
103 | * @param[in] messages List of hashes | ||
104 | * @param[in] path Path of file | ||
105 | */ | ||
106 | void | ||
107 | save_list_messages (struct GNUNET_MESSENGER_ListMessages *messages, const char *path); | ||
108 | |||
81 | #endif //GNUNET_SERVICE_MESSENGER_LIST_MESSAGES_H | 109 | #endif //GNUNET_SERVICE_MESSENGER_LIST_MESSAGES_H |
diff --git a/src/messenger/gnunet-service-messenger_member.c b/src/messenger/gnunet-service-messenger_member.c new file mode 100755 index 000000000..7f00e8438 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_member.c | |||
@@ -0,0 +1,385 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_member.c | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "gnunet-service-messenger_member.h" | ||
27 | |||
28 | #include "gnunet-service-messenger_member_session.h" | ||
29 | |||
30 | struct GNUNET_MESSENGER_Member* | ||
31 | create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) | ||
32 | { | ||
33 | GNUNET_assert (store); | ||
34 | |||
35 | struct GNUNET_MESSENGER_Member *member = GNUNET_new(struct GNUNET_MESSENGER_Member); | ||
36 | |||
37 | member->store = store; | ||
38 | |||
39 | if (id) | ||
40 | GNUNET_memcpy(&(member->id), id, sizeof(member->id)); | ||
41 | else if (GNUNET_YES != generate_free_member_id(&(member->id), store->members)) | ||
42 | { | ||
43 | GNUNET_free (member); | ||
44 | return NULL; | ||
45 | } | ||
46 | |||
47 | member->sessions = GNUNET_CONTAINER_multihashmap_create(2, GNUNET_NO); | ||
48 | |||
49 | return member; | ||
50 | } | ||
51 | |||
52 | static int | ||
53 | iterate_destroy_session (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
54 | { | ||
55 | struct GNUNET_MESSENGER_MemberSession *session = value; | ||
56 | destroy_member_session(session); | ||
57 | return GNUNET_YES; | ||
58 | } | ||
59 | |||
60 | void | ||
61 | destroy_member (struct GNUNET_MESSENGER_Member *member) | ||
62 | { | ||
63 | GNUNET_assert((member) && (member->sessions)); | ||
64 | |||
65 | GNUNET_CONTAINER_multihashmap_iterate (member->sessions, iterate_destroy_session, NULL); | ||
66 | GNUNET_CONTAINER_multihashmap_destroy (member->sessions); | ||
67 | |||
68 | GNUNET_free (member); | ||
69 | } | ||
70 | |||
71 | const struct GNUNET_ShortHashCode* | ||
72 | get_member_id (const struct GNUNET_MESSENGER_Member *member) | ||
73 | { | ||
74 | GNUNET_assert (member); | ||
75 | |||
76 | return &(member->id); | ||
77 | } | ||
78 | |||
79 | static int | ||
80 | callback_scan_for_sessions (void *cls, const char *filename) | ||
81 | { | ||
82 | struct GNUNET_MESSENGER_Member *member = cls; | ||
83 | |||
84 | if (GNUNET_YES == GNUNET_DISK_directory_test (filename, GNUNET_YES)) | ||
85 | { | ||
86 | char *directory; | ||
87 | |||
88 | GNUNET_asprintf (&directory, "%s%c", filename, DIR_SEPARATOR); | ||
89 | |||
90 | load_member_session(member, directory); | ||
91 | } | ||
92 | |||
93 | return GNUNET_OK; | ||
94 | } | ||
95 | |||
96 | void | ||
97 | load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) | ||
98 | { | ||
99 | GNUNET_assert ((store) && (directory)); | ||
100 | |||
101 | char *config_file; | ||
102 | GNUNET_asprintf (&config_file, "%s%s", directory, "member.cfg"); | ||
103 | |||
104 | struct GNUNET_MESSENGER_Member *member = NULL; | ||
105 | |||
106 | if (GNUNET_YES != GNUNET_DISK_file_test (config_file)) | ||
107 | goto free_config; | ||
108 | |||
109 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
110 | |||
111 | if (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, config_file)) | ||
112 | { | ||
113 | struct GNUNET_ShortHashCode id; | ||
114 | |||
115 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_data (cfg, "member", "id", &id, sizeof(id))) | ||
116 | goto destroy_config; | ||
117 | |||
118 | member = add_store_member(store, &id); | ||
119 | } | ||
120 | |||
121 | destroy_config: | ||
122 | |||
123 | GNUNET_CONFIGURATION_destroy (cfg); | ||
124 | |||
125 | free_config: | ||
126 | GNUNET_free(config_file); | ||
127 | |||
128 | if (!member) | ||
129 | return; | ||
130 | |||
131 | char *scan_dir; | ||
132 | GNUNET_asprintf (&scan_dir, "%s%s%c", directory, "sessions", DIR_SEPARATOR); | ||
133 | |||
134 | if (GNUNET_OK == GNUNET_DISK_directory_test (scan_dir, GNUNET_YES)) | ||
135 | GNUNET_DISK_directory_scan (scan_dir, callback_scan_for_sessions, member); | ||
136 | |||
137 | GNUNET_free(scan_dir); | ||
138 | } | ||
139 | |||
140 | static int | ||
141 | iterate_load_next_session (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
142 | { | ||
143 | const char* sessions_directory = cls; | ||
144 | |||
145 | char* load_dir; | ||
146 | GNUNET_asprintf (&load_dir, "%s%s%c", sessions_directory, GNUNET_h2s(key), DIR_SEPARATOR); | ||
147 | |||
148 | struct GNUNET_MESSENGER_MemberSession *session = value; | ||
149 | |||
150 | if (GNUNET_YES == GNUNET_DISK_directory_test (load_dir, GNUNET_YES)) | ||
151 | load_member_session_next (session, load_dir); | ||
152 | |||
153 | GNUNET_free (load_dir); | ||
154 | return GNUNET_YES; | ||
155 | } | ||
156 | |||
157 | void | ||
158 | load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory) | ||
159 | { | ||
160 | GNUNET_assert ((member) && (directory)); | ||
161 | |||
162 | char* load_dir; | ||
163 | GNUNET_asprintf (&load_dir, "%s%s%c", directory, "sessions", DIR_SEPARATOR); | ||
164 | |||
165 | GNUNET_CONTAINER_multihashmap_iterate (member->sessions, iterate_load_next_session, load_dir); | ||
166 | |||
167 | GNUNET_free(load_dir); | ||
168 | } | ||
169 | |||
170 | static int | ||
171 | iterate_save_session (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
172 | { | ||
173 | const char* sessions_directory = cls; | ||
174 | |||
175 | char* save_dir; | ||
176 | GNUNET_asprintf (&save_dir, "%s%s%c", sessions_directory, GNUNET_h2s(key), DIR_SEPARATOR); | ||
177 | |||
178 | struct GNUNET_MESSENGER_MemberSession *session = value; | ||
179 | |||
180 | if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) || | ||
181 | (GNUNET_OK == GNUNET_DISK_directory_create (save_dir))) | ||
182 | save_member_session (session, save_dir); | ||
183 | |||
184 | GNUNET_free (save_dir); | ||
185 | return GNUNET_YES; | ||
186 | } | ||
187 | |||
188 | void | ||
189 | save_member (struct GNUNET_MESSENGER_Member *member, const char *directory) | ||
190 | { | ||
191 | GNUNET_assert ((member) && (directory)); | ||
192 | |||
193 | char *config_file; | ||
194 | GNUNET_asprintf (&config_file, "%s%s", directory, "member.cfg"); | ||
195 | |||
196 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
197 | |||
198 | char *id_data = GNUNET_STRINGS_data_to_string_alloc (&(member->id), sizeof(member->id)); | ||
199 | |||
200 | if (id_data) | ||
201 | { | ||
202 | GNUNET_CONFIGURATION_set_value_string (cfg, "member", "id", id_data); | ||
203 | |||
204 | GNUNET_free(id_data); | ||
205 | } | ||
206 | |||
207 | GNUNET_CONFIGURATION_write (cfg, config_file); | ||
208 | GNUNET_CONFIGURATION_destroy (cfg); | ||
209 | |||
210 | GNUNET_free(config_file); | ||
211 | |||
212 | char* save_dir; | ||
213 | GNUNET_asprintf (&save_dir, "%s%s%c", directory, "sessions", DIR_SEPARATOR); | ||
214 | |||
215 | if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) || | ||
216 | (GNUNET_OK == GNUNET_DISK_directory_create (save_dir))) | ||
217 | GNUNET_CONTAINER_multihashmap_iterate (member->sessions, iterate_save_session, save_dir); | ||
218 | |||
219 | GNUNET_free(save_dir); | ||
220 | } | ||
221 | |||
222 | static void | ||
223 | sync_session_contact_from_next (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next) | ||
224 | { | ||
225 | GNUNET_assert((session) && (next)); | ||
226 | |||
227 | if (session == next) | ||
228 | return; | ||
229 | |||
230 | if (next->next) | ||
231 | sync_session_contact_from_next (session, next->next); | ||
232 | else | ||
233 | session->contact = next->contact; | ||
234 | } | ||
235 | |||
236 | static int | ||
237 | iterate_sync_session_contact (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
238 | { | ||
239 | struct GNUNET_MESSENGER_MemberSession *session = value; | ||
240 | |||
241 | if (session->next) | ||
242 | sync_session_contact_from_next (session, session->next); | ||
243 | |||
244 | return GNUNET_YES; | ||
245 | } | ||
246 | |||
247 | void | ||
248 | sync_member_contacts (struct GNUNET_MESSENGER_Member *member) | ||
249 | { | ||
250 | GNUNET_assert ((member) && (member->sessions)); | ||
251 | |||
252 | GNUNET_CONTAINER_multihashmap_iterate (member->sessions, iterate_sync_session_contact, NULL); | ||
253 | } | ||
254 | |||
255 | struct GNUNET_MESSENGER_MemberSession* | ||
256 | get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key) | ||
257 | { | ||
258 | GNUNET_assert ((member) && (public_key)); | ||
259 | |||
260 | struct GNUNET_HashCode hash; | ||
261 | GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash); | ||
262 | |||
263 | return GNUNET_CONTAINER_multihashmap_get(member->sessions, &hash); | ||
264 | } | ||
265 | |||
266 | struct GNUNET_MESSENGER_ClosureSearchSession { | ||
267 | const struct GNUNET_MESSENGER_Message *message; | ||
268 | const struct GNUNET_HashCode *hash; | ||
269 | |||
270 | struct GNUNET_MESSENGER_MemberSession *match; | ||
271 | }; | ||
272 | |||
273 | static int | ||
274 | iterate_search_session (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
275 | { | ||
276 | struct GNUNET_MESSENGER_ClosureSearchSession* search = cls; | ||
277 | struct GNUNET_MESSENGER_MemberSession *session = value; | ||
278 | |||
279 | if (GNUNET_OK != verify_member_session_as_sender(session, search->message, search->hash)) | ||
280 | return GNUNET_YES; | ||
281 | |||
282 | search->match = session; | ||
283 | return GNUNET_NO; | ||
284 | } | ||
285 | |||
286 | static struct GNUNET_MESSENGER_MemberSession* | ||
287 | try_member_session (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key) | ||
288 | { | ||
289 | struct GNUNET_MESSENGER_MemberSession* session = get_member_session(member, public_key); | ||
290 | |||
291 | if (session) | ||
292 | return session; | ||
293 | |||
294 | session = create_member_session(member, public_key); | ||
295 | |||
296 | if (session) | ||
297 | add_member_session(member, session); | ||
298 | |||
299 | return session; | ||
300 | } | ||
301 | |||
302 | struct GNUNET_MESSENGER_MemberSession* | ||
303 | get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, | ||
304 | const struct GNUNET_HashCode *hash) | ||
305 | { | ||
306 | GNUNET_assert ((member) && (message) && (hash) && | ||
307 | (0 == GNUNET_memcmp(&(member->id), &(message->header.sender_id)))); | ||
308 | |||
309 | if (GNUNET_MESSENGER_KIND_INFO == message->header.kind) | ||
310 | return try_member_session(member, &(message->body.info.host_key)); | ||
311 | else if (GNUNET_MESSENGER_KIND_JOIN == message->header.kind) | ||
312 | return try_member_session(member, &(message->body.join.key)); | ||
313 | |||
314 | struct GNUNET_MESSENGER_ClosureSearchSession search; | ||
315 | |||
316 | search.message = message; | ||
317 | search.hash = hash; | ||
318 | |||
319 | search.match = NULL; | ||
320 | GNUNET_CONTAINER_multihashmap_iterate(member->sessions, iterate_search_session, &search); | ||
321 | |||
322 | return search.match; | ||
323 | } | ||
324 | |||
325 | void | ||
326 | add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session) | ||
327 | { | ||
328 | if (!session) | ||
329 | return; | ||
330 | |||
331 | GNUNET_assert((member) && (session->member == member)); | ||
332 | |||
333 | const struct GNUNET_IDENTITY_PublicKey *public_key = get_member_session_public_key(session); | ||
334 | |||
335 | struct GNUNET_HashCode hash; | ||
336 | GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash); | ||
337 | |||
338 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( | ||
339 | member->sessions, &hash, session, | ||
340 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
341 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Adding a member session failed: %s\n", | ||
342 | GNUNET_h2s(&hash)); | ||
343 | } | ||
344 | |||
345 | void | ||
346 | remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session) | ||
347 | { | ||
348 | GNUNET_assert ((member) && (session) && (session->member == member)); | ||
349 | |||
350 | const struct GNUNET_IDENTITY_PublicKey *public_key = get_member_session_public_key(session); | ||
351 | |||
352 | struct GNUNET_HashCode hash; | ||
353 | GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash); | ||
354 | |||
355 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove(member->sessions, &hash, session)) | ||
356 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Removing a member session failed: %s\n", | ||
357 | GNUNET_h2s(&hash)); | ||
358 | } | ||
359 | |||
360 | struct GNUNET_MESSENGER_ClosureIterateSessions { | ||
361 | GNUNET_MESSENGER_MemberIteratorCallback it; | ||
362 | void *cls; | ||
363 | }; | ||
364 | |||
365 | static int | ||
366 | iterate_member_sessions_it (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
367 | { | ||
368 | struct GNUNET_MESSENGER_ClosureIterateSessions *iterate = cls; | ||
369 | struct GNUNET_MESSENGER_MemberSession *session = value; | ||
370 | |||
371 | return iterate->it (iterate->cls, get_member_session_public_key(session), session); | ||
372 | } | ||
373 | |||
374 | int | ||
375 | iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void *cls) | ||
376 | { | ||
377 | GNUNET_assert ((member) && (member->sessions) && (it)); | ||
378 | |||
379 | struct GNUNET_MESSENGER_ClosureIterateSessions iterate; | ||
380 | |||
381 | iterate.it = it; | ||
382 | iterate.cls = cls; | ||
383 | |||
384 | return GNUNET_CONTAINER_multihashmap_iterate(member->sessions, iterate_member_sessions_it, &iterate); | ||
385 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_member.h b/src/messenger/gnunet-service-messenger_member.h new file mode 100644 index 000000000..fb2e57cfb --- /dev/null +++ b/src/messenger/gnunet-service-messenger_member.h | |||
@@ -0,0 +1,170 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_member.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_MEMBER_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_MEMBER_H | ||
28 | |||
29 | #include "messenger_api_contact.h" | ||
30 | |||
31 | #include "gnunet-service-messenger_list_messages.h" | ||
32 | #include "gnunet-service-messenger_member_store.h" | ||
33 | #include "messenger_api_message.h" | ||
34 | #include "messenger_api_util.h" | ||
35 | |||
36 | struct GNUNET_MESSENGER_Member | ||
37 | { | ||
38 | struct GNUNET_MESSENGER_MemberStore *store; | ||
39 | struct GNUNET_ShortHashCode id; | ||
40 | |||
41 | struct GNUNET_CONTAINER_MultiHashMap *sessions; | ||
42 | }; | ||
43 | |||
44 | /** | ||
45 | * Creates and allocates a new member of a <i>room</i> with an optionally defined or | ||
46 | * random <i>id</i>. | ||
47 | * | ||
48 | * If the creation fails, NULL gets returned. | ||
49 | * | ||
50 | * @param[in/out] store Member store | ||
51 | * @param[in] id Member id or NULL | ||
52 | * @return New member or NULL | ||
53 | */ | ||
54 | struct GNUNET_MESSENGER_Member* | ||
55 | create_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); | ||
56 | |||
57 | /** | ||
58 | * Destroys a member and frees its memory fully. | ||
59 | * | ||
60 | * @param[in/out] member Member | ||
61 | */ | ||
62 | void | ||
63 | destroy_member (struct GNUNET_MESSENGER_Member *member); | ||
64 | |||
65 | /** | ||
66 | * Returns the current id of a given <i>member</i>. | ||
67 | * | ||
68 | * @param[in] member Member | ||
69 | * @return Member id | ||
70 | */ | ||
71 | const struct GNUNET_ShortHashCode* | ||
72 | get_member_id (const struct GNUNET_MESSENGER_Member *member); | ||
73 | |||
74 | /** | ||
75 | * Loads data from a <i>directory</i> into a new allocated and created member | ||
76 | * of a <i>store</i> if the required information can be read from the content | ||
77 | * of the given directory. | ||
78 | * | ||
79 | * @param[out] store Member store | ||
80 | * @param[in] directory Path to a directory | ||
81 | */ | ||
82 | void | ||
83 | load_member (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); | ||
84 | |||
85 | /** | ||
86 | * Loads data about next sessions from a <i>directory</i> into an empty loaded | ||
87 | * <i>member</i> which does not contain a fully built session graph yet. | ||
88 | * | ||
89 | * @param[in/out] member Member | ||
90 | * @param[in] directory Path to a directory | ||
91 | */ | ||
92 | void | ||
93 | load_member_next_sessions (const struct GNUNET_MESSENGER_Member *member, const char *directory); | ||
94 | |||
95 | /** | ||
96 | * Saves data from a <i>member</i> into a directory which | ||
97 | * can be load to restore the member completely. | ||
98 | * | ||
99 | * @param[in] member Member | ||
100 | * @param[in] directory Path to a directory | ||
101 | */ | ||
102 | void | ||
103 | save_member (struct GNUNET_MESSENGER_Member *member, const char *directory); | ||
104 | |||
105 | /** | ||
106 | * Synchronizes contacts between all sessions from a given <i>member</i> | ||
107 | * and other sessions which are linked to them. | ||
108 | * | ||
109 | * @param[in/out] member Member | ||
110 | */ | ||
111 | void | ||
112 | sync_member_contacts (struct GNUNET_MESSENGER_Member *member); | ||
113 | |||
114 | /** | ||
115 | * Returns the member session of a <i>member</i> identified by a given public key. | ||
116 | * If the member does not provide a session with the given key, NULL gets returned. | ||
117 | * | ||
118 | * @param[in] member Member | ||
119 | * @param[in] public_key Public key of EGO | ||
120 | * @return Member session | ||
121 | */ | ||
122 | struct GNUNET_MESSENGER_MemberSession* | ||
123 | get_member_session (const struct GNUNET_MESSENGER_Member *member, const struct GNUNET_IDENTITY_PublicKey *public_key); | ||
124 | |||
125 | /** | ||
126 | * Returns the member session of a <i>member</i> using a public key which can verify | ||
127 | * the signature of a given <i>message</i> and its <i>hash</i>. If the member does | ||
128 | * not provide a matching session, NULL gets returned. | ||
129 | * | ||
130 | * @param[in] member Member | ||
131 | * @param[in] message Message | ||
132 | * @param[in] hash Hash of message | ||
133 | * @return Member session | ||
134 | */ | ||
135 | struct GNUNET_MESSENGER_MemberSession* | ||
136 | get_member_session_of (struct GNUNET_MESSENGER_Member *member, const struct GNUNET_MESSENGER_Message *message, | ||
137 | const struct GNUNET_HashCode *hash); | ||
138 | |||
139 | /** | ||
140 | * Adds a given member <i>session</i> to its <i>member</i>. | ||
141 | * | ||
142 | * @param[in/out] member Member | ||
143 | * @param[in/out] session Member session | ||
144 | */ | ||
145 | void | ||
146 | add_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); | ||
147 | |||
148 | /** | ||
149 | * Removes a given member <i>session</i> from its <i>member</i>. | ||
150 | * | ||
151 | * @param[in/out] member Member | ||
152 | * @param[in/out] session Member session | ||
153 | */ | ||
154 | void | ||
155 | remove_member_session (struct GNUNET_MESSENGER_Member *member, struct GNUNET_MESSENGER_MemberSession *session); | ||
156 | |||
157 | /** | ||
158 | * Iterate through all member sessions currently connected to a given <i>member</i> | ||
159 | * and call the provided iterator callback with a selected closure. The function | ||
160 | * will return the amount of member sessions it iterated through. | ||
161 | * | ||
162 | * @param[in/out] member Member | ||
163 | * @param[in] it Iterator callback | ||
164 | * @param[in/out] cls Closure | ||
165 | * @return Amount of sessions iterated through | ||
166 | */ | ||
167 | int | ||
168 | iterate_member_sessions (struct GNUNET_MESSENGER_Member *member, GNUNET_MESSENGER_MemberIteratorCallback it, void* cls); | ||
169 | |||
170 | #endif //GNUNET_SERVICE_MESSENGER_MEMBER_H | ||
diff --git a/src/messenger/gnunet-service-messenger_member_session.c b/src/messenger/gnunet-service-messenger_member_session.c new file mode 100644 index 000000000..690c703b2 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_member_session.c | |||
@@ -0,0 +1,743 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_member_session.c | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "gnunet-service-messenger_member_session.h" | ||
27 | |||
28 | #include "gnunet-service-messenger_room.h" | ||
29 | #include "gnunet-service-messenger_message_store.h" | ||
30 | |||
31 | #include "messenger_api_contact_store.h" | ||
32 | |||
33 | struct GNUNET_MESSENGER_MemberSession* | ||
34 | create_member_session (struct GNUNET_MESSENGER_Member *member, | ||
35 | const struct GNUNET_IDENTITY_PublicKey *pubkey) | ||
36 | { | ||
37 | if ((!member) || (!pubkey) || (!(member->store))) | ||
38 | return NULL; | ||
39 | |||
40 | struct GNUNET_MESSENGER_MemberSession *session = GNUNET_new(struct GNUNET_MESSENGER_MemberSession); | ||
41 | session->member = member; | ||
42 | |||
43 | GNUNET_memcpy(&(session->public_key), pubkey, sizeof(session->public_key)); | ||
44 | |||
45 | get_context_from_member ( | ||
46 | get_member_session_key (session), | ||
47 | get_member_session_id (session), | ||
48 | &(session->context) | ||
49 | ); | ||
50 | |||
51 | struct GNUNET_MESSENGER_ContactStore *store = get_member_contact_store(session->member->store); | ||
52 | |||
53 | session->contact = get_store_contact( | ||
54 | store, | ||
55 | get_member_session_context (session), | ||
56 | get_member_session_public_key (session) | ||
57 | ); | ||
58 | |||
59 | if (!(session->contact)) | ||
60 | { | ||
61 | GNUNET_free(session); | ||
62 | return NULL; | ||
63 | } | ||
64 | |||
65 | increase_contact_rc (session->contact); | ||
66 | |||
67 | session->history = GNUNET_CONTAINER_multihashmap_create(8, GNUNET_NO); | ||
68 | |||
69 | init_list_messages(&(session->messages)); | ||
70 | |||
71 | session->prev = NULL; | ||
72 | session->next = NULL; | ||
73 | |||
74 | session->start = GNUNET_TIME_absolute_get(); | ||
75 | |||
76 | session->closed = GNUNET_NO; | ||
77 | session->completed = GNUNET_NO; | ||
78 | |||
79 | return session; | ||
80 | } | ||
81 | |||
82 | static void | ||
83 | check_member_session_completion (struct GNUNET_MESSENGER_MemberSession *session) | ||
84 | { | ||
85 | GNUNET_assert (session); | ||
86 | |||
87 | if (!session->messages.tail) | ||
88 | { | ||
89 | session->completed = GNUNET_YES; | ||
90 | goto completion; | ||
91 | } | ||
92 | |||
93 | const struct GNUNET_HashCode* start = &(session->messages.head->hash); | ||
94 | const struct GNUNET_HashCode* end = &(session->messages.tail->hash); | ||
95 | |||
96 | struct GNUNET_MESSENGER_ListMessages level; | ||
97 | init_list_messages(&level); | ||
98 | |||
99 | add_to_list_messages(&level, end); | ||
100 | |||
101 | struct GNUNET_MESSENGER_MessageStore *store = get_room_message_store(session->member->store->room); | ||
102 | |||
103 | struct GNUNET_MESSENGER_ListMessages list; | ||
104 | init_list_messages(&list); | ||
105 | |||
106 | while (level.head) | ||
107 | { | ||
108 | struct GNUNET_MESSENGER_ListMessage *element; | ||
109 | |||
110 | for (element = level.head; element; element = element->next) | ||
111 | { | ||
112 | const struct GNUNET_MESSENGER_MessageLink *link = get_store_message_link( | ||
113 | store, &(element->hash), GNUNET_NO | ||
114 | ); | ||
115 | |||
116 | if (!link) | ||
117 | continue; | ||
118 | |||
119 | add_to_list_messages(&list, &(link->first)); | ||
120 | |||
121 | if (GNUNET_YES == link->multiple) | ||
122 | add_to_list_messages(&list, &(link->second)); | ||
123 | } | ||
124 | |||
125 | clear_list_messages(&level); | ||
126 | |||
127 | for (element = list.head; element; element = element->next) | ||
128 | if (GNUNET_YES == check_member_session_history(session, &(element->hash), GNUNET_YES)) | ||
129 | break; | ||
130 | |||
131 | if (element) | ||
132 | if (0 != GNUNET_CRYPTO_hash_cmp(&(element->hash), start)) | ||
133 | add_to_list_messages(&level, &(element->hash)); | ||
134 | else | ||
135 | session->completed = GNUNET_YES; | ||
136 | else | ||
137 | copy_list_messages(&level, &list); | ||
138 | |||
139 | clear_list_messages(&list); | ||
140 | } | ||
141 | |||
142 | completion: | ||
143 | if (GNUNET_YES == is_member_session_completed(session)) | ||
144 | { | ||
145 | GNUNET_CONTAINER_multihashmap_destroy (session->history); | ||
146 | |||
147 | struct GNUNET_MESSENGER_ContactStore *store = get_member_contact_store(session->member->store); | ||
148 | |||
149 | if ((session->contact) && (GNUNET_YES == decrease_contact_rc (session->contact))) | ||
150 | remove_store_contact ( | ||
151 | store, | ||
152 | session->contact, | ||
153 | get_member_session_context(session) | ||
154 | ); | ||
155 | |||
156 | session->contact = NULL; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | static int | ||
161 | iterate_copy_history (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
162 | { | ||
163 | struct GNUNET_MESSENGER_MemberSession *next = cls; | ||
164 | |||
165 | GNUNET_CONTAINER_multihashmap_put(next->history, key, (value? next : NULL), | ||
166 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
167 | |||
168 | return GNUNET_YES; | ||
169 | } | ||
170 | |||
171 | struct GNUNET_MESSENGER_MemberSession* | ||
172 | switch_member_session (struct GNUNET_MESSENGER_MemberSession *session, | ||
173 | const struct GNUNET_MESSENGER_Message *message, | ||
174 | const struct GNUNET_HashCode *hash) | ||
175 | { | ||
176 | if ((!session) || (!message) || (!hash)) | ||
177 | return NULL; | ||
178 | |||
179 | GNUNET_assert((GNUNET_MESSENGER_KIND_ID == message->header.kind) || | ||
180 | (GNUNET_MESSENGER_KIND_KEY == message->header.kind)); | ||
181 | |||
182 | struct GNUNET_MESSENGER_MemberSession *next = GNUNET_new(struct GNUNET_MESSENGER_MemberSession); | ||
183 | |||
184 | if (GNUNET_MESSENGER_KIND_ID == message->header.kind) | ||
185 | next->member = add_store_member(session->member->store, &(message->body.id.id)); | ||
186 | else | ||
187 | next->member = session->member; | ||
188 | |||
189 | if (GNUNET_MESSENGER_KIND_KEY == message->header.kind) | ||
190 | GNUNET_memcpy(&(next->public_key), &(message->body.key.key), sizeof(next->public_key)); | ||
191 | else | ||
192 | GNUNET_memcpy(&(next->public_key), get_member_session_public_key(session), sizeof(next->public_key)); | ||
193 | |||
194 | get_context_from_member ( | ||
195 | get_member_session_key (next), | ||
196 | get_member_session_id (next), | ||
197 | &(next->context) | ||
198 | ); | ||
199 | |||
200 | update_store_contact( | ||
201 | get_member_contact_store(next->member->store), | ||
202 | get_member_session_contact(session), | ||
203 | get_member_session_context(session), | ||
204 | get_member_session_context(next), | ||
205 | get_member_session_public_key(next) | ||
206 | ); | ||
207 | |||
208 | next->contact = get_member_session_contact(session); | ||
209 | |||
210 | if (!(next->contact)) | ||
211 | { | ||
212 | GNUNET_free(next); | ||
213 | return NULL; | ||
214 | } | ||
215 | |||
216 | increase_contact_rc (next->contact); | ||
217 | |||
218 | next->history = GNUNET_CONTAINER_multihashmap_create( | ||
219 | GNUNET_CONTAINER_multihashmap_size(session->history), GNUNET_NO | ||
220 | ); | ||
221 | |||
222 | GNUNET_CONTAINER_multihashmap_iterate(session->history, iterate_copy_history, next); | ||
223 | |||
224 | init_list_messages(&(next->messages)); | ||
225 | copy_list_messages(&(next->messages), &(session->messages)); | ||
226 | |||
227 | session->next = next; | ||
228 | next->prev = session; | ||
229 | next->next = NULL; | ||
230 | |||
231 | next->start = GNUNET_TIME_absolute_get(); | ||
232 | |||
233 | session->closed = GNUNET_YES; | ||
234 | next->closed = GNUNET_NO; | ||
235 | next->completed = GNUNET_NO; | ||
236 | |||
237 | check_member_session_completion (session); | ||
238 | |||
239 | return next; | ||
240 | } | ||
241 | |||
242 | void | ||
243 | destroy_member_session(struct GNUNET_MESSENGER_MemberSession* session) | ||
244 | { | ||
245 | GNUNET_assert (session); | ||
246 | |||
247 | GNUNET_CONTAINER_multihashmap_destroy (session->history); | ||
248 | |||
249 | clear_list_messages (&(session->messages)); | ||
250 | |||
251 | struct GNUNET_MESSENGER_Contact *contact = get_member_session_contact (session); | ||
252 | |||
253 | if ((contact) && (GNUNET_YES == decrease_contact_rc (contact))) | ||
254 | remove_store_contact ( | ||
255 | get_member_contact_store(session->member->store), | ||
256 | contact, | ||
257 | get_member_session_context(session) | ||
258 | ); | ||
259 | |||
260 | GNUNET_free(session); | ||
261 | } | ||
262 | |||
263 | int | ||
264 | reset_member_session (struct GNUNET_MESSENGER_MemberSession* session, | ||
265 | const struct GNUNET_HashCode *hash) | ||
266 | { | ||
267 | GNUNET_assert ((session) && (hash)); | ||
268 | |||
269 | struct GNUNET_MESSENGER_ContactStore *store = get_member_contact_store(session->member->store); | ||
270 | struct GNUNET_MESSENGER_Contact *contact = get_store_contact( | ||
271 | store, | ||
272 | get_member_session_context (session), | ||
273 | get_member_session_public_key (session) | ||
274 | ); | ||
275 | |||
276 | if (!contact) | ||
277 | return GNUNET_SYSERR; | ||
278 | |||
279 | if (contact == session->contact) | ||
280 | goto clear_messages; | ||
281 | |||
282 | session->contact = contact; | ||
283 | increase_contact_rc (session->contact); | ||
284 | |||
285 | clear_messages: | ||
286 | clear_list_messages(&(session->messages)); | ||
287 | add_to_list_messages(&(session->messages), hash); | ||
288 | |||
289 | session->next = NULL; | ||
290 | session->closed = GNUNET_NO; | ||
291 | session->completed = GNUNET_NO; | ||
292 | |||
293 | return GNUNET_OK; | ||
294 | } | ||
295 | |||
296 | void | ||
297 | close_member_session (struct GNUNET_MESSENGER_MemberSession* session) | ||
298 | { | ||
299 | GNUNET_assert (session); | ||
300 | |||
301 | session->closed = GNUNET_YES; | ||
302 | check_member_session_completion (session); | ||
303 | } | ||
304 | |||
305 | int | ||
306 | is_member_session_closed (const struct GNUNET_MESSENGER_MemberSession* session) | ||
307 | { | ||
308 | GNUNET_assert(session); | ||
309 | |||
310 | return session->closed; | ||
311 | } | ||
312 | |||
313 | int | ||
314 | is_member_session_completed (const struct GNUNET_MESSENGER_MemberSession* session) | ||
315 | { | ||
316 | GNUNET_assert(session); | ||
317 | |||
318 | return session->completed; | ||
319 | } | ||
320 | |||
321 | struct GNUNET_TIME_Absolute | ||
322 | get_member_session_start (const struct GNUNET_MESSENGER_MemberSession* session) | ||
323 | { | ||
324 | GNUNET_assert(session); | ||
325 | |||
326 | if (session->prev) | ||
327 | return get_member_session_start(session->prev); | ||
328 | |||
329 | return session->start; | ||
330 | } | ||
331 | |||
332 | const struct GNUNET_HashCode* | ||
333 | get_member_session_key (const struct GNUNET_MESSENGER_MemberSession* session) | ||
334 | { | ||
335 | GNUNET_assert((session) && (session->member)); | ||
336 | |||
337 | return get_member_store_key(session->member->store); | ||
338 | } | ||
339 | |||
340 | const struct GNUNET_ShortHashCode* | ||
341 | get_member_session_id (const struct GNUNET_MESSENGER_MemberSession* session) | ||
342 | { | ||
343 | GNUNET_assert(session); | ||
344 | |||
345 | return get_member_id(session->member); | ||
346 | } | ||
347 | |||
348 | const struct GNUNET_IDENTITY_PublicKey* | ||
349 | get_member_session_public_key (const struct GNUNET_MESSENGER_MemberSession* session) | ||
350 | { | ||
351 | GNUNET_assert(session); | ||
352 | |||
353 | return &(session->public_key); | ||
354 | } | ||
355 | |||
356 | const struct GNUNET_HashCode* | ||
357 | get_member_session_context (const struct GNUNET_MESSENGER_MemberSession* session) | ||
358 | { | ||
359 | GNUNET_assert(session); | ||
360 | |||
361 | return &(session->context); | ||
362 | } | ||
363 | |||
364 | struct GNUNET_MESSENGER_Contact* | ||
365 | get_member_session_contact (struct GNUNET_MESSENGER_MemberSession* session) | ||
366 | { | ||
367 | GNUNET_assert (session); | ||
368 | |||
369 | return session->contact; | ||
370 | } | ||
371 | |||
372 | int verify_member_session_as_sender (const struct GNUNET_MESSENGER_MemberSession *session, | ||
373 | const struct GNUNET_MESSENGER_Message *message, | ||
374 | const struct GNUNET_HashCode *hash) | ||
375 | { | ||
376 | GNUNET_assert((session) && (message) && (hash)); | ||
377 | |||
378 | if (GNUNET_YES == is_member_session_completed(session)) | ||
379 | return GNUNET_SYSERR; | ||
380 | |||
381 | if (0 != GNUNET_memcmp(get_member_session_id(session), &(message->header.sender_id))) | ||
382 | return GNUNET_SYSERR; | ||
383 | |||
384 | return verify_message(message, hash, get_member_session_public_key(session)); | ||
385 | } | ||
386 | |||
387 | int | ||
388 | check_member_session_history (const struct GNUNET_MESSENGER_MemberSession *session, | ||
389 | const struct GNUNET_HashCode *hash, int ownership) | ||
390 | { | ||
391 | GNUNET_assert((session) && (hash)); | ||
392 | |||
393 | if (GNUNET_YES == ownership) | ||
394 | return (NULL != GNUNET_CONTAINER_multihashmap_get(session->history, hash)? GNUNET_YES : GNUNET_NO); | ||
395 | else | ||
396 | return GNUNET_CONTAINER_multihashmap_contains(session->history, hash); | ||
397 | } | ||
398 | |||
399 | static void | ||
400 | update_member_chain_history (struct GNUNET_MESSENGER_MemberSession *session, | ||
401 | const struct GNUNET_HashCode *hash, int ownership) | ||
402 | { | ||
403 | GNUNET_assert ((session) && (hash)); | ||
404 | |||
405 | if ((GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(session->history, hash, (GNUNET_YES == ownership? session : NULL), | ||
406 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) && (session->next)) | ||
407 | update_member_chain_history (session->next, hash, ownership); | ||
408 | } | ||
409 | |||
410 | void | ||
411 | update_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, | ||
412 | const struct GNUNET_MESSENGER_Message *message, | ||
413 | const struct GNUNET_HashCode *hash) | ||
414 | { | ||
415 | GNUNET_assert((session) && (message) && (hash)); | ||
416 | |||
417 | if (GNUNET_YES == is_member_session_completed(session)) | ||
418 | return; | ||
419 | |||
420 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Updating sessions history (%s) += (%s)\n", | ||
421 | GNUNET_sh2s(get_member_session_id(session)), GNUNET_h2s(hash)); | ||
422 | |||
423 | if (GNUNET_OK == verify_member_session_as_sender (session, message, hash)) | ||
424 | { | ||
425 | if (GNUNET_YES == is_message_session_bound (message)) | ||
426 | add_to_list_messages(&(session->messages), hash); | ||
427 | |||
428 | update_member_chain_history (session, hash, GNUNET_YES); | ||
429 | } | ||
430 | else | ||
431 | update_member_chain_history (session, hash, GNUNET_NO); | ||
432 | |||
433 | if (GNUNET_YES == session->closed) | ||
434 | check_member_session_completion(session); | ||
435 | } | ||
436 | |||
437 | static void | ||
438 | clear_member_chain_history (struct GNUNET_MESSENGER_MemberSession *session, | ||
439 | const struct GNUNET_HashCode *hash) | ||
440 | { | ||
441 | GNUNET_assert ((session) && (hash)); | ||
442 | |||
443 | if ((0 < GNUNET_CONTAINER_multihashmap_remove_all(session->history, hash)) && (session->next)) | ||
444 | clear_member_session_history(session->next, hash); | ||
445 | } | ||
446 | |||
447 | void | ||
448 | clear_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, | ||
449 | const struct GNUNET_HashCode *hash) | ||
450 | { | ||
451 | GNUNET_assert((session) && (hash)); | ||
452 | |||
453 | clear_member_chain_history (session, hash); | ||
454 | } | ||
455 | |||
456 | struct GNUNET_MESSENGER_MemberSessionHistoryEntry | ||
457 | { | ||
458 | struct GNUNET_HashCode hash; | ||
459 | unsigned char ownership; | ||
460 | }; | ||
461 | |||
462 | static void | ||
463 | load_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path) | ||
464 | { | ||
465 | GNUNET_assert((session) && (path)); | ||
466 | |||
467 | if (GNUNET_YES != GNUNET_DISK_file_test (path)) | ||
468 | return; | ||
469 | |||
470 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
471 | |||
472 | struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open( | ||
473 | path, GNUNET_DISK_OPEN_READ, permission | ||
474 | ); | ||
475 | |||
476 | if (!handle) | ||
477 | return; | ||
478 | |||
479 | GNUNET_DISK_file_seek(handle, 0, GNUNET_DISK_SEEK_SET); | ||
480 | |||
481 | struct GNUNET_MESSENGER_MemberSessionHistoryEntry entry; | ||
482 | ssize_t len; | ||
483 | |||
484 | int status; | ||
485 | |||
486 | do { | ||
487 | len = GNUNET_DISK_file_read(handle, &(entry.hash), sizeof(entry.hash)); | ||
488 | |||
489 | if (len != sizeof(entry.hash)) | ||
490 | break; | ||
491 | |||
492 | len = GNUNET_DISK_file_read(handle, &(entry.ownership), sizeof(entry.ownership)); | ||
493 | |||
494 | if (len != sizeof(entry.ownership)) | ||
495 | break; | ||
496 | |||
497 | status = GNUNET_CONTAINER_multihashmap_put(session->history, &(entry.hash), (entry.ownership? session : NULL), | ||
498 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
499 | } while (status == GNUNET_OK); | ||
500 | |||
501 | GNUNET_DISK_file_close(handle); | ||
502 | } | ||
503 | |||
504 | void | ||
505 | load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory) | ||
506 | { | ||
507 | GNUNET_assert ((member) && (directory)); | ||
508 | |||
509 | char *config_file; | ||
510 | GNUNET_asprintf (&config_file, "%s%s", directory, "session.cfg"); | ||
511 | |||
512 | struct GNUNET_MESSENGER_MemberSession *session = NULL; | ||
513 | |||
514 | if (GNUNET_YES != GNUNET_DISK_file_test (config_file)) | ||
515 | goto free_config; | ||
516 | |||
517 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
518 | |||
519 | if (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, config_file)) | ||
520 | { | ||
521 | char *key_data; | ||
522 | |||
523 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(cfg, "session", "key", &key_data)) | ||
524 | goto destroy_config; | ||
525 | |||
526 | struct GNUNET_IDENTITY_PublicKey key; | ||
527 | |||
528 | enum GNUNET_GenericReturnValue key_return = GNUNET_IDENTITY_public_key_from_string(key_data, &key); | ||
529 | |||
530 | GNUNET_free(key_data); | ||
531 | |||
532 | if (GNUNET_OK != key_return) | ||
533 | goto destroy_config; | ||
534 | |||
535 | session = create_member_session(member, &key); | ||
536 | |||
537 | unsigned long long numeric_value; | ||
538 | |||
539 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number(cfg, "session", "start", &numeric_value)) | ||
540 | session->start.abs_value_us = numeric_value; | ||
541 | |||
542 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number(cfg, "session", "closed", &numeric_value)) | ||
543 | session->closed = (GNUNET_YES == numeric_value? GNUNET_YES : GNUNET_NO); | ||
544 | |||
545 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number(cfg, "session", "completed", &numeric_value)) | ||
546 | session->completed = (GNUNET_YES == numeric_value? GNUNET_YES : GNUNET_NO); | ||
547 | } | ||
548 | |||
549 | destroy_config: | ||
550 | GNUNET_CONFIGURATION_destroy (cfg); | ||
551 | |||
552 | free_config: | ||
553 | GNUNET_free(config_file); | ||
554 | |||
555 | if (!session) | ||
556 | return; | ||
557 | |||
558 | char *history_file; | ||
559 | GNUNET_asprintf (&history_file, "%s%s", directory, "history.map"); | ||
560 | |||
561 | load_member_session_history (session, history_file); | ||
562 | GNUNET_free(history_file); | ||
563 | |||
564 | char *messages_file; | ||
565 | GNUNET_asprintf (&messages_file, "%s%s", directory, "messages.list"); | ||
566 | |||
567 | load_list_messages(&(session->messages), messages_file); | ||
568 | GNUNET_free(messages_file); | ||
569 | |||
570 | add_member_session(member, session); | ||
571 | } | ||
572 | |||
573 | static struct GNUNET_MESSENGER_MemberSession* | ||
574 | get_cycle_safe_next_session (struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_MESSENGER_MemberSession *next) | ||
575 | { | ||
576 | if (!next) | ||
577 | return NULL; | ||
578 | |||
579 | struct GNUNET_MESSENGER_MemberSession *check = next; | ||
580 | |||
581 | do { | ||
582 | if (check == session) | ||
583 | return NULL; | ||
584 | |||
585 | check = check->next; | ||
586 | } while (check); | ||
587 | |||
588 | return next; | ||
589 | } | ||
590 | |||
591 | void | ||
592 | load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory) | ||
593 | { | ||
594 | GNUNET_assert ((session) && (directory)); | ||
595 | |||
596 | char *config_file; | ||
597 | GNUNET_asprintf (&config_file, "%s%s", directory, "session.cfg"); | ||
598 | |||
599 | if (GNUNET_YES != GNUNET_DISK_file_test (config_file)) | ||
600 | goto free_config; | ||
601 | |||
602 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
603 | |||
604 | if (GNUNET_OK == GNUNET_CONFIGURATION_parse (cfg, config_file)) | ||
605 | { | ||
606 | char *key_data; | ||
607 | |||
608 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string(cfg, "session", "next_key", &key_data)) | ||
609 | goto destroy_config; | ||
610 | |||
611 | struct GNUNET_IDENTITY_PublicKey next_key; | ||
612 | |||
613 | enum GNUNET_GenericReturnValue key_return = GNUNET_IDENTITY_public_key_from_string(key_data, &next_key); | ||
614 | |||
615 | GNUNET_free(key_data); | ||
616 | |||
617 | if (GNUNET_OK != key_return) | ||
618 | goto destroy_config; | ||
619 | |||
620 | struct GNUNET_ShortHashCode next_id; | ||
621 | |||
622 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_data (cfg, "session", "next_id", &next_id, sizeof(next_id))) | ||
623 | goto destroy_config; | ||
624 | |||
625 | struct GNUNET_MESSENGER_Member *member = get_store_member(session->member->store, &next_id); | ||
626 | |||
627 | session->next = get_cycle_safe_next_session( | ||
628 | session, member? get_member_session (member, &next_key) : NULL | ||
629 | ); | ||
630 | |||
631 | if (session->next) | ||
632 | session->next->prev = session; | ||
633 | } | ||
634 | |||
635 | destroy_config: | ||
636 | GNUNET_CONFIGURATION_destroy (cfg); | ||
637 | |||
638 | free_config: | ||
639 | GNUNET_free(config_file); | ||
640 | } | ||
641 | |||
642 | static int | ||
643 | iterate_save_member_session_history_hentries (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
644 | { | ||
645 | struct GNUNET_DISK_FileHandle *handle = cls; | ||
646 | unsigned char ownership = value? GNUNET_YES : GNUNET_NO; | ||
647 | |||
648 | GNUNET_DISK_file_write(handle, key, sizeof(*key)); | ||
649 | GNUNET_DISK_file_write(handle, &ownership, sizeof(ownership)); | ||
650 | |||
651 | return GNUNET_YES; | ||
652 | } | ||
653 | |||
654 | static void | ||
655 | save_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, const char *path) | ||
656 | { | ||
657 | GNUNET_assert((session) && (path)); | ||
658 | |||
659 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
660 | |||
661 | struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open( | ||
662 | path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission | ||
663 | ); | ||
664 | |||
665 | if (!handle) | ||
666 | return; | ||
667 | |||
668 | GNUNET_DISK_file_seek(handle, 0, GNUNET_DISK_SEEK_SET); | ||
669 | |||
670 | GNUNET_CONTAINER_multihashmap_iterate( | ||
671 | session->history, | ||
672 | iterate_save_member_session_history_hentries, | ||
673 | handle | ||
674 | ); | ||
675 | |||
676 | GNUNET_DISK_file_sync(handle); | ||
677 | GNUNET_DISK_file_close(handle); | ||
678 | } | ||
679 | |||
680 | void | ||
681 | save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory) | ||
682 | { | ||
683 | GNUNET_assert ((session) && (directory)); | ||
684 | |||
685 | char *config_file; | ||
686 | GNUNET_asprintf (&config_file, "%s%s", directory, "session.cfg"); | ||
687 | |||
688 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
689 | |||
690 | char *key_data = GNUNET_IDENTITY_public_key_to_string(get_member_session_public_key(session)); | ||
691 | |||
692 | if (key_data) | ||
693 | { | ||
694 | GNUNET_CONFIGURATION_set_value_string (cfg, "session", "key", key_data); | ||
695 | |||
696 | GNUNET_free(key_data); | ||
697 | } | ||
698 | |||
699 | if (session->next) | ||
700 | { | ||
701 | const struct GNUNET_ShortHashCode *next_id = get_member_session_id(session->next); | ||
702 | |||
703 | char *next_id_data = GNUNET_STRINGS_data_to_string_alloc (next_id, sizeof(*next_id)); | ||
704 | |||
705 | if (next_id_data) | ||
706 | { | ||
707 | GNUNET_CONFIGURATION_set_value_string (cfg, "session", "next_id", next_id_data); | ||
708 | |||
709 | GNUNET_free(next_id_data); | ||
710 | } | ||
711 | |||
712 | key_data = GNUNET_IDENTITY_public_key_to_string(get_member_session_public_key(session->next)); | ||
713 | |||
714 | if (key_data) | ||
715 | { | ||
716 | GNUNET_CONFIGURATION_set_value_string (cfg, "session", "next_key", key_data); | ||
717 | |||
718 | GNUNET_free(key_data); | ||
719 | } | ||
720 | } | ||
721 | |||
722 | GNUNET_CONFIGURATION_set_value_number(cfg, "session", "start", session->start.abs_value_us); | ||
723 | |||
724 | GNUNET_CONFIGURATION_set_value_number (cfg, "session", "closed", session->closed); | ||
725 | GNUNET_CONFIGURATION_set_value_number (cfg, "session", "completed", session->completed); | ||
726 | |||
727 | GNUNET_CONFIGURATION_write (cfg, config_file); | ||
728 | GNUNET_CONFIGURATION_destroy (cfg); | ||
729 | |||
730 | GNUNET_free(config_file); | ||
731 | |||
732 | char *history_file; | ||
733 | GNUNET_asprintf (&history_file, "%s%s", directory, "history.map"); | ||
734 | |||
735 | save_member_session_history (session, history_file); | ||
736 | GNUNET_free(history_file); | ||
737 | |||
738 | char *messages_file; | ||
739 | GNUNET_asprintf (&messages_file, "%s%s", directory, "messages.list"); | ||
740 | |||
741 | save_list_messages(&(session->messages), messages_file); | ||
742 | GNUNET_free(messages_file); | ||
743 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_member_session.h b/src/messenger/gnunet-service-messenger_member_session.h new file mode 100644 index 000000000..fa9c6b829 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_member_session.h | |||
@@ -0,0 +1,288 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_member_session.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_crypto_lib.h" | ||
31 | #include "gnunet_container_lib.h" | ||
32 | #include "gnunet_identity_service.h" | ||
33 | #include "gnunet_time_lib.h" | ||
34 | |||
35 | #include "gnunet-service-messenger_member.h" | ||
36 | |||
37 | #include "messenger_api_contact.h" | ||
38 | |||
39 | struct GNUNET_MESSENGER_MemberSession { | ||
40 | struct GNUNET_MESSENGER_Member *member; | ||
41 | |||
42 | struct GNUNET_IDENTITY_PublicKey public_key; | ||
43 | struct GNUNET_HashCode context; | ||
44 | |||
45 | struct GNUNET_MESSENGER_Contact *contact; | ||
46 | |||
47 | struct GNUNET_CONTAINER_MultiHashMap *history; | ||
48 | struct GNUNET_MESSENGER_ListMessages messages; | ||
49 | |||
50 | struct GNUNET_MESSENGER_MemberSession* prev; | ||
51 | struct GNUNET_MESSENGER_MemberSession* next; | ||
52 | |||
53 | struct GNUNET_TIME_Absolute start; | ||
54 | |||
55 | int closed; | ||
56 | int completed; | ||
57 | }; | ||
58 | |||
59 | /** | ||
60 | * Creates and allocates a new member session of a <i>member</i> with a given | ||
61 | * public key. | ||
62 | * | ||
63 | * If the creation fails, NULL gets returned. | ||
64 | * | ||
65 | * @param[in/out] member Member | ||
66 | * @param[in] pubkey Public key of EGO | ||
67 | * @return New member session | ||
68 | */ | ||
69 | struct GNUNET_MESSENGER_MemberSession* | ||
70 | create_member_session (struct GNUNET_MESSENGER_Member *member, | ||
71 | const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
72 | |||
73 | /** | ||
74 | * Creates and allocates a new member session closing and replacing a given | ||
75 | * other <i>session</i> of the same member. The new session could have significant | ||
76 | * changes to the members public key or its member id depending on the used | ||
77 | * <i>message</i> to switch session. The new session will be linked to the old | ||
78 | * one. | ||
79 | * | ||
80 | * @param[in/out] session Old member session | ||
81 | * @param[in] message Message | ||
82 | * @param[in] hash Hash of message | ||
83 | * @return New member session | ||
84 | */ | ||
85 | struct GNUNET_MESSENGER_MemberSession* | ||
86 | switch_member_session (struct GNUNET_MESSENGER_MemberSession *session, | ||
87 | const struct GNUNET_MESSENGER_Message *message, | ||
88 | const struct GNUNET_HashCode *hash); | ||
89 | |||
90 | /** | ||
91 | * Destroys a member session and frees its memory fully. | ||
92 | * | ||
93 | * @param[in/out] session Member session | ||
94 | */ | ||
95 | void | ||
96 | destroy_member_session(struct GNUNET_MESSENGER_MemberSession* session); | ||
97 | |||
98 | /** | ||
99 | * Resets a given member <i>session</i> which re-opens a member | ||
100 | * session for new usage. Every connection to other sessions will be | ||
101 | * be dropped. The member sessions messages will be cleared but old | ||
102 | * history from uncompleted sessions however can be reused! | ||
103 | * | ||
104 | * @param[in/out] session Member session | ||
105 | * @param[in] hash Hash of initial message (JOIN message!) | ||
106 | * @return #GNUNET_OK on success, #GNUNET_SYSERR otherwise | ||
107 | */ | ||
108 | int | ||
109 | reset_member_session (struct GNUNET_MESSENGER_MemberSession* session, | ||
110 | const struct GNUNET_HashCode *hash); | ||
111 | |||
112 | /** | ||
113 | * Closes a given member <i>session</i> which opens the request | ||
114 | * for completion of the given member session. | ||
115 | * | ||
116 | * Closing a session may complete a session and can't be used without | ||
117 | * a reset! ( @see #reset_member_session() ) | ||
118 | * | ||
119 | * @param[in/out] session Member session | ||
120 | */ | ||
121 | void | ||
122 | close_member_session (struct GNUNET_MESSENGER_MemberSession* session); | ||
123 | |||
124 | /** | ||
125 | * Returns if the given member <i>session</i> has been closed. | ||
126 | * | ||
127 | * @param[in] session Member session | ||
128 | * @return #GNUNET_YES or #GNUNET_NO | ||
129 | */ | ||
130 | int | ||
131 | is_member_session_closed (const struct GNUNET_MESSENGER_MemberSession* session); | ||
132 | |||
133 | /** | ||
134 | * Returns if the given member <i>session</i> has been completed. | ||
135 | * | ||
136 | * A completed member session can't verify any message as its own and | ||
137 | * it won't add any message to its history. | ||
138 | * | ||
139 | * @param[in] session Member session | ||
140 | * @return #GNUNET_YES or #GNUNET_NO | ||
141 | */ | ||
142 | int | ||
143 | is_member_session_completed (const struct GNUNET_MESSENGER_MemberSession* session); | ||
144 | |||
145 | /** | ||
146 | * Returns the timestamp of the member <i>session</i>'s start. | ||
147 | * | ||
148 | * @param[in] session Member session | ||
149 | * @return Absolute timestamp | ||
150 | */ | ||
151 | struct GNUNET_TIME_Absolute | ||
152 | get_member_session_start (const struct GNUNET_MESSENGER_MemberSession* session); | ||
153 | |||
154 | /** | ||
155 | * Returns the key of the room a given member <i>session</i> belongs to. | ||
156 | * | ||
157 | * @param[in] session Member session | ||
158 | * @return Key of room | ||
159 | */ | ||
160 | const struct GNUNET_HashCode* | ||
161 | get_member_session_key (const struct GNUNET_MESSENGER_MemberSession* session); | ||
162 | |||
163 | /** | ||
164 | * Returns the member id of a given member <i>session</i>. | ||
165 | * | ||
166 | * @param[in] session Member session | ||
167 | * @return Member id | ||
168 | */ | ||
169 | const struct GNUNET_ShortHashCode* | ||
170 | get_member_session_id (const struct GNUNET_MESSENGER_MemberSession* session); | ||
171 | |||
172 | /** | ||
173 | * Returns the public key from an EGO of a given member <i>session</i>. | ||
174 | * | ||
175 | * @param[in] session Member session | ||
176 | * @return Public key of EGO | ||
177 | */ | ||
178 | const struct GNUNET_IDENTITY_PublicKey* | ||
179 | get_member_session_public_key (const struct GNUNET_MESSENGER_MemberSession* session); | ||
180 | |||
181 | /** | ||
182 | * Returns the member context of a given member <i>session</i>. | ||
183 | * | ||
184 | * @param[in] session Member session | ||
185 | * @return Member context as hash | ||
186 | */ | ||
187 | const struct GNUNET_HashCode* | ||
188 | get_member_session_context (const struct GNUNET_MESSENGER_MemberSession* session); | ||
189 | |||
190 | /** | ||
191 | * Retruns the contact which is connected to a given member <i>session</i>. | ||
192 | * | ||
193 | * @param[in] session Member session | ||
194 | * @return Contact | ||
195 | */ | ||
196 | struct GNUNET_MESSENGER_Contact* | ||
197 | get_member_session_contact (struct GNUNET_MESSENGER_MemberSession* session); | ||
198 | |||
199 | /** | ||
200 | * Verifies a given member <i>session</i> as sender of a selected <i>message</i> and | ||
201 | * its <i>hash</i>. The function returns #GNUNET_OK if the message session is verified | ||
202 | * as sender, otherwise #GNUNET_SYSERR. | ||
203 | * | ||
204 | * @see #is_member_session_completed() for verification. | ||
205 | * | ||
206 | * @param[in] session Member session | ||
207 | * @param[in] message Message | ||
208 | * @param[in] hash Hash of message | ||
209 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | ||
210 | */ | ||
211 | int | ||
212 | verify_member_session_as_sender (const struct GNUNET_MESSENGER_MemberSession *session, | ||
213 | const struct GNUNET_MESSENGER_Message *message, | ||
214 | const struct GNUNET_HashCode *hash); | ||
215 | |||
216 | /** | ||
217 | * Checks the history of a <i>session</i> for a specific message which is identified | ||
218 | * by its <i>hash</i> and if the <i>ownership</i> flag is set, if the message is | ||
219 | * owned by the sessions contact. | ||
220 | * | ||
221 | * @param[in] session Member session | ||
222 | * @param[in] hash Hash of message | ||
223 | * @param[in] ownership Ownership flag | ||
224 | * @return #GNUNET_YES if found, otherwise #GNUNET_NO | ||
225 | */ | ||
226 | int | ||
227 | check_member_session_history (const struct GNUNET_MESSENGER_MemberSession *session, | ||
228 | const struct GNUNET_HashCode *hash, int ownership); | ||
229 | |||
230 | /** | ||
231 | * Adds a given <i>message</i> to the history of a <i>session</i> using the messages | ||
232 | * <i>hash</i>. The ownership will be set automatically. | ||
233 | * | ||
234 | * @see #is_member_session_completed() for updating a history. | ||
235 | * | ||
236 | * @param[in/out] session Member session | ||
237 | * @param[in] message Message | ||
238 | * @param[in] hash Hash of message | ||
239 | */ | ||
240 | void | ||
241 | update_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, | ||
242 | const struct GNUNET_MESSENGER_Message *message, | ||
243 | const struct GNUNET_HashCode *hash); | ||
244 | |||
245 | /** | ||
246 | * Removes a message from the history of a <i>session</i> using the messages | ||
247 | * <i>hash</i>. | ||
248 | * | ||
249 | * @param[in/out] session Member session | ||
250 | * @param[in] hash Hash of message | ||
251 | */ | ||
252 | void | ||
253 | clear_member_session_history (struct GNUNET_MESSENGER_MemberSession *session, | ||
254 | const struct GNUNET_HashCode *hash); | ||
255 | |||
256 | /** | ||
257 | * Loads data from a <i>directory</i> into a new allocated and created member | ||
258 | * session of a <i>member</i> if the required information can be read from the | ||
259 | * content of the given directory. | ||
260 | * | ||
261 | * @param[out] member Member | ||
262 | * @param[in] directory Path to a directory | ||
263 | */ | ||
264 | void | ||
265 | load_member_session (struct GNUNET_MESSENGER_Member *member, const char *directory); | ||
266 | |||
267 | /** | ||
268 | * Loads the connection from one <i>session</i> to another through the | ||
269 | * next attribute. Necessary information will be loaded from a configuration | ||
270 | * file inside of a given <i>directory</i>. | ||
271 | * | ||
272 | * @param[in/out] session Member session | ||
273 | * @param[in] directory Path to a directory | ||
274 | */ | ||
275 | void | ||
276 | load_member_session_next (struct GNUNET_MESSENGER_MemberSession *session, const char *directory); | ||
277 | |||
278 | /** | ||
279 | * Saves data from a member <i>session</i> into a <i>directory</i> which can be | ||
280 | * load to restore the member session completely. | ||
281 | * | ||
282 | * @param[in] session Member session | ||
283 | * @param[in] directory Path to a directory | ||
284 | */ | ||
285 | void | ||
286 | save_member_session (struct GNUNET_MESSENGER_MemberSession *session, const char *directory); | ||
287 | |||
288 | #endif //GNUNET_SERVICE_MESSENGER_MEMBER_SESSION_H | ||
diff --git a/src/messenger/gnunet-service-messenger_member_store.c b/src/messenger/gnunet-service-messenger_member_store.c new file mode 100644 index 000000000..2925965d4 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_member_store.c | |||
@@ -0,0 +1,250 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_member_store.c | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "gnunet-service-messenger_member_store.h" | ||
27 | |||
28 | #include "gnunet-service-messenger_member.h" | ||
29 | #include "gnunet-service-messenger_service.h" | ||
30 | #include "gnunet-service-messenger_room.h" | ||
31 | |||
32 | void | ||
33 | init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room) | ||
34 | { | ||
35 | GNUNET_assert ((store) && (room)); | ||
36 | |||
37 | store->room = room; | ||
38 | store->members = GNUNET_CONTAINER_multishortmap_create(8, GNUNET_NO); | ||
39 | } | ||
40 | |||
41 | static int | ||
42 | iterate_destroy_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) | ||
43 | { | ||
44 | struct GNUNET_MESSENGER_Member *member = value; | ||
45 | destroy_member(member); | ||
46 | return GNUNET_YES; | ||
47 | } | ||
48 | |||
49 | void | ||
50 | clear_member_store (struct GNUNET_MESSENGER_MemberStore *store) | ||
51 | { | ||
52 | GNUNET_assert ((store) && (store->members)); | ||
53 | |||
54 | GNUNET_CONTAINER_multishortmap_iterate (store->members, iterate_destroy_members, NULL); | ||
55 | GNUNET_CONTAINER_multishortmap_destroy (store->members); | ||
56 | } | ||
57 | |||
58 | |||
59 | struct GNUNET_MESSENGER_ContactStore* | ||
60 | get_member_contact_store (struct GNUNET_MESSENGER_MemberStore *store) | ||
61 | { | ||
62 | GNUNET_assert ((store) && (store->room)); | ||
63 | |||
64 | struct GNUNET_MESSENGER_SrvRoom *room = store->room; | ||
65 | |||
66 | return get_service_contact_store(room->service); | ||
67 | } | ||
68 | |||
69 | const struct GNUNET_HashCode* | ||
70 | get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store) | ||
71 | { | ||
72 | GNUNET_assert (store); | ||
73 | |||
74 | return get_room_key((const struct GNUNET_MESSENGER_SrvRoom*) store->room); | ||
75 | } | ||
76 | |||
77 | static int | ||
78 | callback_scan_for_members (void *cls, const char *filename) | ||
79 | { | ||
80 | struct GNUNET_MESSENGER_MemberStore *store = cls; | ||
81 | |||
82 | if (GNUNET_YES == GNUNET_DISK_directory_test (filename, GNUNET_YES)) | ||
83 | { | ||
84 | char *directory; | ||
85 | |||
86 | GNUNET_asprintf (&directory, "%s%c", filename, DIR_SEPARATOR); | ||
87 | |||
88 | load_member(store, directory); | ||
89 | |||
90 | GNUNET_free(directory); | ||
91 | } | ||
92 | |||
93 | return GNUNET_OK; | ||
94 | } | ||
95 | |||
96 | static int | ||
97 | iterate_load_next_member_sessions (void *cls, const struct GNUNET_ShortHashCode *id, void *value) | ||
98 | { | ||
99 | const char *sync_dir = cls; | ||
100 | |||
101 | struct GNUNET_MESSENGER_Member *member = value; | ||
102 | |||
103 | if (!member) | ||
104 | return GNUNET_YES; | ||
105 | |||
106 | char *member_dir; | ||
107 | GNUNET_asprintf (&member_dir, "%s%s%c", sync_dir, GNUNET_sh2s(id), DIR_SEPARATOR); | ||
108 | |||
109 | if (GNUNET_YES == GNUNET_DISK_directory_test (member_dir, GNUNET_YES)) | ||
110 | load_member_next_sessions (member, member_dir); | ||
111 | |||
112 | GNUNET_free(member_dir); | ||
113 | return GNUNET_YES; | ||
114 | } | ||
115 | |||
116 | static int | ||
117 | iterate_sync_member_contacts (void *cls, const struct GNUNET_ShortHashCode *id, void *value) | ||
118 | { | ||
119 | struct GNUNET_MESSENGER_Member *member = value; | ||
120 | |||
121 | if (!member) | ||
122 | return GNUNET_YES; | ||
123 | |||
124 | sync_member_contacts (member); | ||
125 | return GNUNET_YES; | ||
126 | } | ||
127 | |||
128 | void | ||
129 | load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) | ||
130 | { | ||
131 | GNUNET_assert ((store) && (directory)); | ||
132 | |||
133 | char *scan_dir; | ||
134 | GNUNET_asprintf (&scan_dir, "%s%s%c", directory, "members", DIR_SEPARATOR); | ||
135 | |||
136 | if (GNUNET_OK == GNUNET_DISK_directory_test (scan_dir, GNUNET_YES)) | ||
137 | GNUNET_DISK_directory_scan (scan_dir, callback_scan_for_members, store); | ||
138 | |||
139 | GNUNET_CONTAINER_multishortmap_iterate(store->members, iterate_load_next_member_sessions, scan_dir); | ||
140 | GNUNET_CONTAINER_multishortmap_iterate(store->members, iterate_sync_member_contacts, NULL); | ||
141 | |||
142 | GNUNET_free(scan_dir); | ||
143 | } | ||
144 | |||
145 | static int | ||
146 | iterate_save_members (void *cls, const struct GNUNET_ShortHashCode *id, void *value) | ||
147 | { | ||
148 | const char *save_dir = cls; | ||
149 | |||
150 | struct GNUNET_MESSENGER_Member *member = value; | ||
151 | |||
152 | if (!member) | ||
153 | return GNUNET_YES; | ||
154 | |||
155 | char *member_dir; | ||
156 | GNUNET_asprintf (&member_dir, "%s%s%c", save_dir, GNUNET_sh2s(id), DIR_SEPARATOR); | ||
157 | |||
158 | if ((GNUNET_YES == GNUNET_DISK_directory_test (member_dir, GNUNET_NO)) || | ||
159 | (GNUNET_OK == GNUNET_DISK_directory_create (member_dir))) | ||
160 | save_member(member, member_dir); | ||
161 | |||
162 | GNUNET_free(member_dir); | ||
163 | return GNUNET_YES; | ||
164 | } | ||
165 | |||
166 | void | ||
167 | save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory) | ||
168 | { | ||
169 | GNUNET_assert ((store) && (directory)); | ||
170 | |||
171 | char* save_dir; | ||
172 | GNUNET_asprintf (&save_dir, "%s%s%c", directory, "members", DIR_SEPARATOR); | ||
173 | |||
174 | if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) || | ||
175 | (GNUNET_OK == GNUNET_DISK_directory_create (save_dir))) | ||
176 | GNUNET_CONTAINER_multishortmap_iterate(store->members, iterate_save_members, save_dir); | ||
177 | |||
178 | GNUNET_free(save_dir); | ||
179 | } | ||
180 | |||
181 | struct GNUNET_MESSENGER_Member* | ||
182 | get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) | ||
183 | { | ||
184 | GNUNET_assert ((store) && (store->members) && (id)); | ||
185 | |||
186 | return GNUNET_CONTAINER_multishortmap_get (store->members, id); | ||
187 | } | ||
188 | |||
189 | struct GNUNET_MESSENGER_Member* | ||
190 | get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message) | ||
191 | { | ||
192 | if ((GNUNET_MESSENGER_KIND_INFO == message->header.kind) || | ||
193 | (GNUNET_MESSENGER_KIND_JOIN == message->header.kind)) | ||
194 | return add_store_member(store, &(message->header.sender_id)); | ||
195 | else | ||
196 | return get_store_member(store, &(message->header.sender_id)); | ||
197 | } | ||
198 | |||
199 | struct GNUNET_MESSENGER_Member* | ||
200 | add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id) | ||
201 | { | ||
202 | GNUNET_assert ((store) && (store->members)); | ||
203 | |||
204 | struct GNUNET_MESSENGER_Member *member = id? get_store_member(store, id) : NULL; | ||
205 | |||
206 | if (member) | ||
207 | return member; | ||
208 | |||
209 | member = create_member(store, id); | ||
210 | |||
211 | if (!member) | ||
212 | return NULL; | ||
213 | |||
214 | if (GNUNET_OK != GNUNET_CONTAINER_multishortmap_put (store->members, get_member_id(member), member, | ||
215 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
216 | { | ||
217 | destroy_member(member); | ||
218 | return NULL; | ||
219 | } | ||
220 | |||
221 | return member; | ||
222 | } | ||
223 | |||
224 | struct GNUNET_MESSENGER_ClosureIterateMembers { | ||
225 | GNUNET_MESSENGER_MemberIteratorCallback it; | ||
226 | void *cls; | ||
227 | }; | ||
228 | |||
229 | static int | ||
230 | iterate_store_members_it (void *cls, const struct GNUNET_ShortHashCode *key, void *value) | ||
231 | { | ||
232 | struct GNUNET_MESSENGER_ClosureIterateMembers *iterate = cls; | ||
233 | struct GNUNET_MESSENGER_Member *member = value; | ||
234 | |||
235 | return iterate_member_sessions(member, iterate->it, iterate->cls); | ||
236 | } | ||
237 | |||
238 | int | ||
239 | iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, | ||
240 | void* cls) | ||
241 | { | ||
242 | GNUNET_assert ((store) && (store->members) && (it)); | ||
243 | |||
244 | struct GNUNET_MESSENGER_ClosureIterateMembers iterate; | ||
245 | |||
246 | iterate.it = it; | ||
247 | iterate.cls = cls; | ||
248 | |||
249 | return GNUNET_CONTAINER_multishortmap_iterate(store->members, iterate_store_members_it, &iterate); | ||
250 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_member_store.h b/src/messenger/gnunet-service-messenger_member_store.h new file mode 100644 index 000000000..859e4683d --- /dev/null +++ b/src/messenger/gnunet-service-messenger_member_store.h | |||
@@ -0,0 +1,151 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_member_store.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_MEMBER_STORE_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_MEMBER_STORE_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_crypto_lib.h" | ||
31 | #include "gnunet_container_lib.h" | ||
32 | #include "gnunet_identity_service.h" | ||
33 | #include "messenger_api_message.h" | ||
34 | |||
35 | struct GNUNET_MESSENGER_SrvRoom; | ||
36 | |||
37 | struct GNUNET_MESSENGER_Member; | ||
38 | struct GNUNET_MESSENGER_MemberSession; | ||
39 | |||
40 | struct GNUNET_MESSENGER_MemberStore | ||
41 | { | ||
42 | struct GNUNET_MESSENGER_SrvRoom *room; | ||
43 | |||
44 | struct GNUNET_CONTAINER_MultiShortmap *members; | ||
45 | }; | ||
46 | |||
47 | typedef int (*GNUNET_MESSENGER_MemberIteratorCallback) ( | ||
48 | void *cls, | ||
49 | const struct GNUNET_IDENTITY_PublicKey *public_key, | ||
50 | struct GNUNET_MESSENGER_MemberSession *session); | ||
51 | |||
52 | /** | ||
53 | * Initializes a member <i>store</i> as fully empty connected to a <i>room</i>. | ||
54 | * | ||
55 | * @param[out] store Member store | ||
56 | * @param room Room | ||
57 | */ | ||
58 | void | ||
59 | init_member_store (struct GNUNET_MESSENGER_MemberStore *store, struct GNUNET_MESSENGER_SrvRoom *room); | ||
60 | |||
61 | /** | ||
62 | * Clears a member <i>store</i>, wipes its content and deallocates its memory. | ||
63 | * | ||
64 | * @param[in/out] store Member store | ||
65 | */ | ||
66 | void | ||
67 | clear_member_store (struct GNUNET_MESSENGER_MemberStore *store); | ||
68 | |||
69 | /** | ||
70 | * Returns the used contact store of a given member <i>store</i>. | ||
71 | * | ||
72 | * @param[in/out] store Member store | ||
73 | * @return Contact store | ||
74 | */ | ||
75 | struct GNUNET_MESSENGER_ContactStore* | ||
76 | get_member_contact_store (struct GNUNET_MESSENGER_MemberStore *store); | ||
77 | |||
78 | /** | ||
79 | * Returns the shared secret you need to access a room of the <i>store</i>. | ||
80 | * | ||
81 | * @param[in] store Member store | ||
82 | * @return Shared secret | ||
83 | */ | ||
84 | const struct GNUNET_HashCode* | ||
85 | get_member_store_key (const struct GNUNET_MESSENGER_MemberStore *store); | ||
86 | |||
87 | /** | ||
88 | * Loads members from a directory into a member <i>store</i>. | ||
89 | * | ||
90 | * @param[out] store Member store | ||
91 | * @param[in] directory Path to a directory | ||
92 | */ | ||
93 | void | ||
94 | load_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); | ||
95 | |||
96 | /** | ||
97 | * Saves members from a member <i>store</i> into a directory. | ||
98 | * | ||
99 | * @param[in] store Member store | ||
100 | * @param[in] directory Path to a directory | ||
101 | */ | ||
102 | void | ||
103 | save_member_store (struct GNUNET_MESSENGER_MemberStore *store, const char *directory); | ||
104 | |||
105 | /** | ||
106 | * Returns the member in a <i>store</i> identified by a given <i>id</i>. If the <i>store</i> | ||
107 | * does not contain a member with the given <i>id</i>, NULL gets returned. | ||
108 | * | ||
109 | * @param[in] store Member store | ||
110 | * @param[in] id Member id | ||
111 | * @return Member or NULL | ||
112 | */ | ||
113 | struct GNUNET_MESSENGER_Member* | ||
114 | get_store_member (const struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); | ||
115 | |||
116 | /** | ||
117 | * Returns the member of a <i>store</i> using a sender id of a given <i>message</i>. | ||
118 | * If the member does not provide a matching session, NULL gets returned. | ||
119 | * | ||
120 | * @param[in/out] store Member store | ||
121 | * @param[in] message Message | ||
122 | * @return Member or NULL | ||
123 | */ | ||
124 | struct GNUNET_MESSENGER_Member* | ||
125 | get_store_member_of (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_MESSENGER_Message *message); | ||
126 | |||
127 | /** | ||
128 | * Adds a member to a <i>store</i> under a specific <i>id</i> and returns it on success. | ||
129 | * | ||
130 | * @param[in/out] store Member store | ||
131 | * @param[in] id Member id | ||
132 | * @return Member or NULL | ||
133 | */ | ||
134 | struct GNUNET_MESSENGER_Member* | ||
135 | add_store_member (struct GNUNET_MESSENGER_MemberStore *store, const struct GNUNET_ShortHashCode *id); | ||
136 | |||
137 | /** | ||
138 | * Iterate through all member sessions currently connected to the members of the given | ||
139 | * member <i>store</i> and call the provided iterator callback with a selected closure. | ||
140 | * The function will return the amount of members it iterated through. | ||
141 | * | ||
142 | * @param[in/out] store Member store | ||
143 | * @param[in] it Iterator callback | ||
144 | * @param[in/out] cls Closure | ||
145 | * @return Amount of members iterated through | ||
146 | */ | ||
147 | int | ||
148 | iterate_store_members (struct GNUNET_MESSENGER_MemberStore *store, GNUNET_MESSENGER_MemberIteratorCallback it, | ||
149 | void* cls); | ||
150 | |||
151 | #endif //GNUNET_SERVICE_MESSENGER_MEMBER_STORE_H | ||
diff --git a/src/messenger/gnunet-service-messenger_message_handle.c b/src/messenger/gnunet-service-messenger_message_handle.c index 1652435c8..1d489310c 100644 --- a/src/messenger/gnunet-service-messenger_message_handle.c +++ b/src/messenger/gnunet-service-messenger_message_handle.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -25,75 +25,66 @@ | |||
25 | 25 | ||
26 | #include "gnunet-service-messenger_message_handle.h" | 26 | #include "gnunet-service-messenger_message_handle.h" |
27 | 27 | ||
28 | void | 28 | static void |
29 | handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 29 | handle_session_switch (struct GNUNET_MESSENGER_MemberSession *session, |
30 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 30 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
31 | { | 31 | { |
32 | struct GNUNET_MESSENGER_SrvContact *contact = get_room_contact (room, &(message->header.sender_id)); | 32 | struct GNUNET_MESSENGER_MemberSession *next = switch_member_session(session, message, hash); |
33 | |||
34 | if (!contact) | ||
35 | add_room_contact (room, &(message->header.sender_id), &(message->body.join.key)); | ||
36 | |||
37 | struct GNUNET_MESSENGER_MemberInfo *info = get_room_member_info (room, &(message->header.sender_id)); | ||
38 | |||
39 | if (!info) | ||
40 | { | ||
41 | info = GNUNET_new(struct GNUNET_MESSENGER_MemberInfo); | ||
42 | |||
43 | info->access = GNUNET_MESSENGER_MEMBER_UNKNOWN; | ||
44 | init_list_messages (&(info->session_messages)); | ||
45 | } | ||
46 | else | ||
47 | clear_list_messages (&(info->session_messages)); | ||
48 | 33 | ||
49 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_put (room->member_infos, &(message->header.sender_id), info, | 34 | if (next != session) |
50 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 35 | add_member_session(next->member, next); |
51 | add_to_list_messages (&(info->session_messages), hash); | ||
52 | } | 36 | } |
53 | 37 | ||
54 | void | 38 | void |
55 | handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 39 | handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
56 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 40 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
57 | { | 41 | { |
58 | struct GNUNET_MESSENGER_MemberInfo *info = get_room_member_info (room, &(message->header.sender_id)); | 42 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) joins room (%s).\n", |
59 | 43 | GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room))); | |
60 | if (info) | 44 | |
61 | clear_list_messages (&(info->session_messages)); | 45 | if (GNUNET_OK != reset_member_session(session, hash)) |
46 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Resetting member session failed!\n"); | ||
47 | |||
48 | solve_room_member_collisions ( | ||
49 | room, | ||
50 | &(message->body.join.key), | ||
51 | &(message->header.sender_id), | ||
52 | GNUNET_TIME_absolute_ntoh(message->header.timestamp) | ||
53 | ); | ||
62 | } | 54 | } |
63 | 55 | ||
64 | void | 56 | void |
65 | handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 57 | handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
66 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 58 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
67 | { | 59 | { |
68 | struct GNUNET_MESSENGER_SrvContact *contact = get_room_contact (room, &(message->header.sender_id)); | 60 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Member (%s) leaves room (%s).\n", |
69 | 61 | GNUNET_sh2s (&(message->header.sender_id)), GNUNET_h2s(get_room_key(room))); | |
70 | if (contact) | ||
71 | set_contact_name (contact, message->body.name.name); | ||
72 | |||
73 | struct GNUNET_MESSENGER_MemberInfo *info = get_room_member_info (room, &(message->header.sender_id)); | ||
74 | 62 | ||
75 | if (info) | 63 | close_member_session(session); |
76 | add_to_list_messages (&(info->session_messages), hash); | ||
77 | } | 64 | } |
78 | 65 | ||
79 | void | 66 | void |
80 | handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 67 | handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
81 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 68 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
82 | { | 69 | { |
83 | struct GNUNET_MESSENGER_SrvContact *contact = get_room_contact (room, &(message->header.sender_id)); | 70 | struct GNUNET_MESSENGER_Contact *contact = get_member_session_contact(session); |
84 | 71 | ||
85 | if (contact) | 72 | if (!contact) |
86 | swap_service_contact_by_pubkey (room->service, contact, &(message->body.key.key)); | 73 | return; |
87 | 74 | ||
88 | struct GNUNET_MESSENGER_MemberInfo *info = get_room_member_info (room, &(message->header.sender_id)); | 75 | set_contact_name (contact, message->body.name.name); |
76 | } | ||
89 | 77 | ||
90 | if (info) | 78 | void |
91 | add_to_list_messages (&(info->session_messages), hash); | 79 | handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
80 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
81 | { | ||
82 | handle_session_switch (session, message, hash); | ||
92 | } | 83 | } |
93 | 84 | ||
94 | void | 85 | void |
95 | handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 86 | handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
96 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 87 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
97 | { | 88 | { |
98 | if (GNUNET_NO == contains_list_tunnels (&(room->basement), &(message->body.peer.peer))) | 89 | if (GNUNET_NO == contains_list_tunnels (&(room->basement), &(message->body.peer.peer))) |
99 | add_to_list_tunnels (&(room->basement), &(message->body.peer.peer)); | 90 | add_to_list_tunnels (&(room->basement), &(message->body.peer.peer)); |
@@ -103,20 +94,22 @@ handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN | |||
103 | } | 94 | } |
104 | 95 | ||
105 | void | 96 | void |
106 | handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 97 | handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
107 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 98 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
108 | { | 99 | { |
109 | struct GNUNET_MESSENGER_MemberInfo *info = get_room_member_info (room, &(message->header.sender_id)); | 100 | handle_session_switch (session, message, hash); |
110 | 101 | ||
111 | if (info) | 102 | solve_room_member_collisions ( |
112 | add_to_list_messages (&(info->session_messages), hash); | 103 | room, |
113 | 104 | get_member_session_public_key(session), | |
114 | switch_room_member_id (room, &(message->header.sender_id), &(message->body.id.id), hash); | 105 | &(message->body.id.id), |
106 | GNUNET_TIME_absolute_ntoh(message->header.timestamp) | ||
107 | ); | ||
115 | } | 108 | } |
116 | 109 | ||
117 | void | 110 | void |
118 | handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 111 | handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
119 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 112 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
120 | { | 113 | { |
121 | struct GNUNET_MESSENGER_ListTunnel *element = find_list_tunnels (&(room->basement), &(message->body.peer.peer), NULL); | 114 | struct GNUNET_MESSENGER_ListTunnel *element = find_list_tunnels (&(room->basement), &(message->body.peer.peer), NULL); |
122 | 115 | ||
@@ -128,3 +121,16 @@ handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSEN | |||
128 | if (room->peer_message) | 121 | if (room->peer_message) |
129 | rebuild_room_basement_structure (room); | 122 | rebuild_room_basement_structure (room); |
130 | } | 123 | } |
124 | |||
125 | void | ||
126 | handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | ||
127 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
128 | { | ||
129 | struct GNUNET_TIME_Relative delay = GNUNET_TIME_relative_ntoh (message->body.delete.delay); | ||
130 | struct GNUNET_TIME_Absolute action = GNUNET_TIME_absolute_ntoh (message->header.timestamp); | ||
131 | |||
132 | action = GNUNET_TIME_absolute_add (action, delay); | ||
133 | delay = GNUNET_TIME_absolute_get_difference (GNUNET_TIME_absolute_get (), action); | ||
134 | |||
135 | delete_room_message (room, session, &(message->body.delete.hash), delay); | ||
136 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_message_handle.h b/src/messenger/gnunet-service-messenger_message_handle.h index d091e1d11..844142b77 100644 --- a/src/messenger/gnunet-service-messenger_message_handle.h +++ b/src/messenger/gnunet-service-messenger_message_handle.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include "gnunet-service-messenger_message_kind.h" | 32 | #include "gnunet-service-messenger_message_kind.h" |
33 | 33 | ||
34 | #include "gnunet-service-messenger_member_session.h" | ||
34 | #include "gnunet-service-messenger_tunnel.h" | 35 | #include "gnunet-service-messenger_tunnel.h" |
35 | #include "messenger_api_message.h" | 36 | #include "messenger_api_message.h" |
36 | 37 | ||
@@ -38,91 +39,104 @@ | |||
38 | * Handles a received or sent join message to make changes of current member information. | 39 | * Handles a received or sent join message to make changes of current member information. |
39 | * (add matching member and clear member info) | 40 | * (add matching member and clear member info) |
40 | * | 41 | * |
41 | * @param room Room of the message | 42 | * @param[in/out] room Room of the message |
42 | * @param tunnel Receiving/sending connection (may be NULL) | 43 | * @param[in/out] session Member session |
43 | * @param message JOIN-Message | 44 | * @param[in] message JOIN-Message |
44 | * @param hash Hash of the message | 45 | * @param[in] hash Hash of the message |
45 | */ | 46 | */ |
46 | void | 47 | void |
47 | handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 48 | handle_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
48 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 49 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
49 | 50 | ||
50 | /** | 51 | /** |
51 | * Handles a received or sent leave message to make changes of current member information. | 52 | * Handles a received or sent leave message to make changes of current member information. |
52 | * (remove matching member and clear member info) | 53 | * (remove matching member and clear member info) |
53 | * | 54 | * |
54 | * @param room Room of the message | 55 | * @param[in/out] room Room of the message |
55 | * @param tunnel Receiving/sending connection (may be NULL) | 56 | * @param[in/out] session Member session |
56 | * @param message LEAVE-Message | 57 | * @param[in] message LEAVE-Message |
57 | * @param hash Hash of the message | 58 | * @param[in] hash Hash of the message |
58 | */ | 59 | */ |
59 | void | 60 | void |
60 | handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 61 | handle_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
61 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 62 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
62 | 63 | ||
63 | /** | 64 | /** |
64 | * Handles a received or sent name message to rename a current member. | 65 | * Handles a received or sent name message to rename a current member. |
65 | * (change name of matching member) | 66 | * (change name of matching member) |
66 | * | 67 | * |
67 | * @param room Room of the message | 68 | * @param[in/out] room Room of the message |
68 | * @param tunnel Receiving/sending connection (may be NULL) | 69 | * @param[in/out] session Member session |
69 | * @param message NAME-Message | 70 | * @param[in] message NAME-Message |
70 | * @param hash Hash of the message | 71 | * @param[in] hash Hash of the message |
71 | */ | 72 | */ |
72 | void | 73 | void |
73 | handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 74 | handle_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
74 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 75 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
75 | 76 | ||
76 | /** | 77 | /** |
77 | * Handles a received or sent key message to change the key of a member and rearrange the contacts accordingly. | 78 | * Handles a received or sent key message to change the key of a member and rearrange the contacts accordingly. |
78 | * (move the member in the contacts and change its key) | 79 | * (move the member in the contacts and change its key) |
79 | * | 80 | * |
80 | * @param room Room of the message | 81 | * @param[in/out] room Room of the message |
81 | * @param tunnel Receiving/sending connection (may be NULL) | 82 | * @param[in/out] session Member session |
82 | * @param message KEY-Message | 83 | * @param[in] message KEY-Message |
83 | * @param hash Hash of the message | 84 | * @param[in] hash Hash of the message |
84 | */ | 85 | */ |
85 | void | 86 | void |
86 | handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 87 | handle_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
87 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 88 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
88 | 89 | ||
89 | /** | 90 | /** |
90 | * Handles a received or sent peer message to make changes of the basement in the room. | 91 | * Handles a received or sent peer message to make changes of the basement in the room. |
91 | * (add a new peer to the basement and restructure connections based on updated list of peers) | 92 | * (add a new peer to the basement and restructure connections based on updated list of peers) |
92 | * | 93 | * |
93 | * @param room Room of the message | 94 | * @param[in/out] room Room of the message |
94 | * @param tunnel Receiving/sending connection (may be NULL) | 95 | * @param[in/out] session Member session |
95 | * @param message PEER-Message | 96 | * @param[in] message PEER-Message |
96 | * @param hash Hash of the message | 97 | * @param[in] hash Hash of the message |
97 | */ | 98 | */ |
98 | void | 99 | void |
99 | handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 100 | handle_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
100 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 101 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
101 | 102 | ||
102 | /** | 103 | /** |
103 | * Handles a received or sent id message to change a members id. | 104 | * Handles a received or sent id message to change a members id. |
104 | * (change id of matching member) | 105 | * (change id of matching member) |
105 | * | 106 | * |
106 | * @param room Room of the message | 107 | * @param[in/out] room Room of the message |
107 | * @param tunnel Receiving/sending connection (may be NULL) | 108 | * @param[in/out] session Member session |
108 | * @param message ID-Message | 109 | * @param[in] message ID-Message |
109 | * @param hash Hash of the message | 110 | * @param[in] hash Hash of the message |
110 | */ | 111 | */ |
111 | void | 112 | void |
112 | handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 113 | handle_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
113 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 114 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
114 | 115 | ||
115 | /** | 116 | /** |
116 | * Handles a received or sent miss message to drop a peer from the basement in the room. | 117 | * Handles a received or sent miss message to drop a peer from the basement in the room. |
117 | * (remove a peer from the basement and restructure connections based on updated list of peers) | 118 | * (remove a peer from the basement and restructure connections based on updated list of peers) |
118 | * | 119 | * |
119 | * @param room Room of the message | 120 | * @param[in/out] room Room of the message |
120 | * @param tunnel Receiving/sending connection (may be NULL) | 121 | * @param[in/out] session Member session |
121 | * @param message MISS-Message | 122 | * @param[in] message MISS-Message |
122 | * @param hash Hash of the message | 123 | * @param[in] hash Hash of the message |
123 | */ | 124 | */ |
124 | void | 125 | void |
125 | handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 126 | handle_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
126 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 127 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
128 | |||
129 | /** | ||
130 | * Handles a received or sent delete message to delete a specific message from the store. | ||
131 | * (remove a message from the store of a room under a given delay) | ||
132 | * | ||
133 | * @param[in/out] room Room of the message | ||
134 | * @param[in/out] session Member session | ||
135 | * @param[in] message DELETE-Message | ||
136 | * @param[in] hash Hash of the message | ||
137 | */ | ||
138 | void | ||
139 | handle_message_delete (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | ||
140 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
127 | 141 | ||
128 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H | 142 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_HANDLE_H |
diff --git a/src/messenger/gnunet-service-messenger_message_kind.c b/src/messenger/gnunet-service-messenger_message_kind.c index 9c829fe09..ef9bbfd2e 100644 --- a/src/messenger/gnunet-service-messenger_message_kind.c +++ b/src/messenger/gnunet-service-messenger_message_kind.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -24,11 +24,15 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "gnunet-service-messenger_message_kind.h" | 26 | #include "gnunet-service-messenger_message_kind.h" |
27 | #include "gnunet-service-messenger_util.h" | 27 | |
28 | #include "messenger_api_util.h" | ||
28 | 29 | ||
29 | struct GNUNET_MESSENGER_Message* | 30 | struct GNUNET_MESSENGER_Message* |
30 | create_message_info (struct GNUNET_MESSENGER_Ego *ego, struct GNUNET_CONTAINER_MultiShortmap *members) | 31 | create_message_info (const struct GNUNET_MESSENGER_Ego *ego) |
31 | { | 32 | { |
33 | if (!ego) | ||
34 | return NULL; | ||
35 | |||
32 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_INFO); | 36 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_INFO); |
33 | 37 | ||
34 | if (!message) | 38 | if (!message) |
@@ -36,18 +40,17 @@ create_message_info (struct GNUNET_MESSENGER_Ego *ego, struct GNUNET_CONTAINER_M | |||
36 | 40 | ||
37 | GNUNET_memcpy(&(message->body.info.host_key), &(ego->pub), sizeof(ego->pub)); | 41 | GNUNET_memcpy(&(message->body.info.host_key), &(ego->pub), sizeof(ego->pub)); |
38 | 42 | ||
39 | if (GNUNET_YES == generate_free_member_id (&(message->body.info.unique_id), members)) | 43 | message->body.info.messenger_version = GNUNET_MESSENGER_VERSION; |
40 | return message; | 44 | |
41 | else | 45 | return message; |
42 | { | ||
43 | destroy_message (message); | ||
44 | return NULL; | ||
45 | } | ||
46 | } | 46 | } |
47 | 47 | ||
48 | struct GNUNET_MESSENGER_Message* | 48 | struct GNUNET_MESSENGER_Message* |
49 | create_message_join (struct GNUNET_MESSENGER_Ego *ego) | 49 | create_message_join (const struct GNUNET_MESSENGER_Ego *ego) |
50 | { | 50 | { |
51 | if (!ego) | ||
52 | return NULL; | ||
53 | |||
51 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_JOIN); | 54 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_JOIN); |
52 | 55 | ||
53 | if (!message) | 56 | if (!message) |
@@ -67,6 +70,9 @@ create_message_leave () | |||
67 | struct GNUNET_MESSENGER_Message* | 70 | struct GNUNET_MESSENGER_Message* |
68 | create_message_name (const char *name) | 71 | create_message_name (const char *name) |
69 | { | 72 | { |
73 | if (!name) | ||
74 | return NULL; | ||
75 | |||
70 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_NAME); | 76 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_NAME); |
71 | 77 | ||
72 | if (!message) | 78 | if (!message) |
@@ -79,6 +85,9 @@ create_message_name (const char *name) | |||
79 | struct GNUNET_MESSENGER_Message* | 85 | struct GNUNET_MESSENGER_Message* |
80 | create_message_key (const struct GNUNET_IDENTITY_PrivateKey *key) | 86 | create_message_key (const struct GNUNET_IDENTITY_PrivateKey *key) |
81 | { | 87 | { |
88 | if (!key) | ||
89 | return NULL; | ||
90 | |||
82 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_KEY); | 91 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_KEY); |
83 | 92 | ||
84 | if (!message) | 93 | if (!message) |
@@ -91,6 +100,9 @@ create_message_key (const struct GNUNET_IDENTITY_PrivateKey *key) | |||
91 | struct GNUNET_MESSENGER_Message* | 100 | struct GNUNET_MESSENGER_Message* |
92 | create_message_peer (const struct GNUNET_MESSENGER_Service *service) | 101 | create_message_peer (const struct GNUNET_MESSENGER_Service *service) |
93 | { | 102 | { |
103 | if (!service) | ||
104 | return NULL; | ||
105 | |||
94 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_PEER); | 106 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_PEER); |
95 | 107 | ||
96 | if (!message) | 108 | if (!message) |
@@ -108,6 +120,9 @@ create_message_peer (const struct GNUNET_MESSENGER_Service *service) | |||
108 | struct GNUNET_MESSENGER_Message* | 120 | struct GNUNET_MESSENGER_Message* |
109 | create_message_id (const struct GNUNET_ShortHashCode *unique_id) | 121 | create_message_id (const struct GNUNET_ShortHashCode *unique_id) |
110 | { | 122 | { |
123 | if (!unique_id) | ||
124 | return NULL; | ||
125 | |||
111 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_ID); | 126 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_ID); |
112 | 127 | ||
113 | if (!message) | 128 | if (!message) |
@@ -121,6 +136,9 @@ create_message_id (const struct GNUNET_ShortHashCode *unique_id) | |||
121 | struct GNUNET_MESSENGER_Message* | 136 | struct GNUNET_MESSENGER_Message* |
122 | create_message_miss (const struct GNUNET_PeerIdentity *peer) | 137 | create_message_miss (const struct GNUNET_PeerIdentity *peer) |
123 | { | 138 | { |
139 | if (!peer) | ||
140 | return NULL; | ||
141 | |||
124 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_MISS); | 142 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_MISS); |
125 | 143 | ||
126 | if (!message) | 144 | if (!message) |
@@ -136,6 +154,9 @@ create_message_miss (const struct GNUNET_PeerIdentity *peer) | |||
136 | struct GNUNET_MESSENGER_Message* | 154 | struct GNUNET_MESSENGER_Message* |
137 | create_message_merge (const struct GNUNET_HashCode *previous) | 155 | create_message_merge (const struct GNUNET_HashCode *previous) |
138 | { | 156 | { |
157 | if (!previous) | ||
158 | return NULL; | ||
159 | |||
139 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_MERGE); | 160 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_MERGE); |
140 | 161 | ||
141 | if (!message) | 162 | if (!message) |
@@ -149,6 +170,9 @@ create_message_merge (const struct GNUNET_HashCode *previous) | |||
149 | struct GNUNET_MESSENGER_Message* | 170 | struct GNUNET_MESSENGER_Message* |
150 | create_message_request (const struct GNUNET_HashCode *hash) | 171 | create_message_request (const struct GNUNET_HashCode *hash) |
151 | { | 172 | { |
173 | if (!hash) | ||
174 | return NULL; | ||
175 | |||
152 | struct GNUNET_HashCode zero; | 176 | struct GNUNET_HashCode zero; |
153 | memset (&zero, 0, sizeof(zero)); | 177 | memset (&zero, 0, sizeof(zero)); |
154 | 178 | ||
@@ -168,6 +192,9 @@ create_message_request (const struct GNUNET_HashCode *hash) | |||
168 | struct GNUNET_MESSENGER_Message* | 192 | struct GNUNET_MESSENGER_Message* |
169 | create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) | 193 | create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) |
170 | { | 194 | { |
195 | if ((!door) || (!key)) | ||
196 | return NULL; | ||
197 | |||
171 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_INVITE); | 198 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_INVITE); |
172 | 199 | ||
173 | if (!message) | 200 | if (!message) |
@@ -182,6 +209,9 @@ create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUN | |||
182 | struct GNUNET_MESSENGER_Message* | 209 | struct GNUNET_MESSENGER_Message* |
183 | create_message_text (const char *text) | 210 | create_message_text (const char *text) |
184 | { | 211 | { |
212 | if (!text) | ||
213 | return NULL; | ||
214 | |||
185 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_TEXT); | 215 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_TEXT); |
186 | 216 | ||
187 | if (!message) | 217 | if (!message) |
@@ -190,3 +220,20 @@ create_message_text (const char *text) | |||
190 | message->body.text.text = GNUNET_strdup(text); | 220 | message->body.text.text = GNUNET_strdup(text); |
191 | return message; | 221 | return message; |
192 | } | 222 | } |
223 | |||
224 | struct GNUNET_MESSENGER_Message* | ||
225 | create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) | ||
226 | { | ||
227 | if (!hash) | ||
228 | return NULL; | ||
229 | |||
230 | struct GNUNET_MESSENGER_Message *message = create_message (GNUNET_MESSENGER_KIND_DELETE); | ||
231 | |||
232 | if (!message) | ||
233 | return NULL; | ||
234 | |||
235 | GNUNET_memcpy(&(message->body.delete.hash), hash, sizeof(struct GNUNET_HashCode)); | ||
236 | message->body.delete.delay = GNUNET_TIME_relative_hton (delay); | ||
237 | |||
238 | return message; | ||
239 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_message_kind.h b/src/messenger/gnunet-service-messenger_message_kind.h index dd89d0b2f..c098868c0 100644 --- a/src/messenger/gnunet-service-messenger_message_kind.h +++ b/src/messenger/gnunet-service-messenger_message_kind.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -30,31 +30,32 @@ | |||
30 | #include "gnunet_container_lib.h" | 30 | #include "gnunet_container_lib.h" |
31 | #include "gnunet_crypto_lib.h" | 31 | #include "gnunet_crypto_lib.h" |
32 | #include "gnunet_identity_service.h" | 32 | #include "gnunet_identity_service.h" |
33 | #include "gnunet_time_lib.h" | ||
33 | 34 | ||
34 | #include "messenger_api_message.h" | 35 | #include "messenger_api_message.h" |
35 | #include "gnunet-service-messenger_service.h" | 36 | #include "gnunet-service-messenger_service.h" |
36 | #include "messenger_api_ego.h" | 37 | #include "messenger_api_ego.h" |
37 | 38 | ||
38 | /** | 39 | /** |
39 | * Creates and allocates a new info message containing the hosts public key and a newly generated unique member id. | 40 | * Creates and allocates a new info message containing the hosts EGO public key and a newly generated unique member id. |
40 | * (all values are stored as copy) | 41 | * (all values are stored as copy) |
41 | * | 42 | * |
42 | * @param ego EGO of the host | 43 | * @param[in] ego EGO of the host |
43 | * @param members Map of all assigned member ids | 44 | * @param[in] members Map of all assigned member ids |
44 | * @return New message | 45 | * @return New message |
45 | */ | 46 | */ |
46 | struct GNUNET_MESSENGER_Message* | 47 | struct GNUNET_MESSENGER_Message* |
47 | create_message_info (struct GNUNET_MESSENGER_Ego *ego, struct GNUNET_CONTAINER_MultiShortmap *members); | 48 | create_message_info (const struct GNUNET_MESSENGER_Ego *ego); |
48 | 49 | ||
49 | /** | 50 | /** |
50 | * Creates and allocates a new join message containing the clients public key. | 51 | * Creates and allocates a new join message containing the clients EGO public key. |
51 | * (all values are stored as copy) | 52 | * (all values are stored as copy) |
52 | * | 53 | * |
53 | * @param ego EGO of the client | 54 | * @param[in] ego EGO of the client |
54 | * @return New message | 55 | * @return New message |
55 | */ | 56 | */ |
56 | struct GNUNET_MESSENGER_Message* | 57 | struct GNUNET_MESSENGER_Message* |
57 | create_message_join (struct GNUNET_MESSENGER_Ego *ego); | 58 | create_message_join (const struct GNUNET_MESSENGER_Ego *ego); |
58 | 59 | ||
59 | /** | 60 | /** |
60 | * Creates and allocates a new leave message. | 61 | * Creates and allocates a new leave message. |
@@ -68,17 +69,17 @@ create_message_leave (); | |||
68 | * Creates and allocates a new name message containing the <i>name</i> to change to. | 69 | * Creates and allocates a new name message containing the <i>name</i> to change to. |
69 | * (all values are stored as copy) | 70 | * (all values are stored as copy) |
70 | * | 71 | * |
71 | * @param name New name | 72 | * @param[in] name New name |
72 | * @return New message | 73 | * @return New message |
73 | */ | 74 | */ |
74 | struct GNUNET_MESSENGER_Message* | 75 | struct GNUNET_MESSENGER_Message* |
75 | create_message_name (const char *name); | 76 | create_message_name (const char *name); |
76 | 77 | ||
77 | /** | 78 | /** |
78 | * Creates and allocates a new key message containing the public key to change to derived | 79 | * Creates and allocates a new key message containing the public <i>key</i> to change to derived |
79 | * from its private counterpart. (all values are stored as copy) | 80 | * from its private counterpart. (all values are stored as copy) |
80 | * | 81 | * |
81 | * @param key Private key of EGO | 82 | * @param[in] key Private key of EGO |
82 | * @return New message | 83 | * @return New message |
83 | */ | 84 | */ |
84 | struct GNUNET_MESSENGER_Message* | 85 | struct GNUNET_MESSENGER_Message* |
@@ -88,7 +89,7 @@ create_message_key (const struct GNUNET_IDENTITY_PrivateKey *key); | |||
88 | * Creates and allocates a new peer message containing a services peer identity. | 89 | * Creates and allocates a new peer message containing a services peer identity. |
89 | * (all values are stored as copy) | 90 | * (all values are stored as copy) |
90 | * | 91 | * |
91 | * @param service Service | 92 | * @param[in] service Service |
92 | * @return New message | 93 | * @return New message |
93 | */ | 94 | */ |
94 | struct GNUNET_MESSENGER_Message* | 95 | struct GNUNET_MESSENGER_Message* |
@@ -98,38 +99,38 @@ create_message_peer (const struct GNUNET_MESSENGER_Service *service); | |||
98 | * Creates and allocates a new id message containing the unique member id to change to. | 99 | * Creates and allocates a new id message containing the unique member id to change to. |
99 | * (all values are stored as copy) | 100 | * (all values are stored as copy) |
100 | * | 101 | * |
101 | * @param unique_id Unique member id | 102 | * @param[in] unique_id Unique member id |
102 | * @return New message | 103 | * @return New message |
103 | */ | 104 | */ |
104 | struct GNUNET_MESSENGER_Message* | 105 | struct GNUNET_MESSENGER_Message* |
105 | create_message_id (const struct GNUNET_ShortHashCode *unique_id); | 106 | create_message_id (const struct GNUNET_ShortHashCode *unique_id); |
106 | 107 | ||
107 | /** | 108 | /** |
108 | * Creates and allocates a new miss message containing the missing peer identity. | 109 | * Creates and allocates a new miss message containing the missing <i>peer</i> identity. |
109 | * (all values are stored as copy) | 110 | * (all values are stored as copy) |
110 | * | 111 | * |
111 | * @param peer Missing peer identity | 112 | * @param[in] peer Missing peer identity |
112 | * @return New message | 113 | * @return New message |
113 | */ | 114 | */ |
114 | struct GNUNET_MESSENGER_Message* | 115 | struct GNUNET_MESSENGER_Message* |
115 | create_message_miss (const struct GNUNET_PeerIdentity *peer); | 116 | create_message_miss (const struct GNUNET_PeerIdentity *peer); |
116 | 117 | ||
117 | /** | 118 | /** |
118 | * Creates and allocates a new merge message containing the hash of a second previous message | 119 | * Creates and allocates a new merge message containing the hash of a second <i>previous</i> message |
119 | * besides the regular previous message mentioned in a messages header. | 120 | * besides the regular previous message mentioned in a messages header. |
120 | * (all values are stored as copy) | 121 | * (all values are stored as copy) |
121 | * | 122 | * |
122 | * @param previous Hash of message | 123 | * @param[in] previous Hash of message |
123 | * @return New message | 124 | * @return New message |
124 | */ | 125 | */ |
125 | struct GNUNET_MESSENGER_Message* | 126 | struct GNUNET_MESSENGER_Message* |
126 | create_message_merge (const struct GNUNET_HashCode *previous); | 127 | create_message_merge (const struct GNUNET_HashCode *previous); |
127 | 128 | ||
128 | /** | 129 | /** |
129 | * Creates and allocates a new request message containing the hash of a missing message. | 130 | * Creates and allocates a new request message containing the <i>hash</i> of a missing message. |
130 | * (all values are stored as copy) | 131 | * (all values are stored as copy) |
131 | * | 132 | * |
132 | * @param hash Hash of message | 133 | * @param[in] hash Hash of message |
133 | * @return New message | 134 | * @return New message |
134 | */ | 135 | */ |
135 | struct GNUNET_MESSENGER_Message* | 136 | struct GNUNET_MESSENGER_Message* |
@@ -140,21 +141,32 @@ create_message_request (const struct GNUNET_HashCode *hash); | |||
140 | * to a room using a given <i>key</i> as shared secret for communication. | 141 | * to a room using a given <i>key</i> as shared secret for communication. |
141 | * (all values are stored as copy) | 142 | * (all values are stored as copy) |
142 | * | 143 | * |
143 | * @param door Peer identity | 144 | * @param[in] door Peer identity |
144 | * @param key Shared secret of a room | 145 | * @param[in] key Shared secret of a room |
145 | * @return New message | 146 | * @return New message |
146 | */ | 147 | */ |
147 | struct GNUNET_MESSENGER_Message* | 148 | struct GNUNET_MESSENGER_Message* |
148 | create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); | 149 | create_message_invite (const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key); |
149 | 150 | ||
150 | /** | 151 | /** |
151 | * Creates and allocates a new text message containing a string representing text. | 152 | * Creates and allocates a new <i>text message containing a string representing text. |
152 | * (all values are stored as copy) | 153 | * (all values are stored as copy) |
153 | * | 154 | * |
154 | * @param text Text | 155 | * @param[in] text Text |
155 | * @return New message | 156 | * @return New message |
156 | */ | 157 | */ |
157 | struct GNUNET_MESSENGER_Message* | 158 | struct GNUNET_MESSENGER_Message* |
158 | create_message_text (const char *text); | 159 | create_message_text (const char *text); |
159 | 160 | ||
161 | /** | ||
162 | * Creates and allocates a new delete message containing the <i>hash</i> of a message to delete after a specific <i>delay</i>. | ||
163 | * (all values are stored as copy) | ||
164 | * | ||
165 | * @param[in] hash Hash of message | ||
166 | * @param[in] delay Delay of deletion | ||
167 | * @return New message | ||
168 | */ | ||
169 | struct GNUNET_MESSENGER_Message* | ||
170 | create_message_delete (const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay); | ||
171 | |||
160 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H | 172 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_KIND_H |
diff --git a/src/messenger/gnunet-service-messenger_message_recv.c b/src/messenger/gnunet-service-messenger_message_recv.c index aa28a36ea..b2a5052d2 100644 --- a/src/messenger/gnunet-service-messenger_message_recv.c +++ b/src/messenger/gnunet-service-messenger_message_recv.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -24,137 +24,92 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "gnunet-service-messenger_message_recv.h" | 26 | #include "gnunet-service-messenger_message_recv.h" |
27 | #include "gnunet-service-messenger_message_handle.h" | ||
28 | 27 | ||
29 | void | 28 | #include "gnunet-service-messenger_operation.h" |
30 | recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | ||
31 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
32 | { | ||
33 | int conflict = GNUNET_CONTAINER_multishortmap_contains (room->members, &(message->body.info.unique_id)); | ||
34 | |||
35 | if (GNUNET_NO == conflict) | ||
36 | { | ||
37 | struct GNUNET_MESSENGER_Message *sync_message = create_message_id (&(message->body.info.unique_id)); | ||
38 | struct GNUNET_HashCode sync_hash; | ||
39 | 29 | ||
40 | send_room_message_ext (room, room->host, sync_message, &sync_hash, tunnel); | 30 | static void |
41 | destroy_message (sync_message); | 31 | forward_about_members (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
42 | 32 | struct GNUNET_MESSENGER_MemberSession *session, struct GNUNET_CONTAINER_MultiHashMap *map) | |
43 | switch_room_member_id (room, get_room_host_id (room), &(message->body.info.unique_id), NULL); | 33 | { |
44 | 34 | if (session->prev) | |
45 | change_room_host_id (room, &(message->body.info.unique_id)); | 35 | forward_about_members (room, tunnel, session->prev, map); |
46 | } | ||
47 | |||
48 | if (!tunnel->contact_id) | ||
49 | tunnel->contact_id = GNUNET_new(struct GNUNET_ShortHashCode); | ||
50 | |||
51 | GNUNET_memcpy(tunnel->contact_id, &(message->header.sender_id), sizeof(struct GNUNET_ShortHashCode)); | ||
52 | |||
53 | struct GNUNET_ShortHashCode original_id; | ||
54 | |||
55 | if (GNUNET_YES == conflict) | ||
56 | { | ||
57 | GNUNET_memcpy(&original_id, get_room_host_id (room), sizeof(struct GNUNET_ShortHashCode)); | ||
58 | 36 | ||
59 | change_room_host_id (room, &(message->body.info.unique_id)); | 37 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); |
60 | } | 38 | struct GNUNET_MESSENGER_ListMessage *element; |
61 | 39 | ||
40 | for (element = session->messages.head; element; element = element->next) | ||
62 | { | 41 | { |
63 | struct GNUNET_MESSENGER_Message *join_message = create_message_join (room->host->ego); | 42 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(map, &(element->hash))) |
64 | struct GNUNET_HashCode join_hash; | 43 | continue; |
65 | 44 | ||
66 | send_tunnel_message (tunnel, room->host, join_message, &join_hash); | 45 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(map, &(element->hash), NULL, |
67 | destroy_message (join_message); | 46 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
68 | } | 47 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Forwarding of session message could be duplicated!\n"); |
69 | 48 | ||
70 | if ((GNUNET_YES == conflict) && (0 != GNUNET_memcmp(&original_id, get_room_host_id (room)))) | 49 | const struct GNUNET_MESSENGER_Message *message = get_store_message(message_store, &(element->hash)); |
71 | { | ||
72 | struct GNUNET_MESSENGER_Message *sync_message = create_message_id (&original_id); | ||
73 | struct GNUNET_HashCode sync_hash; | ||
74 | 50 | ||
75 | send_tunnel_message (tunnel, room->host, sync_message, &sync_hash); | 51 | if (message) |
76 | destroy_message (sync_message); | 52 | forward_tunnel_message(tunnel, message, &(element->hash)); |
77 | } | 53 | } |
78 | } | 54 | } |
79 | 55 | ||
80 | struct GNUNET_MESSENGER_MemberInfoSpread | ||
81 | { | ||
82 | struct GNUNET_MESSENGER_SrvRoom *room; | ||
83 | struct GNUNET_MESSENGER_SrvTunnel *tunnel; | ||
84 | }; | ||
85 | |||
86 | static int | 56 | static int |
87 | iterate_send_member_infos (void *cls, const struct GNUNET_ShortHashCode *key, void *value) | 57 | iterate_forward_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, |
58 | struct GNUNET_MESSENGER_MemberSession *session) | ||
88 | { | 59 | { |
89 | struct GNUNET_MESSENGER_MemberInfo *info = value; | 60 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; |
90 | struct GNUNET_MESSENGER_MemberInfoSpread *spread = cls; | ||
91 | 61 | ||
92 | struct GNUNET_MESSENGER_ListMessage *element = info->session_messages.head; | 62 | if (GNUNET_YES == is_member_session_completed(session)) |
63 | return GNUNET_YES; | ||
93 | 64 | ||
94 | while (element) | 65 | struct GNUNET_CONTAINER_MultiHashMap *map = GNUNET_CONTAINER_multihashmap_create(4, GNUNET_NO); |
95 | { | ||
96 | const struct GNUNET_MESSENGER_Message *message = get_room_message (spread->room, spread->room->host, | ||
97 | &(element->hash), GNUNET_NO); | ||
98 | 66 | ||
99 | if (message) | 67 | forward_about_members (tunnel->room, tunnel, session, map); |
100 | forward_tunnel_message (spread->tunnel, message, &(element->hash)); | ||
101 | |||
102 | element = element->next; | ||
103 | } | ||
104 | 68 | ||
69 | GNUNET_CONTAINER_multihashmap_destroy(map); | ||
105 | return GNUNET_YES; | 70 | return GNUNET_YES; |
106 | } | 71 | } |
107 | 72 | ||
108 | void | 73 | int |
109 | recv_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 74 | recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
110 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 75 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
111 | { | 76 | { |
112 | const struct GNUNET_MESSENGER_Message *info_msg = get_room_message (room, room->host, &(message->header.previous), | 77 | const uint32_t version = get_tunnel_messenger_version(tunnel); |
113 | GNUNET_NO); | ||
114 | 78 | ||
115 | if ((info_msg) && (0 == GNUNET_memcmp(&(info_msg->header.sender_id), get_room_host_id (room))) | 79 | if (GNUNET_OK != update_tunnel_messenger_version(tunnel, message->body.info.messenger_version)) |
116 | && (GNUNET_MESSENGER_KIND_INFO == info_msg->header.kind)) | ||
117 | { | 80 | { |
118 | struct GNUNET_MESSENGER_MemberInfoSpread spread; | 81 | disconnect_tunnel(tunnel); |
82 | return GNUNET_NO; | ||
83 | } | ||
119 | 84 | ||
120 | spread.room = room; | 85 | if (version == get_tunnel_messenger_version(tunnel)) |
86 | return GNUNET_NO; | ||
121 | 87 | ||
122 | if ((tunnel) && (tunnel->contact_id) && (0 == GNUNET_memcmp(tunnel->contact_id, &(message->header.sender_id)))) | 88 | if (room->host) |
123 | spread.tunnel = tunnel; | 89 | { |
124 | else | 90 | const struct GNUNET_MESSENGER_Ego *ego = get_handle_ego(room->host); |
125 | spread.tunnel = find_room_tunnel_to (room, &(message->header.sender_id)); | ||
126 | 91 | ||
127 | if (spread.tunnel) | 92 | send_tunnel_message (tunnel, room->host, create_message_info(ego)); |
128 | GNUNET_CONTAINER_multishortmap_iterate (room->member_infos, iterate_send_member_infos, &spread); | ||
129 | } | 93 | } |
130 | 94 | ||
131 | handle_message_join (room, tunnel, message, hash); | 95 | struct GNUNET_PeerIdentity peer; |
132 | } | 96 | get_tunnel_peer_identity(tunnel, &peer); |
133 | 97 | ||
134 | void | 98 | if (GNUNET_YES != contains_list_tunnels(&(room->basement), &peer)) |
135 | recv_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 99 | { |
136 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 100 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); |
137 | { | ||
138 | handle_message_leave (room, tunnel, message, hash); | ||
139 | } | ||
140 | 101 | ||
141 | void | 102 | iterate_store_members(member_store, iterate_forward_members, tunnel); |
142 | recv_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 103 | } |
143 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
144 | { | ||
145 | handle_message_name (room, tunnel, message, hash); | ||
146 | } | ||
147 | 104 | ||
148 | void | 105 | check_room_peer_status(room, tunnel); |
149 | recv_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 106 | |
150 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 107 | return GNUNET_NO; |
151 | { | ||
152 | handle_message_key (room, tunnel, message, hash); | ||
153 | } | 108 | } |
154 | 109 | ||
155 | void | 110 | int |
156 | recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 111 | recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
157 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 112 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
158 | { | 113 | { |
159 | struct GNUNET_PeerIdentity peer; | 114 | struct GNUNET_PeerIdentity peer; |
160 | GNUNET_PEER_resolve (tunnel->peer, &peer); | 115 | GNUNET_PEER_resolve (tunnel->peer, &peer); |
@@ -164,41 +119,57 @@ recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE | |||
164 | if (!tunnel->peer_message) | 119 | if (!tunnel->peer_message) |
165 | tunnel->peer_message = GNUNET_new(struct GNUNET_HashCode); | 120 | tunnel->peer_message = GNUNET_new(struct GNUNET_HashCode); |
166 | 121 | ||
167 | GNUNET_memcpy(tunnel->peer_message, hash, sizeof(struct GNUNET_HashCode)); | 122 | GNUNET_memcpy(tunnel->peer_message, &hash, sizeof(hash)); |
168 | |||
169 | if (!tunnel->contact_id) | ||
170 | tunnel->contact_id = GNUNET_new(struct GNUNET_ShortHashCode); | ||
171 | |||
172 | GNUNET_memcpy(tunnel->contact_id, &(message->header.sender_id), sizeof(struct GNUNET_ShortHashCode)); | ||
173 | } | 123 | } |
174 | 124 | ||
175 | handle_message_peer (room, tunnel, message, hash); | 125 | return GNUNET_YES; |
176 | } | 126 | } |
177 | 127 | ||
178 | void | 128 | static void |
179 | recv_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 129 | callback_found_message (void *cls, struct GNUNET_MESSENGER_SrvRoom *room, |
180 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 130 | const struct GNUNET_MESSENGER_Message *message, |
131 | const struct GNUNET_HashCode *hash) | ||
181 | { | 132 | { |
182 | if ((tunnel->contact_id) && (0 == GNUNET_memcmp(tunnel->contact_id, &(message->header.sender_id)))) | 133 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = tunnel; |
183 | GNUNET_memcpy(tunnel->contact_id, &(message->body.id.id), sizeof(struct GNUNET_ShortHashCode)); | ||
184 | 134 | ||
185 | handle_message_id (room, tunnel, message, hash); | 135 | if (!message) |
186 | } | 136 | { |
187 | 137 | struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room); | |
188 | void | 138 | |
189 | recv_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 139 | use_store_operation( |
190 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 140 | operation_store, |
191 | { | 141 | hash, |
192 | handle_message_miss (room, tunnel, message, hash); | 142 | GNUNET_MESSENGER_OP_REQUEST, |
143 | GNUNET_MESSENGER_REQUEST_DELAY | ||
144 | ); | ||
145 | } | ||
146 | else | ||
147 | forward_tunnel_message (tunnel, message, hash); | ||
193 | } | 148 | } |
194 | 149 | ||
195 | void | 150 | /* |
151 | * Function returns GNUNET_NO to drop forwarding the request. | ||
152 | * It will only be forwarded if it can't be answered! | ||
153 | */ | ||
154 | int | ||
196 | recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 155 | recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
197 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 156 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
198 | { | 157 | { |
199 | const struct GNUNET_MESSENGER_Message *msg = get_room_message (room, room->host, &(message->body.request.hash), | 158 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); |
200 | GNUNET_NO); | 159 | struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); |
160 | |||
161 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Request for message (%s)\n", GNUNET_h2s (hash)); | ||
162 | |||
163 | if (!member) | ||
164 | return GNUNET_NO; | ||
165 | |||
166 | struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of(member, message, hash); | ||
167 | |||
168 | if ((!session) || (GNUNET_YES != check_member_session_history(session, hash, GNUNET_NO))) | ||
169 | return GNUNET_NO; | ||
170 | |||
171 | if (GNUNET_NO == request_room_message(room, &(message->body.request.hash), session, callback_found_message, tunnel)) | ||
172 | return GNUNET_YES; | ||
201 | 173 | ||
202 | if (msg) | 174 | return GNUNET_NO; |
203 | forward_tunnel_message (tunnel, msg, &(message->body.request.hash)); | ||
204 | } | 175 | } |
diff --git a/src/messenger/gnunet-service-messenger_message_recv.h b/src/messenger/gnunet-service-messenger_message_recv.h index 245612cb0..9cb36c466 100644 --- a/src/messenger/gnunet-service-messenger_message_recv.h +++ b/src/messenger/gnunet-service-messenger_message_recv.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -29,6 +29,9 @@ | |||
29 | #include "platform.h" | 29 | #include "platform.h" |
30 | #include "gnunet_crypto_lib.h" | 30 | #include "gnunet_crypto_lib.h" |
31 | 31 | ||
32 | #include "gnunet-service-messenger_message_kind.h" | ||
33 | |||
34 | #include "gnunet-service-messenger_member_session.h" | ||
32 | #include "gnunet-service-messenger_tunnel.h" | 35 | #include "gnunet-service-messenger_tunnel.h" |
33 | #include "messenger_api_message.h" | 36 | #include "messenger_api_message.h" |
34 | 37 | ||
@@ -36,124 +39,43 @@ | |||
36 | * Handles a received info message to change the current member id to the one generated by | 39 | * Handles a received info message to change the current member id to the one generated by |
37 | * the host connected to. (all current tunnels will be informed about the id change) | 40 | * the host connected to. (all current tunnels will be informed about the id change) |
38 | * | 41 | * |
39 | * @param room Room of the message | 42 | * @param[in/out] room Room of the message |
40 | * @param tunnel Receiving connection | 43 | * @param[in/out] tunnel Receiving connection |
41 | * @param message INFO-Message | 44 | * @param[in] message INFO-Message |
42 | * @param hash Hash of the message | 45 | * @param[in] hash Hash of the message |
46 | * @return #GNUNET_NO to not forward the message | ||
43 | */ | 47 | */ |
44 | void | 48 | int |
45 | recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 49 | recv_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
46 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 50 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
47 | |||
48 | /** | ||
49 | * Handles a received join message to forward all member information to the new member if the message was | ||
50 | * the direct reaction to a previous info message from this peer. | ||
51 | * | ||
52 | * @param room Room of the message | ||
53 | * @param tunnel Receiving connection | ||
54 | * @param message JOIN-Message | ||
55 | * @param hash Hash of the message | ||
56 | */ | ||
57 | void | ||
58 | recv_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | ||
59 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
60 | |||
61 | /** | ||
62 | * Handles a received leave message. | ||
63 | * @see handle_message_leave() | ||
64 | * | ||
65 | * @param room Room of the message | ||
66 | * @param tunnel Receiving connection | ||
67 | * @param message LEAVE-Message | ||
68 | * @param hash Hash of the message | ||
69 | */ | ||
70 | void | ||
71 | recv_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | ||
72 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
73 | |||
74 | /** | ||
75 | * Handles a received name message. | ||
76 | * @see handle_message_name() | ||
77 | * | ||
78 | * @param room Room of the message | ||
79 | * @param tunnel Receiving connection | ||
80 | * @param message NAME-Message | ||
81 | * @param hash Hash of the message | ||
82 | */ | ||
83 | void | ||
84 | recv_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | ||
85 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
86 | |||
87 | /** | ||
88 | * Handles a received key message. | ||
89 | * @see handle_message_key() | ||
90 | * | ||
91 | * @param room Room of the message | ||
92 | * @param tunnel Receiving connection | ||
93 | * @param message KEY-Message | ||
94 | * @param hash Hash of the message | ||
95 | */ | ||
96 | void | ||
97 | recv_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | ||
98 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
99 | 51 | ||
100 | /** | 52 | /** |
101 | * Handles a received peer message to link it to its origin tunnel if the peer identity matches. | 53 | * Handles a received peer message to link it to its origin tunnel if the peer identity matches. |
102 | * (the peer message and the member id can potentially be linked to the tunnel) | 54 | * (the peer message and the member id can potentially be linked to the tunnel) |
103 | * | 55 | * |
104 | * TODO: This handling will only check the one given tunnel! | 56 | * @param[in/out] room Room of the message |
105 | * | 57 | * @param[in/out] tunnel Receiving connection |
106 | * @param room Room of the message | 58 | * @param[in] message PEER-Message |
107 | * @param tunnel Receiving connection | 59 | * @param[in] hash Hash of the message |
108 | * @param message PEER-Message | 60 | * @return #GNUNET_YES to forward the message |
109 | * @param hash Hash of the message | ||
110 | */ | 61 | */ |
111 | void | 62 | int |
112 | recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 63 | recv_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
113 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 64 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
114 | |||
115 | /** | ||
116 | * Handles a received id message to change the tunnels linked member id if necessary. | ||
117 | * (the tunnels linked member id will be changed if the sender id is matching) | ||
118 | * | ||
119 | * TODO: This handling will only check the one given tunnel! | ||
120 | * | ||
121 | * @param room Room of the message | ||
122 | * @param tunnel Receiving connection | ||
123 | * @param message ID-Message | ||
124 | * @param hash Hash of the message | ||
125 | */ | ||
126 | void | ||
127 | recv_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | ||
128 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
129 | |||
130 | /** | ||
131 | * Handles a received miss message. | ||
132 | * @see handle_message_miss() | ||
133 | * | ||
134 | * @param room Room of the message | ||
135 | * @param tunnel Receiving connection | ||
136 | * @param message MISS-Message | ||
137 | * @param hash Hash of the message | ||
138 | */ | ||
139 | void | ||
140 | recv_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | ||
141 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
142 | 65 | ||
143 | /** | 66 | /** |
144 | * Handles a received request message by checking for the requested message and forwarding it back | 67 | * Handles a received request message by checking for the requested message and forwarding it back |
145 | * if the message was found. | 68 | * if the message was found. |
146 | * (this can also cause this peer to send a new request instead of only forwarding the received one) | 69 | * (this can also cause this peer to send a new request instead of only forwarding the received one) |
147 | * | 70 | * |
148 | * TODO: Requests can cause exponentially more requests! | 71 | * @param[in/out] room Room of the message |
149 | * | 72 | * @param[in/out] tunnel Receiving connection |
150 | * @param room Room of the message | 73 | * @param[in] message REQUEST-Message |
151 | * @param tunnel Receiving connection | 74 | * @param[in] hash Hash of the message |
152 | * @param message REQUEST-Message | 75 | * @return #GNUNET_YES or #GNUNET_NO depending on required forwarding |
153 | * @param hash Hash of the message | ||
154 | */ | 76 | */ |
155 | void | 77 | int |
156 | recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 78 | recv_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
157 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 79 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
158 | 80 | ||
159 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H | 81 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_RECV_H |
diff --git a/src/messenger/gnunet-service-messenger_message_send.c b/src/messenger/gnunet-service-messenger_message_send.c index 86cf9b888..a59a178cc 100644 --- a/src/messenger/gnunet-service-messenger_message_send.c +++ b/src/messenger/gnunet-service-messenger_message_send.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -24,95 +24,45 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "gnunet-service-messenger_message_send.h" | 26 | #include "gnunet-service-messenger_message_send.h" |
27 | #include "gnunet-service-messenger_message_handle.h" | ||
28 | 27 | ||
29 | void | 28 | #include "gnunet-service-messenger_member.h" |
30 | send_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 29 | #include "gnunet-service-messenger_member_session.h" |
31 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 30 | #include "gnunet-service-messenger_operation.h" |
32 | const struct GNUNET_HashCode *hash) | ||
33 | { | ||
34 | if (!tunnel->contact_id) | ||
35 | { | ||
36 | tunnel->contact_id = GNUNET_new(struct GNUNET_ShortHashCode); | ||
37 | |||
38 | GNUNET_memcpy(tunnel->contact_id, &(message->body.info.unique_id), sizeof(struct GNUNET_ShortHashCode)); | ||
39 | } | ||
40 | else | ||
41 | { | ||
42 | disconnect_tunnel (tunnel); | ||
43 | } | ||
44 | } | ||
45 | 31 | ||
46 | void | 32 | void |
47 | send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 33 | send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
48 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 34 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
49 | const struct GNUNET_HashCode *hash) | ||
50 | { | ||
51 | handle_message_join (room, tunnel, message, hash); | ||
52 | |||
53 | if (room->peer_message) | ||
54 | { | ||
55 | const struct GNUNET_MESSENGER_Message *peer_message = get_room_message (room, handle, room->peer_message, | ||
56 | GNUNET_NO); | ||
57 | |||
58 | if ((peer_message) && (tunnel)) | ||
59 | { | ||
60 | forward_tunnel_message (tunnel, peer_message, room->peer_message); | ||
61 | } | ||
62 | } | ||
63 | } | ||
64 | |||
65 | void | ||
66 | send_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
67 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | ||
68 | const struct GNUNET_HashCode *hash) | ||
69 | { | 35 | { |
70 | handle_message_leave (room, tunnel, message, hash); | 36 | check_room_peer_status(room, NULL); |
71 | } | ||
72 | |||
73 | void | ||
74 | send_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
75 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | ||
76 | const struct GNUNET_HashCode *hash) | ||
77 | { | ||
78 | handle_message_name (room, tunnel, message, hash); | ||
79 | } | ||
80 | |||
81 | void | ||
82 | send_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
83 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | ||
84 | const struct GNUNET_HashCode *hash) | ||
85 | { | ||
86 | handle_message_key (room, tunnel, message, hash); | ||
87 | } | 37 | } |
88 | 38 | ||
89 | void | 39 | void |
90 | send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 40 | send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
91 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 41 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
92 | const struct GNUNET_HashCode *hash) | ||
93 | { | 42 | { |
94 | if (!room->peer_message) | 43 | if (!room->peer_message) |
95 | { | ||
96 | room->peer_message = GNUNET_new(struct GNUNET_HashCode); | 44 | room->peer_message = GNUNET_new(struct GNUNET_HashCode); |
97 | } | ||
98 | 45 | ||
99 | GNUNET_memcpy(room->peer_message, hash, sizeof(struct GNUNET_HashCode)); | 46 | GNUNET_memcpy(room->peer_message, hash, sizeof(struct GNUNET_HashCode)); |
100 | |||
101 | handle_message_peer (room, tunnel, message, hash); | ||
102 | } | 47 | } |
103 | 48 | ||
104 | void | 49 | void |
105 | send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 50 | send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
106 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 51 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
107 | const struct GNUNET_HashCode *hash) | ||
108 | { | 52 | { |
109 | handle_message_id (room, tunnel, message, hash); | 53 | change_handle_member_id (handle, get_room_key(room), &(message->body.id.id)); |
110 | } | 54 | } |
111 | 55 | ||
112 | void | 56 | void |
113 | send_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 57 | send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
114 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 58 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
115 | const struct GNUNET_HashCode *hash) | ||
116 | { | 59 | { |
117 | handle_message_miss (room, tunnel, message, hash); | 60 | struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room); |
61 | |||
62 | use_store_operation( | ||
63 | operation_store, | ||
64 | &(message->body.request.hash), | ||
65 | GNUNET_MESSENGER_OP_REQUEST, | ||
66 | GNUNET_MESSENGER_REQUEST_DELAY | ||
67 | ); | ||
118 | } | 68 | } |
diff --git a/src/messenger/gnunet-service-messenger_message_send.h b/src/messenger/gnunet-service-messenger_message_send.h index c1096205a..63320ab17 100644 --- a/src/messenger/gnunet-service-messenger_message_send.h +++ b/src/messenger/gnunet-service-messenger_message_send.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -29,127 +29,61 @@ | |||
29 | #include "platform.h" | 29 | #include "platform.h" |
30 | #include "gnunet_crypto_lib.h" | 30 | #include "gnunet_crypto_lib.h" |
31 | 31 | ||
32 | #include "gnunet-service-messenger_message_kind.h" | ||
33 | |||
32 | #include "gnunet-service-messenger_tunnel.h" | 34 | #include "gnunet-service-messenger_tunnel.h" |
33 | #include "messenger_api_message.h" | 35 | #include "messenger_api_message.h" |
34 | 36 | ||
35 | /** | 37 | /** |
36 | * Handles a sent info message to setup a tunnels linked member id. | ||
37 | * (if a tunnel has already got a member id linked to it, the connection will be closed) | ||
38 | * | ||
39 | * @param room Room of the message | ||
40 | * @param handle Sending handle | ||
41 | * @param tunnel Sending connection (may be NULL) | ||
42 | * @param message INFO-Message | ||
43 | * @param hash Hash of the message | ||
44 | */ | ||
45 | void | ||
46 | send_message_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
47 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | ||
48 | const struct GNUNET_HashCode *hash); | ||
49 | |||
50 | /** | ||
51 | * Handles a sent join message to ensure growth of the decentralized room structure. | 38 | * Handles a sent join message to ensure growth of the decentralized room structure. |
52 | * (if the service provides a peer message for this room currently, it will be forwarded) | 39 | * (if the service provides a peer message for this room currently, it will be forwarded) |
53 | * | 40 | * |
54 | * @param room Room of the message | 41 | * @param[in/out] room Room of the message |
55 | * @param handle Sending handle | 42 | * @param[in/out] handle Sending handle |
56 | * @param tunnel Sending connection (may be NULL) | 43 | * @param[in] message JOIN-Message |
57 | * @param message JOIN-Message | 44 | * @param[in] hash Hash of the message |
58 | * @param hash Hash of the message | ||
59 | */ | 45 | */ |
60 | void | 46 | void |
61 | send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 47 | send_message_join (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
62 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 48 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
63 | const struct GNUNET_HashCode *hash); | ||
64 | |||
65 | /** | ||
66 | * Handles a sent leave message. | ||
67 | * @see handle_message_leave() | ||
68 | * | ||
69 | * @param room Room of the message | ||
70 | * @param handle Sending handle | ||
71 | * @param tunnel Sending connection (may be NULL) | ||
72 | * @param message LEAVE-Message | ||
73 | * @param hash Hash of the message | ||
74 | */ | ||
75 | void | ||
76 | send_message_leave (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
77 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | ||
78 | const struct GNUNET_HashCode *hash); | ||
79 | |||
80 | /** | ||
81 | * Handles a sent name message. | ||
82 | * @see handle_message_name() | ||
83 | * | ||
84 | * @param room Room of the message | ||
85 | * @param handle Sending handle | ||
86 | * @param tunnel Sending connection (may be NULL) | ||
87 | * @param message NAME-Message | ||
88 | * @param hash Hash of the message | ||
89 | */ | ||
90 | void | ||
91 | send_message_name (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
92 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | ||
93 | const struct GNUNET_HashCode *hash); | ||
94 | |||
95 | /** | ||
96 | * Handles a sent key message. | ||
97 | * @see handle_message_key() | ||
98 | * | ||
99 | * @param room Room of the message | ||
100 | * @param handle Sending handle | ||
101 | * @param tunnel Sending connection (may be NULL) | ||
102 | * @param message KEY-Message | ||
103 | * @param hash Hash of the message | ||
104 | */ | ||
105 | void | ||
106 | send_message_key (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
107 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | ||
108 | const struct GNUNET_HashCode *hash); | ||
109 | 49 | ||
110 | /** | 50 | /** |
111 | * Handles a sent peer message to update the rooms peer message of this service. | 51 | * Handles a sent peer message to update the rooms peer message of this service. |
112 | * (a set peer message indicates this service being a part of the decentralized room structure) | 52 | * (a set peer message indicates this service being a part of the decentralized room structure) |
113 | * | 53 | * |
114 | * @param room Room of the message | 54 | * @param[in/out] room Room of the message |
115 | * @param handle Sending handle | 55 | * @param[in/out] handle Sending handle |
116 | * @param tunnel Sending connection (may be NULL) | 56 | * @param[in] message PEER-Message |
117 | * @param message PEER-Message | 57 | * @param[in] hash Hash of the message |
118 | * @param hash Hash of the message | ||
119 | */ | 58 | */ |
120 | void | 59 | void |
121 | send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 60 | send_message_peer (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
122 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 61 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
123 | const struct GNUNET_HashCode *hash); | ||
124 | 62 | ||
125 | /** | 63 | /** |
126 | * Handles a sent id message. | 64 | * Handles a sent id message to update the handles member id in the room. |
127 | * @see handle_message_id() | 65 | * (changing member id is useful to prevent collisions) |
128 | * | 66 | * |
129 | * @param room Room of the message | 67 | * @param[in/out] room Room of the message |
130 | * @param handle Sending handle | 68 | * @param[in/out] handle Sending handle |
131 | * @param tunnel Sending connection (may be NULL) | 69 | * @param[in] message ID-Message |
132 | * @param message ID-Message | 70 | * @param[in] hash Hash of the message |
133 | * @param hash Hash of the message | ||
134 | */ | 71 | */ |
135 | void | 72 | void |
136 | send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 73 | send_message_id (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
137 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 74 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
138 | const struct GNUNET_HashCode *hash); | ||
139 | 75 | ||
140 | /** | 76 | /** |
141 | * Handles a sent miss message. | 77 | * Handles a sent request message to trigger the request operation for this service. |
142 | * @see handle_message_miss() | 78 | * (the request operation will deactivate the possibility of spamming requests) |
143 | * | 79 | * |
144 | * @param room Room of the message | 80 | * @param[in/out] room Room of the message |
145 | * @param handle Sending handle | 81 | * @param[in/out] handle Sending handle |
146 | * @param tunnel Sending connection (may be NULL) | 82 | * @param[in] message PEER-Message |
147 | * @param message MISS-Message | 83 | * @param[in] hash Hash of the message |
148 | * @param hash Hash of the message | ||
149 | */ | 84 | */ |
150 | void | 85 | void |
151 | send_message_miss (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 86 | send_message_request (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
152 | struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MESSENGER_Message *message, | 87 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
153 | const struct GNUNET_HashCode *hash); | ||
154 | 88 | ||
155 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_SEND_H | 89 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_SEND_H |
diff --git a/src/messenger/gnunet-service-messenger_message_state.c b/src/messenger/gnunet-service-messenger_message_state.c new file mode 100644 index 000000000..cdd2d9712 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_message_state.c | |||
@@ -0,0 +1,109 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_message_state.c | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "gnunet-service-messenger_message_state.h" | ||
27 | |||
28 | void | ||
29 | init_message_state (struct GNUNET_MESSENGER_MessageState *state) | ||
30 | { | ||
31 | GNUNET_assert(state); | ||
32 | |||
33 | init_list_messages (&(state->last_messages)); | ||
34 | } | ||
35 | |||
36 | void | ||
37 | clear_message_state (struct GNUNET_MESSENGER_MessageState *state) | ||
38 | { | ||
39 | GNUNET_assert(state); | ||
40 | |||
41 | clear_list_messages (&(state->last_messages)); | ||
42 | } | ||
43 | |||
44 | void | ||
45 | get_message_state_chain_hash (const struct GNUNET_MESSENGER_MessageState *state, | ||
46 | struct GNUNET_HashCode *hash) | ||
47 | { | ||
48 | GNUNET_assert((state) && (hash)); | ||
49 | |||
50 | if (state->last_messages.head) | ||
51 | GNUNET_memcpy(hash, &(state->last_messages.head->hash), sizeof(*hash)); | ||
52 | else | ||
53 | memset (hash, 0, sizeof(*hash)); | ||
54 | } | ||
55 | |||
56 | const struct GNUNET_HashCode* | ||
57 | get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state) | ||
58 | { | ||
59 | GNUNET_assert(state); | ||
60 | |||
61 | if (state->last_messages.head == state->last_messages.tail) | ||
62 | return NULL; | ||
63 | |||
64 | return &(state->last_messages.tail->hash); | ||
65 | } | ||
66 | |||
67 | void | ||
68 | update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested, | ||
69 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
70 | { | ||
71 | GNUNET_assert((state) && (message) && (hash)); | ||
72 | |||
73 | if ((GNUNET_YES == requested) || | ||
74 | (GNUNET_MESSENGER_KIND_INFO == message->header.kind) || | ||
75 | (GNUNET_MESSENGER_KIND_REQUEST == message->header.kind)) | ||
76 | return; | ||
77 | |||
78 | if (GNUNET_MESSENGER_KIND_MERGE == message->header.kind) | ||
79 | remove_from_list_messages(&(state->last_messages), &(message->body.merge.previous)); | ||
80 | remove_from_list_messages(&(state->last_messages), &(message->header.previous)); | ||
81 | |||
82 | add_to_list_messages (&(state->last_messages), hash); | ||
83 | } | ||
84 | |||
85 | void | ||
86 | load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path) | ||
87 | { | ||
88 | GNUNET_assert((state) && (path)); | ||
89 | |||
90 | char *last_messages_file; | ||
91 | GNUNET_asprintf (&last_messages_file, "%s%s", path, "last_messages.list"); | ||
92 | |||
93 | load_list_messages(&(state->last_messages), last_messages_file); | ||
94 | GNUNET_free(last_messages_file); | ||
95 | } | ||
96 | |||
97 | void | ||
98 | save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path) | ||
99 | { | ||
100 | GNUNET_assert((state) && (path)); | ||
101 | |||
102 | char *last_messages_file; | ||
103 | GNUNET_asprintf (&last_messages_file, "%s%s", path, "last_messages.list"); | ||
104 | |||
105 | save_list_messages(&(state->last_messages), last_messages_file); | ||
106 | GNUNET_free(last_messages_file); | ||
107 | } | ||
108 | |||
109 | |||
diff --git a/src/messenger/gnunet-service-messenger_message_state.h b/src/messenger/gnunet-service-messenger_message_state.h new file mode 100644 index 000000000..dc8671df4 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_message_state.h | |||
@@ -0,0 +1,63 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_message_state.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_MESSAGE_STATE_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_MESSAGE_STATE_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_crypto_lib.h" | ||
31 | |||
32 | #include "messenger_api_message.h" | ||
33 | #include "gnunet-service-messenger_list_messages.h" | ||
34 | |||
35 | struct GNUNET_MESSENGER_MessageState | ||
36 | { | ||
37 | struct GNUNET_MESSENGER_ListMessages last_messages; | ||
38 | }; | ||
39 | |||
40 | void | ||
41 | init_message_state (struct GNUNET_MESSENGER_MessageState *state); | ||
42 | |||
43 | void | ||
44 | clear_message_state (struct GNUNET_MESSENGER_MessageState *state); | ||
45 | |||
46 | void | ||
47 | get_message_state_chain_hash (const struct GNUNET_MESSENGER_MessageState *state, | ||
48 | struct GNUNET_HashCode *hash); | ||
49 | |||
50 | const struct GNUNET_HashCode* | ||
51 | get_message_state_merge_hash (const struct GNUNET_MESSENGER_MessageState *state); | ||
52 | |||
53 | void | ||
54 | update_message_state (struct GNUNET_MESSENGER_MessageState *state, int requested, | ||
55 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
56 | |||
57 | void | ||
58 | load_message_state (struct GNUNET_MESSENGER_MessageState *state, const char *path); | ||
59 | |||
60 | void | ||
61 | save_message_state (const struct GNUNET_MESSENGER_MessageState *state, const char *path); | ||
62 | |||
63 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STATE_H | ||
diff --git a/src/messenger/gnunet-service-messenger_message_store.c b/src/messenger/gnunet-service-messenger_message_store.c index 5933d6390..1984eba21 100644..100755 --- a/src/messenger/gnunet-service-messenger_message_store.c +++ b/src/messenger/gnunet-service-messenger_message_store.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -29,10 +29,16 @@ | |||
29 | void | 29 | void |
30 | init_message_store (struct GNUNET_MESSENGER_MessageStore *store) | 30 | init_message_store (struct GNUNET_MESSENGER_MessageStore *store) |
31 | { | 31 | { |
32 | GNUNET_assert(store); | ||
33 | |||
32 | store->storage_messages = NULL; | 34 | store->storage_messages = NULL; |
33 | 35 | ||
34 | store->entries = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 36 | store->entries = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); |
35 | store->messages = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 37 | store->messages = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); |
38 | store->links = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | ||
39 | |||
40 | store->rewrite_entries = GNUNET_NO; | ||
41 | store->write_links = GNUNET_NO; | ||
36 | } | 42 | } |
37 | 43 | ||
38 | static int | 44 | static int |
@@ -55,9 +61,21 @@ iterate_destroy_messages (void *cls, const struct GNUNET_HashCode *key, void *va | |||
55 | return GNUNET_YES; | 61 | return GNUNET_YES; |
56 | } | 62 | } |
57 | 63 | ||
64 | static int | ||
65 | iterate_destroy_links (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
66 | { | ||
67 | struct GNUNET_HashCode *previous = value; | ||
68 | |||
69 | GNUNET_free(previous); | ||
70 | |||
71 | return GNUNET_YES; | ||
72 | } | ||
73 | |||
58 | void | 74 | void |
59 | clear_message_store (struct GNUNET_MESSENGER_MessageStore *store) | 75 | clear_message_store (struct GNUNET_MESSENGER_MessageStore *store) |
60 | { | 76 | { |
77 | GNUNET_assert(store); | ||
78 | |||
61 | if (store->storage_messages) | 79 | if (store->storage_messages) |
62 | { | 80 | { |
63 | GNUNET_DISK_file_close (store->storage_messages); | 81 | GNUNET_DISK_file_close (store->storage_messages); |
@@ -67,9 +85,11 @@ clear_message_store (struct GNUNET_MESSENGER_MessageStore *store) | |||
67 | 85 | ||
68 | GNUNET_CONTAINER_multihashmap_iterate (store->entries, iterate_destroy_entries, NULL); | 86 | GNUNET_CONTAINER_multihashmap_iterate (store->entries, iterate_destroy_entries, NULL); |
69 | GNUNET_CONTAINER_multihashmap_iterate (store->messages, iterate_destroy_messages, NULL); | 87 | GNUNET_CONTAINER_multihashmap_iterate (store->messages, iterate_destroy_messages, NULL); |
88 | GNUNET_CONTAINER_multihashmap_iterate (store->links, iterate_destroy_links, NULL); | ||
70 | 89 | ||
71 | GNUNET_CONTAINER_multihashmap_destroy (store->entries); | 90 | GNUNET_CONTAINER_multihashmap_destroy (store->entries); |
72 | GNUNET_CONTAINER_multihashmap_destroy (store->messages); | 91 | GNUNET_CONTAINER_multihashmap_destroy (store->messages); |
92 | GNUNET_CONTAINER_multihashmap_destroy (store->links); | ||
73 | } | 93 | } |
74 | 94 | ||
75 | struct GNUNET_MESSENGER_MessageEntryStorage | 95 | struct GNUNET_MESSENGER_MessageEntryStorage |
@@ -78,36 +98,15 @@ struct GNUNET_MESSENGER_MessageEntryStorage | |||
78 | struct GNUNET_MESSENGER_MessageEntry entry; | 98 | struct GNUNET_MESSENGER_MessageEntry entry; |
79 | }; | 99 | }; |
80 | 100 | ||
81 | void | 101 | static void |
82 | load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) | 102 | load_message_store_entries (struct GNUNET_MESSENGER_MessageStore *store, const char *filename) |
83 | { | 103 | { |
84 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 104 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ); |
85 | |||
86 | if (store->storage_messages) | ||
87 | GNUNET_DISK_file_close (store->storage_messages); | ||
88 | |||
89 | char *filename; | ||
90 | GNUNET_asprintf (&filename, "%s%s", directory, "messages.store"); | ||
91 | |||
92 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) | ||
93 | store->storage_messages = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, permission); | ||
94 | else | ||
95 | store->storage_messages = NULL; | ||
96 | |||
97 | GNUNET_free(filename); | ||
98 | |||
99 | if (!store->storage_messages) | ||
100 | return; | ||
101 | |||
102 | GNUNET_asprintf (&filename, "%s%s", directory, "entries.store"); | ||
103 | |||
104 | if (GNUNET_YES != GNUNET_DISK_file_test (filename)) | ||
105 | goto free_filename; | ||
106 | 105 | ||
107 | struct GNUNET_DISK_FileHandle *entries = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, permission); | 106 | struct GNUNET_DISK_FileHandle *entries = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, permission); |
108 | 107 | ||
109 | if (!entries) | 108 | if (!entries) |
110 | goto free_filename; | 109 | return; |
111 | 110 | ||
112 | struct GNUNET_MESSENGER_MessageEntryStorage storage; | 111 | struct GNUNET_MESSENGER_MessageEntryStorage storage; |
113 | struct GNUNET_MESSENGER_MessageEntry *entry; | 112 | struct GNUNET_MESSENGER_MessageEntry *entry; |
@@ -120,9 +119,13 @@ load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir | |||
120 | { | 119 | { |
121 | GNUNET_memcpy(entry, &(storage.entry), sizeof(*entry)); | 120 | GNUNET_memcpy(entry, &(storage.entry), sizeof(*entry)); |
122 | 121 | ||
123 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (store->entries, &(storage.hash), entry, | 122 | if ((GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (store->entries, &(storage.hash))) || |
124 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 123 | (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (store->entries, &(storage.hash), entry, |
124 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | ||
125 | { | ||
126 | store->rewrite_entries = GNUNET_YES; | ||
125 | GNUNET_free(entry); | 127 | GNUNET_free(entry); |
128 | } | ||
126 | } | 129 | } |
127 | else | 130 | else |
128 | { | 131 | { |
@@ -134,22 +137,120 @@ load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir | |||
134 | while (entry); | 137 | while (entry); |
135 | 138 | ||
136 | GNUNET_DISK_file_close (entries); | 139 | GNUNET_DISK_file_close (entries); |
140 | } | ||
141 | |||
142 | struct GNUNET_MESSENGER_MessageLinkStorage | ||
143 | { | ||
144 | struct GNUNET_HashCode hash; | ||
145 | struct GNUNET_MESSENGER_MessageLink link; | ||
146 | }; | ||
147 | |||
148 | static void | ||
149 | load_message_store_links (struct GNUNET_MESSENGER_MessageStore *store, const char *filename) | ||
150 | { | ||
151 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ); | ||
152 | |||
153 | struct GNUNET_DISK_FileHandle *entries = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, permission); | ||
154 | |||
155 | if (!entries) | ||
156 | return; | ||
157 | |||
158 | struct GNUNET_MESSENGER_MessageLinkStorage storage; | ||
159 | struct GNUNET_MESSENGER_MessageLink *link = NULL; | ||
160 | |||
161 | memset(&storage, 0, sizeof(storage)); | ||
162 | |||
163 | do | ||
164 | { | ||
165 | if ((sizeof(storage.hash) != GNUNET_DISK_file_read (entries, &(storage.hash), sizeof(storage.hash))) || | ||
166 | (sizeof(storage.link.multiple) != GNUNET_DISK_file_read (entries, &(storage.link.multiple), sizeof(storage.link.multiple))) || | ||
167 | (sizeof(storage.link.first) != GNUNET_DISK_file_read (entries, &(storage.link.first), sizeof(storage.link.first))) || | ||
168 | ((GNUNET_YES == storage.link.multiple) && | ||
169 | (sizeof(storage.link.second) != GNUNET_DISK_file_read (entries, &(storage.link.second), sizeof(storage.link.second))))) | ||
170 | break; | ||
171 | |||
172 | link = GNUNET_new(struct GNUNET_MESSENGER_MessageLink); | ||
173 | |||
174 | GNUNET_memcpy(link, &(storage.link), sizeof(*link)); | ||
175 | |||
176 | if ((GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (store->links, &(storage.hash))) || | ||
177 | (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (store->links, &(storage.hash), link, | ||
178 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | ||
179 | break; | ||
180 | } | ||
181 | while (link); | ||
182 | |||
183 | if (link) | ||
184 | GNUNET_free(link); | ||
185 | |||
186 | GNUNET_DISK_file_close (entries); | ||
187 | } | ||
188 | |||
189 | void | ||
190 | load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) | ||
191 | { | ||
192 | GNUNET_assert((store) && (directory)); | ||
193 | |||
194 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
195 | |||
196 | if (store->storage_messages) | ||
197 | GNUNET_DISK_file_close (store->storage_messages); | ||
198 | |||
199 | char *filename; | ||
200 | GNUNET_asprintf (&filename, "%s%s", directory, "messages.store"); | ||
201 | |||
202 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) | ||
203 | store->storage_messages = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READWRITE, permission); | ||
204 | else | ||
205 | store->storage_messages = NULL; | ||
206 | |||
207 | GNUNET_free(filename); | ||
208 | |||
209 | if (!store->storage_messages) | ||
210 | return; | ||
211 | |||
212 | GNUNET_asprintf (&filename, "%s%s", directory, "entries.store"); | ||
213 | |||
214 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) | ||
215 | load_message_store_entries(store, filename); | ||
216 | |||
217 | GNUNET_free(filename); | ||
218 | |||
219 | GNUNET_asprintf (&filename, "%s%s", directory, "links.store"); | ||
220 | |||
221 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) | ||
222 | load_message_store_links(store, filename); | ||
137 | 223 | ||
138 | free_filename: | ||
139 | GNUNET_free(filename); | 224 | GNUNET_free(filename); |
140 | } | 225 | } |
141 | 226 | ||
142 | struct GNUNET_MESSENGER_MessageSave | 227 | struct GNUNET_MESSENGER_ClosureMessageSave |
143 | { | 228 | { |
144 | struct GNUNET_MESSENGER_MessageStore *store; | 229 | struct GNUNET_MESSENGER_MessageStore *store; |
145 | 230 | ||
146 | struct GNUNET_DISK_FileHandle *storage_entries; | 231 | struct GNUNET_DISK_FileHandle *storage; |
147 | }; | 232 | }; |
148 | 233 | ||
149 | static int | 234 | static int |
235 | iterate_save_entries (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
236 | { | ||
237 | struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; | ||
238 | struct GNUNET_MESSENGER_MessageEntry *entry = value; | ||
239 | |||
240 | struct GNUNET_MESSENGER_MessageEntryStorage storage; | ||
241 | |||
242 | GNUNET_memcpy(&(storage.hash), key, sizeof(storage.hash)); | ||
243 | GNUNET_memcpy(&(storage.entry), entry, sizeof(*entry)); | ||
244 | |||
245 | GNUNET_DISK_file_write (save->storage, &storage, sizeof(storage)); | ||
246 | |||
247 | return GNUNET_YES; | ||
248 | } | ||
249 | |||
250 | static int | ||
150 | iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value) | 251 | iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value) |
151 | { | 252 | { |
152 | struct GNUNET_MESSENGER_MessageSave *save = cls; | 253 | struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; |
153 | 254 | ||
154 | if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (save->store->entries, key)) | 255 | if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (save->store->entries, key)) |
155 | return GNUNET_YES; | 256 | return GNUNET_YES; |
@@ -159,16 +260,16 @@ iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value | |||
159 | 260 | ||
160 | GNUNET_memcpy(&(storage.hash), key, sizeof(storage.hash)); | 261 | GNUNET_memcpy(&(storage.hash), key, sizeof(storage.hash)); |
161 | 262 | ||
162 | storage.entry.length = get_message_size (message); | 263 | storage.entry.length = get_message_size (message, GNUNET_YES); |
163 | storage.entry.offset = GNUNET_DISK_file_seek (save->store->storage_messages, 0, GNUNET_DISK_SEEK_END); | 264 | storage.entry.offset = GNUNET_DISK_file_seek (save->store->storage_messages, 0, GNUNET_DISK_SEEK_END); |
164 | 265 | ||
165 | if ((GNUNET_SYSERR == storage.entry.offset) || | 266 | if ((GNUNET_SYSERR == storage.entry.offset) || (sizeof(storage) |
166 | (sizeof(storage) != GNUNET_DISK_file_write (save->storage_entries, &storage, sizeof(storage)))) | 267 | != GNUNET_DISK_file_write (save->storage, &storage, sizeof(storage)))) |
167 | return GNUNET_YES; | 268 | return GNUNET_YES; |
168 | 269 | ||
169 | char *buffer = GNUNET_malloc(storage.entry.length); | 270 | char *buffer = GNUNET_malloc(storage.entry.length); |
170 | 271 | ||
171 | encode_message (message, storage.entry.length, buffer); | 272 | encode_message (message, storage.entry.length, buffer, GNUNET_YES); |
172 | 273 | ||
173 | GNUNET_DISK_file_write (save->store->storage_messages, buffer, storage.entry.length); | 274 | GNUNET_DISK_file_write (save->store->storage_messages, buffer, storage.entry.length); |
174 | 275 | ||
@@ -177,25 +278,75 @@ iterate_save_messages (void *cls, const struct GNUNET_HashCode *key, void *value | |||
177 | return GNUNET_YES; | 278 | return GNUNET_YES; |
178 | } | 279 | } |
179 | 280 | ||
281 | static int | ||
282 | iterate_save_links (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
283 | { | ||
284 | struct GNUNET_MESSENGER_ClosureMessageSave *save = cls; | ||
285 | struct GNUNET_MESSENGER_MessageLink *link = value; | ||
286 | |||
287 | GNUNET_DISK_file_write (save->storage, key, sizeof(*key)); | ||
288 | GNUNET_DISK_file_write (save->storage, &(link->multiple), sizeof(link->multiple)); | ||
289 | GNUNET_DISK_file_write (save->storage, &(link->first), sizeof(link->first)); | ||
290 | |||
291 | if (GNUNET_YES == link->multiple) | ||
292 | GNUNET_DISK_file_write (save->storage, &(link->second), sizeof(link->second)); | ||
293 | |||
294 | return GNUNET_YES; | ||
295 | } | ||
296 | |||
180 | void | 297 | void |
181 | save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) | 298 | save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory) |
182 | { | 299 | { |
183 | struct GNUNET_MESSENGER_MessageSave save; | 300 | GNUNET_assert((store) && (directory)); |
301 | |||
302 | struct GNUNET_MESSENGER_ClosureMessageSave save; | ||
184 | 303 | ||
185 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | 304 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); |
186 | 305 | ||
187 | char *filename; | 306 | char *filename; |
307 | |||
308 | if (GNUNET_YES != store->write_links) | ||
309 | goto save_entries; | ||
310 | |||
311 | GNUNET_asprintf (&filename, "%s%s", directory, "links.store"); | ||
312 | |||
313 | save.store = store; | ||
314 | save.storage = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, permission); | ||
315 | |||
316 | GNUNET_free(filename); | ||
317 | |||
318 | if (!save.storage) | ||
319 | goto save_entries; | ||
320 | |||
321 | if (GNUNET_SYSERR == GNUNET_DISK_file_seek (save.storage, 0, GNUNET_DISK_SEEK_SET)) | ||
322 | goto close_links; | ||
323 | |||
324 | GNUNET_CONTAINER_multihashmap_iterate (store->links, iterate_save_links, &save); | ||
325 | store->write_links = GNUNET_NO; | ||
326 | |||
327 | close_links: | ||
328 | GNUNET_DISK_file_close (save.storage); | ||
329 | |||
330 | save_entries: | ||
188 | GNUNET_asprintf (&filename, "%s%s", directory, "entries.store"); | 331 | GNUNET_asprintf (&filename, "%s%s", directory, "entries.store"); |
189 | 332 | ||
190 | save.store = store; | 333 | save.store = store; |
191 | save.storage_entries = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, permission); | 334 | save.storage = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE, permission); |
192 | 335 | ||
193 | GNUNET_free(filename); | 336 | GNUNET_free(filename); |
194 | 337 | ||
195 | if (!save.storage_entries) | 338 | if (!save.storage) |
196 | return; | 339 | return; |
197 | 340 | ||
198 | if (GNUNET_SYSERR == GNUNET_DISK_file_seek (save.storage_entries, 0, GNUNET_DISK_SEEK_END)) | 341 | if (GNUNET_YES == store->rewrite_entries) |
342 | { | ||
343 | if (GNUNET_SYSERR == GNUNET_DISK_file_seek (save.storage, 0, GNUNET_DISK_SEEK_SET)) | ||
344 | goto close_entries; | ||
345 | |||
346 | GNUNET_CONTAINER_multihashmap_iterate (store->entries, iterate_save_entries, &save); | ||
347 | store->rewrite_entries = GNUNET_NO; | ||
348 | } | ||
349 | else if (GNUNET_SYSERR == GNUNET_DISK_file_seek (save.storage, 0, GNUNET_DISK_SEEK_END)) | ||
199 | goto close_entries; | 350 | goto close_entries; |
200 | 351 | ||
201 | if (store->storage_messages) | 352 | if (store->storage_messages) |
@@ -213,16 +364,18 @@ save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *dir | |||
213 | GNUNET_CONTAINER_multihashmap_iterate (store->messages, iterate_save_messages, &save); | 364 | GNUNET_CONTAINER_multihashmap_iterate (store->messages, iterate_save_messages, &save); |
214 | 365 | ||
215 | GNUNET_DISK_file_sync (store->storage_messages); | 366 | GNUNET_DISK_file_sync (store->storage_messages); |
216 | GNUNET_DISK_file_sync (save.storage_entries); | 367 | GNUNET_DISK_file_sync (save.storage); |
217 | } | 368 | } |
218 | 369 | ||
219 | close_entries: | 370 | close_entries: |
220 | GNUNET_DISK_file_close (save.storage_entries); | 371 | GNUNET_DISK_file_close (save.storage); |
221 | } | 372 | } |
222 | 373 | ||
223 | int | 374 | int |
224 | contains_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) | 375 | contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) |
225 | { | 376 | { |
377 | GNUNET_assert((store) && (hash)); | ||
378 | |||
226 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (store->messages, hash)) | 379 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (store->messages, hash)) |
227 | return GNUNET_YES; | 380 | return GNUNET_YES; |
228 | 381 | ||
@@ -232,6 +385,8 @@ contains_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struc | |||
232 | const struct GNUNET_MESSENGER_Message* | 385 | const struct GNUNET_MESSENGER_Message* |
233 | get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) | 386 | get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) |
234 | { | 387 | { |
388 | GNUNET_assert((store) && (hash)); | ||
389 | |||
235 | struct GNUNET_MESSENGER_Message *message = GNUNET_CONTAINER_multihashmap_get (store->messages, hash); | 390 | struct GNUNET_MESSENGER_Message *message = GNUNET_CONTAINER_multihashmap_get (store->messages, hash); |
236 | 391 | ||
237 | if (message) | 392 | if (message) |
@@ -250,33 +405,145 @@ get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNU | |||
250 | 405 | ||
251 | char *buffer = GNUNET_malloc(entry->length); | 406 | char *buffer = GNUNET_malloc(entry->length); |
252 | 407 | ||
253 | if (GNUNET_DISK_file_read (store->storage_messages, buffer, entry->length) != entry->length) | 408 | if (!buffer) |
254 | goto free_buffer; | 409 | return NULL; |
255 | 410 | ||
411 | if ((GNUNET_DISK_file_read (store->storage_messages, buffer, entry->length) != entry->length) || | ||
412 | (entry->length < get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN))) | ||
413 | goto free_buffer; | ||
256 | 414 | ||
257 | message = create_message (GNUNET_MESSENGER_KIND_UNKNOWN); | 415 | message = create_message (GNUNET_MESSENGER_KIND_UNKNOWN); |
258 | 416 | ||
259 | if ((GNUNET_YES != decode_message (message, entry->length, buffer)) || (GNUNET_OK | 417 | const int decoding = decode_message (message, entry->length, buffer, GNUNET_YES, NULL); |
260 | != GNUNET_CONTAINER_multihashmap_put (store->messages, hash, message, | 418 | |
261 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | 419 | struct GNUNET_HashCode check; |
420 | hash_message (message, entry->length, buffer, &check); | ||
421 | |||
422 | if ((GNUNET_YES != decoding) || (GNUNET_CRYPTO_hash_cmp (hash, &check) != 0)) | ||
262 | { | 423 | { |
263 | destroy_message (message); | 424 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (store->entries, hash, entry)) |
425 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Corrupted entry could not be removed from store: %s\n", | ||
426 | GNUNET_h2s(hash)); | ||
264 | 427 | ||
265 | message = NULL; | 428 | store->rewrite_entries = GNUNET_YES; |
266 | 429 | ||
267 | GNUNET_CONTAINER_multihashmap_remove (store->entries, hash, entry); | 430 | goto free_message; |
268 | } | 431 | } |
269 | 432 | ||
433 | if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (store->messages, hash, message, | ||
434 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
435 | goto free_buffer; | ||
436 | |||
437 | free_message: destroy_message (message); | ||
438 | message = NULL; | ||
439 | |||
270 | free_buffer: | 440 | free_buffer: |
271 | GNUNET_free(buffer); | 441 | GNUNET_free(buffer); |
272 | 442 | ||
273 | return message; | 443 | return message; |
274 | } | 444 | } |
275 | 445 | ||
446 | const struct GNUNET_MESSENGER_MessageLink* | ||
447 | get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | ||
448 | int deleted_only) | ||
449 | { | ||
450 | if (deleted_only) | ||
451 | goto get_link; | ||
452 | |||
453 | const struct GNUNET_MESSENGER_Message *message = get_store_message(store, hash); | ||
454 | |||
455 | if (!message) | ||
456 | goto get_link; | ||
457 | |||
458 | static struct GNUNET_MESSENGER_MessageLink link; | ||
459 | |||
460 | GNUNET_memcpy(&(link.first), &(message->header.previous), sizeof(link.first)); | ||
461 | |||
462 | link.multiple = GNUNET_MESSENGER_KIND_MERGE == message->header.kind? GNUNET_YES : GNUNET_NO; | ||
463 | |||
464 | if (GNUNET_YES == link.multiple) | ||
465 | GNUNET_memcpy(&(link.second), &(message->body.merge.previous), sizeof(link.second)); | ||
466 | else | ||
467 | GNUNET_memcpy(&(link.second), &(message->header.previous), sizeof(link.second)); | ||
468 | |||
469 | return &link; | ||
470 | |||
471 | get_link: | ||
472 | return GNUNET_CONTAINER_multihashmap_get (store->links, hash); | ||
473 | } | ||
474 | |||
276 | int | 475 | int |
277 | put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | 476 | put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, |
278 | struct GNUNET_MESSENGER_Message *message) | 477 | struct GNUNET_MESSENGER_Message *message) |
279 | { | 478 | { |
479 | GNUNET_assert((store) && (hash) && (message)); | ||
480 | |||
280 | return GNUNET_CONTAINER_multihashmap_put (store->messages, hash, message, | 481 | return GNUNET_CONTAINER_multihashmap_put (store->messages, hash, message, |
281 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 482 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); |
282 | } | 483 | } |
484 | |||
485 | static void | ||
486 | add_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | ||
487 | const struct GNUNET_MESSENGER_Message *message) | ||
488 | { | ||
489 | struct GNUNET_MESSENGER_MessageLink *link = GNUNET_new(struct GNUNET_MESSENGER_MessageLink); | ||
490 | |||
491 | GNUNET_memcpy(&(link->first), &(message->header.previous), sizeof(link->first)); | ||
492 | |||
493 | link->multiple = GNUNET_MESSENGER_KIND_MERGE == message->header.kind? GNUNET_YES : GNUNET_NO; | ||
494 | |||
495 | if (GNUNET_YES == link->multiple) | ||
496 | GNUNET_memcpy(&(link->second), &(message->body.merge.previous), sizeof(link->second)); | ||
497 | else | ||
498 | GNUNET_memcpy(&(link->second), &(message->header.previous), sizeof(link->second)); | ||
499 | |||
500 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(store->links, hash, link, | ||
501 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
502 | GNUNET_free(link); | ||
503 | } | ||
504 | |||
505 | int | ||
506 | delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash) | ||
507 | { | ||
508 | GNUNET_assert((store) && (hash)); | ||
509 | |||
510 | const struct GNUNET_MESSENGER_MessageEntry *entry = GNUNET_CONTAINER_multihashmap_get (store->entries, hash); | ||
511 | |||
512 | if (!entry) | ||
513 | goto clear_memory; | ||
514 | |||
515 | const struct GNUNET_MESSENGER_Message *message = get_store_message(store, hash); | ||
516 | |||
517 | if (message) | ||
518 | add_link (store, hash, message); | ||
519 | |||
520 | if (!store->storage_messages) | ||
521 | goto clear_entry; | ||
522 | |||
523 | if (entry->offset != GNUNET_DISK_file_seek (store->storage_messages, entry->offset, GNUNET_DISK_SEEK_SET)) | ||
524 | return GNUNET_SYSERR; | ||
525 | |||
526 | char *clear_buffer = GNUNET_malloc(entry->length); | ||
527 | |||
528 | if (!clear_buffer) | ||
529 | return GNUNET_SYSERR; | ||
530 | |||
531 | GNUNET_CRYPTO_zero_keys (clear_buffer, entry->length); | ||
532 | |||
533 | if ((entry->length != GNUNET_DISK_file_write (store->storage_messages, clear_buffer, entry->length)) || (GNUNET_OK | ||
534 | != GNUNET_DISK_file_sync (store->storage_messages))) | ||
535 | { | ||
536 | GNUNET_free(clear_buffer); | ||
537 | return GNUNET_SYSERR; | ||
538 | } | ||
539 | |||
540 | GNUNET_free(clear_buffer); | ||
541 | |||
542 | clear_entry: | ||
543 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (store->entries, hash, entry)) | ||
544 | store->rewrite_entries = GNUNET_YES; | ||
545 | |||
546 | clear_memory: | ||
547 | GNUNET_CONTAINER_multihashmap_remove_all (store->messages, hash); | ||
548 | return GNUNET_OK; | ||
549 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_message_store.h b/src/messenger/gnunet-service-messenger_message_store.h index e58459b21..87305826a 100644 --- a/src/messenger/gnunet-service-messenger_message_store.h +++ b/src/messenger/gnunet-service-messenger_message_store.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -36,85 +36,127 @@ struct GNUNET_MESSENGER_MessageEntry | |||
36 | uint16_t length; | 36 | uint16_t length; |
37 | }; | 37 | }; |
38 | 38 | ||
39 | struct GNUNET_MESSENGER_Message; | ||
40 | |||
41 | struct GNUNET_MESSENGER_MessageLink | ||
42 | { | ||
43 | uint8_t multiple; | ||
44 | |||
45 | struct GNUNET_HashCode first; | ||
46 | struct GNUNET_HashCode second; | ||
47 | }; | ||
48 | |||
39 | struct GNUNET_MESSENGER_MessageStore | 49 | struct GNUNET_MESSENGER_MessageStore |
40 | { | 50 | { |
41 | struct GNUNET_DISK_FileHandle *storage_messages; | 51 | struct GNUNET_DISK_FileHandle *storage_messages; |
42 | 52 | ||
43 | struct GNUNET_CONTAINER_MultiHashMap *entries; | 53 | struct GNUNET_CONTAINER_MultiHashMap *entries; |
44 | struct GNUNET_CONTAINER_MultiHashMap *messages; | 54 | struct GNUNET_CONTAINER_MultiHashMap *messages; |
55 | struct GNUNET_CONTAINER_MultiHashMap *links; | ||
56 | |||
57 | int rewrite_entries; | ||
58 | int write_links; | ||
45 | }; | 59 | }; |
46 | 60 | ||
47 | /** | 61 | /** |
48 | * Initializes a message store as fully empty. | 62 | * Initializes a message <i>store</i> as fully empty. |
49 | * | 63 | * |
50 | * @param store Message store | 64 | * @param[out] store Message store |
51 | */ | 65 | */ |
52 | void | 66 | void |
53 | init_message_store (struct GNUNET_MESSENGER_MessageStore *store); | 67 | init_message_store (struct GNUNET_MESSENGER_MessageStore *store); |
54 | 68 | ||
55 | /** | 69 | /** |
56 | * Clears a message store, wipes its content and deallocates its memory. | 70 | * Clears a message <i>store</i>, wipes its content and deallocates its memory. |
57 | * | 71 | * |
58 | * @param store Message store | 72 | * @param[in/out] store Message store |
59 | */ | 73 | */ |
60 | void | 74 | void |
61 | clear_message_store (struct GNUNET_MESSENGER_MessageStore *store); | 75 | clear_message_store (struct GNUNET_MESSENGER_MessageStore *store); |
62 | 76 | ||
63 | /** | 77 | /** |
64 | * Loads messages from a directory into a message store. | 78 | * Loads messages from a <i>directory</i> into a message <i>store</i>. |
65 | * | 79 | * |
66 | * @param store Message store | 80 | * @param[out] store Message store |
67 | * @param directory Path to a directory | 81 | * @param[in] directory Path to a directory |
68 | */ | 82 | */ |
69 | void | 83 | void |
70 | load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); | 84 | load_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); |
71 | 85 | ||
72 | /** | 86 | /** |
73 | * Saves messages from a message store into a directory. | 87 | * Saves messages from a message <i>store</i> into a <i>directory</i>. |
74 | * | 88 | * |
75 | * @param store Message store | 89 | * @param[in] store Message store |
76 | * @param directory Path to a directory | 90 | * @param[in] directory Path to a directory |
77 | */ | 91 | */ |
78 | void | 92 | void |
79 | save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); | 93 | save_message_store (struct GNUNET_MESSENGER_MessageStore *store, const char *directory); |
80 | 94 | ||
81 | /** | 95 | /** |
82 | * Checks if a message matching a given <i>hash</i> is stored in a message store. The function returns | 96 | * Checks if a message matching a given <i>hash</i> is stored in a message <i>store</i>. |
83 | * GNUNET_YES if a match is found, GNUNET_NO otherwise. | 97 | * The function returns #GNUNET_YES if a match is found, #GNUNET_NO otherwise. |
84 | * | 98 | * |
85 | * The message has not to be loaded from disk into memory for this check! | 99 | * The message has not to be loaded from disk into memory for this check! |
86 | * | 100 | * |
87 | * @param store Message store | 101 | * @param[in] store Message store |
88 | * @param hash Hash of message | 102 | * @param[in] hash Hash of message |
89 | * @return GNUNET_YES on match, otherwise GNUNET_NO | 103 | * @return #GNUNET_YES on match, otherwise #GNUNET_NO |
90 | */ | 104 | */ |
91 | int | 105 | int |
92 | contains_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | 106 | contains_store_message (const struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); |
93 | 107 | ||
94 | /** | 108 | /** |
95 | * Returns the message from a message store matching a given <i>hash</i>. If no matching message is found, | 109 | * Returns the message from a message <i>store</i> matching a given <i>hash</i>. If no matching |
96 | * NULL gets returned. | 110 | * message is found, NULL gets returned. |
97 | * | 111 | * |
98 | * This function requires the message to be loaded into memory! | 112 | * This function requires the message to be loaded into memory! |
99 | * @see contains_store_message() | 113 | * @see contains_store_message() |
100 | * | 114 | * |
101 | * @param store Message store | 115 | * @param[in/out] store Message store |
102 | * @param hash Hash of message | 116 | * @param[in] hash Hash of message |
103 | * @return Message or NULL | 117 | * @return Message or NULL |
104 | */ | 118 | */ |
105 | const struct GNUNET_MESSENGER_Message* | 119 | const struct GNUNET_MESSENGER_Message* |
106 | get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | 120 | get_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); |
107 | 121 | ||
108 | /** | 122 | /** |
123 | * Returns the message link from a message <i>store</i> matching a given <i>hash</i>. If the | ||
124 | * flag is set to #GNUNET_YES, only links from deleted messages will be returned or NULL. | ||
125 | * | ||
126 | * Otherwise message links will also returned for messages found in the store under the given | ||
127 | * hash. The link which will be returned copies link information from the message for | ||
128 | * temporary usage. | ||
129 | * | ||
130 | * @param[in/out] store Message store | ||
131 | * @param[in] hash Hash of message | ||
132 | * @param[in] deleted_only Flag | ||
133 | * @return Message link or NULL | ||
134 | */ | ||
135 | const struct GNUNET_MESSENGER_MessageLink* | ||
136 | get_store_message_link (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | ||
137 | int deleted_only); | ||
138 | |||
139 | /** | ||
109 | * Stores a message into the message store. The result indicates if the operation was successful. | 140 | * Stores a message into the message store. The result indicates if the operation was successful. |
110 | * | 141 | * |
111 | * @param store Message store | 142 | * @param[in/out] store Message store |
112 | * @param hash Hash of message | 143 | * @param[in] hash Hash of message |
113 | * @param message Message | 144 | * @param[in/out] message Message |
114 | * @return GNUNET_OK on success, otherwise GNUNET_NO | 145 | * @return #GNUNET_OK on success, otherwise #GNUNET_NO |
115 | */ | 146 | */ |
116 | int | 147 | int |
117 | put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, | 148 | put_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash, |
118 | struct GNUNET_MESSENGER_Message *message); | 149 | struct GNUNET_MESSENGER_Message *message); |
119 | 150 | ||
151 | /** | ||
152 | * Deletes a message in the message store. It will be removed from disk space and memory. The result | ||
153 | * indicates if the operation was successful. | ||
154 | * | ||
155 | * @param[in/out] store Message store | ||
156 | * @param[in] hash Hash of message | ||
157 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure | ||
158 | */ | ||
159 | int | ||
160 | delete_store_message (struct GNUNET_MESSENGER_MessageStore *store, const struct GNUNET_HashCode *hash); | ||
161 | |||
120 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STORE_H | 162 | #endif //GNUNET_SERVICE_MESSENGER_MESSAGE_STORE_H |
diff --git a/src/messenger/gnunet-service-messenger_operation.c b/src/messenger/gnunet-service-messenger_operation.c new file mode 100644 index 000000000..d0c378699 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_operation.c | |||
@@ -0,0 +1,214 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_operation.c | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "gnunet-service-messenger_operation.h" | ||
27 | |||
28 | #include "gnunet-service-messenger_operation_store.h" | ||
29 | |||
30 | struct GNUNET_MESSENGER_Operation* | ||
31 | create_operation (const struct GNUNET_HashCode *hash) | ||
32 | { | ||
33 | GNUNET_assert(hash); | ||
34 | |||
35 | struct GNUNET_MESSENGER_Operation *op = GNUNET_new(struct GNUNET_MESSENGER_Operation); | ||
36 | |||
37 | op->type = GNUNET_MESSENGER_OP_UNKNOWN; | ||
38 | GNUNET_memcpy(&(op->hash), hash, sizeof(*hash)); | ||
39 | op->timestamp = GNUNET_TIME_absolute_get_zero_(); | ||
40 | op->store = NULL; | ||
41 | op->task = NULL; | ||
42 | |||
43 | return op; | ||
44 | } | ||
45 | |||
46 | void | ||
47 | destroy_operation (struct GNUNET_MESSENGER_Operation *op) | ||
48 | { | ||
49 | GNUNET_assert(op); | ||
50 | |||
51 | if (op->task) | ||
52 | GNUNET_SCHEDULER_cancel(op->task); | ||
53 | |||
54 | GNUNET_free(op); | ||
55 | } | ||
56 | |||
57 | static void | ||
58 | callback_operation (void *cls); | ||
59 | |||
60 | struct GNUNET_MESSENGER_Operation* | ||
61 | load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path) | ||
62 | { | ||
63 | GNUNET_assert((store) && (path)); | ||
64 | |||
65 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
66 | struct GNUNET_MESSENGER_Operation* op = NULL; | ||
67 | |||
68 | if (GNUNET_OK != GNUNET_CONFIGURATION_parse(cfg, path)) | ||
69 | goto destroy_config; | ||
70 | |||
71 | struct GNUNET_HashCode hash; | ||
72 | |||
73 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_data (cfg, "operation", "hash", &hash, sizeof(hash))) | ||
74 | goto destroy_config; | ||
75 | |||
76 | op = create_operation(&hash); | ||
77 | |||
78 | unsigned long long type_number; | ||
79 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number(cfg, "operation", "type", &type_number)) | ||
80 | switch (type_number) | ||
81 | { | ||
82 | case GNUNET_MESSENGER_OP_REQUEST: | ||
83 | op->type = GNUNET_MESSENGER_OP_REQUEST; | ||
84 | break; | ||
85 | case GNUNET_MESSENGER_OP_DELETE: | ||
86 | op->type = GNUNET_MESSENGER_OP_DELETE; | ||
87 | break; | ||
88 | case GNUNET_MESSENGER_OP_MERGE: | ||
89 | op->type = GNUNET_MESSENGER_OP_MERGE; | ||
90 | break; | ||
91 | default: | ||
92 | break; | ||
93 | } | ||
94 | |||
95 | if ((GNUNET_MESSENGER_OP_UNKNOWN == op->type) || | ||
96 | (GNUNET_OK != GNUNET_CONFIGURATION_get_data (cfg, "operation", "timestamp", &(op->timestamp), sizeof(op->timestamp)))) | ||
97 | { | ||
98 | destroy_operation(op); | ||
99 | op = NULL; | ||
100 | goto destroy_config; | ||
101 | } | ||
102 | |||
103 | const struct GNUNET_TIME_Relative delay = GNUNET_TIME_absolute_get_remaining(op->timestamp); | ||
104 | |||
105 | op->task = GNUNET_SCHEDULER_add_delayed_with_priority( | ||
106 | delay, | ||
107 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
108 | callback_operation, | ||
109 | op | ||
110 | ); | ||
111 | |||
112 | op->store = store; | ||
113 | |||
114 | destroy_config: | ||
115 | GNUNET_CONFIGURATION_destroy (cfg); | ||
116 | |||
117 | return op; | ||
118 | } | ||
119 | |||
120 | void | ||
121 | save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path) | ||
122 | { | ||
123 | GNUNET_assert((path) && (op)); | ||
124 | |||
125 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
126 | |||
127 | char *hash_data; | ||
128 | hash_data = GNUNET_STRINGS_data_to_string_alloc (&(op->hash), sizeof(op->hash)); | ||
129 | |||
130 | if (hash_data) | ||
131 | { | ||
132 | GNUNET_CONFIGURATION_set_value_string (cfg, "operation", "hash", hash_data); | ||
133 | |||
134 | GNUNET_free(hash_data); | ||
135 | } | ||
136 | |||
137 | GNUNET_CONFIGURATION_set_value_number(cfg, "operation", "type", op->type); | ||
138 | |||
139 | char *timestamp_data; | ||
140 | timestamp_data = GNUNET_STRINGS_data_to_string_alloc (&(op->timestamp), sizeof(op->timestamp)); | ||
141 | |||
142 | if (timestamp_data) | ||
143 | { | ||
144 | GNUNET_CONFIGURATION_set_value_string (cfg, "operation", "timestamp", timestamp_data); | ||
145 | |||
146 | GNUNET_free(timestamp_data); | ||
147 | } | ||
148 | |||
149 | GNUNET_CONFIGURATION_write (cfg, path); | ||
150 | GNUNET_CONFIGURATION_destroy (cfg); | ||
151 | } | ||
152 | |||
153 | extern void | ||
154 | callback_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
155 | enum GNUNET_MESSENGER_OperationType type, | ||
156 | const struct GNUNET_HashCode *hash); | ||
157 | |||
158 | static void | ||
159 | callback_operation (void *cls) | ||
160 | { | ||
161 | struct GNUNET_MESSENGER_Operation *op = cls; | ||
162 | |||
163 | op->task = NULL; | ||
164 | |||
165 | callback_store_operation (op->store, op->type, &(op->hash)); | ||
166 | } | ||
167 | |||
168 | int | ||
169 | start_operation (struct GNUNET_MESSENGER_Operation *op, | ||
170 | enum GNUNET_MESSENGER_OperationType type, | ||
171 | struct GNUNET_MESSENGER_OperationStore *store, | ||
172 | struct GNUNET_TIME_Relative delay) | ||
173 | { | ||
174 | GNUNET_assert((op) && (store)); | ||
175 | |||
176 | if (op->task) | ||
177 | return GNUNET_SYSERR; | ||
178 | |||
179 | const struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_absolute_add( | ||
180 | GNUNET_TIME_absolute_get(), | ||
181 | delay | ||
182 | ); | ||
183 | |||
184 | op->task = GNUNET_SCHEDULER_add_delayed_with_priority( | ||
185 | delay, | ||
186 | GNUNET_SCHEDULER_PRIORITY_BACKGROUND, | ||
187 | callback_operation, | ||
188 | op | ||
189 | ); | ||
190 | |||
191 | op->type = type; | ||
192 | op->timestamp = timestamp; | ||
193 | op->store = store; | ||
194 | |||
195 | return GNUNET_OK; | ||
196 | } | ||
197 | |||
198 | int | ||
199 | stop_operation (struct GNUNET_MESSENGER_Operation *op) | ||
200 | { | ||
201 | GNUNET_assert(op); | ||
202 | |||
203 | if (!op->task) | ||
204 | return GNUNET_SYSERR; | ||
205 | |||
206 | GNUNET_SCHEDULER_cancel(op->task); | ||
207 | op->task = NULL; | ||
208 | |||
209 | op->type = GNUNET_MESSENGER_OP_UNKNOWN; | ||
210 | op->timestamp = GNUNET_TIME_absolute_get_zero_(); | ||
211 | op->store = NULL; | ||
212 | |||
213 | return GNUNET_OK; | ||
214 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_operation.h b/src/messenger/gnunet-service-messenger_operation.h new file mode 100644 index 000000000..7757b8e88 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_operation.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_operation.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_OPERATION_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_OPERATION_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_configuration_lib.h" | ||
31 | #include "gnunet_crypto_lib.h" | ||
32 | #include "gnunet_scheduler_lib.h" | ||
33 | #include "gnunet_strings_lib.h" | ||
34 | #include "gnunet_time_lib.h" | ||
35 | |||
36 | enum GNUNET_MESSENGER_OperationType | ||
37 | { | ||
38 | GNUNET_MESSENGER_OP_REQUEST = 1, | ||
39 | GNUNET_MESSENGER_OP_DELETE = 2, | ||
40 | GNUNET_MESSENGER_OP_MERGE = 3, | ||
41 | |||
42 | GNUNET_MESSENGER_OP_UNKNOWN = 0 | ||
43 | }; | ||
44 | |||
45 | struct GNUNET_MESSENGER_OperationStore; | ||
46 | |||
47 | struct GNUNET_MESSENGER_Operation | ||
48 | { | ||
49 | enum GNUNET_MESSENGER_OperationType type; | ||
50 | |||
51 | struct GNUNET_HashCode hash; | ||
52 | struct GNUNET_TIME_Absolute timestamp; | ||
53 | |||
54 | struct GNUNET_MESSENGER_OperationStore *store; | ||
55 | struct GNUNET_SCHEDULER_Task* task; | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * Creates and allocates a new operation under a given <i>hash</i>. | ||
60 | * | ||
61 | * @param[in] hash Hash of message | ||
62 | */ | ||
63 | struct GNUNET_MESSENGER_Operation* | ||
64 | create_operation (const struct GNUNET_HashCode *hash); | ||
65 | |||
66 | /** | ||
67 | * Destroys an operation and frees its memory fully. | ||
68 | * | ||
69 | * @param[in/out] op Operation | ||
70 | */ | ||
71 | void | ||
72 | destroy_operation (struct GNUNET_MESSENGER_Operation *op); | ||
73 | |||
74 | /** | ||
75 | * Loads data from a configuration file at a selected <i>path</i> into | ||
76 | * a new allocated and created operation for a specific operation | ||
77 | * <i>store</i> if the required information could be read successfully. | ||
78 | * | ||
79 | * The method will return the new operation and it will be started | ||
80 | * automatically to match its timestamp of execution. | ||
81 | * | ||
82 | * If the method fails to restore any valid operation from the file, | ||
83 | * NULL gets returned instead. | ||
84 | * | ||
85 | * @param[in/out] store Operation store | ||
86 | * @param[in] path Path of a configuration file | ||
87 | */ | ||
88 | struct GNUNET_MESSENGER_Operation* | ||
89 | load_operation (struct GNUNET_MESSENGER_OperationStore *store, const char *path); | ||
90 | |||
91 | /** | ||
92 | * Saves data from an <i>operation</i> into a configuration file at a | ||
93 | * selected <i>path</i> which can be load to restore the operation | ||
94 | * completely and continue its process. | ||
95 | * | ||
96 | * @param[in] op Operation | ||
97 | * @param[in] path Path of a configuration file | ||
98 | */ | ||
99 | void | ||
100 | save_operation (const struct GNUNET_MESSENGER_Operation *op, const char *path); | ||
101 | |||
102 | /** | ||
103 | * Starts an inactive operation with a given <i>delay</i> in a | ||
104 | * specific operation <i>store</i>. The method will replace the | ||
105 | * operations type to process it correctly. An opeation can't be | ||
106 | * started twice, it has to be stopped or fully processed first. | ||
107 | * | ||
108 | * @param[in/out] op Operation | ||
109 | * @param[in] type Type of operation | ||
110 | * @param[in/out] store Operation store | ||
111 | * @param[in] delay Delay | ||
112 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | ||
113 | */ | ||
114 | int | ||
115 | start_operation (struct GNUNET_MESSENGER_Operation *op, | ||
116 | enum GNUNET_MESSENGER_OperationType type, | ||
117 | struct GNUNET_MESSENGER_OperationStore *store, | ||
118 | struct GNUNET_TIME_Relative delay); | ||
119 | |||
120 | /** | ||
121 | * Stops an active operation and resets its type to be | ||
122 | * #GNUNET_MESSENGER_OP_UNKNOWN. | ||
123 | * | ||
124 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | ||
125 | */ | ||
126 | int | ||
127 | stop_operation (struct GNUNET_MESSENGER_Operation *op); | ||
128 | |||
129 | #endif //GNUNET_SERVICE_MESSENGER_OPERATION_H | ||
diff --git a/src/messenger/gnunet-service-messenger_operation_store.c b/src/messenger/gnunet-service-messenger_operation_store.c new file mode 100755 index 000000000..a32fbad2c --- /dev/null +++ b/src/messenger/gnunet-service-messenger_operation_store.c | |||
@@ -0,0 +1,226 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_operation_store.c | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "gnunet-service-messenger_operation_store.h" | ||
27 | |||
28 | #include "gnunet-service-messenger_operation.h" | ||
29 | #include "gnunet-service-messenger_room.h" | ||
30 | |||
31 | void | ||
32 | init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room) | ||
33 | { | ||
34 | GNUNET_assert((store) && (room)); | ||
35 | |||
36 | store->room = room; | ||
37 | store->operations = GNUNET_CONTAINER_multihashmap_create(8, GNUNET_NO); | ||
38 | } | ||
39 | |||
40 | static int | ||
41 | iterate_destroy_operations (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
42 | { | ||
43 | struct GNUNET_MESSENGER_Operation *op = value; | ||
44 | |||
45 | destroy_operation(op); | ||
46 | |||
47 | return GNUNET_YES; | ||
48 | } | ||
49 | |||
50 | void | ||
51 | clear_operation_store (struct GNUNET_MESSENGER_OperationStore *store) | ||
52 | { | ||
53 | GNUNET_assert(store); | ||
54 | |||
55 | GNUNET_CONTAINER_multihashmap_iterate (store->operations, iterate_destroy_operations, NULL); | ||
56 | GNUNET_CONTAINER_multihashmap_destroy(store->operations); | ||
57 | } | ||
58 | |||
59 | static int | ||
60 | callback_scan_for_operations (void *cls, const char *filename) | ||
61 | { | ||
62 | struct GNUNET_MESSENGER_OperationStore *store = cls; | ||
63 | |||
64 | if (GNUNET_YES == GNUNET_DISK_file_test (filename)) | ||
65 | { | ||
66 | char *path; | ||
67 | |||
68 | GNUNET_asprintf (&path, "%s%c", filename, DIR_SEPARATOR); | ||
69 | |||
70 | struct GNUNET_MESSENGER_Operation *op = load_operation(store, path); | ||
71 | |||
72 | if ((op) && (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put( | ||
73 | store->operations, | ||
74 | &(op->hash), op, | ||
75 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | ||
76 | { | ||
77 | destroy_operation(op); | ||
78 | } | ||
79 | |||
80 | GNUNET_free(path); | ||
81 | } | ||
82 | |||
83 | return GNUNET_OK; | ||
84 | } | ||
85 | |||
86 | void | ||
87 | load_operation_store (struct GNUNET_MESSENGER_OperationStore *store, | ||
88 | const char *directory) | ||
89 | { | ||
90 | GNUNET_assert ((store) && (directory)); | ||
91 | |||
92 | if (GNUNET_OK == GNUNET_DISK_directory_test (directory, GNUNET_YES)) | ||
93 | GNUNET_DISK_directory_scan (directory, callback_scan_for_operations, store); | ||
94 | } | ||
95 | |||
96 | static int | ||
97 | iterate_save_operations (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
98 | { | ||
99 | const char *save_dir = cls; | ||
100 | |||
101 | struct GNUNET_MESSENGER_Operation *op = value; | ||
102 | |||
103 | if (!op) | ||
104 | return GNUNET_YES; | ||
105 | |||
106 | char *op_dir; | ||
107 | GNUNET_asprintf (&op_dir, "%s%s.cfg", save_dir, GNUNET_h2s(key)); | ||
108 | save_operation(op, op_dir); | ||
109 | |||
110 | GNUNET_free(op_dir); | ||
111 | return GNUNET_YES; | ||
112 | } | ||
113 | |||
114 | void | ||
115 | save_operation_store (const struct GNUNET_MESSENGER_OperationStore *store, | ||
116 | const char *directory) | ||
117 | { | ||
118 | GNUNET_assert ((store) && (directory)); | ||
119 | |||
120 | char* save_dir; | ||
121 | GNUNET_asprintf (&save_dir, "%s%s%c", directory, "operations", DIR_SEPARATOR); | ||
122 | |||
123 | if ((GNUNET_YES == GNUNET_DISK_directory_test (save_dir, GNUNET_NO)) || | ||
124 | (GNUNET_OK == GNUNET_DISK_directory_create (save_dir))) | ||
125 | GNUNET_CONTAINER_multihashmap_iterate (store->operations, iterate_save_operations, save_dir); | ||
126 | |||
127 | GNUNET_free(save_dir); | ||
128 | } | ||
129 | |||
130 | enum GNUNET_MESSENGER_OperationType | ||
131 | get_store_operation_type (const struct GNUNET_MESSENGER_OperationStore *store, | ||
132 | const struct GNUNET_HashCode *hash) | ||
133 | { | ||
134 | GNUNET_assert((store) && (hash)); | ||
135 | |||
136 | struct GNUNET_MESSENGER_Operation *op = GNUNET_CONTAINER_multihashmap_get(store->operations, hash); | ||
137 | |||
138 | if (!op) | ||
139 | return GNUNET_MESSENGER_OP_UNKNOWN; | ||
140 | |||
141 | return op->type; | ||
142 | } | ||
143 | |||
144 | int | ||
145 | use_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
146 | const struct GNUNET_HashCode *hash, | ||
147 | enum GNUNET_MESSENGER_OperationType type, | ||
148 | struct GNUNET_TIME_Relative delay) | ||
149 | { | ||
150 | GNUNET_assert((store) && (hash)); | ||
151 | |||
152 | struct GNUNET_MESSENGER_Operation *op = GNUNET_CONTAINER_multihashmap_get(store->operations, hash); | ||
153 | |||
154 | if (op) | ||
155 | goto use_op; | ||
156 | |||
157 | op = create_operation(hash); | ||
158 | |||
159 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(store->operations, hash, op, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
160 | { | ||
161 | destroy_operation(op); | ||
162 | |||
163 | return GNUNET_SYSERR; | ||
164 | } | ||
165 | |||
166 | use_op: | ||
167 | if ((op->type != GNUNET_MESSENGER_OP_UNKNOWN) && | ||
168 | (type == GNUNET_MESSENGER_OP_DELETE)) | ||
169 | stop_operation (op); | ||
170 | |||
171 | return start_operation(op, type, store, delay); | ||
172 | } | ||
173 | |||
174 | void | ||
175 | cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
176 | const struct GNUNET_HashCode *hash) | ||
177 | { | ||
178 | GNUNET_assert((store) && (hash)); | ||
179 | |||
180 | struct GNUNET_MESSENGER_Operation *op = GNUNET_CONTAINER_multihashmap_get(store->operations, hash); | ||
181 | |||
182 | if (!op) | ||
183 | return; | ||
184 | |||
185 | stop_operation(op); | ||
186 | |||
187 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove(store->operations, hash, op)) | ||
188 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Canceled operation could not be removed: %s\n", | ||
189 | GNUNET_h2s(hash)); | ||
190 | |||
191 | destroy_operation(op); | ||
192 | } | ||
193 | |||
194 | extern void | ||
195 | callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash); | ||
196 | |||
197 | extern void | ||
198 | callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash); | ||
199 | |||
200 | void | ||
201 | callback_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
202 | enum GNUNET_MESSENGER_OperationType type, | ||
203 | const struct GNUNET_HashCode *hash) | ||
204 | { | ||
205 | GNUNET_assert((store) && (hash)); | ||
206 | |||
207 | struct GNUNET_HashCode op_hash; | ||
208 | GNUNET_memcpy(&op_hash, hash, sizeof(op_hash)); | ||
209 | cancel_store_operation (store, &op_hash); | ||
210 | |||
211 | struct GNUNET_MESSENGER_SrvRoom *room = store->room; | ||
212 | |||
213 | switch (type) | ||
214 | { | ||
215 | case GNUNET_MESSENGER_OP_REQUEST: | ||
216 | break; | ||
217 | case GNUNET_MESSENGER_OP_DELETE: | ||
218 | callback_room_deletion (room, &op_hash); | ||
219 | break; | ||
220 | case GNUNET_MESSENGER_OP_MERGE: | ||
221 | callback_room_merge (room, &op_hash); | ||
222 | break; | ||
223 | default: | ||
224 | break; | ||
225 | } | ||
226 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_operation_store.h b/src/messenger/gnunet-service-messenger_operation_store.h new file mode 100644 index 000000000..2fd604340 --- /dev/null +++ b/src/messenger/gnunet-service-messenger_operation_store.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/gnunet-service-messenger_operation_store.h | ||
23 | * @brief GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||
27 | #define GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_container_lib.h" | ||
31 | #include "gnunet_crypto_lib.h" | ||
32 | #include "gnunet_scheduler_lib.h" | ||
33 | #include "gnunet_time_lib.h" | ||
34 | |||
35 | struct GNUNET_MESSENGER_SrvRoom; | ||
36 | |||
37 | struct GNUNET_MESSENGER_OperationStore | ||
38 | { | ||
39 | struct GNUNET_MESSENGER_SrvRoom *room; | ||
40 | |||
41 | struct GNUNET_CONTAINER_MultiHashMap *operations; | ||
42 | }; | ||
43 | |||
44 | /** | ||
45 | * Initializes an operation <i>store</i> as fully empty with a given <i>room</i>. | ||
46 | * | ||
47 | * @param[out] store Operation store | ||
48 | * @param[in/out] room Room | ||
49 | */ | ||
50 | void | ||
51 | init_operation_store (struct GNUNET_MESSENGER_OperationStore *store, struct GNUNET_MESSENGER_SrvRoom *room); | ||
52 | |||
53 | /** | ||
54 | * Clears an operation <i>store</i>, stops all operations and deallocates its memory. | ||
55 | * | ||
56 | * @param[in/out] store Operation store | ||
57 | */ | ||
58 | void | ||
59 | clear_operation_store (struct GNUNET_MESSENGER_OperationStore *store); | ||
60 | |||
61 | /** | ||
62 | * Loads operations from a <i>directory</i> into an operation <i>store</i>. | ||
63 | * | ||
64 | * @param[out] store Operation store | ||
65 | * @param[in] directory Path to a directory | ||
66 | */ | ||
67 | void | ||
68 | load_operation_store (struct GNUNET_MESSENGER_OperationStore *store, | ||
69 | const char *directory); | ||
70 | |||
71 | /** | ||
72 | * Saves operations from an operation <i>store</i> into a <i>directory</i>. | ||
73 | * | ||
74 | * @param[in] store Operation store | ||
75 | * @param[in] directory Path to a directory | ||
76 | */ | ||
77 | void | ||
78 | save_operation_store (const struct GNUNET_MESSENGER_OperationStore *store, | ||
79 | const char *directory); | ||
80 | |||
81 | /** | ||
82 | * Retruns the type of the active operation under a given <i>hash</i> in | ||
83 | * a specific operation <i>store</i>. If there is no active operation under | ||
84 | * the given <i>hash</i>, #GNUNET_MESSENGER_OP_UNKNOWN gets returned instead. | ||
85 | * | ||
86 | * @param[in] store Operation store | ||
87 | * @param[in] hash Hash of message | ||
88 | * @return Type of operation or #GNUNET_MESSENGER_OP_UNKNOWN | ||
89 | */ | ||
90 | enum GNUNET_MESSENGER_OperationType | ||
91 | get_store_operation_type (const struct GNUNET_MESSENGER_OperationStore *store, | ||
92 | const struct GNUNET_HashCode *hash); | ||
93 | |||
94 | /** | ||
95 | * Tries to use an operation under a given <i>hash</i> in a specific | ||
96 | * operation <i>store</i>. The operation will use the selected <i>type</i> | ||
97 | * if successful. The operation will be delayed by a given <i>delay</i>. | ||
98 | * | ||
99 | * If the selected type is #GNUNET_MESSENGER_OP_DELETE any active operation | ||
100 | * under the given hash will be stopped and replaced. | ||
101 | * | ||
102 | * If the new operation could be started successfully the method returns | ||
103 | * #GNUNET_OK, otherwise #GNUNET_SYSERR. | ||
104 | * | ||
105 | * @param[in/out] store Operation store | ||
106 | * @param[in] hash Hash of message | ||
107 | * @param[in] type Operation type | ||
108 | * @param[in] delay Delay | ||
109 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR | ||
110 | */ | ||
111 | int | ||
112 | use_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
113 | const struct GNUNET_HashCode *hash, | ||
114 | enum GNUNET_MESSENGER_OperationType type, | ||
115 | struct GNUNET_TIME_Relative delay); | ||
116 | |||
117 | /** | ||
118 | * Stops any active operation under a given <i>hash</i> in a specific | ||
119 | * operation <i>store</i>. | ||
120 | * | ||
121 | * Beware that calling this method will also implicitly free the memory | ||
122 | * of any active operation under the given hash! | ||
123 | * | ||
124 | * @param[in/out] store Operation store | ||
125 | * @param[in] hash Hash of message | ||
126 | */ | ||
127 | void | ||
128 | cancel_store_operation (struct GNUNET_MESSENGER_OperationStore *store, | ||
129 | const struct GNUNET_HashCode *hash); | ||
130 | |||
131 | #endif //GNUNET_SERVICE_MESSENGER_OPERATION_STORE_H | ||
diff --git a/src/messenger/gnunet-service-messenger_room.c b/src/messenger/gnunet-service-messenger_room.c index 7383e1d20..e8fe5b1f3 100644 --- a/src/messenger/gnunet-service-messenger_room.c +++ b/src/messenger/gnunet-service-messenger_room.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -25,10 +25,19 @@ | |||
25 | 25 | ||
26 | #include "gnunet-service-messenger_room.h" | 26 | #include "gnunet-service-messenger_room.h" |
27 | 27 | ||
28 | #include "gnunet-service-messenger_member.h" | ||
29 | #include "gnunet-service-messenger_member_session.h" | ||
30 | |||
28 | #include "gnunet-service-messenger_message_kind.h" | 31 | #include "gnunet-service-messenger_message_kind.h" |
32 | #include "gnunet-service-messenger_message_handle.h" | ||
33 | #include "gnunet-service-messenger_message_send.h" | ||
29 | 34 | ||
35 | #include "gnunet-service-messenger_operation.h" | ||
36 | |||
37 | #include "gnunet-service-messenger.h" | ||
30 | #include "gnunet-service-messenger_service.h" | 38 | #include "gnunet-service-messenger_service.h" |
31 | #include "gnunet-service-messenger_util.h" | 39 | #include "gnunet-service-messenger_tunnel.h" |
40 | #include "messenger_api_util.h" | ||
32 | 41 | ||
33 | static void | 42 | static void |
34 | idle_request_room_messages (void *cls); | 43 | idle_request_room_messages (void *cls); |
@@ -47,24 +56,21 @@ create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_Hash | |||
47 | GNUNET_memcpy(&(room->key), key, sizeof(struct GNUNET_HashCode)); | 56 | GNUNET_memcpy(&(room->key), key, sizeof(struct GNUNET_HashCode)); |
48 | 57 | ||
49 | room->tunnels = GNUNET_CONTAINER_multipeermap_create (8, GNUNET_NO); | 58 | room->tunnels = GNUNET_CONTAINER_multipeermap_create (8, GNUNET_NO); |
50 | room->members = GNUNET_CONTAINER_multishortmap_create (8, GNUNET_NO); | ||
51 | room->member_infos = GNUNET_CONTAINER_multishortmap_create (8, GNUNET_NO); | ||
52 | 59 | ||
53 | init_message_store (&(room->store)); | 60 | init_member_store(get_room_member_store(room), room); |
54 | room->requested = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 61 | init_message_store (get_room_message_store(room)); |
62 | init_operation_store(get_room_operation_store(room), room); | ||
55 | 63 | ||
56 | init_list_tunnels (&(room->basement)); | 64 | init_list_tunnels (&(room->basement)); |
57 | init_list_messages (&(room->last_messages)); | 65 | init_message_state(&(room->state)); |
58 | 66 | ||
59 | room->peer_message = NULL; | 67 | room->peer_message = NULL; |
60 | 68 | ||
61 | init_list_messages (&(room->handling)); | 69 | init_list_messages (&(room->handling)); |
62 | room->idle = NULL; | 70 | room->idle = NULL; |
63 | 71 | ||
64 | room->strict_access = GNUNET_NO; | ||
65 | |||
66 | if (room->service->dir) | 72 | if (room->service->dir) |
67 | load_service_room_and_messages (room->service, room); | 73 | load_room (room); |
68 | 74 | ||
69 | room->idle = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, idle_request_room_messages, room); | 75 | room->idle = GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_IDLE, idle_request_room_messages, room); |
70 | 76 | ||
@@ -79,34 +85,8 @@ iterate_destroy_tunnels (void *cls, const struct GNUNET_PeerIdentity *key, void | |||
79 | return GNUNET_YES; | 85 | return GNUNET_YES; |
80 | } | 86 | } |
81 | 87 | ||
82 | static int | 88 | static void |
83 | iterate_clear_members (void *cls, const struct GNUNET_ShortHashCode *key, void *value) | 89 | handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room); |
84 | { | ||
85 | struct GNUNET_MESSENGER_SrvContact *contact = value; | ||
86 | |||
87 | if (GNUNET_YES == decrease_contact_rc (contact)) | ||
88 | { | ||
89 | struct GNUNET_MESSENGER_SrvRoom *room = cls; | ||
90 | |||
91 | const struct GNUNET_HashCode *id = get_contact_id_from_key (contact); | ||
92 | |||
93 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (room->service->contacts, id, contact)) | ||
94 | destroy_contact (contact); | ||
95 | } | ||
96 | |||
97 | return GNUNET_YES; | ||
98 | } | ||
99 | |||
100 | static int | ||
101 | iterate_destroy_member_infos (void *cls, const struct GNUNET_ShortHashCode *key, void *value) | ||
102 | { | ||
103 | struct GNUNET_MESSENGER_MemberInfo *info = value; | ||
104 | |||
105 | clear_list_messages (&(info->session_messages)); | ||
106 | |||
107 | GNUNET_free(info); | ||
108 | return GNUNET_YES; | ||
109 | } | ||
110 | 90 | ||
111 | void | 91 | void |
112 | destroy_room (struct GNUNET_MESSENGER_SrvRoom *room) | 92 | destroy_room (struct GNUNET_MESSENGER_SrvRoom *room) |
@@ -123,29 +103,21 @@ destroy_room (struct GNUNET_MESSENGER_SrvRoom *room) | |||
123 | if (room->port) | 103 | if (room->port) |
124 | GNUNET_CADET_close_port (room->port); | 104 | GNUNET_CADET_close_port (room->port); |
125 | 105 | ||
126 | merge_room_last_messages (room, room->host); | 106 | GNUNET_CONTAINER_multipeermap_iterate (room->tunnels, iterate_destroy_tunnels, NULL); |
127 | |||
128 | GNUNET_CONTAINER_multipeermap_iterate (room->tunnels, iterate_destroy_tunnels, | ||
129 | NULL); | ||
130 | 107 | ||
131 | handle_room_messages (room); | 108 | handle_room_messages (room); |
132 | 109 | ||
133 | if (room->service->dir) | 110 | if (room->service->dir) |
134 | save_service_room_and_messages (room->service, room); | 111 | save_room (room); |
135 | |||
136 | GNUNET_CONTAINER_multishortmap_iterate (room->members, iterate_clear_members, room); | ||
137 | GNUNET_CONTAINER_multishortmap_iterate (room->member_infos, iterate_destroy_member_infos, NULL); | ||
138 | 112 | ||
139 | clear_message_store (&(room->store)); | 113 | clear_member_store (get_room_member_store(room)); |
140 | 114 | clear_message_store (get_room_message_store(room)); | |
141 | GNUNET_CONTAINER_multihashmap_destroy (room->requested); | 115 | clear_operation_store(get_room_operation_store(room)); |
142 | 116 | ||
143 | GNUNET_CONTAINER_multipeermap_destroy (room->tunnels); | 117 | GNUNET_CONTAINER_multipeermap_destroy (room->tunnels); |
144 | GNUNET_CONTAINER_multishortmap_destroy (room->members); | ||
145 | GNUNET_CONTAINER_multishortmap_destroy (room->member_infos); | ||
146 | 118 | ||
147 | clear_list_tunnels (&(room->basement)); | 119 | clear_list_tunnels (&(room->basement)); |
148 | clear_list_messages (&(room->last_messages)); | 120 | clear_message_state(&(room->state)); |
149 | 121 | ||
150 | if (room->peer_message) | 122 | if (room->peer_message) |
151 | GNUNET_free(room->peer_message); | 123 | GNUNET_free(room->peer_message); |
@@ -153,103 +125,38 @@ destroy_room (struct GNUNET_MESSENGER_SrvRoom *room) | |||
153 | GNUNET_free(room); | 125 | GNUNET_free(room); |
154 | } | 126 | } |
155 | 127 | ||
156 | struct GNUNET_MESSENGER_SrvContact* | 128 | struct GNUNET_MESSENGER_MemberStore* |
157 | get_room_contact (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id) | 129 | get_room_member_store (struct GNUNET_MESSENGER_SrvRoom *room) |
158 | { | 130 | { |
159 | GNUNET_assert((room) && (room->members)); | ||
160 | |||
161 | return GNUNET_CONTAINER_multishortmap_get (room->members, id); | ||
162 | } | ||
163 | |||
164 | void | ||
165 | add_room_contact (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id, | ||
166 | const struct GNUNET_IDENTITY_PublicKey *pubkey) | ||
167 | { | ||
168 | struct GNUNET_MESSENGER_SrvContact *contact = get_service_contact_by_pubkey (room->service, pubkey); | ||
169 | |||
170 | if (GNUNET_OK == GNUNET_CONTAINER_multishortmap_put (room->members, id, contact, | ||
171 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
172 | increase_contact_rc (contact); | ||
173 | } | ||
174 | |||
175 | struct GNUNET_MESSENGER_MemberInfo* | ||
176 | get_room_member_info (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id) | ||
177 | { | ||
178 | GNUNET_assert((room) && (room->member_infos)); | ||
179 | |||
180 | return GNUNET_CONTAINER_multishortmap_get (room->member_infos, id); | ||
181 | } | ||
182 | |||
183 | struct GNUNET_ShortHashCode* | ||
184 | generate_room_member_id (const struct GNUNET_MESSENGER_SrvRoom *room) | ||
185 | { | ||
186 | struct GNUNET_ShortHashCode *unique_id = GNUNET_new(struct GNUNET_ShortHashCode); | ||
187 | |||
188 | GNUNET_assert(room); | 131 | GNUNET_assert(room); |
189 | 132 | ||
190 | if (GNUNET_YES == generate_free_member_id (unique_id, room->members)) | 133 | return &(room->member_store); |
191 | return unique_id; | ||
192 | else | ||
193 | { | ||
194 | GNUNET_free(unique_id); | ||
195 | return NULL; | ||
196 | } | ||
197 | } | 134 | } |
198 | 135 | ||
199 | const struct GNUNET_ShortHashCode* | 136 | struct GNUNET_MESSENGER_MessageStore* |
200 | get_room_host_id (const struct GNUNET_MESSENGER_SrvRoom *room) | 137 | get_room_message_store (struct GNUNET_MESSENGER_SrvRoom *room) |
201 | { | 138 | { |
202 | GNUNET_assert(room); | 139 | GNUNET_assert(room); |
203 | 140 | ||
204 | return get_handle_member_id (room->host, &(room->key)); | 141 | return &(room->message_store); |
205 | } | 142 | } |
206 | 143 | ||
207 | void | 144 | struct GNUNET_MESSENGER_OperationStore* |
208 | change_room_host_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *unique_id) | 145 | get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room) |
209 | { | 146 | { |
210 | GNUNET_assert(room); | 147 | GNUNET_assert(room); |
211 | 148 | ||
212 | change_handle_member_id (room->host, &(room->key), unique_id); | 149 | return &(room->operation_store); |
213 | } | 150 | } |
214 | 151 | ||
215 | static int | 152 | static int |
216 | send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 153 | send_room_info (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
217 | struct GNUNET_MESSENGER_SrvTunnel *tunnel) | 154 | struct GNUNET_MESSENGER_SrvTunnel *tunnel) |
218 | { | 155 | { |
219 | if (!handle) | 156 | if ((!handle) || (!is_tunnel_connected (tunnel))) |
220 | return GNUNET_NO; | 157 | return GNUNET_NO; |
221 | 158 | ||
222 | merge_room_last_messages (room, handle); | 159 | return send_tunnel_message (tunnel, handle, create_message_info (get_handle_ego (handle))); |
223 | |||
224 | if (!is_tunnel_connected (tunnel)) | ||
225 | return GNUNET_NO; | ||
226 | |||
227 | struct GNUNET_MESSENGER_Message *message = create_message_info (get_handle_ego(handle), room->members); | ||
228 | |||
229 | if (!message) | ||
230 | return GNUNET_NO; | ||
231 | |||
232 | if ((tunnel->peer_message) && (tunnel->contact_id)) | ||
233 | { | ||
234 | GNUNET_memcpy(&(message->body.info.unique_id), &(tunnel->contact_id), sizeof(struct GNUNET_ShortHashCode)); | ||
235 | GNUNET_free(tunnel->contact_id); | ||
236 | |||
237 | tunnel->contact_id = NULL; | ||
238 | } | ||
239 | |||
240 | struct GNUNET_HashCode hash; | ||
241 | |||
242 | send_tunnel_message (tunnel, handle, message, &hash); | ||
243 | destroy_message (message); | ||
244 | |||
245 | if (tunnel->contact_id) | ||
246 | { | ||
247 | GNUNET_free(tunnel->contact_id); | ||
248 | |||
249 | tunnel->contact_id = NULL; | ||
250 | } | ||
251 | |||
252 | return GNUNET_YES; | ||
253 | } | 160 | } |
254 | 161 | ||
255 | static void* | 162 | static void* |
@@ -257,63 +164,51 @@ callback_room_connect (void *cls, struct GNUNET_CADET_Channel *channel, const st | |||
257 | { | 164 | { |
258 | struct GNUNET_MESSENGER_SrvRoom *room = cls; | 165 | struct GNUNET_MESSENGER_SrvRoom *room = cls; |
259 | 166 | ||
260 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = GNUNET_CONTAINER_multipeermap_get (room->tunnels, source); | 167 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = create_tunnel (room, source); |
261 | 168 | ||
262 | if (tunnel) | 169 | if ((tunnel) && |
170 | (GNUNET_OK != GNUNET_CONTAINER_multipeermap_put (room->tunnels, source, tunnel, | ||
171 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE))) | ||
263 | { | 172 | { |
264 | if (GNUNET_YES == bind_tunnel (tunnel, channel)) | 173 | destroy_tunnel (tunnel); |
265 | { | 174 | tunnel = NULL; |
266 | if (GNUNET_YES == send_room_info (room, room->host, tunnel)) | ||
267 | return tunnel; | ||
268 | else | ||
269 | { | ||
270 | disconnect_tunnel (tunnel); | ||
271 | return NULL; | ||
272 | } | ||
273 | } | ||
274 | else | ||
275 | { | ||
276 | delayed_disconnect_channel (channel); | ||
277 | return NULL; | ||
278 | } | ||
279 | } | 175 | } |
280 | else | 176 | |
177 | if (!tunnel) | ||
281 | { | 178 | { |
282 | tunnel = create_tunnel (room, source); | 179 | delayed_disconnect_channel (channel); |
180 | return NULL; | ||
181 | } | ||
283 | 182 | ||
284 | if ((GNUNET_YES == bind_tunnel (tunnel, channel)) && (GNUNET_OK | 183 | bind_tunnel(tunnel, channel); |
285 | == GNUNET_CONTAINER_multipeermap_put (room->tunnels, source, tunnel, | ||
286 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | ||
287 | { | ||
288 | if (GNUNET_YES == send_room_info (room, room->host, tunnel)) | ||
289 | return tunnel; | ||
290 | else | ||
291 | { | ||
292 | GNUNET_CONTAINER_multipeermap_remove (room->tunnels, source, tunnel); | ||
293 | 184 | ||
294 | disconnect_tunnel (tunnel); | 185 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "New tunnel in room (%s) established to peer: %s\n", |
295 | destroy_tunnel (tunnel); | 186 | GNUNET_h2s(get_room_key(room)), GNUNET_i2s (source)); |
296 | return NULL; | ||
297 | } | ||
298 | } | ||
299 | else | ||
300 | { | ||
301 | tunnel->channel = NULL; | ||
302 | destroy_tunnel (tunnel); | ||
303 | 187 | ||
304 | delayed_disconnect_channel (channel); | 188 | if (GNUNET_YES == send_room_info (room, room->host, tunnel)) |
305 | return NULL; | 189 | return tunnel; |
306 | } | 190 | |
307 | } | 191 | disconnect_tunnel (tunnel); |
192 | |||
193 | if (GNUNET_YES == GNUNET_CONTAINER_multipeermap_remove (room->tunnels, source, tunnel)) | ||
194 | destroy_tunnel (tunnel); | ||
195 | |||
196 | return NULL; | ||
308 | } | 197 | } |
309 | 198 | ||
310 | static int | 199 | static int |
311 | join_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 200 | join_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
312 | const struct GNUNET_ShortHashCode *member_id) | 201 | struct GNUNET_MESSENGER_Member *member) |
313 | { | 202 | { |
314 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Joining room: %s (%s)\n", GNUNET_h2s(get_room_key(room)), GNUNET_sh2s(member_id)); | 203 | GNUNET_assert((room) && (handle) && (member)); |
315 | 204 | ||
316 | struct GNUNET_MESSENGER_Message *message = create_message_join (get_handle_ego(handle)); | 205 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Joining room: %s (%s)\n", GNUNET_h2s (get_room_key (room)), |
206 | GNUNET_sh2s (get_member_id(member))); | ||
207 | |||
208 | if (GNUNET_OK != change_handle_member_id (handle, get_room_key(room), get_member_id(member))) | ||
209 | return GNUNET_NO; | ||
210 | |||
211 | struct GNUNET_MESSENGER_Message *message = create_message_join (get_handle_ego (handle)); | ||
317 | 212 | ||
318 | if (!message) | 213 | if (!message) |
319 | { | 214 | { |
@@ -322,48 +217,97 @@ join_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHan | |||
322 | return GNUNET_NO; | 217 | return GNUNET_NO; |
323 | } | 218 | } |
324 | 219 | ||
325 | struct GNUNET_HashCode hash; | 220 | return send_room_message (room, handle, message); |
221 | } | ||
326 | 222 | ||
327 | send_room_message (room, handle, message, &hash); | 223 | struct GNUNET_MESSENGER_MemberNotify |
328 | destroy_message (message); | 224 | { |
225 | struct GNUNET_MESSENGER_SrvRoom *room; | ||
226 | struct GNUNET_MESSENGER_SrvHandle *handle; | ||
227 | struct GNUNET_MESSENGER_MemberSession *session; | ||
228 | }; | ||
329 | 229 | ||
330 | struct GNUNET_MESSENGER_MemberInfo *info = GNUNET_new(struct GNUNET_MESSENGER_MemberInfo); | 230 | static void |
231 | notify_about_members (struct GNUNET_MESSENGER_MemberNotify *notify, struct GNUNET_MESSENGER_MemberSession *session, | ||
232 | struct GNUNET_CONTAINER_MultiHashMap *map, int check_permission) | ||
233 | { | ||
234 | if (session->prev) | ||
235 | notify_about_members (notify, session->prev, map, GNUNET_YES); | ||
331 | 236 | ||
332 | info->access = GNUNET_MESSENGER_MEMBER_ALLOWED; | 237 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(notify->room); |
333 | init_list_messages (&(info->session_messages)); | 238 | struct GNUNET_MESSENGER_ListMessage *element; |
334 | 239 | ||
335 | if (GNUNET_YES == GNUNET_CONTAINER_multishortmap_put (room->member_infos, member_id, info, | 240 | for (element = session->messages.head; element; element = element->next) |
336 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
337 | { | 241 | { |
338 | change_handle_member_id (handle, &(room->key), member_id); | 242 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains(map, &(element->hash))) |
243 | continue; | ||
339 | 244 | ||
340 | add_to_list_messages (&(info->session_messages), &hash); | 245 | if ((GNUNET_YES == check_permission) && |
341 | return GNUNET_YES; | 246 | (GNUNET_YES != check_member_session_history(notify->session, &(element->hash), GNUNET_NO))) |
342 | } | 247 | continue; |
343 | else | ||
344 | { | ||
345 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Your member information could not be registered!\n"); | ||
346 | 248 | ||
347 | GNUNET_free(info); | 249 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put(map, &(element->hash), NULL, |
348 | return GNUNET_NO; | 250 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
251 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Notification of session message could be duplicated!\n"); | ||
252 | |||
253 | const struct GNUNET_MESSENGER_Message *message = get_store_message(message_store, &(element->hash)); | ||
254 | |||
255 | if (message) | ||
256 | notify_handle_message (notify->handle, get_room_key(notify->room), session, message, &(element->hash)); | ||
349 | } | 257 | } |
350 | } | 258 | } |
351 | 259 | ||
352 | static int | 260 | static int |
261 | iterate_notify_about_members (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, | ||
262 | struct GNUNET_MESSENGER_MemberSession *session) | ||
263 | { | ||
264 | struct GNUNET_MESSENGER_MemberNotify *notify = cls; | ||
265 | |||
266 | if ((notify->session == session) || (GNUNET_YES == is_member_session_completed(session))) | ||
267 | return GNUNET_YES; | ||
268 | |||
269 | struct GNUNET_CONTAINER_MultiHashMap *map = GNUNET_CONTAINER_multihashmap_create(4, GNUNET_NO); | ||
270 | |||
271 | notify_about_members (notify, session, map, GNUNET_NO); | ||
272 | |||
273 | GNUNET_CONTAINER_multihashmap_destroy(map); | ||
274 | return GNUNET_YES; | ||
275 | } | ||
276 | |||
277 | static int | ||
353 | join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) | 278 | join_room_locally (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) |
354 | { | 279 | { |
355 | const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (handle, &(room->key)); | 280 | const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (handle, get_room_key(room)); |
281 | |||
282 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); | ||
283 | struct GNUNET_MESSENGER_Member *member = add_store_member(member_store, member_id); | ||
284 | |||
285 | if (GNUNET_NO == join_room (room, handle, member)) | ||
286 | return GNUNET_NO; | ||
356 | 287 | ||
357 | struct GNUNET_MESSENGER_MemberInfo *info = GNUNET_CONTAINER_multishortmap_get (room->member_infos, member_id); | 288 | const struct GNUNET_MESSENGER_Ego *ego = get_handle_ego(handle); |
289 | struct GNUNET_MESSENGER_MemberSession *session = get_member_session (member, &(ego->pub)); | ||
358 | 290 | ||
359 | if ((!info) && (GNUNET_NO == join_room (room, handle, member_id))) | 291 | if (!session) |
292 | { | ||
293 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "A valid session is required to join a room!\n"); | ||
360 | return GNUNET_NO; | 294 | return GNUNET_NO; |
295 | } | ||
296 | |||
297 | struct GNUNET_MESSENGER_MemberNotify notify; | ||
298 | |||
299 | notify.room = room; | ||
300 | notify.handle = handle; | ||
301 | notify.session = session; | ||
302 | |||
303 | iterate_store_members(get_room_member_store(room), iterate_notify_about_members, ¬ify); | ||
361 | 304 | ||
362 | return GNUNET_YES; | 305 | return GNUNET_YES; |
363 | } | 306 | } |
364 | 307 | ||
365 | extern int | 308 | extern int |
366 | check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); | 309 | check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); |
310 | |||
367 | extern void | 311 | extern void |
368 | handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); | 312 | handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header); |
369 | 313 | ||
@@ -373,24 +317,39 @@ callback_tunnel_disconnect (void *cls, const struct GNUNET_CADET_Channel *channe | |||
373 | int | 317 | int |
374 | open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) | 318 | open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) |
375 | { | 319 | { |
320 | GNUNET_assert((room) && (handle)); | ||
321 | |||
376 | if (room->port) | 322 | if (room->port) |
377 | return join_room_locally (room, handle); | 323 | return join_room_locally (room, handle); |
378 | 324 | ||
379 | struct GNUNET_CADET_Handle *cadet = get_room_cadet (room); | 325 | struct GNUNET_CADET_Handle *cadet = get_room_cadet (room); |
380 | struct GNUNET_HashCode *key = get_room_key (room); | 326 | const struct GNUNET_HashCode *key = get_room_key (room); |
381 | 327 | ||
382 | struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size(tunnel_message, GNUNET_MESSAGE_TYPE_CADET_CLI, | 328 | struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size(tunnel_message, GNUNET_MESSAGE_TYPE_CADET_CLI, |
383 | struct GNUNET_MessageHeader, NULL), | 329 | struct GNUNET_MessageHeader, NULL), |
384 | GNUNET_MQ_handler_end() }; | 330 | GNUNET_MQ_handler_end() }; |
385 | 331 | ||
386 | room->port = GNUNET_CADET_open_port (cadet, key, callback_room_connect, room, NULL, | 332 | room->port = GNUNET_CADET_open_port (cadet, key, callback_room_connect, room, NULL, callback_tunnel_disconnect, |
387 | callback_tunnel_disconnect, handlers); | 333 | handlers); |
334 | |||
335 | if (room->port) | ||
336 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Port of room (%s) was opened!\n", | ||
337 | GNUNET_h2s(get_room_key(room))); | ||
338 | else | ||
339 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Port of room (%s) could not be opened!\n", | ||
340 | GNUNET_h2s(get_room_key(room))); | ||
341 | |||
342 | const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (handle, get_room_key(room)); | ||
343 | |||
344 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); | ||
345 | struct GNUNET_MESSENGER_Member *member = get_store_member(member_store, member_id); | ||
388 | 346 | ||
389 | const struct GNUNET_ShortHashCode *member_id = get_handle_member_id (handle, &(room->key)); | 347 | if (member) |
348 | goto exit_open_room; | ||
390 | 349 | ||
391 | struct GNUNET_MESSENGER_MemberInfo *info = GNUNET_CONTAINER_multishortmap_get (room->member_infos, member_id); | 350 | member = add_store_member(member_store, member_id); |
392 | 351 | ||
393 | if ((!info) && (GNUNET_NO == join_room (room, handle, member_id)) && (room->port)) | 352 | if ((GNUNET_NO == join_room (room, handle, member)) && (room->port)) |
394 | { | 353 | { |
395 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "You could not join the room, therefore it keeps closed!\n"); | 354 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "You could not join the room, therefore it keeps closed!\n"); |
396 | 355 | ||
@@ -400,111 +359,62 @@ open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHan | |||
400 | return GNUNET_NO; | 359 | return GNUNET_NO; |
401 | } | 360 | } |
402 | 361 | ||
403 | struct GNUNET_MESSENGER_Message *message = create_message_peer (room->service); | 362 | exit_open_room: |
404 | 363 | return (room->port ? send_room_message (room, handle, create_message_peer (room->service)) : GNUNET_NO); | |
405 | if (message) | ||
406 | { | ||
407 | struct GNUNET_HashCode hash; | ||
408 | |||
409 | send_room_message (room, handle, message, &hash); | ||
410 | destroy_message (message); | ||
411 | } | ||
412 | |||
413 | return (room->port ? GNUNET_YES : GNUNET_NO); | ||
414 | } | 364 | } |
415 | 365 | ||
416 | int | 366 | int |
417 | entry_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 367 | enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
418 | const struct GNUNET_PeerIdentity *door) | 368 | const struct GNUNET_PeerIdentity *door) |
419 | { | 369 | { |
420 | if (room->peer_message) | 370 | GNUNET_assert((room) && (handle) && (door)); |
421 | { | ||
422 | const struct GNUNET_MESSENGER_Message *msg = get_room_message (room, handle, room->peer_message, GNUNET_NO); | ||
423 | 371 | ||
424 | if (0 == GNUNET_memcmp(&(msg->body.peer.peer), door)) | 372 | struct GNUNET_PeerIdentity peer; |
425 | return join_room_locally (room, handle); | 373 | |
426 | } | 374 | if ((GNUNET_OK == get_service_peer_identity (room->service, &peer)) && |
375 | (0 == GNUNET_memcmp(&peer, door))) | ||
376 | return join_room_locally (room, handle); | ||
427 | 377 | ||
428 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = GNUNET_CONTAINER_multipeermap_get (room->tunnels, door); | 378 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = GNUNET_CONTAINER_multipeermap_get (room->tunnels, door); |
429 | 379 | ||
430 | if (tunnel) | 380 | if (!tunnel) |
431 | { | 381 | { |
432 | switch (connect_tunnel (tunnel)) | 382 | tunnel = create_tunnel (room, door); |
383 | |||
384 | if (GNUNET_OK != GNUNET_CONTAINER_multipeermap_put (room->tunnels, door, tunnel, | ||
385 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)) | ||
433 | { | 386 | { |
434 | case GNUNET_YES: | 387 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "You could not connect to that door!\n"); |
435 | return GNUNET_YES; | 388 | destroy_tunnel (tunnel); |
436 | case GNUNET_NO: | ||
437 | return join_room_locally (room, handle); | ||
438 | default: | ||
439 | return GNUNET_NO; | 389 | return GNUNET_NO; |
440 | } | 390 | } |
441 | } | 391 | } |
442 | 392 | ||
443 | tunnel = create_tunnel (room, door); | 393 | if (GNUNET_SYSERR == connect_tunnel (tunnel)) |
444 | |||
445 | if ((GNUNET_YES == connect_tunnel (tunnel)) && | ||
446 | (GNUNET_OK == GNUNET_CONTAINER_multipeermap_put (room->tunnels, door, tunnel, | ||
447 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | ||
448 | return GNUNET_YES; | ||
449 | else | ||
450 | { | 394 | { |
451 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "You could not connect to that door!\n"); | 395 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Connection failure during entrance!\n"); |
452 | 396 | GNUNET_CONTAINER_multipeermap_remove (room->tunnels, door, tunnel); | |
453 | destroy_tunnel (tunnel); | 397 | destroy_tunnel (tunnel); |
454 | return GNUNET_NO; | 398 | return GNUNET_NO; |
455 | } | 399 | } |
456 | } | ||
457 | |||
458 | struct GNUNET_MESSENGER_SrvTunnelFinder | ||
459 | { | ||
460 | const struct GNUNET_ShortHashCode *needle; | ||
461 | struct GNUNET_MESSENGER_SrvTunnel *tunnel; | ||
462 | }; | ||
463 | |||
464 | static int | ||
465 | iterate_find_tunnel (void *cls, const struct GNUNET_PeerIdentity *peer, void *value) | ||
466 | { | ||
467 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = value; | ||
468 | struct GNUNET_MESSENGER_SrvTunnelFinder *finder = cls; | ||
469 | |||
470 | if ((tunnel->contact_id) && (0 == GNUNET_memcmp(tunnel->contact_id, finder->needle))) | ||
471 | { | ||
472 | finder->tunnel = tunnel; | ||
473 | return GNUNET_NO; | ||
474 | } | ||
475 | |||
476 | return GNUNET_YES; | ||
477 | } | ||
478 | |||
479 | struct GNUNET_MESSENGER_SrvTunnel* | ||
480 | find_room_tunnel_to (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *contact_id) | ||
481 | { | ||
482 | struct GNUNET_MESSENGER_SrvTunnelFinder finder; | ||
483 | |||
484 | finder.needle = contact_id; | ||
485 | finder.tunnel = NULL; | ||
486 | |||
487 | GNUNET_CONTAINER_multipeermap_iterate (room->tunnels, iterate_find_tunnel, &finder); | ||
488 | 400 | ||
489 | return finder.tunnel; | 401 | return join_room_locally (room, handle); |
490 | } | 402 | } |
491 | 403 | ||
492 | struct GNUNET_MQ_Envelope* | 404 | struct GNUNET_MQ_Envelope* |
493 | pack_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 405 | pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, |
494 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode) | 406 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode) |
495 | { | 407 | { |
408 | GNUNET_assert((room) && (handle) && (message) && (hash)); | ||
409 | |||
496 | message->header.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); | 410 | message->header.timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); |
497 | 411 | ||
498 | const struct GNUNET_ShortHashCode *id = get_handle_member_id (handle, &(room->key)); | 412 | const struct GNUNET_ShortHashCode *id = get_handle_member_id (handle, get_room_key(room)); |
499 | 413 | ||
500 | GNUNET_assert(id); | 414 | GNUNET_assert(id); |
501 | 415 | ||
502 | GNUNET_memcpy(&(message->header.sender_id), id, sizeof(struct GNUNET_ShortHashCode)); | 416 | GNUNET_memcpy(&(message->header.sender_id), id, sizeof(struct GNUNET_ShortHashCode)); |
503 | 417 | get_message_state_chain_hash (&(room->state), &(message->header.previous)); | |
504 | if (room->last_messages.head) | ||
505 | GNUNET_memcpy(&(message->header.previous), &(room->last_messages.head->hash), sizeof(struct GNUNET_HashCode)); | ||
506 | else | ||
507 | memset (&(message->header.previous), 0, sizeof(struct GNUNET_HashCode)); | ||
508 | 418 | ||
509 | return pack_message (message, hash, get_handle_ego (handle), mode); | 419 | return pack_message (message, hash, get_handle_ego (handle), mode); |
510 | } | 420 | } |
@@ -524,7 +434,8 @@ iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, voi | |||
524 | { | 434 | { |
525 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = value; | 435 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = value; |
526 | 436 | ||
527 | if ((!is_tunnel_connected (tunnel)) || (!tunnel->contact_id)) | 437 | if ((!is_tunnel_connected (tunnel)) || |
438 | (get_tunnel_messenger_version(tunnel) < GNUNET_MESSENGER_VERSION)) | ||
528 | return GNUNET_YES; | 439 | return GNUNET_YES; |
529 | 440 | ||
530 | struct GNUNET_MESSENGER_ClosureSendRoom *closure = cls; | 441 | struct GNUNET_MESSENGER_ClosureSendRoom *closure = cls; |
@@ -540,80 +451,91 @@ iterate_send_room_message (void *cls, const struct GNUNET_PeerIdentity *key, voi | |||
540 | GNUNET_MESSENGER_PACK_MODE_ENVELOPE); | 451 | GNUNET_MESSENGER_PACK_MODE_ENVELOPE); |
541 | 452 | ||
542 | if (env) | 453 | if (env) |
543 | { | ||
544 | closure->message = copy_message (closure->message); | ||
545 | closure->packed = GNUNET_YES; | 454 | closure->packed = GNUNET_YES; |
546 | } | ||
547 | } | 455 | } |
548 | else | 456 | else |
549 | { | 457 | env = pack_message (closure->message, NULL, NULL, GNUNET_MESSENGER_PACK_MODE_ENVELOPE); |
550 | env = pack_message (closure->message, NULL, NULL, | ||
551 | GNUNET_MESSENGER_PACK_MODE_ENVELOPE); | ||
552 | } | ||
553 | 458 | ||
554 | if (env) | 459 | if (env) |
555 | send_tunnel_envelope (tunnel, closure->handle, env, closure->message, closure->hash); | 460 | send_tunnel_envelope (tunnel, env, closure->hash); |
556 | 461 | ||
557 | return GNUNET_YES; | 462 | return GNUNET_YES; |
558 | } | 463 | } |
559 | 464 | ||
560 | void | 465 | int |
561 | callback_room_sent (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, void *cls, | 466 | update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, |
562 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 467 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
563 | 468 | ||
564 | void | 469 | void |
470 | callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
471 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
472 | |||
473 | int | ||
565 | send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 474 | send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
566 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash) | 475 | struct GNUNET_MESSENGER_Message *message) |
567 | { | 476 | { |
568 | struct GNUNET_MESSENGER_ClosureSendRoom closure; | 477 | GNUNET_assert((room) && (handle)); |
569 | 478 | ||
570 | closure.room = room; | 479 | if (!message) |
571 | closure.handle = handle; | 480 | return GNUNET_NO; |
572 | closure.exclude = NULL; | ||
573 | closure.message = message; | ||
574 | closure.hash = hash; | ||
575 | closure.packed = GNUNET_NO; | ||
576 | |||
577 | GNUNET_CONTAINER_multipeermap_iterate (room->tunnels, iterate_send_room_message, &closure); | ||
578 | 481 | ||
579 | if ((GNUNET_NO == closure.packed) && (closure.message == message)) | 482 | if (GNUNET_YES == is_message_session_bound(message)) |
580 | { | 483 | merge_room_last_messages(room, handle); |
581 | pack_room_message (room, handle, message, hash, | ||
582 | GNUNET_MESSENGER_PACK_MODE_UNKNOWN); | ||
583 | 484 | ||
584 | callback_room_sent (room, handle, NULL, copy_message (message), hash); | 485 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Sending message from handle with member id: %s\n", |
585 | } | 486 | GNUNET_sh2s(get_handle_member_id(handle, get_room_key(room)))); |
586 | } | ||
587 | 487 | ||
588 | void | 488 | struct GNUNET_HashCode hash; |
589 | send_room_message_ext (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | ||
590 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, | ||
591 | struct GNUNET_MESSENGER_SrvTunnel *tunnel) | ||
592 | { | ||
593 | struct GNUNET_MESSENGER_ClosureSendRoom closure; | 489 | struct GNUNET_MESSENGER_ClosureSendRoom closure; |
594 | 490 | ||
595 | closure.room = room; | 491 | closure.room = room; |
596 | closure.handle = handle; | 492 | closure.handle = handle; |
597 | closure.exclude = tunnel; | 493 | closure.exclude = NULL; |
598 | closure.message = message; | 494 | closure.message = message; |
599 | closure.hash = hash; | 495 | closure.hash = &hash; |
600 | closure.packed = GNUNET_NO; | 496 | closure.packed = GNUNET_NO; |
601 | 497 | ||
602 | GNUNET_CONTAINER_multipeermap_iterate (room->tunnels, iterate_send_room_message, &closure); | 498 | GNUNET_CONTAINER_multipeermap_iterate (room->tunnels, iterate_send_room_message, &closure); |
603 | 499 | ||
604 | if ((GNUNET_NO == closure.packed) && (closure.message == message)) | 500 | if (GNUNET_NO == closure.packed) |
605 | { | 501 | pack_room_message (room, handle, message, &hash, GNUNET_MESSENGER_PACK_MODE_UNKNOWN); |
606 | pack_room_message (room, handle, message, hash, | 502 | |
607 | GNUNET_MESSENGER_PACK_MODE_UNKNOWN); | 503 | const int new_message = update_room_message (room, message, &hash); |
504 | |||
505 | if (GNUNET_YES != new_message) | ||
506 | return GNUNET_SYSERR; | ||
608 | 507 | ||
609 | callback_room_sent (room, handle, NULL, copy_message (message), hash); | 508 | switch (message->header.kind) |
509 | { | ||
510 | case GNUNET_MESSENGER_KIND_JOIN: | ||
511 | send_message_join (room, handle, message, &hash); | ||
512 | break; | ||
513 | case GNUNET_MESSENGER_KIND_PEER: | ||
514 | send_message_peer (room, handle, message, &hash); | ||
515 | break; | ||
516 | case GNUNET_MESSENGER_KIND_ID: | ||
517 | send_message_id (room, handle, message, &hash); | ||
518 | break; | ||
519 | case GNUNET_MESSENGER_KIND_REQUEST: | ||
520 | send_message_request (room, handle, message, &hash); | ||
521 | break; | ||
522 | default: | ||
523 | break; | ||
610 | } | 524 | } |
525 | |||
526 | callback_room_handle_message (room, handle, message, &hash); | ||
527 | return GNUNET_YES; | ||
611 | } | 528 | } |
612 | 529 | ||
613 | void | 530 | void |
614 | forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 531 | forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
615 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 532 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
616 | { | 533 | { |
534 | GNUNET_assert((room) && (tunnel)); | ||
535 | |||
536 | if (!message) | ||
537 | return; | ||
538 | |||
617 | struct GNUNET_MESSENGER_ClosureSendRoom closure; | 539 | struct GNUNET_MESSENGER_ClosureSendRoom closure; |
618 | struct GNUNET_HashCode message_hash; | 540 | struct GNUNET_HashCode message_hash; |
619 | 541 | ||
@@ -622,7 +544,7 @@ forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE | |||
622 | closure.room = room; | 544 | closure.room = room; |
623 | closure.handle = NULL; | 545 | closure.handle = NULL; |
624 | closure.exclude = tunnel; | 546 | closure.exclude = tunnel; |
625 | closure.message = copy_message (message); | 547 | closure.message = message; |
626 | closure.hash = &message_hash; | 548 | closure.hash = &message_hash; |
627 | closure.packed = GNUNET_YES; | 549 | closure.packed = GNUNET_YES; |
628 | 550 | ||
@@ -630,76 +552,196 @@ forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSE | |||
630 | } | 552 | } |
631 | 553 | ||
632 | void | 554 | void |
555 | check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel) | ||
556 | { | ||
557 | if (!room->peer_message) | ||
558 | return; | ||
559 | |||
560 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); | ||
561 | |||
562 | const struct GNUNET_MESSENGER_Message *message = get_store_message(message_store, room->peer_message); | ||
563 | |||
564 | if (!message) | ||
565 | { | ||
566 | GNUNET_free(room->peer_message); | ||
567 | room->peer_message = NULL; | ||
568 | return; | ||
569 | } | ||
570 | |||
571 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); | ||
572 | struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); | ||
573 | |||
574 | if (!member) | ||
575 | goto resend_peer_message; | ||
576 | |||
577 | struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of(member, message, room->peer_message); | ||
578 | |||
579 | if (GNUNET_YES == is_member_session_closed(session)) | ||
580 | goto resend_peer_message; | ||
581 | |||
582 | if (tunnel) | ||
583 | forward_tunnel_message(tunnel, message, room->peer_message); | ||
584 | |||
585 | return; | ||
586 | |||
587 | resend_peer_message: | ||
588 | if (room->host) | ||
589 | send_room_message (room, room->host, create_message_peer (room->service)); | ||
590 | } | ||
591 | |||
592 | void | ||
633 | merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) | 593 | merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle) |
634 | { | 594 | { |
595 | GNUNET_assert(room); | ||
596 | |||
635 | if (!handle) | 597 | if (!handle) |
636 | return; | 598 | return; |
637 | 599 | ||
638 | if (!room->last_messages.head) | 600 | const struct GNUNET_HashCode *hash; |
601 | |||
602 | merge_next: | ||
603 | hash = get_message_state_merge_hash (&(room->state)); | ||
604 | |||
605 | if (!hash) | ||
639 | return; | 606 | return; |
640 | 607 | ||
641 | while (room->last_messages.head != room->last_messages.tail) | 608 | send_room_message (room, handle, create_message_merge (hash)); |
609 | goto merge_next; | ||
610 | } | ||
611 | |||
612 | void | ||
613 | callback_room_deletion (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) | ||
614 | { | ||
615 | if (GNUNET_OK != delete_store_message (get_room_message_store(room), hash)) | ||
642 | { | 616 | { |
643 | struct GNUNET_MESSENGER_ListMessage *element = room->last_messages.tail; | 617 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Deletion of message failed! (%s)\n", GNUNET_h2s(hash)); |
618 | return; | ||
619 | } | ||
620 | } | ||
644 | 621 | ||
645 | struct GNUNET_MESSENGER_Message *message = create_message_merge (&(element->hash)); | 622 | void |
623 | callback_room_merge (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) | ||
624 | { | ||
625 | if (!room->host) | ||
626 | return; | ||
646 | 627 | ||
647 | if (message) | 628 | send_room_message (room, room->host, create_message_merge (hash)); |
648 | { | 629 | } |
649 | struct GNUNET_HashCode hash; | ||
650 | 630 | ||
651 | send_room_message (room, handle, message, &hash); | 631 | int |
652 | destroy_message (message); | 632 | delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, |
653 | } | 633 | const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay) |
634 | { | ||
635 | GNUNET_assert((room) && (session) && (hash)); | ||
654 | 636 | ||
655 | if (element->prev) | 637 | const struct GNUNET_TIME_Relative forever = GNUNET_TIME_relative_get_forever_ (); |
656 | GNUNET_CONTAINER_DLL_remove(room->last_messages.head, room->last_messages.tail, element); | 638 | |
639 | if (0 == GNUNET_memcmp(&forever, &delay)) | ||
640 | { | ||
641 | GNUNET_log(GNUNET_ERROR_TYPE_INFO, "Deletion is delayed forever: operation is impossible!\n"); | ||
642 | return GNUNET_SYSERR; | ||
657 | } | 643 | } |
644 | |||
645 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); | ||
646 | |||
647 | const struct GNUNET_MESSENGER_Message *message = get_store_message(message_store, hash); | ||
648 | |||
649 | if (!message) | ||
650 | return GNUNET_YES; | ||
651 | |||
652 | if (GNUNET_YES != check_member_session_history(session, hash, GNUNET_YES)) | ||
653 | { | ||
654 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Unpermitted request for deletion by member (%s) of message (%s)!\n", | ||
655 | GNUNET_sh2s(get_member_session_id(session)), GNUNET_h2s(hash)); | ||
656 | |||
657 | return GNUNET_NO; | ||
658 | } | ||
659 | |||
660 | struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room); | ||
661 | |||
662 | if (GNUNET_OK != use_store_operation(operation_store, hash, GNUNET_MESSENGER_OP_DELETE, delay)) | ||
663 | { | ||
664 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Deletion has failed: operation denied!\n"); | ||
665 | return GNUNET_SYSERR; | ||
666 | } | ||
667 | |||
668 | return GNUNET_YES; | ||
658 | } | 669 | } |
659 | 670 | ||
660 | struct GNUNET_CADET_Handle* | 671 | struct GNUNET_CADET_Handle* |
661 | get_room_cadet (struct GNUNET_MESSENGER_SrvRoom *room) | 672 | get_room_cadet (struct GNUNET_MESSENGER_SrvRoom *room) |
662 | { | 673 | { |
674 | GNUNET_assert(room); | ||
675 | |||
663 | return room->service->cadet; | 676 | return room->service->cadet; |
664 | } | 677 | } |
665 | 678 | ||
666 | struct GNUNET_HashCode* | 679 | const struct GNUNET_HashCode* |
667 | get_room_key (struct GNUNET_MESSENGER_SrvRoom *room) | 680 | get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room) |
668 | { | 681 | { |
682 | GNUNET_assert(room); | ||
683 | |||
669 | return &(room->key); | 684 | return &(room->key); |
670 | } | 685 | } |
671 | 686 | ||
672 | const struct GNUNET_MESSENGER_SrvTunnel* | 687 | const struct GNUNET_MESSENGER_SrvTunnel* |
673 | get_room_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer) | 688 | get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer) |
674 | { | 689 | { |
690 | GNUNET_assert((room) && (peer)); | ||
691 | |||
675 | return GNUNET_CONTAINER_multipeermap_get (room->tunnels, peer); | 692 | return GNUNET_CONTAINER_multipeermap_get (room->tunnels, peer); |
676 | } | 693 | } |
677 | 694 | ||
678 | const struct GNUNET_MESSENGER_Message* | 695 | static int |
679 | get_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 696 | request_room_message_step (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, |
680 | const struct GNUNET_HashCode *hash, int request) | 697 | const struct GNUNET_MESSENGER_MemberSession *session, |
698 | GNUNET_MESSENGER_MessageRequestCallback callback, void* cls) | ||
681 | { | 699 | { |
682 | const struct GNUNET_MESSENGER_Message *message = get_store_message (&(room->store), hash); | 700 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); |
683 | 701 | ||
684 | if ((message) || (!handle) || (GNUNET_YES != request) | 702 | const struct GNUNET_MESSENGER_MessageLink *link = get_store_message_link( |
685 | || (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->requested, hash))) | 703 | message_store, hash, GNUNET_YES |
686 | return message; | 704 | ); |
687 | 705 | ||
688 | struct GNUNET_MESSENGER_Message *request_msg = create_message_request (hash); | 706 | if (!link) |
707 | goto forward; | ||
689 | 708 | ||
690 | if (request_msg) | 709 | int result = request_room_message_step(room, &(link->first), session, callback, cls); |
691 | { | ||
692 | if (GNUNET_CONTAINER_multihashmap_put (room->requested, hash, NULL, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST) == GNUNET_OK) | ||
693 | { | ||
694 | struct GNUNET_HashCode request_hash; | ||
695 | 710 | ||
696 | send_room_message (room, handle, request_msg, &request_hash); | 711 | if ((GNUNET_YES == link->multiple) && |
697 | } | 712 | (GNUNET_YES == request_room_message_step(room, &(link->second), session, callback, cls))) |
713 | return GNUNET_YES; | ||
714 | else | ||
715 | return result; | ||
698 | 716 | ||
699 | destroy_message (request_msg); | 717 | forward: |
700 | } | 718 | if (GNUNET_YES != check_member_session_history(session, hash, GNUNET_NO)) |
719 | return GNUNET_YES; | ||
701 | 720 | ||
702 | return message; | 721 | const struct GNUNET_MESSENGER_Message *message = get_store_message(message_store, hash); |
722 | |||
723 | if (!message) | ||
724 | return GNUNET_NO; | ||
725 | |||
726 | if (callback) | ||
727 | callback (cls, room, message, hash); | ||
728 | |||
729 | return GNUNET_YES; | ||
730 | } | ||
731 | |||
732 | int | ||
733 | request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, | ||
734 | const struct GNUNET_MESSENGER_MemberSession *session, | ||
735 | GNUNET_MESSENGER_MessageRequestCallback callback, void* cls) | ||
736 | { | ||
737 | GNUNET_assert((room) && (hash)); | ||
738 | |||
739 | int result = request_room_message_step (room, hash, session, callback, cls); | ||
740 | |||
741 | if ((GNUNET_NO == result) && (callback)) | ||
742 | callback (cls, room, NULL, hash); | ||
743 | |||
744 | return result; | ||
703 | } | 745 | } |
704 | 746 | ||
705 | void | 747 | void |
@@ -711,21 +753,14 @@ callback_room_disconnect (struct GNUNET_MESSENGER_SrvRoom *room, void *cls) | |||
711 | return; | 753 | return; |
712 | 754 | ||
713 | struct GNUNET_PeerIdentity identity; | 755 | struct GNUNET_PeerIdentity identity; |
756 | get_tunnel_peer_identity(tunnel, &identity); | ||
714 | 757 | ||
715 | GNUNET_PEER_resolve (tunnel->peer, &identity); | 758 | if ((GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove (room->tunnels, &identity, tunnel)) || |
759 | (GNUNET_YES == GNUNET_CONTAINER_multipeermap_contains(room->tunnels, &identity))) | ||
760 | return; | ||
716 | 761 | ||
717 | if (GNUNET_YES == contains_list_tunnels (&(room->basement), &identity)) | 762 | if (GNUNET_YES == contains_list_tunnels (&(room->basement), &identity)) |
718 | { | 763 | send_room_message (room, room->host, create_message_miss (&identity)); |
719 | struct GNUNET_MESSENGER_Message *message = create_message_miss (&identity); | ||
720 | |||
721 | if (message) | ||
722 | { | ||
723 | struct GNUNET_HashCode hash; | ||
724 | |||
725 | send_room_message (room, room->host, message, &hash); | ||
726 | destroy_message (message); | ||
727 | } | ||
728 | } | ||
729 | } | 764 | } |
730 | 765 | ||
731 | int | 766 | int |
@@ -733,49 +768,32 @@ callback_verify_room_message (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, | |||
733 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash) | 768 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash) |
734 | { | 769 | { |
735 | if (GNUNET_MESSENGER_KIND_UNKNOWN == message->header.kind) | 770 | if (GNUNET_MESSENGER_KIND_UNKNOWN == message->header.kind) |
736 | return GNUNET_SYSERR; | ||
737 | |||
738 | struct GNUNET_MESSENGER_SrvContact *contact = GNUNET_CONTAINER_multishortmap_get (room->members, | ||
739 | &(message->header.sender_id)); | ||
740 | |||
741 | if (!contact) | ||
742 | { | 771 | { |
743 | if (GNUNET_MESSENGER_KIND_INFO == message->header.kind) | 772 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Message error: Kind is unknown! (%d)\n", message->header.kind); |
744 | contact = get_service_contact_by_pubkey (room->service, &(message->body.info.host_key)); | ||
745 | else if (GNUNET_MESSENGER_KIND_JOIN == message->header.kind) | ||
746 | contact = get_service_contact_by_pubkey (room->service, &(message->body.join.key)); | ||
747 | } | ||
748 | |||
749 | if ((!contact) || (GNUNET_SYSERR == verify_message (message, hash, get_contact_key (contact)))) | ||
750 | return GNUNET_SYSERR; | 773 | return GNUNET_SYSERR; |
751 | |||
752 | if (GNUNET_YES == room->strict_access) | ||
753 | { | ||
754 | struct GNUNET_MESSENGER_MemberInfo *info = GNUNET_CONTAINER_multishortmap_get (room->member_infos, | ||
755 | &(message->header.sender_id)); | ||
756 | |||
757 | if ((info) && (GNUNET_MESSENGER_MEMBER_BLOCKED == info->access)) | ||
758 | return GNUNET_SYSERR; | ||
759 | } | 774 | } |
760 | 775 | ||
761 | if (GNUNET_YES == contains_store_message (&(room->store), hash)) | 776 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); |
762 | return GNUNET_NO; | ||
763 | 777 | ||
764 | return GNUNET_YES; | 778 | const struct GNUNET_MESSENGER_Message *previous = get_store_message(message_store, &(message->header.previous)); |
765 | } | ||
766 | 779 | ||
767 | static void | 780 | if (!previous) |
768 | search_room_for_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash) | 781 | goto skip_time_comparison; |
769 | { | ||
770 | const struct GNUNET_MESSENGER_Message *message = get_room_message (room, room->host, hash, GNUNET_YES); | ||
771 | 782 | ||
772 | if (!message) | 783 | struct GNUNET_TIME_Absolute timestamp = GNUNET_TIME_absolute_ntoh(message->header.timestamp); |
773 | return; | 784 | struct GNUNET_TIME_Absolute last = GNUNET_TIME_absolute_ntoh(previous->header.timestamp); |
774 | 785 | ||
775 | if (GNUNET_MESSENGER_KIND_MERGE == message->header.kind) | 786 | if (GNUNET_TIME_relative_get_zero_().rel_value_us != GNUNET_TIME_absolute_get_difference(timestamp, last).rel_value_us) |
776 | search_room_for_message (room, &(message->body.merge.previous)); | 787 | { |
788 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Message error: Timestamp does not check out!\n"); | ||
789 | return GNUNET_SYSERR; | ||
790 | } | ||
791 | |||
792 | skip_time_comparison: | ||
793 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Receiving message of kind: %s!\n", | ||
794 | GNUNET_MESSENGER_name_of_kind(message->header.kind)); | ||
777 | 795 | ||
778 | search_room_for_message (room, &(message->header.previous)); | 796 | return GNUNET_OK; |
779 | } | 797 | } |
780 | 798 | ||
781 | static void | 799 | static void |
@@ -785,102 +803,76 @@ idle_request_room_messages (void *cls) | |||
785 | 803 | ||
786 | room->idle = NULL; | 804 | room->idle = NULL; |
787 | 805 | ||
788 | struct GNUNET_MESSENGER_ListMessage *element = room->last_messages.head; | 806 | struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room); |
789 | 807 | const struct GNUNET_HashCode *hash = get_message_state_merge_hash(&(room->state)); | |
790 | while (element) | 808 | |
791 | { | 809 | if ((hash) && |
792 | search_room_for_message (room, &(element->hash)); | 810 | (GNUNET_MESSENGER_OP_UNKNOWN == get_store_operation_type(operation_store, hash))) |
793 | 811 | use_store_operation( | |
794 | element = element->next; | 812 | operation_store, |
795 | } | 813 | hash, |
796 | 814 | GNUNET_MESSENGER_OP_MERGE, | |
797 | merge_room_last_messages (room, room->host); | 815 | GNUNET_MESSENGER_MERGE_DELAY |
798 | 816 | ); | |
799 | room->idle = GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_relative_get_second_ (), | 817 | |
800 | GNUNET_SCHEDULER_PRIORITY_IDLE, idle_request_room_messages, | 818 | room->idle = GNUNET_SCHEDULER_add_delayed_with_priority ( |
801 | cls); | 819 | GNUNET_MESSENGER_IDLE_DELAY, |
820 | GNUNET_SCHEDULER_PRIORITY_IDLE, | ||
821 | idle_request_room_messages, | ||
822 | cls | ||
823 | ); | ||
802 | } | 824 | } |
803 | 825 | ||
804 | void | 826 | void |
805 | update_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_Message *message, | 827 | solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key, |
806 | const struct GNUNET_HashCode *hash) | 828 | const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp) |
807 | { | 829 | { |
808 | struct GNUNET_MESSENGER_ListMessage *element = room->last_messages.head; | 830 | GNUNET_assert ((room) && (public_key) && (member_id)); |
809 | struct GNUNET_MESSENGER_ListMessage *merging = NULL; | ||
810 | |||
811 | if (GNUNET_MESSENGER_KIND_MERGE == message->header.kind) | ||
812 | { | ||
813 | merging = room->last_messages.head; | ||
814 | |||
815 | while (merging) | ||
816 | { | ||
817 | if (0 == GNUNET_CRYPTO_hash_cmp (&(merging->hash), &(message->body.merge.previous))) | ||
818 | break; | ||
819 | 831 | ||
820 | merging = merging->next; | 832 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); |
821 | } | 833 | struct GNUNET_MESSENGER_Member *member = get_store_member(member_store, member_id); |
822 | 834 | ||
823 | if (merging) | 835 | if ((!member) || (1 >= GNUNET_CONTAINER_multihashmap_size(member->sessions))) |
824 | element = merging->next; | 836 | return; |
825 | } | ||
826 | |||
827 | while (element) | ||
828 | { | ||
829 | if (0 == GNUNET_CRYPTO_hash_cmp (&(element->hash), &(message->header.previous))) | ||
830 | break; | ||
831 | |||
832 | element = element->next; | ||
833 | } | ||
834 | 837 | ||
835 | if ((merging) && (!element)) | 838 | struct GNUNET_MESSENGER_ListHandles *handles = &(room->service->handles); |
836 | { | 839 | struct GNUNET_MESSENGER_ListHandle* element; |
837 | element = merging; | ||
838 | merging = NULL; | ||
839 | } | ||
840 | 840 | ||
841 | if (element) | 841 | for (element = handles->head; element; element = element->next) |
842 | { | 842 | { |
843 | GNUNET_memcpy(&(element->hash), hash, sizeof(struct GNUNET_HashCode)); | 843 | if (0 != GNUNET_memcmp(member_id, get_handle_member_id(element->handle, get_room_key(room)))) |
844 | continue; | ||
844 | 845 | ||
845 | if (merging) | 846 | if (0 == GNUNET_memcmp(public_key, &(get_handle_ego(element->handle)->pub))) |
846 | GNUNET_CONTAINER_DLL_remove(room->last_messages.head, room->last_messages.tail, merging); | 847 | continue; |
847 | } | ||
848 | else | ||
849 | add_to_list_messages (&(room->last_messages), hash); | ||
850 | 848 | ||
851 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (room->requested, hash)) | 849 | struct GNUNET_MESSENGER_MemberSession *session = get_member_session(member, &(get_handle_ego(element->handle)->pub)); |
852 | GNUNET_CONTAINER_multihashmap_remove_all (room->requested, hash); | ||
853 | } | ||
854 | 850 | ||
855 | void | 851 | if (!session) |
856 | switch_room_member_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *old_id, | 852 | continue; |
857 | const struct GNUNET_ShortHashCode *new_id, const struct GNUNET_HashCode *hash) | ||
858 | { | ||
859 | struct GNUNET_MESSENGER_SrvContact *contact = GNUNET_CONTAINER_multishortmap_get (room->members, old_id); | ||
860 | 853 | ||
861 | if ((contact) && (GNUNET_YES == GNUNET_CONTAINER_multishortmap_remove (room->members, old_id, contact))) | 854 | struct GNUNET_TIME_Absolute start = get_member_session_start(session); |
862 | GNUNET_CONTAINER_multishortmap_put (room->members, new_id, contact, | ||
863 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
864 | 855 | ||
865 | struct GNUNET_MESSENGER_MemberInfo *info = GNUNET_CONTAINER_multishortmap_get (room->member_infos, old_id); | 856 | if (GNUNET_TIME_relative_get_zero_().rel_value_us != GNUNET_TIME_absolute_get_difference(start, timestamp).rel_value_us) |
857 | continue; | ||
866 | 858 | ||
867 | if ((!info) || (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove (room->member_infos, old_id, contact)) | 859 | struct GNUNET_ShortHashCode random_id; |
868 | || (GNUNET_YES != GNUNET_CONTAINER_multishortmap_put (room->member_infos, new_id, contact, | 860 | generate_free_member_id (&random_id, member_store->members); |
869 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | ||
870 | return; | ||
871 | 861 | ||
872 | if (hash) | 862 | send_room_message(room, element->handle, create_message_id(&random_id)); |
873 | add_to_list_messages (&(info->session_messages), hash); | 863 | } |
874 | } | 864 | } |
875 | 865 | ||
876 | void | 866 | void |
877 | rebuild_room_basement_structure (struct GNUNET_MESSENGER_SrvRoom *room) | 867 | rebuild_room_basement_structure (struct GNUNET_MESSENGER_SrvRoom *room) |
878 | { | 868 | { |
869 | GNUNET_assert(room); | ||
870 | |||
879 | struct GNUNET_PeerIdentity peer; | 871 | struct GNUNET_PeerIdentity peer; |
880 | size_t src; | 872 | size_t src; |
881 | 873 | ||
882 | if ((GNUNET_OK != get_service_peer_identity (room->service, &peer)) || (!find_list_tunnels (&(room->basement), &peer, | 874 | if ((GNUNET_OK != get_service_peer_identity (room->service, &peer)) || |
883 | &src))) | 875 | (!find_list_tunnels (&(room->basement), &peer, &src))) |
884 | return; | 876 | return; |
885 | 877 | ||
886 | size_t count = count_of_tunnels (&(room->basement)); | 878 | size_t count = count_of_tunnels (&(room->basement)); |
@@ -918,38 +910,167 @@ rebuild_room_basement_structure (struct GNUNET_MESSENGER_SrvRoom *room) | |||
918 | } | 910 | } |
919 | } | 911 | } |
920 | 912 | ||
921 | void | 913 | static void |
922 | handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room) | 914 | handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room) |
923 | { | 915 | { |
916 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); | ||
917 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); | ||
918 | |||
924 | while (room->handling.head) | 919 | while (room->handling.head) |
925 | { | 920 | { |
926 | struct GNUNET_MESSENGER_ListMessage *element = room->handling.head; | 921 | struct GNUNET_MESSENGER_ListMessage *element = room->handling.head; |
927 | 922 | ||
928 | const struct GNUNET_MESSENGER_Message *msg = get_room_message (room, room->host, &(element->hash), GNUNET_NO); | 923 | const struct GNUNET_MESSENGER_Message *message = get_store_message (message_store, &(element->hash)); |
924 | |||
925 | if (!message) | ||
926 | goto finish_handling; | ||
929 | 927 | ||
930 | if (msg) | 928 | struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); |
931 | handle_service_message (room->service, room, msg, &(element->hash)); | ||
932 | 929 | ||
930 | if (!member) | ||
931 | goto finish_handling; | ||
932 | |||
933 | struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of(member, message, &(element->hash)); | ||
934 | |||
935 | if (session) | ||
936 | handle_service_message (room->service, room, session, message, &(element->hash)); | ||
937 | |||
938 | finish_handling: | ||
933 | GNUNET_CONTAINER_DLL_remove(room->handling.head, room->handling.tail, element); | 939 | GNUNET_CONTAINER_DLL_remove(room->handling.head, room->handling.tail, element); |
934 | GNUNET_free(element); | 940 | GNUNET_free(element); |
935 | } | 941 | } |
936 | } | 942 | } |
937 | 943 | ||
938 | #include "gnunet-service-messenger_message_recv.h" | 944 | int |
945 | update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, | ||
946 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
947 | { | ||
948 | GNUNET_assert((room) && (message) && (hash)); | ||
949 | |||
950 | struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(room); | ||
951 | |||
952 | const int requested = (GNUNET_MESSENGER_OP_REQUEST == get_store_operation_type(operation_store, hash)? | ||
953 | GNUNET_YES : GNUNET_NO | ||
954 | ); | ||
955 | |||
956 | if (GNUNET_YES == requested) | ||
957 | cancel_store_operation(operation_store, hash); | ||
958 | |||
959 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(room); | ||
960 | |||
961 | const struct GNUNET_MESSENGER_Message *old_message = get_store_message (message_store, hash); | ||
962 | |||
963 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Handle a message in room (%s).\n", GNUNET_h2s (get_room_key(room))); | ||
964 | |||
965 | if ((old_message) || (GNUNET_OK != put_store_message (message_store, hash, message))) | ||
966 | { | ||
967 | if (old_message != message) | ||
968 | destroy_message(message); | ||
969 | |||
970 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Duplicate message got dropped!\n"); | ||
971 | return GNUNET_NO; | ||
972 | } | ||
973 | |||
974 | update_message_state(&(room->state), requested, message, hash); | ||
975 | |||
976 | if ((GNUNET_YES == requested) || | ||
977 | (GNUNET_MESSENGER_KIND_INFO == message->header.kind) || | ||
978 | (GNUNET_MESSENGER_KIND_REQUEST == message->header.kind)) | ||
979 | return GNUNET_YES; | ||
980 | |||
981 | if ((GNUNET_MESSENGER_KIND_MERGE == message->header.kind) && | ||
982 | (GNUNET_MESSENGER_OP_MERGE == get_store_operation_type(operation_store, &(message->body.merge.previous)))) | ||
983 | cancel_store_operation(operation_store, &(message->body.merge.previous)); | ||
984 | |||
985 | if (GNUNET_MESSENGER_OP_MERGE == get_store_operation_type(operation_store, &(message->header.previous))) | ||
986 | cancel_store_operation(operation_store, &(message->header.previous)); | ||
987 | |||
988 | return GNUNET_YES; | ||
989 | } | ||
990 | |||
991 | struct GNUNET_MESSENGER_MemberSessionCompletion | ||
992 | { | ||
993 | struct GNUNET_MESSENGER_MemberSessionCompletion *prev; | ||
994 | struct GNUNET_MESSENGER_MemberSessionCompletion *next; | ||
995 | |||
996 | struct GNUNET_MESSENGER_MemberSession *session; | ||
997 | }; | ||
998 | |||
999 | struct GNUNET_MESSENGER_MemberUpdate | ||
1000 | { | ||
1001 | const struct GNUNET_MESSENGER_Message *message; | ||
1002 | const struct GNUNET_HashCode *hash; | ||
1003 | |||
1004 | struct GNUNET_MESSENGER_MemberSessionCompletion *head; | ||
1005 | struct GNUNET_MESSENGER_MemberSessionCompletion *tail; | ||
1006 | }; | ||
1007 | |||
1008 | static int | ||
1009 | iterate_update_member_sessions (void *cls, const struct GNUNET_IDENTITY_PublicKey *public_key, | ||
1010 | struct GNUNET_MESSENGER_MemberSession *session) | ||
1011 | { | ||
1012 | struct GNUNET_MESSENGER_MemberUpdate *update = cls; | ||
1013 | |||
1014 | update_member_session_history(session, update->message, update->hash); | ||
1015 | |||
1016 | if (GNUNET_YES == is_member_session_completed(session)) | ||
1017 | { | ||
1018 | struct GNUNET_MESSENGER_MemberSessionCompletion *element = GNUNET_new( | ||
1019 | struct GNUNET_MESSENGER_MemberSessionCompletion | ||
1020 | ); | ||
1021 | |||
1022 | element->session = session; | ||
1023 | |||
1024 | GNUNET_CONTAINER_DLL_insert_tail(update->head, update->tail, element); | ||
1025 | } | ||
1026 | |||
1027 | return GNUNET_YES; | ||
1028 | } | ||
1029 | |||
1030 | static void | ||
1031 | remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session); | ||
939 | 1032 | ||
940 | void | 1033 | void |
941 | callback_room_recv (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, struct GNUNET_MESSENGER_Message *message, | 1034 | callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
942 | const struct GNUNET_HashCode *hash) | 1035 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
943 | { | 1036 | { |
944 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; | 1037 | struct GNUNET_MESSENGER_MemberStore *member_store = get_room_member_store(room); |
1038 | struct GNUNET_MESSENGER_Member *member = get_store_member_of(member_store, message); | ||
1039 | |||
1040 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Callback for message (%s)\n", GNUNET_h2s (hash)); | ||
945 | 1041 | ||
946 | if (GNUNET_OK != put_store_message (&(room->store), hash, message)) | 1042 | if (!member) |
1043 | { | ||
1044 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Message handling dropped: Member is missing!\n"); | ||
947 | return; | 1045 | return; |
1046 | } | ||
1047 | |||
1048 | struct GNUNET_MESSENGER_MemberSession *session = get_member_session_of(member, message, hash); | ||
1049 | |||
1050 | if (!session) | ||
1051 | { | ||
1052 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Message handling dropped: Session is missing!\n"); | ||
1053 | return; | ||
1054 | } | ||
948 | 1055 | ||
949 | update_room_last_messages (room, message, hash); | 1056 | struct GNUNET_MESSENGER_MemberUpdate update; |
1057 | update.message = message; | ||
1058 | update.hash = hash; | ||
950 | 1059 | ||
951 | if (GNUNET_MESSENGER_KIND_INFO != message->header.kind) | 1060 | update.head = NULL; |
952 | forward_room_message (room, tunnel, message, hash); | 1061 | update.tail = NULL; |
1062 | |||
1063 | iterate_store_members(member_store, iterate_update_member_sessions, &update); | ||
1064 | |||
1065 | while (update.head) | ||
1066 | { | ||
1067 | struct GNUNET_MESSENGER_MemberSessionCompletion *element = update.head; | ||
1068 | |||
1069 | remove_room_member_session (room, element->session); | ||
1070 | |||
1071 | GNUNET_CONTAINER_DLL_remove(update.head, update.tail, element); | ||
1072 | GNUNET_free (element); | ||
1073 | } | ||
953 | 1074 | ||
954 | const int start_handle = room->handling.head ? GNUNET_NO : GNUNET_YES; | 1075 | const int start_handle = room->handling.head ? GNUNET_NO : GNUNET_YES; |
955 | 1076 | ||
@@ -957,32 +1078,29 @@ callback_room_recv (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, struct GNU | |||
957 | 1078 | ||
958 | switch (message->header.kind) | 1079 | switch (message->header.kind) |
959 | { | 1080 | { |
960 | case GNUNET_MESSENGER_KIND_INFO: | ||
961 | recv_message_info (room, tunnel, message, hash); | ||
962 | break; | ||
963 | case GNUNET_MESSENGER_KIND_JOIN: | 1081 | case GNUNET_MESSENGER_KIND_JOIN: |
964 | recv_message_join (room, tunnel, message, hash); | 1082 | handle_message_join (room, session, message, hash); |
965 | break; | 1083 | break; |
966 | case GNUNET_MESSENGER_KIND_LEAVE: | 1084 | case GNUNET_MESSENGER_KIND_LEAVE: |
967 | recv_message_leave (room, tunnel, message, hash); | 1085 | handle_message_leave (room, session, message, hash); |
968 | break; | 1086 | break; |
969 | case GNUNET_MESSENGER_KIND_NAME: | 1087 | case GNUNET_MESSENGER_KIND_NAME: |
970 | recv_message_name (room, tunnel, message, hash); | 1088 | handle_message_name (room, session, message, hash); |
971 | break; | 1089 | break; |
972 | case GNUNET_MESSENGER_KIND_KEY: | 1090 | case GNUNET_MESSENGER_KIND_KEY: |
973 | recv_message_key (room, tunnel, message, hash); | 1091 | handle_message_key (room, session, message, hash); |
974 | break; | 1092 | break; |
975 | case GNUNET_MESSENGER_KIND_PEER: | 1093 | case GNUNET_MESSENGER_KIND_PEER: |
976 | recv_message_peer (room, tunnel, message, hash); | 1094 | handle_message_peer (room, session, message, hash); |
977 | break; | 1095 | break; |
978 | case GNUNET_MESSENGER_KIND_ID: | 1096 | case GNUNET_MESSENGER_KIND_ID: |
979 | recv_message_id (room, tunnel, message, hash); | 1097 | handle_message_id (room, session, message, hash); |
980 | break; | 1098 | break; |
981 | case GNUNET_MESSENGER_KIND_MISS: | 1099 | case GNUNET_MESSENGER_KIND_MISS: |
982 | recv_message_miss (room, tunnel, message, hash); | 1100 | handle_message_miss (room, session, message, hash); |
983 | break; | 1101 | break; |
984 | case GNUNET_MESSENGER_KIND_REQUEST: | 1102 | case GNUNET_MESSENGER_KIND_DELETE: |
985 | recv_message_request (room, tunnel, message, hash); | 1103 | handle_message_delete (room, session, message, hash); |
986 | break; | 1104 | break; |
987 | default: | 1105 | default: |
988 | break; | 1106 | break; |
@@ -992,60 +1110,98 @@ callback_room_recv (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, struct GNU | |||
992 | handle_room_messages (room); | 1110 | handle_room_messages (room); |
993 | } | 1111 | } |
994 | 1112 | ||
995 | #include "gnunet-service-messenger_message_send.h" | 1113 | static void |
1114 | get_room_data_subdir (struct GNUNET_MESSENGER_SrvRoom *room, char **dir) | ||
1115 | { | ||
1116 | GNUNET_assert((room) && (dir)); | ||
1117 | |||
1118 | GNUNET_asprintf (dir, "%s%s%c%s%c", room->service->dir, "rooms", DIR_SEPARATOR, GNUNET_h2s (get_room_key(room)), DIR_SEPARATOR); | ||
1119 | } | ||
996 | 1120 | ||
997 | void | 1121 | void |
998 | callback_room_sent (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, void *cls, | 1122 | load_room (struct GNUNET_MESSENGER_SrvRoom *room) |
999 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
1000 | { | 1123 | { |
1001 | const struct GNUNET_MESSENGER_Message *old_message = get_room_message (room, handle, hash, GNUNET_NO); | 1124 | GNUNET_assert(room); |
1125 | |||
1126 | char *room_dir; | ||
1127 | get_room_data_subdir (room, &room_dir); | ||
1002 | 1128 | ||
1003 | if ((old_message) || (GNUNET_OK != put_store_message (&(room->store), hash, message))) | 1129 | if (GNUNET_YES == GNUNET_DISK_directory_test (room_dir, GNUNET_YES)) |
1004 | { | 1130 | { |
1005 | if (old_message != message) | 1131 | load_member_store (get_room_member_store(room), room_dir); |
1006 | GNUNET_free(message); | 1132 | load_message_store (get_room_message_store(room), room_dir); |
1133 | load_operation_store(get_room_operation_store(room), room_dir); | ||
1134 | |||
1135 | char *basement_file; | ||
1136 | GNUNET_asprintf (&basement_file, "%s%s", room_dir, "basement.list"); | ||
1137 | |||
1138 | load_list_tunnels(&(room->basement), basement_file); | ||
1139 | GNUNET_free(basement_file); | ||
1140 | |||
1141 | char *last_messages_file; | ||
1142 | GNUNET_asprintf (&last_messages_file, "%s%s", room_dir, "last_messages.list"); | ||
1143 | |||
1144 | load_message_state(&(room->state), room_dir); | ||
1007 | } | 1145 | } |
1008 | else | ||
1009 | { | ||
1010 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; // may be NULL | ||
1011 | 1146 | ||
1012 | update_room_last_messages (room, message, hash); | 1147 | GNUNET_free(room_dir); |
1148 | } | ||
1013 | 1149 | ||
1014 | const int start_handle = room->handling.head ? GNUNET_NO : GNUNET_YES; | 1150 | void |
1151 | save_room (struct GNUNET_MESSENGER_SrvRoom *room) | ||
1152 | { | ||
1153 | GNUNET_assert(room); | ||
1015 | 1154 | ||
1016 | add_to_list_messages (&(room->handling), hash); | 1155 | char *room_dir; |
1156 | get_room_data_subdir (room, &room_dir); | ||
1017 | 1157 | ||
1018 | switch (message->header.kind) | 1158 | if ((GNUNET_YES == GNUNET_DISK_directory_test (room_dir, GNUNET_NO)) || |
1019 | { | 1159 | (GNUNET_OK == GNUNET_DISK_directory_create (room_dir))) |
1020 | case GNUNET_MESSENGER_KIND_INFO: | 1160 | { |
1021 | send_message_info (room, handle, tunnel, message, hash); | 1161 | save_member_store(get_room_member_store(room), room_dir); |
1022 | break; | 1162 | save_message_store (get_room_message_store(room), room_dir); |
1023 | case GNUNET_MESSENGER_KIND_JOIN: | 1163 | save_operation_store(get_room_operation_store(room), room_dir); |
1024 | send_message_join (room, handle, tunnel, message, hash); | 1164 | |
1025 | break; | 1165 | char *basement_file; |
1026 | case GNUNET_MESSENGER_KIND_LEAVE: | 1166 | GNUNET_asprintf (&basement_file, "%s%s", room_dir, "basement.list"); |
1027 | send_message_leave (room, handle, tunnel, message, hash); | ||
1028 | break; | ||
1029 | case GNUNET_MESSENGER_KIND_NAME: | ||
1030 | send_message_name (room, handle, tunnel, message, hash); | ||
1031 | break; | ||
1032 | case GNUNET_MESSENGER_KIND_KEY: | ||
1033 | send_message_key (room, handle, tunnel, message, hash); | ||
1034 | break; | ||
1035 | case GNUNET_MESSENGER_KIND_PEER: | ||
1036 | send_message_peer (room, handle, tunnel, message, hash); | ||
1037 | break; | ||
1038 | case GNUNET_MESSENGER_KIND_ID: | ||
1039 | send_message_id (room, handle, tunnel, message, hash); | ||
1040 | break; | ||
1041 | case GNUNET_MESSENGER_KIND_MISS: | ||
1042 | send_message_miss (room, handle, tunnel, message, hash); | ||
1043 | break; | ||
1044 | default: | ||
1045 | break; | ||
1046 | } | ||
1047 | 1167 | ||
1048 | if (GNUNET_YES == start_handle) | 1168 | save_list_tunnels(&(room->basement), basement_file); |
1049 | handle_room_messages (room); | 1169 | GNUNET_free(basement_file); |
1170 | |||
1171 | save_message_state(&(room->state), room_dir); | ||
1050 | } | 1172 | } |
1173 | |||
1174 | GNUNET_free(room_dir); | ||
1175 | } | ||
1176 | |||
1177 | static void | ||
1178 | remove_room_member_session (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session) | ||
1179 | { | ||
1180 | GNUNET_assert ((room) && (session)); | ||
1181 | |||
1182 | remove_member_session (session->member, session); | ||
1183 | |||
1184 | const struct GNUNET_IDENTITY_PublicKey *public_key = get_member_session_public_key(session); | ||
1185 | |||
1186 | struct GNUNET_HashCode hash; | ||
1187 | GNUNET_CRYPTO_hash(public_key, sizeof(*public_key), &hash); | ||
1188 | |||
1189 | char *room_dir; | ||
1190 | get_room_data_subdir (room, &room_dir); | ||
1191 | |||
1192 | char* session_dir; | ||
1193 | GNUNET_asprintf ( | ||
1194 | &session_dir, "%s%s%c%s%c%s%c%s%c", room_dir, | ||
1195 | "members", DIR_SEPARATOR, | ||
1196 | GNUNET_sh2s(get_member_session_id(session)), DIR_SEPARATOR, | ||
1197 | "sessions", DIR_SEPARATOR, | ||
1198 | GNUNET_h2s(&hash), DIR_SEPARATOR | ||
1199 | ); | ||
1200 | |||
1201 | GNUNET_free (room_dir); | ||
1202 | |||
1203 | GNUNET_DISK_directory_remove(session_dir); | ||
1204 | GNUNET_free (session_dir); | ||
1205 | |||
1206 | destroy_member_session(session); | ||
1051 | } | 1207 | } |
diff --git a/src/messenger/gnunet-service-messenger_room.h b/src/messenger/gnunet-service-messenger_room.h index 36c9e8cf5..b6a0f1064 100644 --- a/src/messenger/gnunet-service-messenger_room.h +++ b/src/messenger/gnunet-service-messenger_room.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -33,33 +33,30 @@ | |||
33 | #include "gnunet_identity_service.h" | 33 | #include "gnunet_identity_service.h" |
34 | #include "gnunet_mq_lib.h" | 34 | #include "gnunet_mq_lib.h" |
35 | 35 | ||
36 | #include "gnunet-service-messenger_contact.h" | ||
37 | |||
38 | #include "gnunet_messenger_service.h" | 36 | #include "gnunet_messenger_service.h" |
39 | #include "gnunet-service-messenger_basement.h" | 37 | #include "gnunet-service-messenger_basement.h" |
40 | #include "gnunet-service-messenger_handle.h" | 38 | #include "gnunet-service-messenger_handle.h" |
41 | #include "gnunet-service-messenger_tunnel.h" | 39 | #include "gnunet-service-messenger_message_state.h" |
42 | |||
43 | #include "gnunet-service-messenger_list_messages.h" | 40 | #include "gnunet-service-messenger_list_messages.h" |
41 | |||
44 | #include "messenger_api_list_tunnels.h" | 42 | #include "messenger_api_list_tunnels.h" |
45 | 43 | ||
44 | #include "gnunet-service-messenger_member_store.h" | ||
46 | #include "gnunet-service-messenger_message_store.h" | 45 | #include "gnunet-service-messenger_message_store.h" |
46 | #include "gnunet-service-messenger_operation_store.h" | ||
47 | #include "messenger_api_ego.h" | 47 | #include "messenger_api_ego.h" |
48 | 48 | ||
49 | enum GNUNET_MESSENGER_MemberAccess | 49 | #define GNUNET_MESSENGER_IDLE_DELAY GNUNET_TIME_relative_multiply \ |
50 | { | 50 | (GNUNET_TIME_relative_get_second_ (), 5) |
51 | GNUNET_MESSENGER_MEMBER_ALLOWED = 1, | ||
52 | GNUNET_MESSENGER_MEMBER_BLOCKED = 1, | ||
53 | 51 | ||
54 | GNUNET_MESSENGER_MEMBER_UNKNOWN = 0 | 52 | #define GNUNET_MESSENGER_REQUEST_DELAY GNUNET_TIME_relative_multiply \ |
55 | }; | 53 | (GNUNET_TIME_relative_get_minute_ (), 5) |
56 | 54 | ||
57 | struct GNUNET_MESSENGER_MemberInfo | 55 | #define GNUNET_MESSENGER_MERGE_DELAY GNUNET_TIME_relative_multiply \ |
58 | { | 56 | (GNUNET_TIME_relative_get_second_ (), 30) |
59 | enum GNUNET_MESSENGER_MemberAccess access; | ||
60 | 57 | ||
61 | struct GNUNET_MESSENGER_ListMessages session_messages; | 58 | struct GNUNET_MESSENGER_SrvTunnel; |
62 | }; | 59 | struct GNUNET_MESSENGER_MemberSession; |
63 | 60 | ||
64 | struct GNUNET_MESSENGER_SrvRoom | 61 | struct GNUNET_MESSENGER_SrvRoom |
65 | { | 62 | { |
@@ -70,28 +67,25 @@ struct GNUNET_MESSENGER_SrvRoom | |||
70 | struct GNUNET_HashCode key; | 67 | struct GNUNET_HashCode key; |
71 | 68 | ||
72 | struct GNUNET_CONTAINER_MultiPeerMap *tunnels; | 69 | struct GNUNET_CONTAINER_MultiPeerMap *tunnels; |
73 | struct GNUNET_CONTAINER_MultiShortmap *members; | ||
74 | struct GNUNET_CONTAINER_MultiShortmap *member_infos; | ||
75 | 70 | ||
76 | struct GNUNET_MESSENGER_MessageStore store; | 71 | struct GNUNET_MESSENGER_MemberStore member_store; |
77 | struct GNUNET_CONTAINER_MultiHashMap *requested; | 72 | struct GNUNET_MESSENGER_MessageStore message_store; |
73 | struct GNUNET_MESSENGER_OperationStore operation_store; | ||
78 | 74 | ||
79 | struct GNUNET_MESSENGER_ListTunnels basement; | 75 | struct GNUNET_MESSENGER_ListTunnels basement; |
80 | struct GNUNET_MESSENGER_ListMessages last_messages; | 76 | struct GNUNET_MESSENGER_MessageState state; |
81 | 77 | ||
82 | struct GNUNET_HashCode *peer_message; | 78 | struct GNUNET_HashCode *peer_message; |
83 | 79 | ||
84 | struct GNUNET_MESSENGER_ListMessages handling; | 80 | struct GNUNET_MESSENGER_ListMessages handling; |
85 | struct GNUNET_SCHEDULER_Task *idle; | 81 | struct GNUNET_SCHEDULER_Task *idle; |
86 | |||
87 | int strict_access; | ||
88 | }; | 82 | }; |
89 | 83 | ||
90 | /** | 84 | /** |
91 | * Creates and allocates a new room for a <i>handle</i> with a given <i>key</i>. | 85 | * Creates and allocates a new room for a <i>handle</i> with a given <i>key</i>. |
92 | * | 86 | * |
93 | * @param handle Handle | 87 | * @param[in/out] handle Handle |
94 | * @param key Key of room | 88 | * @param[in] key Key of room |
95 | * @return New room | 89 | * @return New room |
96 | */ | 90 | */ |
97 | struct GNUNET_MESSENGER_SrvRoom* | 91 | struct GNUNET_MESSENGER_SrvRoom* |
@@ -100,71 +94,37 @@ create_room (struct GNUNET_MESSENGER_SrvHandle *handle, const struct GNUNET_Hash | |||
100 | /** | 94 | /** |
101 | * Destroys a room and frees its memory fully. | 95 | * Destroys a room and frees its memory fully. |
102 | * | 96 | * |
103 | * @param room Room | 97 | * @param[in/out] room Room |
104 | */ | 98 | */ |
105 | void | 99 | void |
106 | destroy_room (struct GNUNET_MESSENGER_SrvRoom *room); | 100 | destroy_room (struct GNUNET_MESSENGER_SrvRoom *room); |
107 | 101 | ||
108 | /** | 102 | /** |
109 | * Returns the contact of a member in a <i>room</i> identified by a given <i>id</i>. If the <i>room</i> | 103 | * Returns the used member store of a given <i>room</i>. |
110 | * does not contain a member with the given <i>id</i>, NULL gets returned. | ||
111 | * | ||
112 | * @param room Room | ||
113 | * @param id Member id | ||
114 | * @return Contact or NULL | ||
115 | */ | ||
116 | struct GNUNET_MESSENGER_SrvContact* | ||
117 | get_room_contact (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id); | ||
118 | |||
119 | /** | ||
120 | * Adds a contact from the service to a <i>room</i> under a specific <i>id</i> with a given public key. | ||
121 | * | ||
122 | * @param room Room | ||
123 | * @param id Member id | ||
124 | * @param pubkey Public key of EGO | ||
125 | */ | ||
126 | void | ||
127 | add_room_contact (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id, | ||
128 | const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
129 | |||
130 | /** | ||
131 | * Returns the member information of a member in a <i>room</i> identified by a given <i>id</i>. If the <i>room</i> | ||
132 | * does not contain a member with the given <i>id</i>, NULL gets returned. | ||
133 | * | 104 | * |
134 | * @param room Room | 105 | * @param[in/out] room Room |
135 | * @param id Member id | 106 | * @return Member store |
136 | * @return Member information or NULL | ||
137 | */ | 107 | */ |
138 | struct GNUNET_MESSENGER_MemberInfo* | 108 | struct GNUNET_MESSENGER_MemberStore* |
139 | get_room_member_info (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *id); | 109 | get_room_member_store (struct GNUNET_MESSENGER_SrvRoom *room); |
140 | 110 | ||
141 | /** | 111 | /** |
142 | * Tries to generate and allocate a new unique member id checking all current members for possible | 112 | * Returns the used message store of a given <i>room</i>. |
143 | * duplicates. If the function fails, NULL gets returned. | ||
144 | * | 113 | * |
145 | * @param room Room | 114 | * @param[in/out] room Room |
146 | * @return New member id or NULL | 115 | * @return Message store |
147 | */ | 116 | */ |
148 | struct GNUNET_ShortHashCode* | 117 | struct GNUNET_MESSENGER_MessageStore* |
149 | generate_room_member_id (const struct GNUNET_MESSENGER_SrvRoom *room); | 118 | get_room_message_store (struct GNUNET_MESSENGER_SrvRoom *room); |
150 | 119 | ||
151 | /** | 120 | /** |
152 | * Returns the member id of the member representing the handle currently hosting this <i>room</i>. | 121 | * Returns the used operation store of a given <i>room</i>. |
153 | * | 122 | * |
154 | * @param room Room | 123 | * @param[in/out] room Room |
155 | * @return Host member id or NULL | 124 | * @return Operation store |
156 | */ | 125 | */ |
157 | const struct GNUNET_ShortHashCode* | 126 | struct GNUNET_MESSENGER_OperationStore* |
158 | get_room_host_id (const struct GNUNET_MESSENGER_SrvRoom *room); | 127 | get_room_operation_store (struct GNUNET_MESSENGER_SrvRoom *room); |
159 | |||
160 | /** | ||
161 | * Changes the member id of the member representing the handle currently hosting this <i>room</i>. | ||
162 | * | ||
163 | * @param room Room | ||
164 | * @param unique_id Unique member id | ||
165 | */ | ||
166 | void | ||
167 | change_room_host_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *unique_id); | ||
168 | 128 | ||
169 | /** | 129 | /** |
170 | * Tries to open a <i>room</i> for a given <i>handle</i>. If the room has already been opened, the handle | 130 | * Tries to open a <i>room</i> for a given <i>handle</i>. If the room has already been opened, the handle |
@@ -172,11 +132,11 @@ change_room_host_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ | |||
172 | * | 132 | * |
173 | * Calling this method should result in joining a room and sending a peer message as well for this peer. | 133 | * Calling this method should result in joining a room and sending a peer message as well for this peer. |
174 | * | 134 | * |
175 | * If the function returns GNUNET_YES the port for this room is guranteed to be open for incoming connections. | 135 | * If the function returns #GNUNET_YES the port for this room is guranteed to be open for incoming connections. |
176 | * | 136 | * |
177 | * @param room Room | 137 | * @param[in/out] room Room |
178 | * @param handle Handle | 138 | * @param[in/out] handle Handle |
179 | * @return GNUNET_YES on success, GNUNET_NO on failure. | 139 | * @return #GNUNET_YES on success, #GNUNET_NO on failure. |
180 | */ | 140 | */ |
181 | int | 141 | int |
182 | open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); | 142 | open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); |
@@ -186,45 +146,34 @@ open_room (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHan | |||
186 | * a peer identity of a hosting peer. During the connection the handle will join the room as a member, waiting for | 146 | * a peer identity of a hosting peer. During the connection the handle will join the room as a member, waiting for |
187 | * an info message from the selected host. | 147 | * an info message from the selected host. |
188 | * | 148 | * |
189 | * @param room Room | 149 | * @param[in/out] room Room |
190 | * @param handle Handle | 150 | * @param[in/out] handle Handle |
191 | * @param door Peer identity | 151 | * @param[in] door Peer identity |
192 | * @return GNUNET_YES on success, GNUNET_NO on failure. | 152 | * @return #GNUNET_YES on success, #GNUNET_NO on failure. |
193 | */ | 153 | */ |
194 | int | 154 | int |
195 | entry_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 155 | enter_room_at (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
196 | const struct GNUNET_PeerIdentity *door); | 156 | const struct GNUNET_PeerIdentity *door); |
197 | 157 | ||
198 | /** | 158 | /** |
199 | * Returns a tunnel granting a direct connection to a specific member in a <i>room</i>. The member gets identified | ||
200 | * by an <i>id</i>. If no tunnel has been linked to the selected id, NULL gets returned. | ||
201 | * | ||
202 | * @param room Room | ||
203 | * @param contact_id Member id | ||
204 | * @return Tunnel to the member or NULL | ||
205 | */ | ||
206 | struct GNUNET_MESSENGER_SrvTunnel* | ||
207 | find_room_tunnel_to (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *contact_id); | ||
208 | |||
209 | /** | ||
210 | * Packs a <i>message</i> depending on the selected <i>mode</i> into a newly allocated envelope. It will set the | 159 | * Packs a <i>message</i> depending on the selected <i>mode</i> into a newly allocated envelope. It will set the |
211 | * timestamp of the message, the sender id and the previous messages hash automatically before packing. The message | 160 | * timestamp of the message, the sender id and the previous messages hash automatically before packing. The message |
212 | * will be signed by the handles EGO. | 161 | * will be signed by the handles EGO. |
213 | * | 162 | * |
214 | * If the optional <i>hash</i> parameter is a valid pointer, its value will be overriden by the signed messages hash. | 163 | * If the optional <i>hash</i> parameter is a valid pointer, its value will be overriden by the signed messages hash. |
215 | * | 164 | * |
216 | * If <i>mode</i> is set to GNUNET_MESSENGER_PACK_MODE_ENVELOPE, the function returns a valid envelope to send | 165 | * If <i>mode</i> is set to #GNUNET_MESSENGER_PACK_MODE_ENVELOPE, the function returns a valid envelope to send |
217 | * through a message queue, otherwise NULL. | 166 | * through a message queue, otherwise NULL. |
218 | * | 167 | * |
219 | * @param room Room | 168 | * @param[in] room Room |
220 | * @param handle Handle | 169 | * @param[in] handle Handle |
221 | * @param message Message | 170 | * @param[in/out] message Message |
222 | * @param[out] hash Hash of message | 171 | * @param[out] hash Hash of message |
223 | * @param mode Packing mode | 172 | * @param[in] mode Packing mode |
224 | * @return New envelope or NULL | 173 | * @return New envelope or NULL |
225 | */ | 174 | */ |
226 | struct GNUNET_MQ_Envelope* | 175 | struct GNUNET_MQ_Envelope* |
227 | pack_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 176 | pack_room_message (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_SrvHandle *handle, |
228 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode); | 177 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, int mode); |
229 | 178 | ||
230 | /** | 179 | /** |
@@ -234,59 +183,69 @@ pack_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGE | |||
234 | * The function handles packing the message automatically and will call linked message-events locally even if | 183 | * The function handles packing the message automatically and will call linked message-events locally even if |
235 | * the message won't be sent to another peer. | 184 | * the message won't be sent to another peer. |
236 | * | 185 | * |
237 | * @param room Room | 186 | * The function returns #GNUNET_YES on success, #GNUNET_NO if message is null and |
238 | * @param handle Handle | 187 | * #GNUNET_SYSERR if the message was known already. |
239 | * @param message Message | 188 | * |
240 | * @param[out] hash Hash of message | 189 | * @param[in/out] room Room |
190 | * @param[in/out] handle Handle | ||
191 | * @param[in/out] message Message | ||
192 | * @return #GNUNET_YES on success, #GNUNET_NO or #GNUNET_SYSERR otherwise. | ||
241 | */ | 193 | */ |
242 | void | 194 | int |
243 | send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 195 | send_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
244 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash); | 196 | struct GNUNET_MESSENGER_Message *message); |
245 | 197 | ||
246 | /** | 198 | /** |
247 | * Sends a <i>message</i> from a given <i>handle</i> into a <i>room</i> excluding one specific <i>tunnel</i>. | 199 | * Forwards a <i>message</i> with a given <i>hash</i> to a specific <i>tunnel</i> inside of a <i>room</i>. |
248 | * The <i>hash</i> parameter will be updated with the hash-value resulting from the sent message. | ||
249 | * | ||
250 | * The function handles packing the message automatically and will call linked message-events locally even if | ||
251 | * the message won't be sent to another peer. | ||
252 | * | 200 | * |
253 | * @param room Room | 201 | * @param[in/out] room Room |
254 | * @param handle Handle | 202 | * @param[in/out] tunnel Tunnel |
255 | * @param message Message | 203 | * @param[in/out] message Message |
256 | * @param[out] hash Hash of message | 204 | * @param[in] hash Hash of message |
257 | * @param tunnel Tunnel | ||
258 | */ | 205 | */ |
259 | void | 206 | void |
260 | send_room_message_ext (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 207 | forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, |
261 | struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, | 208 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
262 | struct GNUNET_MESSENGER_SrvTunnel *tunnel); | ||
263 | 209 | ||
264 | /** | 210 | /** |
265 | * Forwards a <i>message</i> with a given <i>hash</i> to a specific <i>tunnel</i> inside of a <i>room</i>. | 211 | * Checks the current state of opening a given <i>room</i> from this peer and re-publishes it |
212 | * if necessary to a selected <i>tunnel</i> or to all connected tunnels if necessary or if the | ||
213 | * selected tunnel is NULL. | ||
266 | * | 214 | * |
267 | * @param room Room | 215 | * @param[in/out] room Room |
268 | * @param tunnel Tunnel | 216 | * @param[in/out] tunnel Tunnel |
269 | * @param message Message | ||
270 | * @param hash Hash of message | ||
271 | */ | 217 | */ |
272 | void | 218 | void |
273 | forward_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel, | 219 | check_room_peer_status (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvTunnel *tunnel); |
274 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
275 | 220 | ||
276 | /** | 221 | /** |
277 | * Reduces all current forks inside of the message history of a <i>room</i> to one remaining last message | 222 | * Reduces all current forks inside of the message history of a <i>room</i> to one remaining last message |
278 | * by merging them down. All merge messages will be sent from a given <i>handle</i>. | 223 | * by merging them down. All merge messages will be sent from a given <i>handle</i>. |
279 | * | 224 | * |
280 | * @param room Room | 225 | * @param[in/out] room Room |
281 | * @param handle Handle | 226 | * @param[in/out] handle Handle |
282 | */ | 227 | */ |
283 | void | 228 | void |
284 | merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); | 229 | merge_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle); |
285 | 230 | ||
286 | /** | 231 | /** |
232 | * Deletes a message from the <i>room</i> with a given <i>hash</i> in a specific <i>delay</i> if | ||
233 | * the provided member by its session is permitted to do so. | ||
234 | * | ||
235 | * @param[in/out] room Room | ||
236 | * @param[in/out] session Member session | ||
237 | * @param[in] hash Hash of message | ||
238 | * @param[in] delay Delay of deletion | ||
239 | * @return #GNUNET_YES on success, #GNUNET_NO if permission gets denied, #GNUNET_SYSERR on operation failure | ||
240 | */ | ||
241 | int | ||
242 | delete_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_MemberSession *session, | ||
243 | const struct GNUNET_HashCode *hash, const struct GNUNET_TIME_Relative delay); | ||
244 | |||
245 | /** | ||
287 | * Returns the CADET handle from a rooms service. | 246 | * Returns the CADET handle from a rooms service. |
288 | * | 247 | * |
289 | * @param room Room | 248 | * @param[in/out] room Room |
290 | * @return CADET handle | 249 | * @return CADET handle |
291 | */ | 250 | */ |
292 | struct GNUNET_CADET_Handle* | 251 | struct GNUNET_CADET_Handle* |
@@ -295,84 +254,95 @@ get_room_cadet (struct GNUNET_MESSENGER_SrvRoom *room); | |||
295 | /** | 254 | /** |
296 | * Returns the shared secret you need to access a <i>room</i>. | 255 | * Returns the shared secret you need to access a <i>room</i>. |
297 | * | 256 | * |
298 | * @param room Room | 257 | * @param[in] room Room |
299 | * @return Shared secret | 258 | * @return Shared secret |
300 | */ | 259 | */ |
301 | struct GNUNET_HashCode* | 260 | const struct GNUNET_HashCode* |
302 | get_room_key (struct GNUNET_MESSENGER_SrvRoom *room); | 261 | get_room_key (const struct GNUNET_MESSENGER_SrvRoom *room); |
303 | 262 | ||
304 | /** | 263 | /** |
305 | * Returns a tunnel inside of a <i>room</i> leading towards a given <i>peer</i> if such a tunnel exists, | 264 | * Returns a tunnel inside of a <i>room</i> leading towards a given <i>peer</i> if such a tunnel exists, |
306 | * otherwise NULL. | 265 | * otherwise NULL. |
307 | * | 266 | * |
308 | * @param room Room | 267 | * @param[in] room Room |
309 | * @param peer Peer identity | 268 | * @param[in] peer Peer identity |
310 | * @return Tunnel or NULL | 269 | * @return Tunnel or NULL |
311 | */ | 270 | */ |
312 | const struct GNUNET_MESSENGER_SrvTunnel* | 271 | const struct GNUNET_MESSENGER_SrvTunnel* |
313 | get_room_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer); | 272 | get_room_tunnel (const struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *peer); |
314 | 273 | ||
315 | /** | 274 | /** |
316 | * Returns a message from a <i>room</i> identified by a given <i>hash</i>. If no matching message is | 275 | * Method called whenever a <i>message</i> is found during a request in a <i>room</i>. |
317 | * found and <i>request</i> is set to GNUNET_YES, the <i>handle</i> will request the missing message | ||
318 | * automatically. | ||
319 | * | ||
320 | * The function uses the optimized check for a message via its hash from the message store. | ||
321 | * @see contains_store_message() | ||
322 | * | 276 | * |
323 | * If a message is missing independent of the following request, NULL gets returned instead of the | 277 | * @param[in/out] cls Closure from #request_room_message |
324 | * matching message. | 278 | * @param[in/out] room Room |
325 | * | 279 | * @param[in] message Message or NULL |
326 | * @param room Room | 280 | * @param[in] hash Hash of message |
327 | * @param handle Handle | ||
328 | * @param hash Hash of message | ||
329 | * @param request Flag to request a message | ||
330 | * @return Message or NULL | ||
331 | */ | 281 | */ |
332 | const struct GNUNET_MESSENGER_Message* | 282 | typedef void (GNUNET_MESSENGER_MessageRequestCallback) ( |
333 | get_room_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, | 283 | void *cls, struct GNUNET_MESSENGER_SrvRoom *room, |
334 | const struct GNUNET_HashCode *hash, int request); | 284 | const struct GNUNET_MESSENGER_Message *message, |
285 | const struct GNUNET_HashCode *hash | ||
286 | ); | ||
335 | 287 | ||
336 | /** | 288 | /** |
337 | * Updates the last messages of a <i>room</i> by replacing them if the previous hash of a given <i>message</i> | 289 | * Requests a message from a <i>room</i> identified by a given <i>hash</i>. If the message is found, |
338 | * matches with one of the latest messages. | 290 | * the selected <i>callback</i> will be called with it and the provided closure. If no matching message |
339 | * | 291 | * is found but it wasn't deleted the selected callback will be called with #NULL as message instead. |
340 | * @param room Room | 292 | * In case of deletion the next available previous message will be used to call the callback. |
341 | * @param message Message | 293 | * |
342 | * @param hash Hash of message | 294 | * It is also possible that the given callback will not be called if the requesting session is not |
295 | * permitted! | ||
296 | * | ||
297 | * @param[in/out] room Room | ||
298 | * @param[in] hash Hash of message | ||
299 | * @param[in] callback Callback to process result | ||
300 | * @param[in] cls Closure for the <i>callback</i> | ||
301 | * @return #GNUNET_YES if the request could be processed, otherwise #GNUNET_NO | ||
343 | */ | 302 | */ |
344 | void | 303 | int |
345 | update_room_last_messages (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_MESSENGER_Message *message, | 304 | request_room_message (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_HashCode *hash, |
346 | const struct GNUNET_HashCode *hash); | 305 | const struct GNUNET_MESSENGER_MemberSession *session, |
306 | GNUNET_MESSENGER_MessageRequestCallback callback, void* cls); | ||
347 | 307 | ||
348 | /** | 308 | /** |
349 | * Changes an id of a current member from an old id to a new one and adds optionally the <i>hash</i> of an | 309 | * Checks for potential collisions with member ids and solves them changing active handles ids if they |
350 | * id message to the members information. | 310 | * use an already used member id (comparing public key and timestamp). |
351 | * | 311 | * |
352 | * @param room Room | 312 | * @param[in/out] room Room |
353 | * @param old_id Old member id | 313 | * @param[in] public_key Public key of EGO |
354 | * @param new_id New member id | 314 | * @param[in] member_id Member ID |
355 | * @param hash Hash of id message | 315 | * @param[in] timestamp Timestamp |
356 | */ | 316 | */ |
357 | void | 317 | void |
358 | switch_room_member_id (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_ShortHashCode *old_id, | 318 | solve_room_member_collisions (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_IDENTITY_PublicKey *public_key, |
359 | const struct GNUNET_ShortHashCode *new_id, const struct GNUNET_HashCode *hash); | 319 | const struct GNUNET_ShortHashCode *member_id, struct GNUNET_TIME_Absolute timestamp); |
360 | 320 | ||
361 | /** | 321 | /** |
362 | * Rebuilds the decentralized structure for a <i>room</i> by ensuring all required connections are made | 322 | * Rebuilds the decentralized structure for a <i>room</i> by ensuring all required connections are made |
363 | * depending on the amount of peers and this peers index in the list of them. | 323 | * depending on the amount of peers and this peers index in the list of them. |
364 | * | 324 | * |
365 | * @param room Room | 325 | * @param[in/out] room Room |
366 | */ | 326 | */ |
367 | void | 327 | void |
368 | rebuild_room_basement_structure (struct GNUNET_MESSENGER_SrvRoom *room); | 328 | rebuild_room_basement_structure (struct GNUNET_MESSENGER_SrvRoom *room); |
369 | 329 | ||
370 | /** | 330 | /** |
371 | * Handles all queued up messages of a room to handle in correct order. | 331 | * Loads the local configuration for a given <i>room</i> of a service which contains the last messages hash |
332 | * and the ruleset for general access of new members. | ||
333 | * | ||
334 | * @param[out] room Room | ||
335 | */ | ||
336 | void | ||
337 | load_room (struct GNUNET_MESSENGER_SrvRoom *room); | ||
338 | |||
339 | /** | ||
340 | * Saves the configuration for a given <i>room</i> of a service which contains the last messages hash | ||
341 | * and the ruleset for general access of new members locally. | ||
372 | * | 342 | * |
373 | * @param room Room | 343 | * @param[in] room Room |
374 | */ | 344 | */ |
375 | void | 345 | void |
376 | handle_room_messages (struct GNUNET_MESSENGER_SrvRoom *room); | 346 | save_room (struct GNUNET_MESSENGER_SrvRoom *room); |
377 | 347 | ||
378 | #endif //GNUNET_SERVICE_MESSENGER_ROOM_H | 348 | #endif //GNUNET_SERVICE_MESSENGER_ROOM_H |
diff --git a/src/messenger/gnunet-service-messenger_service.c b/src/messenger/gnunet-service-messenger_service.c index 963314fd8..8c63e9bf4 100644 --- a/src/messenger/gnunet-service-messenger_service.c +++ b/src/messenger/gnunet-service-messenger_service.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -24,11 +24,8 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "gnunet-service-messenger_service.h" | 26 | #include "gnunet-service-messenger_service.h" |
27 | |||
28 | #include "gnunet-service-messenger_message_kind.h" | 27 | #include "gnunet-service-messenger_message_kind.h" |
29 | |||
30 | #include "gnunet-service-messenger.h" | 28 | #include "gnunet-service-messenger.h" |
31 | #include "gnunet-service-messenger_util.h" | ||
32 | 29 | ||
33 | static void | 30 | static void |
34 | callback_shutdown_service (void *cls) | 31 | callback_shutdown_service (void *cls) |
@@ -43,23 +40,11 @@ callback_shutdown_service (void *cls) | |||
43 | } | 40 | } |
44 | } | 41 | } |
45 | 42 | ||
46 | static void | ||
47 | callback_update_ego (void *cls, | ||
48 | struct GNUNET_IDENTITY_Ego *ego, | ||
49 | void **ctx, | ||
50 | const char *identifier) | ||
51 | { | ||
52 | if ((!ego) || (!identifier)) | ||
53 | return; | ||
54 | |||
55 | struct GNUNET_MESSENGER_Service *service = cls; | ||
56 | |||
57 | update_service_ego(service, identifier, GNUNET_IDENTITY_ego_get_private_key(ego)); | ||
58 | } | ||
59 | |||
60 | struct GNUNET_MESSENGER_Service* | 43 | struct GNUNET_MESSENGER_Service* |
61 | create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle) | 44 | create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_SERVICE_Handle *service_handle) |
62 | { | 45 | { |
46 | GNUNET_assert((config) && (service_handle)); | ||
47 | |||
63 | struct GNUNET_MESSENGER_Service *service = GNUNET_new(struct GNUNET_MESSENGER_Service); | 48 | struct GNUNET_MESSENGER_Service *service = GNUNET_new(struct GNUNET_MESSENGER_Service); |
64 | 49 | ||
65 | service->config = config; | 50 | service->config = config; |
@@ -90,24 +75,16 @@ create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_ | |||
90 | } | 75 | } |
91 | 76 | ||
92 | service->cadet = GNUNET_CADET_connect (service->config); | 77 | service->cadet = GNUNET_CADET_connect (service->config); |
93 | service->identity = GNUNET_IDENTITY_connect (service->config, &callback_update_ego, service); | ||
94 | 78 | ||
95 | service->egos = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 79 | init_ego_store(get_service_ego_store(service), service->config); |
96 | 80 | ||
97 | init_list_handles (&(service->handles)); | 81 | init_list_handles (&(service->handles)); |
98 | 82 | ||
99 | service->contacts = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | ||
100 | service->rooms = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 83 | service->rooms = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); |
101 | 84 | ||
102 | return service; | 85 | init_contact_store(get_service_contact_store(service)); |
103 | } | ||
104 | 86 | ||
105 | static int | 87 | return service; |
106 | iterate_destroy_egos (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
107 | { | ||
108 | struct GNUNET_MESSENGER_Ego *ego = value; | ||
109 | GNUNET_free(ego); | ||
110 | return GNUNET_YES; | ||
111 | } | 88 | } |
112 | 89 | ||
113 | static int | 90 | static int |
@@ -118,17 +95,11 @@ iterate_destroy_rooms (void *cls, const struct GNUNET_HashCode *key, void *value | |||
118 | return GNUNET_YES; | 95 | return GNUNET_YES; |
119 | } | 96 | } |
120 | 97 | ||
121 | static int | ||
122 | iterate_destroy_contacts (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
123 | { | ||
124 | struct GNUNET_MESSENGER_SrvContact *contact = value; | ||
125 | destroy_contact (contact); | ||
126 | return GNUNET_YES; | ||
127 | } | ||
128 | |||
129 | void | 98 | void |
130 | destroy_service (struct GNUNET_MESSENGER_Service *service) | 99 | destroy_service (struct GNUNET_MESSENGER_Service *service) |
131 | { | 100 | { |
101 | GNUNET_assert(service); | ||
102 | |||
132 | if (service->shutdown) | 103 | if (service->shutdown) |
133 | { | 104 | { |
134 | GNUNET_SCHEDULER_cancel (service->shutdown); | 105 | GNUNET_SCHEDULER_cancel (service->shutdown); |
@@ -136,16 +107,13 @@ destroy_service (struct GNUNET_MESSENGER_Service *service) | |||
136 | service->shutdown = NULL; | 107 | service->shutdown = NULL; |
137 | } | 108 | } |
138 | 109 | ||
139 | GNUNET_CONTAINER_multihashmap_iterate (service->egos, iterate_destroy_egos, NULL); | 110 | clear_ego_store(get_service_ego_store(service)); |
140 | |||
141 | clear_list_handles (&(service->handles)); | 111 | clear_list_handles (&(service->handles)); |
142 | 112 | ||
143 | GNUNET_CONTAINER_multihashmap_iterate (service->rooms, iterate_destroy_rooms, NULL); | 113 | GNUNET_CONTAINER_multihashmap_iterate (service->rooms, iterate_destroy_rooms, NULL); |
144 | GNUNET_CONTAINER_multihashmap_iterate (service->contacts, iterate_destroy_contacts, NULL); | ||
145 | |||
146 | GNUNET_CONTAINER_multihashmap_destroy (service->egos); | ||
147 | GNUNET_CONTAINER_multihashmap_destroy (service->rooms); | 114 | GNUNET_CONTAINER_multihashmap_destroy (service->rooms); |
148 | GNUNET_CONTAINER_multihashmap_destroy (service->contacts); | 115 | |
116 | clear_contact_store(get_service_contact_store(service)); | ||
149 | 117 | ||
150 | if (service->cadet) | 118 | if (service->cadet) |
151 | { | 119 | { |
@@ -154,13 +122,6 @@ destroy_service (struct GNUNET_MESSENGER_Service *service) | |||
154 | service->cadet = NULL; | 122 | service->cadet = NULL; |
155 | } | 123 | } |
156 | 124 | ||
157 | if (service->identity) | ||
158 | { | ||
159 | GNUNET_IDENTITY_disconnect (service->identity); | ||
160 | |||
161 | service->identity = NULL; | ||
162 | } | ||
163 | |||
164 | if (service->dir) | 125 | if (service->dir) |
165 | { | 126 | { |
166 | GNUNET_free(service->dir); | 127 | GNUNET_free(service->dir); |
@@ -173,44 +134,27 @@ destroy_service (struct GNUNET_MESSENGER_Service *service) | |||
173 | GNUNET_free(service); | 134 | GNUNET_free(service); |
174 | } | 135 | } |
175 | 136 | ||
176 | struct GNUNET_MESSENGER_Ego* | 137 | struct GNUNET_MESSENGER_EgoStore* |
177 | lookup_service_ego (struct GNUNET_MESSENGER_Service *service, const char *identifier) | 138 | get_service_ego_store (struct GNUNET_MESSENGER_Service *service) |
178 | { | 139 | { |
179 | GNUNET_assert(identifier); | 140 | GNUNET_assert(service); |
180 | 141 | ||
181 | struct GNUNET_HashCode hash; | 142 | return &(service->ego_store); |
182 | |||
183 | GNUNET_CRYPTO_hash(identifier, strlen(identifier), &hash); | ||
184 | return GNUNET_CONTAINER_multihashmap_get(service->egos, &hash); | ||
185 | } | 143 | } |
186 | 144 | ||
187 | void | 145 | struct GNUNET_MESSENGER_ContactStore* |
188 | update_service_ego (struct GNUNET_MESSENGER_Service *service, const char *identifier, | 146 | get_service_contact_store (struct GNUNET_MESSENGER_Service *service) |
189 | const struct GNUNET_IDENTITY_PrivateKey* key) | ||
190 | { | 147 | { |
191 | GNUNET_assert((identifier) && (key)); | 148 | GNUNET_assert(service); |
192 | |||
193 | struct GNUNET_HashCode hash; | ||
194 | |||
195 | GNUNET_CRYPTO_hash(identifier, strlen(identifier), &hash); | ||
196 | 149 | ||
197 | struct GNUNET_MESSENGER_Ego* ego = GNUNET_CONTAINER_multihashmap_get(service->egos, &hash); | 150 | return &(service->contact_store); |
198 | |||
199 | if (!ego) | ||
200 | { | ||
201 | ego = GNUNET_new(struct GNUNET_MESSENGER_Ego); | ||
202 | GNUNET_CONTAINER_multihashmap_put(service->egos, &hash, ego, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
203 | } | ||
204 | |||
205 | GNUNET_memcpy(&(ego->priv), key, sizeof(*key)); | ||
206 | |||
207 | if (GNUNET_OK != GNUNET_IDENTITY_key_get_public(key, &(ego->pub))) | ||
208 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Updating invalid ego key failed!\n"); | ||
209 | } | 151 | } |
210 | 152 | ||
211 | struct GNUNET_MESSENGER_SrvHandle* | 153 | struct GNUNET_MESSENGER_SrvHandle* |
212 | add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) | 154 | add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_Handle *mq) |
213 | { | 155 | { |
156 | GNUNET_assert((service) && (mq)); | ||
157 | |||
214 | struct GNUNET_MESSENGER_SrvHandle *handle = create_handle (service, mq); | 158 | struct GNUNET_MESSENGER_SrvHandle *handle = create_handle (service, mq); |
215 | 159 | ||
216 | if (handle) | 160 | if (handle) |
@@ -224,6 +168,8 @@ add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_H | |||
224 | void | 168 | void |
225 | remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle) | 169 | remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle) |
226 | { | 170 | { |
171 | GNUNET_assert((service) && (handle)); | ||
172 | |||
227 | if (!handle) | 173 | if (!handle) |
228 | return; | 174 | return; |
229 | 175 | ||
@@ -234,68 +180,16 @@ remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_M | |||
234 | int | 180 | int |
235 | get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer) | 181 | get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer) |
236 | { | 182 | { |
237 | return GNUNET_CRYPTO_get_peer_identity (service->config, peer); | 183 | GNUNET_assert((service) && (peer)); |
238 | } | ||
239 | 184 | ||
240 | struct GNUNET_MESSENGER_SrvContact* | 185 | return GNUNET_CRYPTO_get_peer_identity (service->config, peer); |
241 | get_service_contact_by_pubkey (struct GNUNET_MESSENGER_Service *service, const struct GNUNET_IDENTITY_PublicKey *pubkey) | ||
242 | { | ||
243 | struct GNUNET_HashCode hash; | ||
244 | |||
245 | GNUNET_CRYPTO_hash (pubkey, sizeof(*pubkey), &hash); | ||
246 | |||
247 | struct GNUNET_MESSENGER_SrvContact *contact = GNUNET_CONTAINER_multihashmap_get (service->contacts, &hash); | ||
248 | |||
249 | if (contact) | ||
250 | return contact; | ||
251 | |||
252 | contact = create_contact (pubkey); | ||
253 | |||
254 | if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (service->contacts, &hash, contact, | ||
255 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
256 | return contact; | ||
257 | |||
258 | destroy_contact (contact); | ||
259 | return NULL; | ||
260 | } | ||
261 | |||
262 | void | ||
263 | swap_service_contact_by_pubkey (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvContact *contact, | ||
264 | const struct GNUNET_IDENTITY_PublicKey *pubkey) | ||
265 | { | ||
266 | const struct GNUNET_HashCode *hash = get_contact_id_from_key (contact); | ||
267 | |||
268 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (service->contacts, hash, contact)) | ||
269 | { | ||
270 | GNUNET_memcpy(&(contact->public_key), pubkey, sizeof(*pubkey)); | ||
271 | |||
272 | hash = get_contact_id_from_key (contact); | ||
273 | |||
274 | GNUNET_CONTAINER_multihashmap_put (service->contacts, hash, contact, | ||
275 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
276 | } | ||
277 | } | ||
278 | |||
279 | struct GNUNET_ShortHashCode* | ||
280 | generate_service_new_member_id (struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key) | ||
281 | { | ||
282 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key); | ||
283 | |||
284 | if (room) | ||
285 | { | ||
286 | return generate_room_member_id (room); | ||
287 | } | ||
288 | else | ||
289 | { | ||
290 | struct GNUNET_ShortHashCode *random_id = GNUNET_new(struct GNUNET_ShortHashCode); | ||
291 | generate_free_member_id (random_id, NULL); | ||
292 | return random_id; | ||
293 | } | ||
294 | } | 186 | } |
295 | 187 | ||
296 | struct GNUNET_MESSENGER_SrvRoom* | 188 | struct GNUNET_MESSENGER_SrvRoom* |
297 | get_service_room (struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key) | 189 | get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key) |
298 | { | 190 | { |
191 | GNUNET_assert((service) && (key)); | ||
192 | |||
299 | return GNUNET_CONTAINER_multihashmap_get (service->rooms, key); | 193 | return GNUNET_CONTAINER_multihashmap_get (service->rooms, key); |
300 | } | 194 | } |
301 | 195 | ||
@@ -303,6 +197,8 @@ int | |||
303 | open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 197 | open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, |
304 | const struct GNUNET_HashCode *key) | 198 | const struct GNUNET_HashCode *key) |
305 | { | 199 | { |
200 | GNUNET_assert((service) && (handle) && (key)); | ||
201 | |||
306 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key); | 202 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key); |
307 | 203 | ||
308 | if (room) | 204 | if (room) |
@@ -310,8 +206,10 @@ open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSE | |||
310 | 206 | ||
311 | room = create_room (handle, key); | 207 | room = create_room (handle, key); |
312 | 208 | ||
313 | if ((GNUNET_YES == open_room (room, handle)) && (GNUNET_OK | 209 | if ((GNUNET_YES == open_room (room, handle)) && |
314 | == GNUNET_CONTAINER_multihashmap_put (service->rooms, key, room, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | 210 | (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (service->rooms, |
211 | key, room, | ||
212 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | ||
315 | return GNUNET_YES; | 213 | return GNUNET_YES; |
316 | 214 | ||
317 | destroy_room (room); | 215 | destroy_room (room); |
@@ -322,11 +220,13 @@ int | |||
322 | entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 220 | entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, |
323 | const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) | 221 | const struct GNUNET_PeerIdentity *door, const struct GNUNET_HashCode *key) |
324 | { | 222 | { |
223 | GNUNET_assert((service) && (handle) && (door) && (key)); | ||
224 | |||
325 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key); | 225 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key); |
326 | 226 | ||
327 | if (room) | 227 | if (room) |
328 | { | 228 | { |
329 | if (GNUNET_YES == entry_room_at (room, handle, door)) | 229 | if (GNUNET_YES == enter_room_at (room, handle, door)) |
330 | return GNUNET_YES; | 230 | return GNUNET_YES; |
331 | else | 231 | else |
332 | return GNUNET_NO; | 232 | return GNUNET_NO; |
@@ -334,8 +234,10 @@ entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS | |||
334 | 234 | ||
335 | room = create_room (handle, key); | 235 | room = create_room (handle, key); |
336 | 236 | ||
337 | if ((GNUNET_YES == entry_room_at (room, handle, door)) && (GNUNET_OK | 237 | if ((GNUNET_YES == enter_room_at (room, handle, door)) && |
338 | == GNUNET_CONTAINER_multihashmap_put (service->rooms, key, room, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | 238 | (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (service->rooms, |
239 | key, room, | ||
240 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | ||
339 | { | 241 | { |
340 | return GNUNET_YES; | 242 | return GNUNET_YES; |
341 | } | 243 | } |
@@ -351,20 +253,14 @@ int | |||
351 | close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 253 | close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, |
352 | const struct GNUNET_HashCode *key) | 254 | const struct GNUNET_HashCode *key) |
353 | { | 255 | { |
256 | GNUNET_assert((service) && (handle) && (key)); | ||
257 | |||
354 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key); | 258 | struct GNUNET_MESSENGER_SrvRoom *room = get_service_room (service, key); |
355 | 259 | ||
356 | if (!room) | 260 | if (!room) |
357 | return GNUNET_NO; | 261 | return GNUNET_NO; |
358 | 262 | ||
359 | struct GNUNET_MESSENGER_Message *message = create_message_leave (); | 263 | send_room_message (room, handle, create_message_leave ()); |
360 | |||
361 | if (message) | ||
362 | { | ||
363 | struct GNUNET_HashCode hash; | ||
364 | |||
365 | send_room_message (room, handle, message, &hash); | ||
366 | destroy_message (message); | ||
367 | } | ||
368 | 264 | ||
369 | const struct GNUNET_ShortHashCode *id = get_handle_member_id (handle, key); | 265 | const struct GNUNET_ShortHashCode *id = get_handle_member_id (handle, key); |
370 | 266 | ||
@@ -393,124 +289,18 @@ close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS | |||
393 | return GNUNET_YES; | 289 | return GNUNET_YES; |
394 | } | 290 | } |
395 | 291 | ||
396 | static void | ||
397 | get_room_data_subdir (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, char **dir) | ||
398 | { | ||
399 | GNUNET_asprintf (dir, "%s%s%c%s%c", service->dir, "rooms", DIR_SEPARATOR, GNUNET_h2s (&(room->key)), DIR_SEPARATOR); | ||
400 | } | ||
401 | |||
402 | void | ||
403 | load_service_room_and_messages (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room) | ||
404 | { | ||
405 | char *room_dir; | ||
406 | get_room_data_subdir (service, room, &room_dir); | ||
407 | |||
408 | if (GNUNET_YES == GNUNET_DISK_directory_test (room_dir, GNUNET_YES)) | ||
409 | { | ||
410 | load_message_store (&room->store, room_dir); | ||
411 | |||
412 | char *config_file; | ||
413 | GNUNET_asprintf (&config_file, "%s%s", room_dir, "room.cfg"); | ||
414 | |||
415 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
416 | |||
417 | if ((GNUNET_YES == GNUNET_DISK_file_test (config_file)) && (GNUNET_OK | ||
418 | == GNUNET_CONFIGURATION_parse (cfg, config_file))) | ||
419 | { | ||
420 | unsigned long long access; | ||
421 | |||
422 | if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_number (cfg, "room", "access-rule", &access)) | ||
423 | room->strict_access = (int) (access); | ||
424 | |||
425 | char *message_string; | ||
426 | |||
427 | if ((GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (cfg, "room", "last-message", &message_string)) && (message_string)) | ||
428 | { | ||
429 | struct GNUNET_HashCode hash; | ||
430 | |||
431 | GNUNET_CRYPTO_hash_from_string(message_string, &hash); | ||
432 | |||
433 | const struct GNUNET_MESSENGER_Message *message = get_room_message (room, room->host, &hash, GNUNET_NO); | ||
434 | |||
435 | if (message) | ||
436 | update_room_last_messages (room, message, &hash); | ||
437 | |||
438 | GNUNET_free(message_string); | ||
439 | } | ||
440 | } | ||
441 | |||
442 | GNUNET_CONFIGURATION_destroy (cfg); | ||
443 | |||
444 | GNUNET_free(config_file); | ||
445 | } | ||
446 | |||
447 | GNUNET_free(room_dir); | ||
448 | } | ||
449 | |||
450 | void | ||
451 | save_service_room_and_messages (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room) | ||
452 | { | ||
453 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains (service->rooms, &(room->key))) | ||
454 | { | ||
455 | return; | ||
456 | } | ||
457 | |||
458 | char *room_dir; | ||
459 | get_room_data_subdir (service, room, &room_dir); | ||
460 | |||
461 | if ((GNUNET_YES == GNUNET_DISK_directory_test (room_dir, GNUNET_NO)) || (GNUNET_OK | ||
462 | == GNUNET_DISK_directory_create (room_dir))) | ||
463 | { | ||
464 | save_message_store (&room->store, room_dir); | ||
465 | |||
466 | char *config_file; | ||
467 | GNUNET_asprintf (&config_file, "%s%s", room_dir, "room.cfg"); | ||
468 | |||
469 | struct GNUNET_CONFIGURATION_Handle *cfg = GNUNET_CONFIGURATION_create (); | ||
470 | |||
471 | GNUNET_CONFIGURATION_set_value_number (cfg, "room", "access-rule", room->strict_access); | ||
472 | |||
473 | if (room->last_messages.head) | ||
474 | GNUNET_CONFIGURATION_set_value_string (cfg, "room", "last-message", | ||
475 | GNUNET_h2s_full (&(room->last_messages.head->hash))); | ||
476 | |||
477 | GNUNET_CONFIGURATION_write (cfg, config_file); | ||
478 | GNUNET_CONFIGURATION_destroy (cfg); | ||
479 | |||
480 | GNUNET_free(config_file); | ||
481 | } | ||
482 | |||
483 | GNUNET_free(room_dir); | ||
484 | } | ||
485 | |||
486 | void | 292 | void |
487 | handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, | 293 | handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, |
294 | const struct GNUNET_MESSENGER_MemberSession *session, | ||
488 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 295 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
489 | { | 296 | { |
490 | struct GNUNET_MESSENGER_ListHandle *element = service->handles.head; | 297 | GNUNET_assert((service) && (room) && (session) && (message) && (hash)); |
491 | 298 | ||
492 | const uint16_t length = get_message_size (message); | 299 | struct GNUNET_MESSENGER_ListHandle *element = service->handles.head; |
493 | 300 | ||
494 | while (element) | 301 | while (element) |
495 | { | 302 | { |
496 | struct GNUNET_MESSENGER_SrvHandle *handle = (struct GNUNET_MESSENGER_SrvHandle*) element->handle; | 303 | notify_handle_message (element->handle, get_room_key(room), session, message, hash); |
497 | |||
498 | if ((handle->mq) && (get_handle_member_id (handle, &(room->key)))) | ||
499 | { | ||
500 | struct GNUNET_MESSENGER_RecvMessage *msg; | ||
501 | struct GNUNET_MQ_Envelope *env; | ||
502 | |||
503 | env = GNUNET_MQ_msg_extra(msg, length, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE); | ||
504 | |||
505 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(room->key)); | ||
506 | GNUNET_memcpy(&(msg->hash), hash, sizeof(*hash)); | ||
507 | |||
508 | char *buffer = ((char*) msg) + sizeof(*msg); | ||
509 | encode_message (message, length, buffer); | ||
510 | |||
511 | GNUNET_MQ_send (handle->mq, env); | ||
512 | } | ||
513 | |||
514 | element = element->next; | 304 | element = element->next; |
515 | } | 305 | } |
516 | } | 306 | } |
diff --git a/src/messenger/gnunet-service-messenger_service.h b/src/messenger/gnunet-service-messenger_service.h index 246c74771..aa43fa457 100644 --- a/src/messenger/gnunet-service-messenger_service.h +++ b/src/messenger/gnunet-service-messenger_service.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -33,13 +33,14 @@ | |||
33 | #include "gnunet_disk_lib.h" | 33 | #include "gnunet_disk_lib.h" |
34 | #include "gnunet_identity_service.h" | 34 | #include "gnunet_identity_service.h" |
35 | 35 | ||
36 | #include "messenger_api_ego.h" | 36 | #include "gnunet-service-messenger_ego_store.h" |
37 | |||
38 | #include "gnunet-service-messenger_list_handles.h" | 37 | #include "gnunet-service-messenger_list_handles.h" |
39 | 38 | ||
40 | #include "gnunet-service-messenger_contact.h" | 39 | #include "messenger_api_contact_store.h" |
41 | #include "gnunet-service-messenger_room.h" | 40 | #include "gnunet-service-messenger_room.h" |
42 | 41 | ||
42 | #include "gnunet-service-messenger_member_session.h" | ||
43 | |||
43 | struct GNUNET_MESSENGER_Service | 44 | struct GNUNET_MESSENGER_Service |
44 | { | 45 | { |
45 | const struct GNUNET_CONFIGURATION_Handle *config; | 46 | const struct GNUNET_CONFIGURATION_Handle *config; |
@@ -50,21 +51,20 @@ struct GNUNET_MESSENGER_Service | |||
50 | char *dir; | 51 | char *dir; |
51 | 52 | ||
52 | struct GNUNET_CADET_Handle *cadet; | 53 | struct GNUNET_CADET_Handle *cadet; |
53 | struct GNUNET_IDENTITY_Handle *identity; | ||
54 | 54 | ||
55 | struct GNUNET_CONTAINER_MultiHashMap *egos; | 55 | struct GNUNET_MESSENGER_EgoStore ego_store; |
56 | struct GNUNET_MESSENGER_ContactStore contact_store; | ||
56 | 57 | ||
57 | struct GNUNET_MESSENGER_ListHandles handles; | 58 | struct GNUNET_MESSENGER_ListHandles handles; |
58 | 59 | ||
59 | struct GNUNET_CONTAINER_MultiHashMap *contacts; | ||
60 | struct GNUNET_CONTAINER_MultiHashMap *rooms; | 60 | struct GNUNET_CONTAINER_MultiHashMap *rooms; |
61 | }; | 61 | }; |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * Creates and allocates a new service using a given <i>config</i> and a GNUnet service handle. | 64 | * Creates and allocates a new service using a given <i>config</i> and a GNUnet service handle. |
65 | * | 65 | * |
66 | * @param config Configuration | 66 | * @param[in] config Configuration |
67 | * @param service_handle GNUnet service handle | 67 | * @param[in/out] service_handle GNUnet service handle |
68 | * @return New service | 68 | * @return New service |
69 | */ | 69 | */ |
70 | struct GNUNET_MESSENGER_Service* | 70 | struct GNUNET_MESSENGER_Service* |
@@ -73,39 +73,34 @@ create_service (const struct GNUNET_CONFIGURATION_Handle *config, struct GNUNET_ | |||
73 | /** | 73 | /** |
74 | * Destroys a <i>service</i> and frees its memory fully. | 74 | * Destroys a <i>service</i> and frees its memory fully. |
75 | * | 75 | * |
76 | * @param service Service | 76 | * @param[in/out] service Service |
77 | */ | 77 | */ |
78 | void | 78 | void |
79 | destroy_service (struct GNUNET_MESSENGER_Service *service); | 79 | destroy_service (struct GNUNET_MESSENGER_Service *service); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Lookups an EGO which was registered to a <i>service</i> under | 82 | * Returns the used EGO-store of a given <i>service</i>. |
83 | * a specific <i>identifier</i>. | ||
84 | * | 83 | * |
85 | * @param service Service | 84 | * @param[in/out] service Service |
86 | * @param identifier Identifier string | 85 | * @return EGO-store |
87 | * @return EGO or NULL | ||
88 | */ | 86 | */ |
89 | struct GNUNET_MESSENGER_Ego* | 87 | struct GNUNET_MESSENGER_EgoStore* |
90 | lookup_service_ego (struct GNUNET_MESSENGER_Service *service, const char *identifier); | 88 | get_service_ego_store (struct GNUNET_MESSENGER_Service *service); |
91 | 89 | ||
92 | /** | 90 | /** |
93 | * Updates the registration of an EGO to a <i>service</i> under | 91 | * Returns the used contact store of a given <i>service</i>. |
94 | * a specific <i>identifier</i> with a new <i>key</i>. | ||
95 | * | 92 | * |
96 | * @param service Service | 93 | * @param[in/out] service Service |
97 | * @param identifier Identifier string | 94 | * @return Contact store |
98 | * @param key Private EGO key | ||
99 | */ | 95 | */ |
100 | void | 96 | struct GNUNET_MESSENGER_ContactStore* |
101 | update_service_ego (struct GNUNET_MESSENGER_Service *service, const char *identifier, | 97 | get_service_contact_store (struct GNUNET_MESSENGER_Service *service); |
102 | const struct GNUNET_IDENTITY_PrivateKey* key); | ||
103 | 98 | ||
104 | /** | 99 | /** |
105 | * Creates and adds a new handle to a <i>service</i> using a given message queue. | 100 | * Creates and adds a new handle to a <i>service</i> using a given message queue. |
106 | * | 101 | * |
107 | * @param service Service | 102 | * @param[in/out] service Service |
108 | * @param mq Message queue | 103 | * @param[in/out] mq Message queue |
109 | * @return New handle | 104 | * @return New handle |
110 | */ | 105 | */ |
111 | struct GNUNET_MESSENGER_SrvHandle* | 106 | struct GNUNET_MESSENGER_SrvHandle* |
@@ -114,77 +109,42 @@ add_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MQ_H | |||
114 | /** | 109 | /** |
115 | * Removes a <i>handle</i> from a <i>service</i> and destroys it. | 110 | * Removes a <i>handle</i> from a <i>service</i> and destroys it. |
116 | * | 111 | * |
117 | * @param service Service | 112 | * @param[in/out] service Service |
118 | * @param handle Handle | 113 | * @param[in/out] handle Handle |
119 | */ | 114 | */ |
120 | void | 115 | void |
121 | remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle); | 116 | remove_service_handle (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle); |
122 | 117 | ||
123 | /** | 118 | /** |
124 | * Tries to write the peer identity of the peer running a <i>service</i> on to the <i>peer</i> | 119 | * Tries to write the peer identity of the peer running a <i>service</i> on to the <i>peer</i> |
125 | * parameter. The functions returns GNUNET_OK on success, otherwise GNUNET_SYSERR. | 120 | * parameter. The functions returns #GNUNET_OK on success, otherwise #GNUNET_SYSERR. |
126 | * | 121 | * |
127 | * @param service Service | 122 | * @param[in] service Service |
128 | * @param[out] peer Peer identity | 123 | * @param[out] peer Peer identity |
129 | * @return GNUNET_OK on success, otherwise GNUNET_SYSERR | 124 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR |
130 | */ | 125 | */ |
131 | int | 126 | int |
132 | get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer); | 127 | get_service_peer_identity (const struct GNUNET_MESSENGER_Service *service, struct GNUNET_PeerIdentity *peer); |
133 | 128 | ||
134 | /** | 129 | /** |
135 | * Returns a contact of a <i>service</i> identified by a given public key. If no matching contact exists, | ||
136 | * it will tried to create one with the specific public key. If the function still fails to do so, | ||
137 | * NULL gets returned. | ||
138 | * | ||
139 | * @param service Service | ||
140 | * @param pubkey Public key of EGO | ||
141 | * @return Contact | ||
142 | */ | ||
143 | struct GNUNET_MESSENGER_SrvContact* | ||
144 | get_service_contact_by_pubkey (struct GNUNET_MESSENGER_Service *service, const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
145 | |||
146 | /** | ||
147 | * Changes the public key for a <i>contact</i> known to a <i>service</i> to a specific public key and | ||
148 | * updates local map entries to access the contact by its updated key. | ||
149 | * | ||
150 | * @param service Service | ||
151 | * @param contact Contact | ||
152 | * @param pubkey Public key of EGO | ||
153 | */ | ||
154 | void | ||
155 | swap_service_contact_by_pubkey (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvContact *contact, | ||
156 | const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
157 | |||
158 | /** | ||
159 | * Tries to generate and allocate a new unique member id for a given room of a service identified by its <i>key</i>. | ||
160 | * If the generation fails caused by too many tries of duplicates, it returns NULL. | ||
161 | * | ||
162 | * @param service Service | ||
163 | * @param key Key of room | ||
164 | * @return Newly generated member id or NULL | ||
165 | */ | ||
166 | struct GNUNET_ShortHashCode* | ||
167 | generate_service_new_member_id (struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key); | ||
168 | |||
169 | /** | ||
170 | * Returns the room identified by a given <i>key</i> for a <i>service</i>. If the service doesn't know any room | 130 | * Returns the room identified by a given <i>key</i> for a <i>service</i>. If the service doesn't know any room |
171 | * using the given key, NULL gets returned. | 131 | * using the given key, NULL gets returned. |
172 | * | 132 | * |
173 | * @param service Service | 133 | * @param[in] service Service |
174 | * @param key Key of room | 134 | * @param[in] key Key of room |
175 | * @return Room or NULL | 135 | * @return Room or NULL |
176 | */ | 136 | */ |
177 | struct GNUNET_MESSENGER_SrvRoom* | 137 | struct GNUNET_MESSENGER_SrvRoom* |
178 | get_service_room (struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key); | 138 | get_service_room (const struct GNUNET_MESSENGER_Service *service, const struct GNUNET_HashCode *key); |
179 | 139 | ||
180 | /** | 140 | /** |
181 | * Tries to open a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will be | 141 | * Tries to open a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will be |
182 | * created if necessary. If the function is successful, it returns GNUNET_YES, otherwise GNUNET_NO. | 142 | * created if necessary. If the function is successful, it returns #GNUNET_YES, otherwise #GNUNET_NO. |
183 | * | 143 | * |
184 | * @param service Service | 144 | * @param[in/out] service Service |
185 | * @param handle Handle | 145 | * @param[in/out] handle Handle |
186 | * @param key Key of room | 146 | * @param[in] key Key of room |
187 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 147 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
188 | */ | 148 | */ |
189 | int | 149 | int |
190 | open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 150 | open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, |
@@ -192,16 +152,16 @@ open_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSE | |||
192 | 152 | ||
193 | /** | 153 | /** |
194 | * Tries to enter a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will | 154 | * Tries to enter a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will |
195 | * be created if necessary. If the function is successful, it returns GNUNET_YES, otherwise GNUNET_NO. | 155 | * be created if necessary. If the function is successful, it returns #GNUNET_YES, otherwise #GNUNET_NO. |
196 | * | 156 | * |
197 | * The room will be entered through the peer identitied by the peer identity provided as <i>door</i> parameter and | 157 | * The room will be entered through the peer identitied by the peer identity provided as <i>door</i> parameter and |
198 | * a new connection will be made. | 158 | * a new connection will be made. |
199 | * | 159 | * |
200 | * @param service Service | 160 | * @param[in/out] service Service |
201 | * @param handle Handle | 161 | * @param[in/out] handle Handle |
202 | * @param door Peer identity | 162 | * @param[in] door Peer identity |
203 | * @param key Key of room | 163 | * @param[in] key Key of room |
204 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 164 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
205 | */ | 165 | */ |
206 | int | 166 | int |
207 | entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 167 | entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, |
@@ -209,51 +169,33 @@ entry_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESS | |||
209 | 169 | ||
210 | /** | 170 | /** |
211 | * Tries to close a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will | 171 | * Tries to close a room using a given <i>key</i> for a <i>service</i> by a specific <i>handle</i>. The room will |
212 | * be created if necessary. If the function is successful, it returns GNUNET_YES, otherwise GNUNET_NO. | 172 | * be created if necessary. If the function is successful, it returns #GNUNET_YES, otherwise #GNUNET_NO. |
213 | * | 173 | * |
214 | * If the specific handle is currently the host of the room for this service, a new handle which is a member will | 174 | * If the specific handle is currently the host of the room for this service, a new handle which is a member will |
215 | * take its place. Otherwise the room will be destroyed for this service. | 175 | * take its place. Otherwise the room will be destroyed for this service. |
216 | * | 176 | * |
217 | * @param service Service | 177 | * @param[in/out] service Service |
218 | * @param handle Handle | 178 | * @param[in/out] handle Handle |
219 | * @param key Key of room | 179 | * @param[in] key Key of room |
220 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 180 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
221 | */ | 181 | */ |
222 | int | 182 | int |
223 | close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, | 183 | close_service_room (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvHandle *handle, |
224 | const struct GNUNET_HashCode *key); | 184 | const struct GNUNET_HashCode *key); |
225 | 185 | ||
226 | /** | 186 | /** |
227 | * Loads the local configuration for a given <i>room</i> of a <i>service</i> which contains the last messages hash | ||
228 | * and the ruleset for general access of new members. | ||
229 | * | ||
230 | * @param service Service | ||
231 | * @param room Room | ||
232 | */ | ||
233 | void | ||
234 | load_service_room_and_messages (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room); | ||
235 | |||
236 | /** | ||
237 | * Saves the configuration for a given <i>room</i> of a <i>service</i> which contains the last messages hash | ||
238 | * and the ruleset for general access of new members locally. | ||
239 | * | ||
240 | * @param service Service | ||
241 | * @param room Room | ||
242 | */ | ||
243 | void | ||
244 | save_service_room_and_messages (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room); | ||
245 | |||
246 | /** | ||
247 | * Sends a received or sent <i>message</i> with a given <i>hash</i> to each handle of a <i>service</i> which | 187 | * Sends a received or sent <i>message</i> with a given <i>hash</i> to each handle of a <i>service</i> which |
248 | * is currently member of a specific <i>room</i> for handling it in the client API. | 188 | * is currently member of a specific <i>room</i> for handling it in the client API. |
249 | * | 189 | * |
250 | * @param service Service | 190 | * @param[in/out] service Service |
251 | * @param room Room | 191 | * @param[in/out] room Room |
252 | * @param message Message | 192 | * @param[in] session Member session |
253 | * @param hash Hash of message | 193 | * @param[in] message Message |
194 | * @param[in] hash Hash of message | ||
254 | */ | 195 | */ |
255 | void | 196 | void |
256 | handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, | 197 | handle_service_message (struct GNUNET_MESSENGER_Service *service, struct GNUNET_MESSENGER_SrvRoom *room, |
198 | const struct GNUNET_MESSENGER_MemberSession *session, | ||
257 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 199 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
258 | 200 | ||
259 | #endif //GNUNET_SERVICE_MESSENGER_SERVICE_H | 201 | #endif //GNUNET_SERVICE_MESSENGER_SERVICE_H |
diff --git a/src/messenger/gnunet-service-messenger_tunnel.c b/src/messenger/gnunet-service-messenger_tunnel.c index df9e5c4c7..80d8dfa5e 100644 --- a/src/messenger/gnunet-service-messenger_tunnel.c +++ b/src/messenger/gnunet-service-messenger_tunnel.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -26,7 +26,11 @@ | |||
26 | #include "gnunet-service-messenger_tunnel.h" | 26 | #include "gnunet-service-messenger_tunnel.h" |
27 | 27 | ||
28 | #include "gnunet-service-messenger_handle.h" | 28 | #include "gnunet-service-messenger_handle.h" |
29 | #include "gnunet-service-messenger_util.h" | 29 | #include "gnunet-service-messenger_message_recv.h" |
30 | #include "gnunet-service-messenger_message_store.h" | ||
31 | #include "gnunet-service-messenger_operation_store.h" | ||
32 | #include "gnunet-service-messenger_operation.h" | ||
33 | #include "messenger_api_util.h" | ||
30 | 34 | ||
31 | struct GNUNET_MESSENGER_SrvTunnel* | 35 | struct GNUNET_MESSENGER_SrvTunnel* |
32 | create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door) | 36 | create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerIdentity *door) |
@@ -39,10 +43,12 @@ create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerId | |||
39 | tunnel->channel = NULL; | 43 | tunnel->channel = NULL; |
40 | 44 | ||
41 | tunnel->peer = GNUNET_PEER_intern (door); | 45 | tunnel->peer = GNUNET_PEER_intern (door); |
42 | tunnel->contact_id = NULL; | 46 | |
47 | tunnel->messenger_version = 0; | ||
43 | 48 | ||
44 | tunnel->peer_message = NULL; | 49 | tunnel->peer_message = NULL; |
45 | tunnel->last_message = NULL; | 50 | |
51 | init_message_state(&(tunnel->state)); | ||
46 | 52 | ||
47 | return tunnel; | 53 | return tunnel; |
48 | } | 54 | } |
@@ -57,34 +63,23 @@ destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel) | |||
57 | 63 | ||
58 | GNUNET_PEER_change_rc (tunnel->peer, -1); | 64 | GNUNET_PEER_change_rc (tunnel->peer, -1); |
59 | 65 | ||
60 | if (tunnel->contact_id) | ||
61 | GNUNET_free(tunnel->contact_id); | ||
62 | |||
63 | if (tunnel->peer_message) | 66 | if (tunnel->peer_message) |
64 | GNUNET_free(tunnel->peer_message); | 67 | GNUNET_free(tunnel->peer_message); |
65 | 68 | ||
66 | if (tunnel->last_message) | 69 | clear_message_state(&(tunnel->state)); |
67 | GNUNET_free(tunnel->last_message); | ||
68 | 70 | ||
69 | GNUNET_free(tunnel); | 71 | GNUNET_free(tunnel); |
70 | } | 72 | } |
71 | 73 | ||
72 | int | 74 | void |
73 | bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel) | 75 | bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel) |
74 | { | 76 | { |
75 | GNUNET_assert(tunnel); | 77 | GNUNET_assert(tunnel); |
76 | 78 | ||
77 | if (tunnel->channel) | 79 | if (tunnel->channel) |
78 | { | ||
79 | if (tunnel->contact_id) | ||
80 | return GNUNET_NO; | ||
81 | |||
82 | delayed_disconnect_channel (tunnel->channel); | 80 | delayed_disconnect_channel (tunnel->channel); |
83 | } | ||
84 | 81 | ||
85 | tunnel->channel = channel; | 82 | tunnel->channel = channel; |
86 | |||
87 | return GNUNET_YES; | ||
88 | } | 83 | } |
89 | 84 | ||
90 | extern void | 85 | extern void |
@@ -113,52 +108,57 @@ check_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header) | |||
113 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; | 108 | struct GNUNET_MESSENGER_SrvTunnel *tunnel = cls; |
114 | 109 | ||
115 | if (!tunnel) | 110 | if (!tunnel) |
116 | return GNUNET_NO; | 111 | return GNUNET_SYSERR; |
117 | 112 | ||
118 | const uint16_t length = ntohs (header->size) - sizeof(*header); | 113 | const uint16_t length = ntohs (header->size) - sizeof(*header); |
119 | const char *buffer = (const char*) &header[1]; | 114 | const char *buffer = (const char*) &header[1]; |
120 | 115 | ||
121 | struct GNUNET_MESSENGER_Message message; | 116 | struct GNUNET_MESSENGER_Message message; |
122 | 117 | ||
123 | if (length < sizeof(message.header)) | 118 | if (length < get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN)) |
124 | return GNUNET_NO; | 119 | { |
125 | 120 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Tunnel error: Message too short! (%d)\n", length); | |
126 | if (GNUNET_YES != decode_message (&message, length, buffer)) | 121 | return GNUNET_SYSERR; |
127 | return GNUNET_NO; | 122 | } |
128 | |||
129 | struct GNUNET_HashCode hash; | ||
130 | hash_message (length, buffer, &hash); | ||
131 | 123 | ||
132 | int result = callback_verify_room_message (tunnel->room, cls, &message, &hash); | 124 | uint16_t padding = 0; |
133 | 125 | ||
134 | if (GNUNET_MESSENGER_KIND_PEER == message.header.kind) | 126 | if (GNUNET_YES != decode_message (&message, length, buffer, GNUNET_YES, &padding)) |
135 | { | 127 | { |
136 | struct GNUNET_PeerIdentity identity; | 128 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Tunnel error: Decoding failed!\n"); |
137 | 129 | return GNUNET_SYSERR; | |
138 | GNUNET_PEER_resolve (tunnel->peer, &identity); | ||
139 | |||
140 | if (0 == GNUNET_memcmp(&(message.body.peer.peer), &(identity))) | ||
141 | { | ||
142 | if (tunnel->contact_id) | ||
143 | { | ||
144 | if (0 != GNUNET_memcmp(tunnel->contact_id, &(message.header.sender_id))) | ||
145 | result = GNUNET_SYSERR; | ||
146 | } | ||
147 | else | ||
148 | { | ||
149 | tunnel->contact_id = GNUNET_new(struct GNUNET_ShortHashCode); | ||
150 | |||
151 | GNUNET_memcpy(tunnel->contact_id, &(message.header.sender_id), sizeof(struct GNUNET_ShortHashCode)); | ||
152 | } | ||
153 | } | ||
154 | } | 130 | } |
155 | 131 | ||
156 | return (result == GNUNET_YES ? GNUNET_OK : GNUNET_NO); | 132 | struct GNUNET_HashCode hash; |
133 | hash_message (&message, length - padding, buffer, &hash); | ||
134 | |||
135 | return callback_verify_room_message (tunnel->room, cls, &message, &hash); | ||
157 | } | 136 | } |
158 | 137 | ||
138 | extern int | ||
139 | update_room_message (struct GNUNET_MESSENGER_SrvRoom *room, | ||
140 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
141 | |||
159 | extern void | 142 | extern void |
160 | callback_room_recv (struct GNUNET_MESSENGER_SrvRoom *room, void *cls, struct GNUNET_MESSENGER_Message *message, | 143 | callback_room_handle_message (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, |
161 | const struct GNUNET_HashCode *hash); | 144 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
145 | |||
146 | static void | ||
147 | update_tunnel_last_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_HashCode *hash) | ||
148 | { | ||
149 | struct GNUNET_MESSENGER_OperationStore *operation_store = get_room_operation_store(tunnel->room); | ||
150 | |||
151 | const int requested = (GNUNET_MESSENGER_OP_REQUEST == get_store_operation_type(operation_store, hash)? | ||
152 | GNUNET_YES : GNUNET_NO | ||
153 | ); | ||
154 | |||
155 | struct GNUNET_MESSENGER_MessageStore *message_store = get_room_message_store(tunnel->room); | ||
156 | |||
157 | const struct GNUNET_MESSENGER_Message *message = get_store_message(message_store, hash); | ||
158 | |||
159 | if (message) | ||
160 | update_message_state(&(tunnel->state), requested, message, hash); | ||
161 | } | ||
162 | 162 | ||
163 | void | 163 | void |
164 | handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header) | 164 | handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header) |
@@ -171,19 +171,50 @@ handle_tunnel_message (void *cls, const struct GNUNET_MessageHeader *header) | |||
171 | struct GNUNET_MESSENGER_Message message; | 171 | struct GNUNET_MESSENGER_Message message; |
172 | struct GNUNET_HashCode hash; | 172 | struct GNUNET_HashCode hash; |
173 | 173 | ||
174 | decode_message (&message, length, buffer); | 174 | uint16_t padding = 0; |
175 | hash_message (length, buffer, &hash); | ||
176 | 175 | ||
177 | if (tunnel) | 176 | decode_message (&message, length, buffer, GNUNET_YES, &padding); |
178 | { | 177 | hash_message (&message, length - padding, buffer, &hash); |
179 | if (!tunnel->last_message) | 178 | |
180 | tunnel->last_message = GNUNET_new(struct GNUNET_HashCode); | 179 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Got message of kind: %s!\n", |
180 | GNUNET_MESSENGER_name_of_kind(message.header.kind)); | ||
181 | |||
182 | if (!tunnel) | ||
183 | return; | ||
184 | |||
185 | const int new_message = update_room_message ( | ||
186 | tunnel->room, copy_message (&message), &hash | ||
187 | ); | ||
188 | |||
189 | if (GNUNET_YES != new_message) | ||
190 | goto receive_done; | ||
181 | 191 | ||
182 | GNUNET_memcpy(tunnel->last_message, &hash, sizeof(struct GNUNET_HashCode)); | 192 | update_tunnel_last_message (tunnel, &hash); |
183 | 193 | ||
184 | callback_room_recv (tunnel->room, cls, copy_message (&message), &hash); | 194 | int forward_message = GNUNET_YES; |
195 | |||
196 | switch (message.header.kind) | ||
197 | { | ||
198 | case GNUNET_MESSENGER_KIND_INFO: | ||
199 | forward_message = recv_message_info (tunnel->room, tunnel, &message, &hash); | ||
200 | break; | ||
201 | case GNUNET_MESSENGER_KIND_PEER: | ||
202 | forward_message = recv_message_peer (tunnel->room, tunnel, &message, &hash); | ||
203 | break; | ||
204 | case GNUNET_MESSENGER_KIND_REQUEST: | ||
205 | forward_message = recv_message_request (tunnel->room, tunnel, &message, &hash); | ||
206 | break; | ||
207 | default: | ||
208 | break; | ||
185 | } | 209 | } |
186 | 210 | ||
211 | if (GNUNET_YES == forward_message) | ||
212 | { | ||
213 | forward_room_message (tunnel->room, tunnel, &message, &hash); | ||
214 | callback_room_handle_message (tunnel->room, NULL, &message, &hash); | ||
215 | } | ||
216 | |||
217 | receive_done: | ||
187 | GNUNET_CADET_receive_done (tunnel->channel); | 218 | GNUNET_CADET_receive_done (tunnel->channel); |
188 | } | 219 | } |
189 | 220 | ||
@@ -198,7 +229,7 @@ connect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel) | |||
198 | const struct GNUNET_PeerIdentity *door = GNUNET_PEER_resolve2 (tunnel->peer); | 229 | const struct GNUNET_PeerIdentity *door = GNUNET_PEER_resolve2 (tunnel->peer); |
199 | 230 | ||
200 | struct GNUNET_CADET_Handle *cadet = get_room_cadet (tunnel->room); | 231 | struct GNUNET_CADET_Handle *cadet = get_room_cadet (tunnel->room); |
201 | struct GNUNET_HashCode *key = get_room_key (tunnel->room); | 232 | const struct GNUNET_HashCode *key = get_room_key (tunnel->room); |
202 | 233 | ||
203 | struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size(tunnel_message, GNUNET_MESSAGE_TYPE_CADET_CLI, | 234 | struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size(tunnel_message, GNUNET_MESSAGE_TYPE_CADET_CLI, |
204 | struct GNUNET_MessageHeader, NULL), | 235 | struct GNUNET_MessageHeader, NULL), |
@@ -212,6 +243,8 @@ connect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel) | |||
212 | void | 243 | void |
213 | disconnect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel) | 244 | disconnect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel) |
214 | { | 245 | { |
246 | GNUNET_assert(tunnel); | ||
247 | |||
215 | if (tunnel->channel) | 248 | if (tunnel->channel) |
216 | { | 249 | { |
217 | delayed_disconnect_channel (tunnel->channel); | 250 | delayed_disconnect_channel (tunnel->channel); |
@@ -223,6 +256,8 @@ disconnect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel) | |||
223 | int | 256 | int |
224 | is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel) | 257 | is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel) |
225 | { | 258 | { |
259 | GNUNET_assert(tunnel); | ||
260 | |||
226 | return (tunnel->channel ? GNUNET_YES : GNUNET_NO); | 261 | return (tunnel->channel ? GNUNET_YES : GNUNET_NO); |
227 | } | 262 | } |
228 | 263 | ||
@@ -232,30 +267,23 @@ struct GNUNET_MESSENGER_MessageSent | |||
232 | struct GNUNET_HashCode hash; | 267 | struct GNUNET_HashCode hash; |
233 | }; | 268 | }; |
234 | 269 | ||
235 | extern void | ||
236 | callback_room_sent (struct GNUNET_MESSENGER_SrvRoom *room, struct GNUNET_MESSENGER_SrvHandle *handle, void *cls, | ||
237 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | ||
238 | |||
239 | static void | 270 | static void |
240 | callback_tunnel_sent (void *cls) | 271 | callback_tunnel_sent (void *cls) |
241 | { | 272 | { |
242 | struct GNUNET_MESSENGER_MessageSent *sent = cls; | 273 | struct GNUNET_MESSENGER_MessageSent *sent = cls; |
243 | 274 | ||
244 | if (sent->tunnel) | 275 | if (sent->tunnel) |
245 | { | 276 | update_tunnel_last_message (sent->tunnel, &(sent->hash)); |
246 | if (!sent->tunnel->last_message) | ||
247 | sent->tunnel->last_message = GNUNET_new(struct GNUNET_HashCode); | ||
248 | |||
249 | GNUNET_memcpy(sent->tunnel->last_message, &(sent->hash), sizeof(struct GNUNET_HashCode)); | ||
250 | } | ||
251 | 277 | ||
252 | GNUNET_free(sent); | 278 | GNUNET_free(sent); |
253 | } | 279 | } |
254 | 280 | ||
255 | void | 281 | void |
256 | send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MQ_Envelope *env, | 282 | send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, |
257 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | 283 | const struct GNUNET_HashCode *hash) |
258 | { | 284 | { |
285 | GNUNET_assert((tunnel) && (env) && (hash)); | ||
286 | |||
259 | struct GNUNET_MQ_Handle *mq = GNUNET_CADET_get_mq (tunnel->channel); | 287 | struct GNUNET_MQ_Handle *mq = GNUNET_CADET_get_mq (tunnel->channel); |
260 | 288 | ||
261 | struct GNUNET_MESSENGER_MessageSent *sent = GNUNET_new(struct GNUNET_MESSENGER_MessageSent); | 289 | struct GNUNET_MESSENGER_MessageSent *sent = GNUNET_new(struct GNUNET_MESSENGER_MessageSent); |
@@ -266,35 +294,88 @@ send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, s | |||
266 | 294 | ||
267 | GNUNET_MQ_notify_sent (env, callback_tunnel_sent, sent); | 295 | GNUNET_MQ_notify_sent (env, callback_tunnel_sent, sent); |
268 | GNUNET_MQ_send (mq, env); | 296 | GNUNET_MQ_send (mq, env); |
269 | |||
270 | callback_room_sent (tunnel->room, (struct GNUNET_MESSENGER_SrvHandle*) handle, tunnel, message, hash); | ||
271 | } | 297 | } |
272 | 298 | ||
273 | void | 299 | int |
274 | send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message, | 300 | send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message) |
275 | struct GNUNET_HashCode *hash) | ||
276 | { | 301 | { |
277 | struct GNUNET_MQ_Envelope *env = pack_room_message (tunnel->room, (struct GNUNET_MESSENGER_SrvHandle*) handle, | 302 | GNUNET_assert((tunnel) && (handle)); |
278 | message, hash, | 303 | |
279 | GNUNET_MESSENGER_PACK_MODE_ENVELOPE); | 304 | if (!message) |
305 | return GNUNET_NO; | ||
306 | |||
307 | struct GNUNET_HashCode hash; | ||
308 | struct GNUNET_MQ_Envelope *env = pack_room_message ( | ||
309 | tunnel->room, (struct GNUNET_MESSENGER_SrvHandle*) handle, | ||
310 | message, &hash, GNUNET_MESSENGER_PACK_MODE_ENVELOPE | ||
311 | ); | ||
312 | |||
313 | destroy_message(message); | ||
314 | |||
315 | if (!env) | ||
316 | return GNUNET_NO; | ||
280 | 317 | ||
281 | if (env) | 318 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Sending tunnel message: %s\n", |
282 | send_tunnel_envelope (tunnel, handle, env, copy_message (message), hash); | 319 | GNUNET_h2s(&hash)); |
320 | |||
321 | send_tunnel_envelope (tunnel, env, &hash); | ||
322 | return GNUNET_YES; | ||
283 | } | 323 | } |
284 | 324 | ||
285 | void | 325 | void |
286 | forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, | 326 | forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, |
287 | const struct GNUNET_HashCode *hash) | 327 | const struct GNUNET_HashCode *hash) |
288 | { | 328 | { |
289 | struct GNUNET_MESSENGER_Message *clone = copy_message (message); | 329 | GNUNET_assert((tunnel) && (message) && (hash)); |
290 | struct GNUNET_MQ_Envelope *env = pack_message (clone, NULL, NULL, GNUNET_MESSENGER_PACK_MODE_ENVELOPE); | 330 | |
331 | struct GNUNET_MESSENGER_Message *copy = copy_message(message); | ||
332 | struct GNUNET_MQ_Envelope *env = pack_message (copy, NULL, NULL, GNUNET_MESSENGER_PACK_MODE_ENVELOPE); | ||
333 | |||
334 | destroy_message(copy); | ||
335 | |||
336 | if (!env) | ||
337 | return; | ||
291 | 338 | ||
292 | if (env) | 339 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Forwarding tunnel message: %s\n", |
293 | send_tunnel_envelope (tunnel, NULL, env, clone, hash); | 340 | GNUNET_h2s(hash)); |
341 | |||
342 | send_tunnel_envelope (tunnel, env, hash); | ||
294 | } | 343 | } |
295 | 344 | ||
296 | const struct GNUNET_HashCode* | 345 | const struct GNUNET_HashCode* |
297 | get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel) | 346 | get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel) |
298 | { | 347 | { |
348 | GNUNET_assert(tunnel); | ||
349 | |||
299 | return tunnel->peer_message; | 350 | return tunnel->peer_message; |
300 | } | 351 | } |
352 | |||
353 | void | ||
354 | get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer) | ||
355 | { | ||
356 | GNUNET_assert(tunnel); | ||
357 | |||
358 | GNUNET_PEER_resolve(tunnel->peer, peer); | ||
359 | } | ||
360 | |||
361 | uint32_t | ||
362 | get_tunnel_messenger_version (const struct GNUNET_MESSENGER_SrvTunnel *tunnel) | ||
363 | { | ||
364 | GNUNET_assert(tunnel); | ||
365 | |||
366 | return tunnel->messenger_version; | ||
367 | } | ||
368 | |||
369 | int | ||
370 | update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version) | ||
371 | { | ||
372 | GNUNET_assert(tunnel); | ||
373 | |||
374 | if (version != GNUNET_MESSENGER_VERSION) | ||
375 | return GNUNET_SYSERR; | ||
376 | |||
377 | if (version > tunnel->messenger_version) | ||
378 | tunnel->messenger_version = version; | ||
379 | |||
380 | return GNUNET_OK; | ||
381 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_tunnel.h b/src/messenger/gnunet-service-messenger_tunnel.h index e6efb226d..96d98546d 100644 --- a/src/messenger/gnunet-service-messenger_tunnel.h +++ b/src/messenger/gnunet-service-messenger_tunnel.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -32,6 +32,7 @@ | |||
32 | #include "gnunet_crypto_lib.h" | 32 | #include "gnunet_crypto_lib.h" |
33 | 33 | ||
34 | #include "gnunet-service-messenger_room.h" | 34 | #include "gnunet-service-messenger_room.h" |
35 | #include "gnunet-service-messenger_message_state.h" | ||
35 | 36 | ||
36 | struct GNUNET_MESSENGER_SrvTunnel | 37 | struct GNUNET_MESSENGER_SrvTunnel |
37 | { | 38 | { |
@@ -39,17 +40,18 @@ struct GNUNET_MESSENGER_SrvTunnel | |||
39 | struct GNUNET_CADET_Channel *channel; | 40 | struct GNUNET_CADET_Channel *channel; |
40 | 41 | ||
41 | GNUNET_PEER_Id peer; | 42 | GNUNET_PEER_Id peer; |
42 | struct GNUNET_ShortHashCode *contact_id; | 43 | |
44 | uint32_t messenger_version; | ||
43 | 45 | ||
44 | struct GNUNET_HashCode *peer_message; | 46 | struct GNUNET_HashCode *peer_message; |
45 | struct GNUNET_HashCode *last_message; | 47 | struct GNUNET_MESSENGER_MessageState state; |
46 | }; | 48 | }; |
47 | 49 | ||
48 | /** | 50 | /** |
49 | * Creates and allocates a tunnel of a <i>room</i> to a specific peer identity. | 51 | * Creates and allocates a tunnel of a <i>room</i> to a specific peer identity (called <i>door</i>). |
50 | * | 52 | * |
51 | * @param room Room | 53 | * @param[in/out] room Room |
52 | * @param door Peer identity | 54 | * @param[in] door Peer identity |
53 | * @return New tunnel | 55 | * @return New tunnel |
54 | */ | 56 | */ |
55 | struct GNUNET_MESSENGER_SrvTunnel* | 57 | struct GNUNET_MESSENGER_SrvTunnel* |
@@ -58,28 +60,27 @@ create_tunnel (struct GNUNET_MESSENGER_SrvRoom *room, const struct GNUNET_PeerId | |||
58 | /** | 60 | /** |
59 | * Destroys a <i>tunnel</i> and frees its memory fully. | 61 | * Destroys a <i>tunnel</i> and frees its memory fully. |
60 | * | 62 | * |
61 | * @param tunnel | 63 | * @param[in/out] tunnel |
62 | */ | 64 | */ |
63 | void | 65 | void |
64 | destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); | 66 | destroy_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); |
65 | 67 | ||
66 | /** | 68 | /** |
67 | * Binds a CADET <i>channel</i> to a <i>tunnel</i> on returns GNUNET_YES only if | 69 | * Binds a CADET <i>channel</i> to a <i>tunnel</i> and replaces its channel |
68 | * the bounds channel was replaced successfully, otherwise GNUNET_NO gets returned. | 70 | * the tunnel is currently bound to if necessary. |
69 | * | 71 | * |
70 | * @param tunnel Tunnel | 72 | * @param[in/out] tunnel Tunnel |
71 | * @param channel CADET channel | 73 | * @param[in/out] channel CADET channel |
72 | * @return GNUNET_YES on success, otherwise GNUNET_NO | ||
73 | */ | 74 | */ |
74 | int | 75 | void |
75 | bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel); | 76 | bind_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_CADET_Channel *channel); |
76 | 77 | ||
77 | /** | 78 | /** |
78 | * Tries to connect a <i>tunnel</i> by creating a new CADET channel and binding it. | 79 | * Tries to connect a <i>tunnel</i> by creating a new CADET channel and binding it. |
79 | * The function returns GNUNET_YES on success, otherwise GNUNET_NO. | 80 | * The function returns #GNUNET_YES on success, otherwise #GNUNET_NO. |
80 | * | 81 | * |
81 | * @param tunnel Tunnel | 82 | * @param[in/out] tunnel Tunnel |
82 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 83 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
83 | */ | 84 | */ |
84 | int | 85 | int |
85 | connect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); | 86 | connect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); |
@@ -88,7 +89,7 @@ connect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); | |||
88 | * Disconnects and unbinds a channel from a <i>tunnel</i>. The actual disconnection | 89 | * Disconnects and unbinds a channel from a <i>tunnel</i>. The actual disconnection |
89 | * will be asynchronous. | 90 | * will be asynchronous. |
90 | * | 91 | * |
91 | * @param tunnel Tunnel | 92 | * @param[in/out] tunnel Tunnel |
92 | */ | 93 | */ |
93 | void | 94 | void |
94 | disconnect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); | 95 | disconnect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); |
@@ -96,46 +97,43 @@ disconnect_tunnel (struct GNUNET_MESSENGER_SrvTunnel *tunnel); | |||
96 | /** | 97 | /** |
97 | * Returns the status of a currently bound channel of a <i>tunnel</i>. | 98 | * Returns the status of a currently bound channel of a <i>tunnel</i>. |
98 | * | 99 | * |
99 | * @param tunnel Tunnel | 100 | * @param[in] tunnel Tunnel |
100 | * @return GNUNET_YES or GNUNET_NO | 101 | * @return #GNUNET_YES or #GNUNET_NO |
101 | */ | 102 | */ |
102 | int | 103 | int |
103 | is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel); | 104 | is_tunnel_connected (const struct GNUNET_MESSENGER_SrvTunnel *tunnel); |
104 | 105 | ||
105 | /** | 106 | /** |
106 | * Sends an envelope containing a <i>message</i> with a given <i>hash</i> through | 107 | * Sends an envelope containing a <i>message</i> with a given <i>hash</i> through |
107 | * a <i>tunnel</i> by a given <i>handle</i>. | 108 | * a <i>tunnel</i>. |
108 | * | 109 | * |
109 | * @param tunnel Tunnel | 110 | * @param[in/out] tunnel Tunnel |
110 | * @param handle Handle | 111 | * @param[in/out] env Envelope |
111 | * @param env Envelope | 112 | * @param[in] hash Hash of message |
112 | * @param message Message | ||
113 | * @param hash Hash of message | ||
114 | */ | 113 | */ |
115 | void | 114 | void |
116 | send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MQ_Envelope *env, | 115 | send_tunnel_envelope (struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_MQ_Envelope *env, |
117 | struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); | 116 | const struct GNUNET_HashCode *hash); |
118 | 117 | ||
119 | /** | 118 | /** |
120 | * Sends a <i>message</i> by packing it automatically into an envelope and passing it | 119 | * Sends a <i>message</i> by packing it automatically into an envelope and passing it |
121 | * through the <i>tunnel</i>. The used <i>handle</i> will sign the message and | 120 | * through the <i>tunnel</i>. The used <i>handle</i> will sign the message and |
122 | * the <i>hash</i> will be calculated and stored. | 121 | * the <i>hash</i> will be calculated and stored. |
123 | * | 122 | * |
124 | * @param tunnel Tunnel | 123 | * @param[in/out] tunnel Tunnel |
125 | * @param handle Handle | 124 | * @param[in/out] handle Handle |
126 | * @param[out] message Message | 125 | * @param[in/out] message Message |
127 | * @param[out] hash Hash of message | 126 | * @return #GNUNET_YES on success, GNUNET_NO otherwise |
128 | */ | 127 | */ |
129 | void | 128 | int |
130 | send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message, | 129 | send_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, void *handle, struct GNUNET_MESSENGER_Message *message); |
131 | struct GNUNET_HashCode *hash); | ||
132 | 130 | ||
133 | /** | 131 | /** |
134 | * Forwards a given <i>message</i> with a known <i>hash</i> through a <i>tunnel</i>. | 132 | * Forwards a given <i>message</i> with a known <i>hash</i> through a <i>tunnel</i>. |
135 | * | 133 | * |
136 | * @param tunnel Tunnel | 134 | * @param[in/out] tunnel Tunnel |
137 | * @param message Message | 135 | * @param[in] message Message |
138 | * @param hash Hash of message | 136 | * @param[in] hash Hash of message |
139 | */ | 137 | */ |
140 | void | 138 | void |
141 | forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, | 139 | forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct GNUNET_MESSENGER_Message *message, |
@@ -146,10 +144,43 @@ forward_tunnel_message (struct GNUNET_MESSENGER_SrvTunnel *tunnel, const struct | |||
146 | * and matching the tunnels peer identity. If no peer message has been linked to the tunnel | 144 | * and matching the tunnels peer identity. If no peer message has been linked to the tunnel |
147 | * yet, NULL gets returned. | 145 | * yet, NULL gets returned. |
148 | * | 146 | * |
149 | * @param tunnel Tunnel | 147 | * @param[in] tunnel Tunnel |
150 | * @return Hash of peer message or NULL | 148 | * @return Hash of peer message or NULL |
151 | */ | 149 | */ |
152 | const struct GNUNET_HashCode* | 150 | const struct GNUNET_HashCode* |
153 | get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel); | 151 | get_tunnel_peer_message (const struct GNUNET_MESSENGER_SrvTunnel *tunnel); |
154 | 152 | ||
153 | /** | ||
154 | * Writes the peer identity of the peer connected via <i>tunnel</i> to this peer into | ||
155 | * the <i>peer</i> parameter. | ||
156 | * | ||
157 | * @param[in] tunnel Tunnel | ||
158 | * @param[out] peer Peer identity | ||
159 | */ | ||
160 | void | ||
161 | get_tunnel_peer_identity (const struct GNUNET_MESSENGER_SrvTunnel *tunnel, struct GNUNET_PeerIdentity *peer); | ||
162 | |||
163 | /** | ||
164 | * Returns the current messenger version the peer connected via a given <i>tunnel</i> | ||
165 | * has reported to be using if it was compatible during updating. | ||
166 | * | ||
167 | * @see update_tunnel_messenger_version | ||
168 | * | ||
169 | * @param[in] tunnel Tunnel | ||
170 | * @return Version of messenger | ||
171 | */ | ||
172 | uint32_t | ||
173 | get_tunnel_messenger_version (const struct GNUNET_MESSENGER_SrvTunnel *tunnel); | ||
174 | |||
175 | /** | ||
176 | * Updates the messenger version of the <i>tunnel</i> to a given <i>version</i> if | ||
177 | * it is compatible to the running peer of the service. Depending on success it | ||
178 | * returns #GNUNET_OK or #GNUNET_SYSERR on failure. | ||
179 | * | ||
180 | * @param[in/out] tunnel Tunnel | ||
181 | * @param[in] version Version of messenger | ||
182 | */ | ||
183 | int | ||
184 | update_tunnel_messenger_version (struct GNUNET_MESSENGER_SrvTunnel *tunnel, uint32_t version); | ||
185 | |||
155 | #endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H | 186 | #endif //GNUNET_SERVICE_MESSENGER_TUNNEL_H |
diff --git a/src/messenger/messenger_api.c b/src/messenger/messenger_api.c index 6401b18d7..b42bb40cc 100644 --- a/src/messenger/messenger_api.c +++ b/src/messenger/messenger_api.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -29,6 +29,7 @@ | |||
29 | 29 | ||
30 | #include "messenger_api_handle.h" | 30 | #include "messenger_api_handle.h" |
31 | #include "messenger_api_message.h" | 31 | #include "messenger_api_message.h" |
32 | #include "messenger_api_util.h" | ||
32 | 33 | ||
33 | const char* | 34 | const char* |
34 | GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind) | 35 | GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind) |
@@ -61,6 +62,8 @@ GNUNET_MESSENGER_name_of_kind (enum GNUNET_MESSENGER_MessageKind kind) | |||
61 | return "TEXT"; | 62 | return "TEXT"; |
62 | case GNUNET_MESSENGER_KIND_FILE: | 63 | case GNUNET_MESSENGER_KIND_FILE: |
63 | return "FILE"; | 64 | return "FILE"; |
65 | case GNUNET_MESSENGER_KIND_PRIVATE: | ||
66 | return "PRIVATE"; | ||
64 | default: | 67 | default: |
65 | return "UNKNOWN"; | 68 | return "UNKNOWN"; |
66 | } | 69 | } |
@@ -82,7 +85,25 @@ handle_get_name (void *cls, const struct GNUNET_MESSENGER_NameMessage *msg) | |||
82 | 85 | ||
83 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Set name of handle: %s\n", name); | 86 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Set name of handle: %s\n", name); |
84 | 87 | ||
85 | set_handle_name (handle, strlen(name) > 0? name : NULL); | 88 | set_handle_name (handle, strlen (name) > 0 ? name : NULL); |
89 | } | ||
90 | |||
91 | static int | ||
92 | check_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) | ||
93 | { | ||
94 | const uint16_t full_length = ntohs (msg->header.size); | ||
95 | |||
96 | if (full_length < sizeof(*msg)) | ||
97 | return GNUNET_NO; | ||
98 | |||
99 | const uint16_t length = full_length - sizeof(*msg); | ||
100 | const char *buffer = ((const char*) msg) + sizeof(*msg); | ||
101 | |||
102 | struct GNUNET_IDENTITY_PublicKey pubkey; | ||
103 | if (GNUNET_IDENTITY_read_key_from_buffer(&pubkey, buffer, length) < 0) | ||
104 | return GNUNET_NO; | ||
105 | |||
106 | return GNUNET_OK; | ||
86 | } | 107 | } |
87 | 108 | ||
88 | static void | 109 | static void |
@@ -90,11 +111,18 @@ handle_get_key (void *cls, const struct GNUNET_MESSENGER_KeyMessage *msg) | |||
90 | { | 111 | { |
91 | struct GNUNET_MESSENGER_Handle *handle = cls; | 112 | struct GNUNET_MESSENGER_Handle *handle = cls; |
92 | 113 | ||
93 | const struct GNUNET_IDENTITY_PublicKey *pubkey = &(msg->pubkey); | 114 | const uint16_t length = ntohs (msg->header.size) - sizeof(*msg); |
115 | const char *buffer = ((const char*) msg) + sizeof(*msg); | ||
116 | |||
117 | struct GNUNET_IDENTITY_PublicKey pubkey; | ||
118 | if (GNUNET_IDENTITY_read_key_from_buffer(&pubkey, buffer, length) < 0) | ||
119 | return; | ||
94 | 120 | ||
95 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Set key of handle: %s\n", GNUNET_IDENTITY_public_key_to_string (pubkey)); | 121 | char* str = GNUNET_IDENTITY_public_key_to_string (&pubkey); |
122 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Set key of handle: %s\n", str); | ||
123 | GNUNET_free(str); | ||
96 | 124 | ||
97 | set_handle_key (handle, pubkey); | 125 | set_handle_key (handle, &pubkey); |
98 | 126 | ||
99 | if (handle->identity_callback) | 127 | if (handle->identity_callback) |
100 | handle->identity_callback (handle->identity_cls, handle); | 128 | handle->identity_callback (handle->identity_cls, handle); |
@@ -161,20 +189,20 @@ handle_room_close (void *cls, const struct GNUNET_MESSENGER_RoomMessage *msg) | |||
161 | static int | 189 | static int |
162 | check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | 190 | check_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) |
163 | { | 191 | { |
164 | const uint16_t full_length = ntohs (msg->header.size) - sizeof(msg->header); | 192 | const uint16_t full_length = ntohs (msg->header.size); |
165 | 193 | ||
166 | if (full_length < sizeof(msg->hash)) | 194 | if (full_length < sizeof(*msg)) |
167 | return GNUNET_NO; | 195 | return GNUNET_NO; |
168 | 196 | ||
169 | const uint16_t length = full_length - sizeof(msg->hash); | 197 | const uint16_t length = full_length - sizeof(*msg); |
170 | const char *buffer = ((const char*) msg) + sizeof(*msg); | 198 | const char *buffer = ((const char*) msg) + sizeof(*msg); |
171 | 199 | ||
172 | struct GNUNET_MESSENGER_Message message; | 200 | struct GNUNET_MESSENGER_Message message; |
173 | 201 | ||
174 | if (length < sizeof(message.header)) | 202 | if (length < get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN)) |
175 | return GNUNET_NO; | 203 | return GNUNET_NO; |
176 | 204 | ||
177 | if (GNUNET_YES != decode_message (&message, length, buffer)) | 205 | if (GNUNET_YES != decode_message (&message, length, buffer, GNUNET_YES, NULL)) |
178 | return GNUNET_NO; | 206 | return GNUNET_NO; |
179 | 207 | ||
180 | return GNUNET_OK; | 208 | return GNUNET_OK; |
@@ -186,14 +214,18 @@ handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | |||
186 | struct GNUNET_MESSENGER_Handle *handle = cls; | 214 | struct GNUNET_MESSENGER_Handle *handle = cls; |
187 | 215 | ||
188 | const struct GNUNET_HashCode *key = &(msg->key); | 216 | const struct GNUNET_HashCode *key = &(msg->key); |
217 | const struct GNUNET_HashCode *sender = &(msg->sender); | ||
218 | const struct GNUNET_HashCode *context = &(msg->context); | ||
189 | const struct GNUNET_HashCode *hash = &(msg->hash); | 219 | const struct GNUNET_HashCode *hash = &(msg->hash); |
190 | 220 | const enum GNUNET_MESSENGER_MessageFlags flags = ( | |
191 | const char *buffer = ((const char*) msg) + sizeof(*msg); | 221 | (enum GNUNET_MESSENGER_MessageFlags) (msg->flags) |
222 | ); | ||
192 | 223 | ||
193 | const uint16_t length = ntohs (msg->header.size) - sizeof(*msg); | 224 | const uint16_t length = ntohs (msg->header.size) - sizeof(*msg); |
225 | const char *buffer = ((const char*) msg) + sizeof(*msg); | ||
194 | 226 | ||
195 | struct GNUNET_MESSENGER_Message message; | 227 | struct GNUNET_MESSENGER_Message message; |
196 | decode_message (&message, length, buffer); | 228 | decode_message (&message, length, buffer, GNUNET_YES, NULL); |
197 | 229 | ||
198 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Receiving message: %s\n", GNUNET_MESSENGER_name_of_kind (message.header.kind)); | 230 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Receiving message: %s\n", GNUNET_MESSENGER_name_of_kind (message.header.kind)); |
199 | 231 | ||
@@ -201,13 +233,22 @@ handle_recv_message (void *cls, const struct GNUNET_MESSENGER_RecvMessage *msg) | |||
201 | 233 | ||
202 | if (room) | 234 | if (room) |
203 | { | 235 | { |
204 | handle_room_message (room, &message, hash); | 236 | struct GNUNET_MESSENGER_ContactStore *store = get_handle_contact_store(handle); |
237 | |||
238 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Raw contact from sender and context: (%s : %s)\n", | ||
239 | GNUNET_h2s(sender), GNUNET_h2s_full(context)); | ||
240 | |||
241 | struct GNUNET_MESSENGER_Contact *contact = get_store_contact_raw( | ||
242 | store, context, sender | ||
243 | ); | ||
244 | |||
245 | handle_room_message (room, contact, &message, hash); | ||
205 | 246 | ||
206 | if (handle->msg_callback) | 247 | if (handle->msg_callback) |
207 | handle->msg_callback (handle->msg_cls, room, &message, hash); | 248 | handle->msg_callback (handle->msg_cls, room, contact, &message, hash, flags); |
208 | } | 249 | } |
209 | else | 250 | else |
210 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "MESSENGER ERROR: Room not found\n"); | 251 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Room not found\n"); |
211 | } | 252 | } |
212 | 253 | ||
213 | static void | 254 | static void |
@@ -220,12 +261,12 @@ send_open_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_ | |||
220 | struct GNUNET_MQ_Envelope *env; | 261 | struct GNUNET_MQ_Envelope *env; |
221 | 262 | ||
222 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN); | 263 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN); |
223 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(room->key)); | 264 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(msg->key)); |
224 | GNUNET_MQ_send (handle->mq, env); | 265 | GNUNET_MQ_send (handle->mq, env); |
225 | } | 266 | } |
226 | 267 | ||
227 | static void | 268 | static void |
228 | send_entry_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, | 269 | send_enter_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Room *room, |
229 | const struct GNUNET_PeerIdentity *door) | 270 | const struct GNUNET_PeerIdentity *door) |
230 | { | 271 | { |
231 | struct GNUNET_MESSENGER_RoomMessage *msg; | 272 | struct GNUNET_MESSENGER_RoomMessage *msg; |
@@ -233,7 +274,7 @@ send_entry_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER | |||
233 | 274 | ||
234 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY); | 275 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY); |
235 | GNUNET_memcpy(&(msg->door), door, sizeof(*door)); | 276 | GNUNET_memcpy(&(msg->door), door, sizeof(*door)); |
236 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(room->key)); | 277 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(msg->key)); |
237 | GNUNET_MQ_send (handle->mq, env); | 278 | GNUNET_MQ_send (handle->mq, env); |
238 | } | 279 | } |
239 | 280 | ||
@@ -244,7 +285,7 @@ send_close_room (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER | |||
244 | struct GNUNET_MQ_Envelope *env; | 285 | struct GNUNET_MQ_Envelope *env; |
245 | 286 | ||
246 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE); | 287 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE); |
247 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(room->key)); | 288 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(msg->key)); |
248 | GNUNET_MQ_send (handle->mq, env); | 289 | GNUNET_MQ_send (handle->mq, env); |
249 | } | 290 | } |
250 | 291 | ||
@@ -265,7 +306,7 @@ iterate_reset_room (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
265 | { | 306 | { |
266 | GNUNET_PEER_resolve (entry->peer, &door); | 307 | GNUNET_PEER_resolve (entry->peer, &door); |
267 | 308 | ||
268 | send_entry_room (handle, room, &door); | 309 | send_enter_room (handle, room, &door); |
269 | 310 | ||
270 | entry = entry->next; | 311 | entry = entry->next; |
271 | } | 312 | } |
@@ -303,7 +344,7 @@ callback_mq_error (void *cls, enum GNUNET_MQ_Error error) | |||
303 | { | 344 | { |
304 | struct GNUNET_MESSENGER_Handle *handle = cls; | 345 | struct GNUNET_MESSENGER_Handle *handle = cls; |
305 | 346 | ||
306 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "MQ ERROR: %u\n", error); | 347 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "MQ_Error: %u\n", error); |
307 | 348 | ||
308 | GNUNET_CONTAINER_multihashmap_iterate (handle->rooms, iterate_close_room, handle); | 349 | GNUNET_CONTAINER_multihashmap_iterate (handle->rooms, iterate_close_room, handle); |
309 | 350 | ||
@@ -319,36 +360,45 @@ callback_mq_error (void *cls, enum GNUNET_MQ_Error error) | |||
319 | static void | 360 | static void |
320 | reconnect (struct GNUNET_MESSENGER_Handle *handle) | 361 | reconnect (struct GNUNET_MESSENGER_Handle *handle) |
321 | { | 362 | { |
322 | const struct GNUNET_MQ_MessageHandler handlers[] = { GNUNET_MQ_hd_var_size( | 363 | const struct GNUNET_MQ_MessageHandler handlers[] = |
323 | get_name, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_NAME, struct GNUNET_MESSENGER_NameMessage, handle), | 364 | { |
324 | GNUNET_MQ_hd_fixed_size( | 365 | GNUNET_MQ_hd_var_size( |
325 | get_key, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_KEY, | 366 | get_name, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_NAME, |
326 | struct GNUNET_MESSENGER_KeyMessage, handle), | 367 | struct GNUNET_MESSENGER_NameMessage, handle |
327 | GNUNET_MQ_hd_fixed_size( | 368 | ), |
328 | member_id, | 369 | GNUNET_MQ_hd_var_size( |
329 | GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID, | 370 | get_key, GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_GET_KEY, |
330 | struct GNUNET_MESSENGER_MemberMessage, handle), | 371 | struct GNUNET_MESSENGER_KeyMessage, handle |
331 | GNUNET_MQ_hd_fixed_size(room_open, | 372 | ), |
332 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN, | 373 | GNUNET_MQ_hd_fixed_size( |
333 | struct GNUNET_MESSENGER_RoomMessage, | 374 | member_id, |
334 | handle), | 375 | GNUNET_MESSAGE_TYPE_MESSENGER_CONNECTION_MEMBER_ID, |
335 | GNUNET_MQ_hd_fixed_size(room_entry, | 376 | struct GNUNET_MESSENGER_MemberMessage, handle |
336 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY, | 377 | ), |
337 | struct GNUNET_MESSENGER_RoomMessage, | 378 | GNUNET_MQ_hd_fixed_size( |
338 | handle), | 379 | room_open, |
339 | GNUNET_MQ_hd_fixed_size(room_close, | 380 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_OPEN, |
340 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE, | 381 | struct GNUNET_MESSENGER_RoomMessage, handle |
341 | struct GNUNET_MESSENGER_RoomMessage, | 382 | ), |
342 | handle), | 383 | GNUNET_MQ_hd_fixed_size( |
343 | GNUNET_MQ_hd_var_size( | 384 | room_entry, |
344 | recv_message, | 385 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_ENTRY, |
345 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE, | 386 | struct GNUNET_MESSENGER_RoomMessage, handle |
346 | struct GNUNET_MESSENGER_RecvMessage, handle), | 387 | ), |
347 | GNUNET_MQ_handler_end() }; | 388 | GNUNET_MQ_hd_fixed_size( |
348 | 389 | room_close, | |
349 | handle->mq = GNUNET_CLIENT_connect (handle->cfg, | 390 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_CLOSE, |
350 | GNUNET_MESSENGER_SERVICE_NAME, | 391 | struct GNUNET_MESSENGER_RoomMessage, handle |
351 | handlers, &callback_mq_error, handle); | 392 | ), |
393 | GNUNET_MQ_hd_var_size( | ||
394 | recv_message, | ||
395 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_RECV_MESSAGE, | ||
396 | struct GNUNET_MESSENGER_RecvMessage, handle | ||
397 | ), | ||
398 | GNUNET_MQ_handler_end() | ||
399 | }; | ||
400 | |||
401 | handle->mq = GNUNET_CLIENT_connect (handle->cfg, GNUNET_MESSENGER_SERVICE_NAME, handlers, &callback_mq_error, handle); | ||
352 | } | 402 | } |
353 | 403 | ||
354 | struct GNUNET_MESSENGER_Handle* | 404 | struct GNUNET_MESSENGER_Handle* |
@@ -389,7 +439,7 @@ GNUNET_MESSENGER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, const c | |||
389 | int | 439 | int |
390 | GNUNET_MESSENGER_update (struct GNUNET_MESSENGER_Handle *handle) | 440 | GNUNET_MESSENGER_update (struct GNUNET_MESSENGER_Handle *handle) |
391 | { | 441 | { |
392 | if ((!handle) || (!get_handle_name(handle))) | 442 | if ((!handle) || (!get_handle_name (handle))) |
393 | return GNUNET_SYSERR; | 443 | return GNUNET_SYSERR; |
394 | 444 | ||
395 | struct GNUNET_MESSENGER_UpdateMessage *msg; | 445 | struct GNUNET_MESSENGER_UpdateMessage *msg; |
@@ -448,18 +498,30 @@ GNUNET_MESSENGER_set_name (struct GNUNET_MESSENGER_Handle *handle, const char *n | |||
448 | return GNUNET_YES; | 498 | return GNUNET_YES; |
449 | } | 499 | } |
450 | 500 | ||
501 | static const struct GNUNET_IDENTITY_PublicKey* | ||
502 | get_non_anonymous_key (const struct GNUNET_IDENTITY_PublicKey* public_key) | ||
503 | { | ||
504 | if (0 == GNUNET_memcmp(public_key, get_anonymous_public_key())) | ||
505 | return NULL; | ||
506 | |||
507 | return public_key; | ||
508 | } | ||
509 | |||
451 | const struct GNUNET_IDENTITY_PublicKey* | 510 | const struct GNUNET_IDENTITY_PublicKey* |
452 | GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle) | 511 | GNUNET_MESSENGER_get_key (const struct GNUNET_MESSENGER_Handle *handle) |
453 | { | 512 | { |
454 | if (!handle) | 513 | if (!handle) |
455 | return NULL; | 514 | return NULL; |
456 | 515 | ||
457 | return get_handle_key (handle); | 516 | return get_non_anonymous_key (get_handle_key (handle)); |
458 | } | 517 | } |
459 | 518 | ||
460 | struct GNUNET_MESSENGER_Room* | 519 | struct GNUNET_MESSENGER_Room* |
461 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 520 | GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
462 | { | 521 | { |
522 | if ((!handle) || (!key)) | ||
523 | return NULL; | ||
524 | |||
463 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); | 525 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); |
464 | 526 | ||
465 | if (!room) | 527 | if (!room) |
@@ -479,9 +541,12 @@ GNUNET_MESSENGER_open_room (struct GNUNET_MESSENGER_Handle *handle, const struct | |||
479 | } | 541 | } |
480 | 542 | ||
481 | struct GNUNET_MESSENGER_Room* | 543 | struct GNUNET_MESSENGER_Room* |
482 | GNUNET_MESSENGER_entry_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 544 | GNUNET_MESSENGER_enter_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, |
483 | const struct GNUNET_HashCode *key) | 545 | const struct GNUNET_HashCode *key) |
484 | { | 546 | { |
547 | if ((!handle) || (!door) || (!key)) | ||
548 | return NULL; | ||
549 | |||
485 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); | 550 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); |
486 | 551 | ||
487 | if (!room) | 552 | if (!room) |
@@ -496,20 +561,26 @@ GNUNET_MESSENGER_entry_room (struct GNUNET_MESSENGER_Handle *handle, const struc | |||
496 | } | 561 | } |
497 | } | 562 | } |
498 | 563 | ||
499 | send_entry_room (handle, room, door); | 564 | send_enter_room (handle, room, door); |
500 | return room; | 565 | return room; |
501 | } | 566 | } |
502 | 567 | ||
503 | void | 568 | void |
504 | GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room) | 569 | GNUNET_MESSENGER_close_room (struct GNUNET_MESSENGER_Room *room) |
505 | { | 570 | { |
571 | if (!room) | ||
572 | return; | ||
573 | |||
506 | send_close_room (room->handle, room); | 574 | send_close_room (room->handle, room); |
507 | } | 575 | } |
508 | 576 | ||
509 | struct GNUNET_MESSENGER_Contact* | 577 | struct GNUNET_MESSENGER_Contact* |
510 | GNUNET_MESSENGER_get_member (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_ShortHashCode *id) | 578 | GNUNET_MESSENGER_get_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
511 | { | 579 | { |
512 | return GNUNET_CONTAINER_multishortmap_get (room->members, id); | 580 | if ((!room) || (!hash)) |
581 | return NULL; | ||
582 | |||
583 | return get_room_sender(room, hash); | ||
513 | } | 584 | } |
514 | 585 | ||
515 | const char* | 586 | const char* |
@@ -527,23 +598,73 @@ GNUNET_MESSENGER_contact_get_key (const struct GNUNET_MESSENGER_Contact *contact | |||
527 | if (!contact) | 598 | if (!contact) |
528 | return NULL; | 599 | return NULL; |
529 | 600 | ||
530 | return get_contact_key (contact); | 601 | return get_non_anonymous_key (get_contact_key (contact)); |
531 | } | 602 | } |
532 | 603 | ||
533 | void | 604 | void |
534 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message) | 605 | GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, |
606 | const struct GNUNET_MESSENGER_Contact *contact) | ||
535 | { | 607 | { |
536 | const uint16_t length = get_message_size (message); | 608 | if ((!room) || (!message)) |
609 | return; | ||
610 | |||
611 | switch (filter_message_sending (message)) | ||
612 | { | ||
613 | case GNUNET_SYSERR: | ||
614 | GNUNET_log(GNUNET_ERROR_TYPE_ERROR, "Sending message aborted: This kind of message is reserved for the service!\n"); | ||
615 | return; | ||
616 | case GNUNET_NO: | ||
617 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Sending message aborted: This kind of message could cause issues!\n"); | ||
618 | return; | ||
619 | default: | ||
620 | break; | ||
621 | } | ||
622 | |||
623 | ssize_t key_length = 0; | ||
624 | |||
625 | if (contact) | ||
626 | { | ||
627 | const struct GNUNET_IDENTITY_PublicKey *public_key = get_non_anonymous_key ( | ||
628 | get_contact_key(contact) | ||
629 | ); | ||
630 | |||
631 | if (public_key) | ||
632 | key_length = GNUNET_IDENTITY_key_get_length(public_key); | ||
633 | else | ||
634 | key_length = -1; | ||
635 | } | ||
636 | |||
637 | if (key_length < 0) | ||
638 | { | ||
639 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Sending message aborted: Invalid key!\n"); | ||
640 | return; | ||
641 | } | ||
642 | |||
643 | const uint16_t msg_length = get_message_size (message, GNUNET_NO); | ||
537 | 644 | ||
538 | struct GNUNET_MESSENGER_SendMessage *msg; | 645 | struct GNUNET_MESSENGER_SendMessage *msg; |
539 | struct GNUNET_MQ_Envelope *env; | 646 | struct GNUNET_MQ_Envelope *env; |
540 | 647 | ||
541 | env = GNUNET_MQ_msg_extra(msg, length, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SEND_MESSAGE); | 648 | const uint16_t length = (uint16_t) key_length + msg_length; |
649 | |||
650 | env = GNUNET_MQ_msg_extra( | ||
651 | msg, length, | ||
652 | GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_SEND_MESSAGE | ||
653 | ); | ||
542 | 654 | ||
543 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(room->key)); | 655 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(msg->key)); |
656 | |||
657 | msg->flags = (uint32_t) ( | ||
658 | contact? GNUNET_MESSENGER_FLAG_PRIVATE : GNUNET_MESSENGER_FLAG_NONE | ||
659 | ); | ||
544 | 660 | ||
545 | char *buffer = ((char*) msg) + sizeof(*msg); | 661 | char *buffer = ((char*) msg) + sizeof(*msg); |
546 | encode_message (message, length, buffer); | 662 | char *msg_buffer = buffer + key_length; |
663 | |||
664 | if (key_length > 0) | ||
665 | GNUNET_IDENTITY_write_key_to_buffer(get_contact_key(contact), buffer, key_length); | ||
666 | |||
667 | encode_message (message, msg_length, msg_buffer, GNUNET_NO); | ||
547 | 668 | ||
548 | GNUNET_MQ_send (room->handle->mq, env); | 669 | GNUNET_MQ_send (room->handle->mq, env); |
549 | } | 670 | } |
@@ -551,18 +672,31 @@ GNUNET_MESSENGER_send_message (struct GNUNET_MESSENGER_Room *room, const struct | |||
551 | const struct GNUNET_MESSENGER_Message* | 672 | const struct GNUNET_MESSENGER_Message* |
552 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) | 673 | GNUNET_MESSENGER_get_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
553 | { | 674 | { |
675 | if ((!room) || (!hash)) | ||
676 | return NULL; | ||
677 | |||
554 | const struct GNUNET_MESSENGER_Message *message = get_room_message (room, hash); | 678 | const struct GNUNET_MESSENGER_Message *message = get_room_message (room, hash); |
555 | 679 | ||
556 | if (!message) | 680 | if (!message) |
557 | { | 681 | { |
558 | struct GNUNET_MESSENGER_RecvMessage *msg; | 682 | struct GNUNET_MESSENGER_GetMessage *msg; |
559 | struct GNUNET_MQ_Envelope *env; | 683 | struct GNUNET_MQ_Envelope *env; |
560 | 684 | ||
561 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_GET_MESSAGE); | 685 | env = GNUNET_MQ_msg(msg, GNUNET_MESSAGE_TYPE_MESSENGER_ROOM_GET_MESSAGE); |
562 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(room->key)); | 686 | GNUNET_memcpy(&(msg->key), &(room->key), sizeof(msg->key)); |
563 | GNUNET_memcpy(&(msg->hash), hash, sizeof(*hash)); | 687 | GNUNET_memcpy(&(msg->hash), hash, sizeof(*hash)); |
564 | GNUNET_MQ_send (room->handle->mq, env); | 688 | GNUNET_MQ_send (room->handle->mq, env); |
565 | } | 689 | } |
566 | 690 | ||
567 | return message; | 691 | return message; |
568 | } | 692 | } |
693 | |||
694 | int | ||
695 | GNUNET_MESSENGER_iterate_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | ||
696 | void* cls) | ||
697 | { | ||
698 | if (!room) | ||
699 | return GNUNET_SYSERR; | ||
700 | |||
701 | return iterate_room_members(room, callback, cls); | ||
702 | } | ||
diff --git a/src/messenger/messenger_api_contact.c b/src/messenger/messenger_api_contact.c index 9a242aa00..04e1f60c1 100644 --- a/src/messenger/messenger_api_contact.c +++ b/src/messenger/messenger_api_contact.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -28,9 +28,12 @@ | |||
28 | struct GNUNET_MESSENGER_Contact* | 28 | struct GNUNET_MESSENGER_Contact* |
29 | create_contact (const struct GNUNET_IDENTITY_PublicKey *key) | 29 | create_contact (const struct GNUNET_IDENTITY_PublicKey *key) |
30 | { | 30 | { |
31 | GNUNET_assert(key); | ||
32 | |||
31 | struct GNUNET_MESSENGER_Contact *contact = GNUNET_new(struct GNUNET_MESSENGER_Contact); | 33 | struct GNUNET_MESSENGER_Contact *contact = GNUNET_new(struct GNUNET_MESSENGER_Contact); |
32 | 34 | ||
33 | contact->name = NULL; | 35 | contact->name = NULL; |
36 | contact->rc = 0; | ||
34 | 37 | ||
35 | GNUNET_memcpy(&(contact->public_key), key, sizeof(contact->public_key)); | 38 | GNUNET_memcpy(&(contact->public_key), key, sizeof(contact->public_key)); |
36 | 39 | ||
@@ -40,6 +43,8 @@ create_contact (const struct GNUNET_IDENTITY_PublicKey *key) | |||
40 | void | 43 | void |
41 | destroy_contact (struct GNUNET_MESSENGER_Contact *contact) | 44 | destroy_contact (struct GNUNET_MESSENGER_Contact *contact) |
42 | { | 45 | { |
46 | GNUNET_assert(contact); | ||
47 | |||
43 | if (contact->name) | 48 | if (contact->name) |
44 | GNUNET_free(contact->name); | 49 | GNUNET_free(contact->name); |
45 | 50 | ||
@@ -49,30 +54,55 @@ destroy_contact (struct GNUNET_MESSENGER_Contact *contact) | |||
49 | const char* | 54 | const char* |
50 | get_contact_name (const struct GNUNET_MESSENGER_Contact *contact) | 55 | get_contact_name (const struct GNUNET_MESSENGER_Contact *contact) |
51 | { | 56 | { |
57 | GNUNET_assert(contact); | ||
58 | |||
52 | return contact->name; | 59 | return contact->name; |
53 | } | 60 | } |
54 | 61 | ||
55 | void | 62 | void |
56 | set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name) | 63 | set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name) |
57 | { | 64 | { |
65 | GNUNET_assert(contact); | ||
66 | |||
58 | if (contact->name) | 67 | if (contact->name) |
59 | GNUNET_free(contact->name); | 68 | GNUNET_free(contact->name); |
60 | 69 | ||
61 | contact->name = name? GNUNET_strdup(name) : NULL; | 70 | contact->name = name ? GNUNET_strdup(name) : NULL; |
62 | } | 71 | } |
63 | 72 | ||
64 | const struct GNUNET_IDENTITY_PublicKey* | 73 | const struct GNUNET_IDENTITY_PublicKey* |
65 | get_contact_key (const struct GNUNET_MESSENGER_Contact *contact) | 74 | get_contact_key (const struct GNUNET_MESSENGER_Contact *contact) |
66 | { | 75 | { |
76 | GNUNET_assert(contact); | ||
77 | |||
67 | return &(contact->public_key); | 78 | return &(contact->public_key); |
68 | } | 79 | } |
69 | 80 | ||
70 | const struct GNUNET_HashCode* | 81 | void |
71 | get_contact_id_from_key (const struct GNUNET_MESSENGER_Contact *contact) | 82 | increase_contact_rc (struct GNUNET_MESSENGER_Contact *contact) |
72 | { | 83 | { |
73 | static struct GNUNET_HashCode id; | 84 | GNUNET_assert(contact); |
85 | |||
86 | contact->rc++; | ||
87 | } | ||
74 | 88 | ||
75 | GNUNET_CRYPTO_hash (&(contact->public_key), sizeof(contact->public_key), &id); | 89 | int |
90 | decrease_contact_rc (struct GNUNET_MESSENGER_Contact *contact) | ||
91 | { | ||
92 | GNUNET_assert(contact); | ||
93 | |||
94 | if (contact->rc > 0) | ||
95 | contact->rc--; | ||
96 | |||
97 | return contact->rc ? GNUNET_NO : GNUNET_YES; | ||
98 | } | ||
99 | |||
100 | void | ||
101 | get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, | ||
102 | struct GNUNET_HashCode *context) | ||
103 | { | ||
104 | GNUNET_assert((key) && (id) && (context)); | ||
76 | 105 | ||
77 | return &id; | 106 | GNUNET_CRYPTO_hash (id, sizeof(*id), context); |
107 | GNUNET_CRYPTO_hash_xor (key, context, context); | ||
78 | } | 108 | } |
diff --git a/src/messenger/messenger_api_contact.h b/src/messenger/messenger_api_contact.h index 0673b9b85..e94d1fcd0 100644 --- a/src/messenger/messenger_api_contact.h +++ b/src/messenger/messenger_api_contact.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -33,6 +33,7 @@ | |||
33 | struct GNUNET_MESSENGER_Contact | 33 | struct GNUNET_MESSENGER_Contact |
34 | { | 34 | { |
35 | char *name; | 35 | char *name; |
36 | size_t rc; | ||
36 | 37 | ||
37 | struct GNUNET_IDENTITY_PublicKey public_key; | 38 | struct GNUNET_IDENTITY_PublicKey public_key; |
38 | }; | 39 | }; |
@@ -40,7 +41,7 @@ struct GNUNET_MESSENGER_Contact | |||
40 | /** | 41 | /** |
41 | * Creates and allocates a new contact with a given public <i>key</i> from an EGO. | 42 | * Creates and allocates a new contact with a given public <i>key</i> from an EGO. |
42 | * | 43 | * |
43 | * @param key Public key | 44 | * @param[in] key Public key |
44 | * @return New contact | 45 | * @return New contact |
45 | */ | 46 | */ |
46 | struct GNUNET_MESSENGER_Contact* | 47 | struct GNUNET_MESSENGER_Contact* |
@@ -49,7 +50,7 @@ create_contact (const struct GNUNET_IDENTITY_PublicKey *key); | |||
49 | /** | 50 | /** |
50 | * Destroys a contact and frees its memory fully. | 51 | * Destroys a contact and frees its memory fully. |
51 | * | 52 | * |
52 | * @param contact Contact | 53 | * @param[in/out] contact Contact |
53 | */ | 54 | */ |
54 | void | 55 | void |
55 | destroy_contact (struct GNUNET_MESSENGER_Contact *contact); | 56 | destroy_contact (struct GNUNET_MESSENGER_Contact *contact); |
@@ -57,7 +58,7 @@ destroy_contact (struct GNUNET_MESSENGER_Contact *contact); | |||
57 | /** | 58 | /** |
58 | * Returns the current name of a given <i>contact</i> or NULL if no valid name was assigned yet. | 59 | * Returns the current name of a given <i>contact</i> or NULL if no valid name was assigned yet. |
59 | * | 60 | * |
60 | * @param contact Contact | 61 | * @param[in] contact Contact |
61 | * @return Name of the contact or NULL | 62 | * @return Name of the contact or NULL |
62 | */ | 63 | */ |
63 | const char* | 64 | const char* |
@@ -66,8 +67,8 @@ get_contact_name (const struct GNUNET_MESSENGER_Contact *contact); | |||
66 | /** | 67 | /** |
67 | * Changes the current name of a given <i>contact</i> by copying it from the parameter <i>name</i>. | 68 | * Changes the current name of a given <i>contact</i> by copying it from the parameter <i>name</i>. |
68 | * | 69 | * |
69 | * @param contact Contact | 70 | * @param[in/out] contact Contact |
70 | * @param name Valid name (may not be NULL!) | 71 | * @param[in] name Name |
71 | */ | 72 | */ |
72 | void | 73 | void |
73 | set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name); | 74 | set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name); |
@@ -75,19 +76,39 @@ set_contact_name (struct GNUNET_MESSENGER_Contact *contact, const char *name); | |||
75 | /** | 76 | /** |
76 | * Returns the public key of a given <i>contact</i>. | 77 | * Returns the public key of a given <i>contact</i>. |
77 | * | 78 | * |
78 | * @param contact Contact | 79 | * @param[in] contact Contact |
79 | * @return Public key of the contact | 80 | * @return Public key of the contact |
80 | */ | 81 | */ |
81 | const struct GNUNET_IDENTITY_PublicKey* | 82 | const struct GNUNET_IDENTITY_PublicKey* |
82 | get_contact_key (const struct GNUNET_MESSENGER_Contact *contact); | 83 | get_contact_key (const struct GNUNET_MESSENGER_Contact *contact); |
83 | 84 | ||
84 | /** | 85 | /** |
85 | * Returns the resulting hashcode of the public key from a given <i>contact</i>. | 86 | * Increases the reference counter of a given <i>contact</i> which is zero as default. |
86 | * | 87 | * |
87 | * @param contact Contact | 88 | * @param[in/out] contact Contact |
88 | * @return Hash of the contacts public key | ||
89 | */ | 89 | */ |
90 | const struct GNUNET_HashCode* | 90 | void |
91 | get_contact_id_from_key (const struct GNUNET_MESSENGER_Contact *contact); | 91 | increase_contact_rc (struct GNUNET_MESSENGER_Contact *contact); |
92 | |||
93 | /** | ||
94 | * Decreases the reference counter if possible (can not underflow!) of a given <i>contact</i> | ||
95 | * and returns #GNUNET_YES if the counter is equal to zero, otherwise #GNUNET_NO. | ||
96 | * | ||
97 | * @param[in/out] contact Contact | ||
98 | * @return #GNUNET_YES or #GNUNET_NO depending on the reference counter | ||
99 | */ | ||
100 | int | ||
101 | decrease_contact_rc (struct GNUNET_MESSENGER_Contact *contact); | ||
102 | |||
103 | /** | ||
104 | * Calculates the context <i>hash</i> of a member in a room and returns it. | ||
105 | * | ||
106 | * @param[in] key Key of room | ||
107 | * @param[in] id Member id | ||
108 | * @param[out] hash Member context | ||
109 | */ | ||
110 | void | ||
111 | get_context_from_member (const struct GNUNET_HashCode *key, const struct GNUNET_ShortHashCode *id, | ||
112 | struct GNUNET_HashCode *context); | ||
92 | 113 | ||
93 | #endif //GNUNET_MESSENGER_API_CONTACT_H | 114 | #endif //GNUNET_MESSENGER_API_CONTACT_H |
diff --git a/src/messenger/messenger_api_contact_store.c b/src/messenger/messenger_api_contact_store.c new file mode 100755 index 000000000..6a517c2e0 --- /dev/null +++ b/src/messenger/messenger_api_contact_store.c | |||
@@ -0,0 +1,185 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/messenger_api_contact_store.c | ||
23 | * @brief messenger api: client implementation of GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #include "messenger_api_contact_store.h" | ||
27 | |||
28 | #include "messenger_api_contact.h" | ||
29 | #include "messenger_api_util.h" | ||
30 | |||
31 | void | ||
32 | init_contact_store (struct GNUNET_MESSENGER_ContactStore *store) | ||
33 | { | ||
34 | GNUNET_assert (store); | ||
35 | |||
36 | store->anonymous = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | ||
37 | store->contacts = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | ||
38 | } | ||
39 | |||
40 | static int | ||
41 | iterate_destroy_contacts (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
42 | { | ||
43 | struct GNUNET_MESSENGER_Contact *contact = value; | ||
44 | destroy_contact (contact); | ||
45 | return GNUNET_YES; | ||
46 | } | ||
47 | |||
48 | void | ||
49 | clear_contact_store (struct GNUNET_MESSENGER_ContactStore *store) | ||
50 | { | ||
51 | GNUNET_assert ((store) && (store->contacts)); | ||
52 | |||
53 | GNUNET_CONTAINER_multihashmap_iterate (store->anonymous, iterate_destroy_contacts, NULL); | ||
54 | GNUNET_CONTAINER_multihashmap_iterate (store->contacts, iterate_destroy_contacts, NULL); | ||
55 | |||
56 | GNUNET_CONTAINER_multihashmap_destroy (store->anonymous); | ||
57 | GNUNET_CONTAINER_multihashmap_destroy (store->contacts); | ||
58 | } | ||
59 | |||
60 | static struct GNUNET_CONTAINER_MultiHashMap* | ||
61 | select_store_contact_map (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | ||
62 | struct GNUNET_HashCode *hash) | ||
63 | { | ||
64 | const struct GNUNET_IDENTITY_PublicKey *anonymous = get_anonymous_public_key (); | ||
65 | |||
66 | struct GNUNET_HashCode anonHash; | ||
67 | GNUNET_CRYPTO_hash (anonymous, sizeof(*anonymous), &anonHash); | ||
68 | |||
69 | if ((context) && (0 == GNUNET_CRYPTO_hash_cmp(hash, &anonHash))) | ||
70 | { | ||
71 | GNUNET_memcpy(hash, context, sizeof(*context)); | ||
72 | return store->anonymous; | ||
73 | } | ||
74 | else | ||
75 | return store->contacts; | ||
76 | } | ||
77 | |||
78 | struct GNUNET_MESSENGER_Contact* | ||
79 | get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | ||
80 | const struct GNUNET_HashCode *key_hash) | ||
81 | { | ||
82 | GNUNET_assert ((store) && (store->contacts) && (context) && (key_hash)); | ||
83 | |||
84 | struct GNUNET_HashCode hash; | ||
85 | GNUNET_memcpy(&hash, key_hash, sizeof(*key_hash)); | ||
86 | |||
87 | struct GNUNET_CONTAINER_MultiHashMap *map = select_store_contact_map ( | ||
88 | store, context, &hash | ||
89 | ); | ||
90 | |||
91 | return GNUNET_CONTAINER_multihashmap_get (map, &hash); | ||
92 | } | ||
93 | |||
94 | struct GNUNET_MESSENGER_Contact* | ||
95 | get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | ||
96 | const struct GNUNET_IDENTITY_PublicKey *pubkey) | ||
97 | { | ||
98 | GNUNET_assert ((store) && (store->contacts) && (context) && (pubkey)); | ||
99 | |||
100 | struct GNUNET_HashCode hash; | ||
101 | GNUNET_CRYPTO_hash (pubkey, sizeof(*pubkey), &hash); | ||
102 | |||
103 | struct GNUNET_CONTAINER_MultiHashMap *map = select_store_contact_map ( | ||
104 | store, context, &hash | ||
105 | ); | ||
106 | |||
107 | struct GNUNET_MESSENGER_Contact *contact = GNUNET_CONTAINER_multihashmap_get (map, &hash); | ||
108 | |||
109 | if (contact) | ||
110 | { | ||
111 | if (0 != GNUNET_memcmp(pubkey, get_contact_key(contact))) | ||
112 | { | ||
113 | char* str = GNUNET_IDENTITY_public_key_to_string (get_contact_key(contact)); | ||
114 | GNUNET_log (GNUNET_ERROR_TYPE_INVALID, "Contact in store uses wrong key: %s\n", str); | ||
115 | GNUNET_free (str); | ||
116 | return NULL; | ||
117 | } | ||
118 | |||
119 | return contact; | ||
120 | } | ||
121 | |||
122 | contact = create_contact (pubkey); | ||
123 | |||
124 | if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (map, &hash, contact, | ||
125 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
126 | return contact; | ||
127 | |||
128 | destroy_contact (contact); | ||
129 | return NULL; | ||
130 | } | ||
131 | |||
132 | void | ||
133 | update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, | ||
134 | const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context, | ||
135 | const struct GNUNET_IDENTITY_PublicKey *pubkey) | ||
136 | { | ||
137 | GNUNET_assert ((store) && (store->contacts) && (contact) && (pubkey)); | ||
138 | |||
139 | const struct GNUNET_IDENTITY_PublicKey* oldkey = get_contact_key (contact); | ||
140 | |||
141 | struct GNUNET_HashCode hash; | ||
142 | GNUNET_CRYPTO_hash (oldkey, sizeof(*oldkey), &hash); | ||
143 | |||
144 | struct GNUNET_CONTAINER_MultiHashMap *map = select_store_contact_map ( | ||
145 | store, context, &hash | ||
146 | ); | ||
147 | |||
148 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (map, &hash, contact)) | ||
149 | { | ||
150 | GNUNET_memcpy(&(contact->public_key), pubkey, sizeof(*pubkey)); | ||
151 | |||
152 | GNUNET_CRYPTO_hash (pubkey, sizeof(*pubkey), &hash); | ||
153 | |||
154 | map = select_store_contact_map ( | ||
155 | store, next_context, &hash | ||
156 | ); | ||
157 | |||
158 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (map, &hash, contact, | ||
159 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
160 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Updating a contact failed: %s\n", | ||
161 | GNUNET_h2s(&hash)); | ||
162 | } | ||
163 | } | ||
164 | |||
165 | void | ||
166 | remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, | ||
167 | const struct GNUNET_HashCode *context) | ||
168 | { | ||
169 | GNUNET_assert ((store) && (store->contacts) && (contact)); | ||
170 | |||
171 | const struct GNUNET_IDENTITY_PublicKey* pubkey = get_contact_key(contact); | ||
172 | |||
173 | struct GNUNET_HashCode hash; | ||
174 | GNUNET_CRYPTO_hash (pubkey, sizeof(*pubkey), &hash); | ||
175 | |||
176 | struct GNUNET_CONTAINER_MultiHashMap *map = select_store_contact_map ( | ||
177 | store, context, &hash | ||
178 | ); | ||
179 | |||
180 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_remove (map, &hash, contact)) | ||
181 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Removing a contact failed: %s\n", | ||
182 | GNUNET_h2s(&hash)); | ||
183 | |||
184 | destroy_contact (contact); | ||
185 | } | ||
diff --git a/src/messenger/messenger_api_contact_store.h b/src/messenger/messenger_api_contact_store.h new file mode 100644 index 000000000..966f6d962 --- /dev/null +++ b/src/messenger/messenger_api_contact_store.h | |||
@@ -0,0 +1,122 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @author Tobias Frisch | ||
22 | * @file src/messenger/messenger_api_contact_store.h | ||
23 | * @brief messenger api: client implementation of GNUnet MESSENGER service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_MESSENGER_API_CONTACT_STORE_H | ||
27 | #define GNUNET_MESSENGER_API_CONTACT_STORE_H | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_container_lib.h" | ||
31 | #include "gnunet_crypto_lib.h" | ||
32 | #include "gnunet_identity_service.h" | ||
33 | |||
34 | struct GNUNET_MESSENGER_Contact; | ||
35 | |||
36 | struct GNUNET_MESSENGER_ContactStore | ||
37 | { | ||
38 | struct GNUNET_CONTAINER_MultiHashMap *anonymous; | ||
39 | struct GNUNET_CONTAINER_MultiHashMap *contacts; | ||
40 | }; | ||
41 | |||
42 | /** | ||
43 | * Initializes a contact store as fully empty. | ||
44 | * | ||
45 | * @param[out] store Contact store | ||
46 | */ | ||
47 | void | ||
48 | init_contact_store (struct GNUNET_MESSENGER_ContactStore *store); | ||
49 | |||
50 | /** | ||
51 | * Clears a contact store, wipes its content and deallocates its memory. | ||
52 | * | ||
53 | * @param[in/out] store Contact store | ||
54 | */ | ||
55 | void | ||
56 | clear_contact_store (struct GNUNET_MESSENGER_ContactStore *store); | ||
57 | |||
58 | /** | ||
59 | * Returns a contact using the hash of a specific public key. In case the anonymous | ||
60 | * key gets used by the requested contact, it will use its provided member | ||
61 | * <i>context</i> to select the matching contact from the <i>store</i>. | ||
62 | * | ||
63 | * In case there is no contact stored which uses the given key or context, | ||
64 | * NULL gets returned. | ||
65 | * | ||
66 | * @param[in/out] store Contact store | ||
67 | * @param[in] context Member context | ||
68 | * @param[in] key_hash Hash of public key | ||
69 | */ | ||
70 | struct GNUNET_MESSENGER_Contact* | ||
71 | get_store_contact_raw (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | ||
72 | const struct GNUNET_HashCode *key_hash); | ||
73 | |||
74 | /** | ||
75 | * Returns a contact using a specific public key. In case the anonymous | ||
76 | * key gets used by the requested contact, it will use its provided member | ||
77 | * <i>context</i> to select the matching contact from the <i>store</i>. | ||
78 | * | ||
79 | * In case there is no contact stored which uses the given key or context, | ||
80 | * a new contact will be created automatically. | ||
81 | * | ||
82 | * The function returns NULL if an error occures during allocation | ||
83 | * or validation of the contacts key. | ||
84 | * | ||
85 | * @param[in/out] store Contact store | ||
86 | * @param[in] context Member context | ||
87 | * @param[in] pubkey Public key of EGO | ||
88 | */ | ||
89 | struct GNUNET_MESSENGER_Contact* | ||
90 | get_store_contact (struct GNUNET_MESSENGER_ContactStore *store, const struct GNUNET_HashCode *context, | ||
91 | const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
92 | |||
93 | /** | ||
94 | * Moves a <i>contact</i> from the <i>store</i> to another location | ||
95 | * matching a given public key and member <i>context</i>. | ||
96 | * | ||
97 | * This function allows changes of keys or changes of member contexts! | ||
98 | * | ||
99 | * @param[in/out] store Contact store | ||
100 | * @param[in/out] contact Contact | ||
101 | * @param[in] context Member context | ||
102 | * @param[in] next_context Member context | ||
103 | * @param[in] pubkey Public key of EGO | ||
104 | */ | ||
105 | void | ||
106 | update_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, | ||
107 | const struct GNUNET_HashCode *context, const struct GNUNET_HashCode *next_context, | ||
108 | const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
109 | |||
110 | /** | ||
111 | * Removes a <i>contact</i> from the <i>store</i> which uses | ||
112 | * a given member <i>context</i>. | ||
113 | * | ||
114 | * @param[in/out] store Contact store | ||
115 | * @param[in/out] contact Contact | ||
116 | * @param[in] context Member context | ||
117 | */ | ||
118 | void | ||
119 | remove_store_contact (struct GNUNET_MESSENGER_ContactStore *store, struct GNUNET_MESSENGER_Contact* contact, | ||
120 | const struct GNUNET_HashCode *context); | ||
121 | |||
122 | #endif //GNUNET_MESSENGER_API_CONTACT_STORE_H | ||
diff --git a/src/messenger/messenger_api_ego.h b/src/messenger/messenger_api_ego.h index c60eeac50..b52b895f2 100644 --- a/src/messenger/messenger_api_ego.h +++ b/src/messenger/messenger_api_ego.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
diff --git a/src/messenger/messenger_api_handle.c b/src/messenger/messenger_api_handle.c index 20ef77254..ab57f82cc 100644 --- a/src/messenger/messenger_api_handle.c +++ b/src/messenger/messenger_api_handle.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -25,10 +25,14 @@ | |||
25 | 25 | ||
26 | #include "messenger_api_handle.h" | 26 | #include "messenger_api_handle.h" |
27 | 27 | ||
28 | #include "messenger_api_util.h" | ||
29 | |||
28 | struct GNUNET_MESSENGER_Handle* | 30 | struct GNUNET_MESSENGER_Handle* |
29 | create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, | 31 | create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_IdentityCallback identity_callback, |
30 | void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) | 32 | void *identity_cls, GNUNET_MESSENGER_MessageCallback msg_callback, void *msg_cls) |
31 | { | 33 | { |
34 | GNUNET_assert(cfg); | ||
35 | |||
32 | struct GNUNET_MESSENGER_Handle *handle = GNUNET_new(struct GNUNET_MESSENGER_Handle); | 36 | struct GNUNET_MESSENGER_Handle *handle = GNUNET_new(struct GNUNET_MESSENGER_Handle); |
33 | 37 | ||
34 | handle->cfg = cfg; | 38 | handle->cfg = cfg; |
@@ -47,7 +51,8 @@ create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_I | |||
47 | handle->reconnect_task = NULL; | 51 | handle->reconnect_task = NULL; |
48 | 52 | ||
49 | handle->rooms = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 53 | handle->rooms = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); |
50 | handle->contacts = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 54 | |
55 | init_contact_store(get_handle_contact_store(handle)); | ||
51 | 56 | ||
52 | return handle; | 57 | return handle; |
53 | } | 58 | } |
@@ -62,19 +67,11 @@ iterate_destroy_room (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
62 | return GNUNET_YES; | 67 | return GNUNET_YES; |
63 | } | 68 | } |
64 | 69 | ||
65 | static int | ||
66 | iterate_destroy_contact (void *cls, const struct GNUNET_HashCode *key, void *value) | ||
67 | { | ||
68 | struct GNUNET_MESSENGER_Contact *contact = value; | ||
69 | |||
70 | destroy_contact (contact); | ||
71 | |||
72 | return GNUNET_YES; | ||
73 | } | ||
74 | |||
75 | void | 70 | void |
76 | destroy_handle (struct GNUNET_MESSENGER_Handle *handle) | 71 | destroy_handle (struct GNUNET_MESSENGER_Handle *handle) |
77 | { | 72 | { |
73 | GNUNET_assert(handle); | ||
74 | |||
78 | if (handle->reconnect_task) | 75 | if (handle->reconnect_task) |
79 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); | 76 | GNUNET_SCHEDULER_cancel (handle->reconnect_task); |
80 | 77 | ||
@@ -94,12 +91,7 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle) | |||
94 | GNUNET_CONTAINER_multihashmap_destroy (handle->rooms); | 91 | GNUNET_CONTAINER_multihashmap_destroy (handle->rooms); |
95 | } | 92 | } |
96 | 93 | ||
97 | if (handle->contacts) | 94 | clear_contact_store(get_handle_contact_store(handle)); |
98 | { | ||
99 | GNUNET_CONTAINER_multihashmap_iterate (handle->contacts, iterate_destroy_contact, NULL); | ||
100 | |||
101 | GNUNET_CONTAINER_multihashmap_destroy (handle->contacts); | ||
102 | } | ||
103 | 95 | ||
104 | GNUNET_free(handle->name); | 96 | GNUNET_free(handle->name); |
105 | } | 97 | } |
@@ -107,21 +99,27 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle) | |||
107 | void | 99 | void |
108 | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) | 100 | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name) |
109 | { | 101 | { |
102 | GNUNET_assert(handle); | ||
103 | |||
110 | if (handle->name) | 104 | if (handle->name) |
111 | GNUNET_free(handle->name); | 105 | GNUNET_free(handle->name); |
112 | 106 | ||
113 | handle->name = name? GNUNET_strdup(name) : NULL; | 107 | handle->name = name ? GNUNET_strdup(name) : NULL; |
114 | } | 108 | } |
115 | 109 | ||
116 | const char* | 110 | const char* |
117 | get_handle_name (const struct GNUNET_MESSENGER_Handle *handle) | 111 | get_handle_name (const struct GNUNET_MESSENGER_Handle *handle) |
118 | { | 112 | { |
113 | GNUNET_assert(handle); | ||
114 | |||
119 | return handle->name; | 115 | return handle->name; |
120 | } | 116 | } |
121 | 117 | ||
122 | void | 118 | void |
123 | set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey) | 119 | set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey) |
124 | { | 120 | { |
121 | GNUNET_assert(handle); | ||
122 | |||
125 | if (!handle->pubkey) | 123 | if (!handle->pubkey) |
126 | handle->pubkey = GNUNET_new(struct GNUNET_IDENTITY_PublicKey); | 124 | handle->pubkey = GNUNET_new(struct GNUNET_IDENTITY_PublicKey); |
127 | 125 | ||
@@ -131,62 +129,43 @@ set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDEN | |||
131 | const struct GNUNET_IDENTITY_PublicKey* | 129 | const struct GNUNET_IDENTITY_PublicKey* |
132 | get_handle_key (const struct GNUNET_MESSENGER_Handle *handle) | 130 | get_handle_key (const struct GNUNET_MESSENGER_Handle *handle) |
133 | { | 131 | { |
134 | if (!handle->pubkey) | 132 | GNUNET_assert(handle); |
135 | { | ||
136 | struct GNUNET_IDENTITY_Ego *anonymous = GNUNET_IDENTITY_ego_get_anonymous (); | ||
137 | static struct GNUNET_IDENTITY_PublicKey pubkey; | ||
138 | 133 | ||
139 | GNUNET_IDENTITY_ego_get_public_key (anonymous, &pubkey); | 134 | if (handle->pubkey) |
140 | 135 | return handle->pubkey; | |
141 | return &pubkey; | ||
142 | } | ||
143 | 136 | ||
144 | return handle->pubkey; | 137 | return get_anonymous_public_key (); |
145 | } | 138 | } |
146 | 139 | ||
147 | struct GNUNET_MESSENGER_Contact* | 140 | struct GNUNET_MESSENGER_ContactStore* |
148 | get_handle_contact_by_pubkey (const struct GNUNET_MESSENGER_Handle *handle, | 141 | get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle) |
149 | const struct GNUNET_IDENTITY_PublicKey *pubkey) | ||
150 | { | 142 | { |
151 | struct GNUNET_HashCode hash; | 143 | GNUNET_assert(handle); |
152 | |||
153 | GNUNET_CRYPTO_hash (pubkey, sizeof(*pubkey), &hash); | ||
154 | |||
155 | struct GNUNET_MESSENGER_Contact *contact = GNUNET_CONTAINER_multihashmap_get (handle->contacts, &hash); | ||
156 | |||
157 | if (contact) | ||
158 | return contact; | ||
159 | |||
160 | contact = create_contact (pubkey); | ||
161 | |||
162 | if (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (handle->contacts, &hash, contact, | ||
163 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | ||
164 | return contact; | ||
165 | 144 | ||
166 | destroy_contact (contact); | 145 | return &(handle->contact_store); |
167 | return NULL; | ||
168 | } | 146 | } |
169 | 147 | ||
170 | void | 148 | struct GNUNET_MESSENGER_Contact* |
171 | swap_handle_contact_by_pubkey (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Contact *contact, | 149 | get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
172 | const struct GNUNET_IDENTITY_PublicKey *pubkey) | ||
173 | { | 150 | { |
174 | const struct GNUNET_HashCode *hash = get_contact_id_from_key (contact); | 151 | GNUNET_assert((handle) && (key)); |
175 | 152 | ||
176 | if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (handle->contacts, hash, contact)) | 153 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); |
177 | { | ||
178 | GNUNET_memcpy(&(contact->public_key), pubkey, sizeof(*pubkey)); | ||
179 | 154 | ||
180 | hash = get_contact_id_from_key (contact); | 155 | if ((!room) || (!(room->contact_id))) |
156 | return NULL; | ||
181 | 157 | ||
182 | GNUNET_CONTAINER_multihashmap_put (handle->contacts, hash, contact, | 158 | struct GNUNET_HashCode context; |
183 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | 159 | get_context_from_member (key, room->contact_id, &context); |
184 | } | 160 | |
161 | return get_store_contact(get_handle_contact_store(handle), &context, get_handle_key(handle)); | ||
185 | } | 162 | } |
186 | 163 | ||
187 | void | 164 | void |
188 | open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 165 | open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
189 | { | 166 | { |
167 | GNUNET_assert((handle) && (key)); | ||
168 | |||
190 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); | 169 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); |
191 | 170 | ||
192 | if (room) | 171 | if (room) |
@@ -197,6 +176,8 @@ void | |||
197 | entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 176 | entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, |
198 | const struct GNUNET_HashCode *key) | 177 | const struct GNUNET_HashCode *key) |
199 | { | 178 | { |
179 | GNUNET_assert((handle) && (door) && (key)); | ||
180 | |||
200 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); | 181 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); |
201 | 182 | ||
202 | if (room) | 183 | if (room) |
@@ -206,6 +187,8 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE | |||
206 | void | 187 | void |
207 | close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 188 | close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
208 | { | 189 | { |
190 | GNUNET_assert((handle) && (key)); | ||
191 | |||
209 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); | 192 | struct GNUNET_MESSENGER_Room *room = GNUNET_CONTAINER_multihashmap_get (handle->rooms, key); |
210 | 193 | ||
211 | if ((room) && (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (handle->rooms, key, room))) | 194 | if ((room) && (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (handle->rooms, key, room))) |
diff --git a/src/messenger/messenger_api_handle.h b/src/messenger/messenger_api_handle.h index d6cde0106..e6ca474f2 100644 --- a/src/messenger/messenger_api_handle.h +++ b/src/messenger/messenger_api_handle.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -35,7 +35,7 @@ | |||
35 | 35 | ||
36 | #include "gnunet_messenger_service.h" | 36 | #include "gnunet_messenger_service.h" |
37 | 37 | ||
38 | #include "messenger_api_contact.h" | 38 | #include "messenger_api_contact_store.h" |
39 | #include "messenger_api_room.h" | 39 | #include "messenger_api_room.h" |
40 | 40 | ||
41 | struct GNUNET_MESSENGER_Handle | 41 | struct GNUNET_MESSENGER_Handle |
@@ -56,17 +56,18 @@ struct GNUNET_MESSENGER_Handle | |||
56 | struct GNUNET_TIME_Relative reconnect_time; | 56 | struct GNUNET_TIME_Relative reconnect_time; |
57 | struct GNUNET_SCHEDULER_Task *reconnect_task; | 57 | struct GNUNET_SCHEDULER_Task *reconnect_task; |
58 | 58 | ||
59 | struct GNUNET_MESSENGER_ContactStore contact_store; | ||
60 | |||
59 | struct GNUNET_CONTAINER_MultiHashMap *rooms; | 61 | struct GNUNET_CONTAINER_MultiHashMap *rooms; |
60 | struct GNUNET_CONTAINER_MultiHashMap *contacts; | ||
61 | }; | 62 | }; |
62 | 63 | ||
63 | /** | 64 | /** |
64 | * Creates and allocates a new handle using a given configuration and a custom message callback | 65 | * Creates and allocates a new handle using a given configuration and a custom message callback |
65 | * with a given closure for the client API. | 66 | * with a given closure for the client API. |
66 | * | 67 | * |
67 | * @param cfg Configuration | 68 | * @param[in] cfg Configuration |
68 | * @param msg_callback Message callback | 69 | * @param[in] msg_callback Message callback |
69 | * @param msg_cls Closure | 70 | * @param[in/out] msg_cls Closure |
70 | * @return New handle | 71 | * @return New handle |
71 | */ | 72 | */ |
72 | struct GNUNET_MESSENGER_Handle* | 73 | struct GNUNET_MESSENGER_Handle* |
@@ -76,7 +77,7 @@ create_handle (const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_MESSENGER_I | |||
76 | /** | 77 | /** |
77 | * Destroys a <i>handle</i> and frees its memory fully from the client API. | 78 | * Destroys a <i>handle</i> and frees its memory fully from the client API. |
78 | * | 79 | * |
79 | * @param handle Handle | 80 | * @param[in/out] handle Handle |
80 | */ | 81 | */ |
81 | void | 82 | void |
82 | destroy_handle (struct GNUNET_MESSENGER_Handle *handle); | 83 | destroy_handle (struct GNUNET_MESSENGER_Handle *handle); |
@@ -84,8 +85,8 @@ destroy_handle (struct GNUNET_MESSENGER_Handle *handle); | |||
84 | /** | 85 | /** |
85 | * Sets the name of a <i>handle</i> to a specific <i>name</i>. | 86 | * Sets the name of a <i>handle</i> to a specific <i>name</i>. |
86 | * | 87 | * |
87 | * @param handle Handle | 88 | * @param[in/out] handle Handle |
88 | * @param name New name | 89 | * @param[in] name New name |
89 | */ | 90 | */ |
90 | void | 91 | void |
91 | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); | 92 | set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); |
@@ -93,7 +94,7 @@ set_handle_name (struct GNUNET_MESSENGER_Handle *handle, const char *name); | |||
93 | /** | 94 | /** |
94 | * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet. | 95 | * Returns the current name of a given <i>handle</i> or NULL if no valid name was assigned yet. |
95 | * | 96 | * |
96 | * @param handle Handle | 97 | * @param[in] handle Handle |
97 | * @return Name of the handle or NULL | 98 | * @return Name of the handle or NULL |
98 | */ | 99 | */ |
99 | const char* | 100 | const char* |
@@ -102,8 +103,8 @@ get_handle_name (const struct GNUNET_MESSENGER_Handle *handle); | |||
102 | /** | 103 | /** |
103 | * Sets the public key of a given <i>handle</i> to a specific public key. | 104 | * Sets the public key of a given <i>handle</i> to a specific public key. |
104 | * | 105 | * |
105 | * @param handle Handle | 106 | * @param[in/out] handle Handle |
106 | * @param pubkey Public key | 107 | * @param[in] pubkey Public key |
107 | */ | 108 | */ |
108 | void | 109 | void |
109 | set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey); | 110 | set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDENTITY_PublicKey *pubkey); |
@@ -111,41 +112,37 @@ set_handle_key (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_IDEN | |||
111 | /** | 112 | /** |
112 | * Returns the public key of a given <i>handle</i>. | 113 | * Returns the public key of a given <i>handle</i>. |
113 | * | 114 | * |
114 | * @param handle Handle | 115 | * @param[in] handle Handle |
115 | * @return Public key of the handle | 116 | * @return Public key of the handle |
116 | */ | 117 | */ |
117 | const struct GNUNET_IDENTITY_PublicKey* | 118 | const struct GNUNET_IDENTITY_PublicKey* |
118 | get_handle_key (const struct GNUNET_MESSENGER_Handle *handle); | 119 | get_handle_key (const struct GNUNET_MESSENGER_Handle *handle); |
119 | 120 | ||
120 | /** | 121 | /** |
121 | * Returns a contact known to a <i>handle</i> identified by a given public key. If not matching | 122 | * Returns the used contact store of a given <i>handle</i>. |
122 | * contact is found, NULL gets returned. | ||
123 | * | 123 | * |
124 | * @param handle Handle | 124 | * @param[in/out] handle Handle |
125 | * @param pubkey Public key of EGO | 125 | * @return Contact store |
126 | * @return Contact or NULL | ||
127 | */ | 126 | */ |
128 | struct GNUNET_MESSENGER_Contact* | 127 | struct GNUNET_MESSENGER_ContactStore* |
129 | get_handle_contact_by_pubkey (const struct GNUNET_MESSENGER_Handle *handle, | 128 | get_handle_contact_store (struct GNUNET_MESSENGER_Handle *handle); |
130 | const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
131 | 129 | ||
132 | /** | 130 | /** |
133 | * Changes the public key for a <i>contact</i> known to a <i>handle</i> to a specific public key and | 131 | * Returns the contact of a given <i>handle</i> in a room identified by a |
134 | * updates local map entries to access the contact by its updated key. | 132 | * given <i>key</i>. |
135 | * | 133 | * |
136 | * @param handle Handle | 134 | * @param[in/out] handle Handle |
137 | * @param contact Contact | 135 | * @param[in] key Key of room |
138 | * @param pubkey Public key of EGO | 136 | * @return Contact |
139 | */ | 137 | */ |
140 | void | 138 | struct GNUNET_MESSENGER_Contact* |
141 | swap_handle_contact_by_pubkey (struct GNUNET_MESSENGER_Handle *handle, struct GNUNET_MESSENGER_Contact *contact, | 139 | get_handle_contact (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); |
142 | const struct GNUNET_IDENTITY_PublicKey *pubkey); | ||
143 | 140 | ||
144 | /** | 141 | /** |
145 | * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open. | 142 | * Marks a room known to a <i>handle</i> identified by a given <i>key</i> as open. |
146 | * | 143 | * |
147 | * @param handle Handle | 144 | * @param[in/out] handle Handle |
148 | * @param key Key of room | 145 | * @param[in] key Key of room |
149 | */ | 146 | */ |
150 | void | 147 | void |
151 | open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | 148 | open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); |
@@ -154,9 +151,9 @@ open_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_Ha | |||
154 | * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a | 151 | * Adds a tunnel for a room known to a <i>handle</i> identified by a given <i>key</i> to a |
155 | * list of opened connections. | 152 | * list of opened connections. |
156 | * | 153 | * |
157 | * @param handle Handle | 154 | * @param[in/out] handle Handle |
158 | * @param door Peer identity | 155 | * @param[in] door Peer identity |
159 | * @param key Key of room | 156 | * @param[in] key Key of room |
160 | */ | 157 | */ |
161 | void | 158 | void |
162 | entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, | 159 | entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_PeerIdentity *door, |
@@ -165,8 +162,8 @@ entry_handle_room_at (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNE | |||
165 | /** | 162 | /** |
166 | * Destroys and so implicitly closes a room known to a <i>handle</i> identified by a given <i>key</i>. | 163 | * Destroys and so implicitly closes a room known to a <i>handle</i> identified by a given <i>key</i>. |
167 | * | 164 | * |
168 | * @param handle Handle | 165 | * @param[in/out] handle Handle |
169 | * @param key Key of room | 166 | * @param[in] key Key of room |
170 | */ | 167 | */ |
171 | void | 168 | void |
172 | close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); | 169 | close_handle_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key); |
diff --git a/src/messenger/messenger_api_list_tunnels.c b/src/messenger/messenger_api_list_tunnels.c index 13d8c1906..990e36878 100644 --- a/src/messenger/messenger_api_list_tunnels.c +++ b/src/messenger/messenger_api_list_tunnels.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -62,6 +62,8 @@ compare_list_tunnels (void *cls, struct GNUNET_MESSENGER_ListTunnel *element0, | |||
62 | void | 62 | void |
63 | add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) | 63 | add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) |
64 | { | 64 | { |
65 | GNUNET_assert((tunnels) && (peer)); | ||
66 | |||
65 | struct GNUNET_MESSENGER_ListTunnel *element = GNUNET_new(struct GNUNET_MESSENGER_ListTunnel); | 67 | struct GNUNET_MESSENGER_ListTunnel *element = GNUNET_new(struct GNUNET_MESSENGER_ListTunnel); |
66 | 68 | ||
67 | element->peer = GNUNET_PEER_intern (peer); | 69 | element->peer = GNUNET_PEER_intern (peer); |
@@ -73,6 +75,8 @@ add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct | |||
73 | struct GNUNET_MESSENGER_ListTunnel* | 75 | struct GNUNET_MESSENGER_ListTunnel* |
74 | find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index) | 76 | find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer, size_t *index) |
75 | { | 77 | { |
78 | GNUNET_assert((tunnels) && (peer)); | ||
79 | |||
76 | struct GNUNET_MESSENGER_ListTunnel *element; | 80 | struct GNUNET_MESSENGER_ListTunnel *element; |
77 | struct GNUNET_PeerIdentity pid; | 81 | struct GNUNET_PeerIdentity pid; |
78 | 82 | ||
@@ -96,12 +100,16 @@ find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GN | |||
96 | int | 100 | int |
97 | contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) | 101 | contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer) |
98 | { | 102 | { |
103 | GNUNET_assert((tunnels) && (peer)); | ||
104 | |||
99 | return find_list_tunnels (tunnels, peer, NULL) != NULL ? GNUNET_YES : GNUNET_NO; | 105 | return find_list_tunnels (tunnels, peer, NULL) != NULL ? GNUNET_YES : GNUNET_NO; |
100 | } | 106 | } |
101 | 107 | ||
102 | struct GNUNET_MESSENGER_ListTunnel* | 108 | struct GNUNET_MESSENGER_ListTunnel* |
103 | remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element) | 109 | remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element) |
104 | { | 110 | { |
111 | GNUNET_assert((tunnels) && (element)); | ||
112 | |||
105 | struct GNUNET_MESSENGER_ListTunnel *next = element->next; | 113 | struct GNUNET_MESSENGER_ListTunnel *next = element->next; |
106 | 114 | ||
107 | GNUNET_CONTAINER_DLL_remove(tunnels->head, tunnels->tail, element); | 115 | GNUNET_CONTAINER_DLL_remove(tunnels->head, tunnels->tail, element); |
@@ -110,3 +118,67 @@ remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct G | |||
110 | 118 | ||
111 | return next; | 119 | return next; |
112 | } | 120 | } |
121 | |||
122 | void | ||
123 | load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) | ||
124 | { | ||
125 | GNUNET_assert((tunnels) && (path)); | ||
126 | |||
127 | if (GNUNET_YES != GNUNET_DISK_file_test (path)) | ||
128 | return; | ||
129 | |||
130 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
131 | |||
132 | struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open( | ||
133 | path, GNUNET_DISK_OPEN_READ, permission | ||
134 | ); | ||
135 | |||
136 | if (!handle) | ||
137 | return; | ||
138 | |||
139 | GNUNET_DISK_file_seek(handle, 0, GNUNET_DISK_SEEK_SET); | ||
140 | |||
141 | struct GNUNET_PeerIdentity peer; | ||
142 | ssize_t len; | ||
143 | |||
144 | do { | ||
145 | len = GNUNET_DISK_file_read(handle, &peer, sizeof(peer)); | ||
146 | |||
147 | if (len != sizeof(peer)) | ||
148 | break; | ||
149 | |||
150 | add_to_list_tunnels(tunnels, &peer); | ||
151 | } while (len == sizeof(peer)); | ||
152 | |||
153 | GNUNET_DISK_file_close(handle); | ||
154 | } | ||
155 | |||
156 | void | ||
157 | save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path) | ||
158 | { | ||
159 | GNUNET_assert((tunnels) && (path)); | ||
160 | |||
161 | enum GNUNET_DISK_AccessPermissions permission = (GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE); | ||
162 | |||
163 | struct GNUNET_DISK_FileHandle *handle = GNUNET_DISK_file_open( | ||
164 | path, GNUNET_DISK_OPEN_CREATE | GNUNET_DISK_OPEN_WRITE, permission | ||
165 | ); | ||
166 | |||
167 | if (!handle) | ||
168 | return; | ||
169 | |||
170 | GNUNET_DISK_file_seek(handle, 0, GNUNET_DISK_SEEK_SET); | ||
171 | |||
172 | struct GNUNET_MESSENGER_ListTunnel *element; | ||
173 | struct GNUNET_PeerIdentity pid; | ||
174 | |||
175 | for (element = tunnels->head; element; element = element->next) | ||
176 | { | ||
177 | GNUNET_PEER_resolve (element->peer, &pid); | ||
178 | |||
179 | GNUNET_DISK_file_write(handle, &pid, sizeof(pid)); | ||
180 | } | ||
181 | |||
182 | GNUNET_DISK_file_sync(handle); | ||
183 | GNUNET_DISK_file_close(handle); | ||
184 | } | ||
diff --git a/src/messenger/messenger_api_list_tunnels.h b/src/messenger/messenger_api_list_tunnels.h index 0240fceb8..bd0a42e41 100644 --- a/src/messenger/messenger_api_list_tunnels.h +++ b/src/messenger/messenger_api_list_tunnels.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -47,7 +47,7 @@ struct GNUNET_MESSENGER_ListTunnels | |||
47 | /** | 47 | /** |
48 | * Initializes list of tunnels peer identities as empty list. | 48 | * Initializes list of tunnels peer identities as empty list. |
49 | * | 49 | * |
50 | * @param tunnels List of peer identities | 50 | * @param[out] tunnels List of peer identities |
51 | */ | 51 | */ |
52 | void | 52 | void |
53 | init_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); | 53 | init_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); |
@@ -55,7 +55,7 @@ init_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); | |||
55 | /** | 55 | /** |
56 | * Clears the list of tunnels peer identities. | 56 | * Clears the list of tunnels peer identities. |
57 | * | 57 | * |
58 | * @param tunnels List of peer identities | 58 | * @param[in/out] tunnels List of peer identities |
59 | */ | 59 | */ |
60 | void | 60 | void |
61 | clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); | 61 | clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); |
@@ -63,8 +63,8 @@ clear_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels); | |||
63 | /** | 63 | /** |
64 | * Adds a specific <i>peer</i> from a tunnel to the end of the list. | 64 | * Adds a specific <i>peer</i> from a tunnel to the end of the list. |
65 | * | 65 | * |
66 | * @param tunnels List of peer identities | 66 | * @param[in/out] tunnels List of peer identities |
67 | * @param peer Peer identity of tunnel | 67 | * @param[in] peer Peer identity of tunnel |
68 | */ | 68 | */ |
69 | void | 69 | void |
70 | add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); | 70 | add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); |
@@ -79,8 +79,8 @@ add_to_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct | |||
79 | * the found element in the list. If no matching element is found, <i>index</i> will | 79 | * the found element in the list. If no matching element is found, <i>index</i> will |
80 | * contain the total amount of elements in the list. | 80 | * contain the total amount of elements in the list. |
81 | * | 81 | * |
82 | * @param tunnels List of peer identities | 82 | * @param[in/out] tunnels List of peer identities |
83 | * @param peer Peer identity of tunnel | 83 | * @param[in] peer Peer identity of tunnel |
84 | * @param[out] index Index of found element (optional) | 84 | * @param[out] index Index of found element (optional) |
85 | * @return Element in the list with matching peer identity | 85 | * @return Element in the list with matching peer identity |
86 | */ | 86 | */ |
@@ -89,11 +89,11 @@ find_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GN | |||
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Tests linearly if the list of tunnels peer identities contains a specific | 91 | * Tests linearly if the list of tunnels peer identities contains a specific |
92 | * <i>peer</i> identity and returns GNUNET_YES on success, otherwise GNUNET_NO. | 92 | * <i>peer</i> identity and returns #GNUNET_YES on success, otherwise #GNUNET_NO. |
93 | * | 93 | * |
94 | * @param tunnels List of peer identities | 94 | * @param[in/out] tunnels List of peer identities |
95 | * @param peer Peer identity of tunnel | 95 | * @param[in] peer Peer identity of tunnel |
96 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 96 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
97 | */ | 97 | */ |
98 | int | 98 | int |
99 | contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); | 99 | contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struct GNUNET_PeerIdentity *peer); |
@@ -102,11 +102,29 @@ contains_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const struc | |||
102 | * Removes a specific <i>element</i> from the list of tunnels peer identities and returns | 102 | * Removes a specific <i>element</i> from the list of tunnels peer identities and returns |
103 | * the next element in the list. | 103 | * the next element in the list. |
104 | * | 104 | * |
105 | * @param tunnels List of peer identities | 105 | * @param[in/out] tunnels List of peer identities |
106 | * @param element Element of the list | 106 | * @param[in/out] element Element of the list |
107 | * @return Next element in the list | 107 | * @return Next element in the list |
108 | */ | 108 | */ |
109 | struct GNUNET_MESSENGER_ListTunnel* | 109 | struct GNUNET_MESSENGER_ListTunnel* |
110 | remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element); | 110 | remove_from_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, struct GNUNET_MESSENGER_ListTunnel *element); |
111 | 111 | ||
112 | /** | ||
113 | * Loads the list of tunnels peer identities from a file under a given <i>path</i>. | ||
114 | * | ||
115 | * @param[out] messages List of hashes | ||
116 | * @param[in] path Path of file | ||
117 | */ | ||
118 | void | ||
119 | load_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path); | ||
120 | |||
121 | /** | ||
122 | * Saves the list of tunnels peer identities to a file under a given <i>path</i>. | ||
123 | * | ||
124 | * @param[in] messages List of hashes | ||
125 | * @param[in] path Path of file | ||
126 | */ | ||
127 | void | ||
128 | save_list_tunnels (struct GNUNET_MESSENGER_ListTunnels *tunnels, const char *path); | ||
129 | |||
112 | #endif //GNUNET_MESSENGER_API_LIST_TUNNELS_H | 130 | #endif //GNUNET_MESSENGER_API_LIST_TUNNELS_H |
diff --git a/src/messenger/messenger_api_message.c b/src/messenger/messenger_api_message.c index fdab60eef..d65b80576 100644..100755 --- a/src/messenger/messenger_api_message.c +++ b/src/messenger/messenger_api_message.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -69,6 +69,8 @@ create_message (enum GNUNET_MESSENGER_MessageKind kind) | |||
69 | struct GNUNET_MESSENGER_Message* | 69 | struct GNUNET_MESSENGER_Message* |
70 | copy_message (const struct GNUNET_MESSENGER_Message *message) | 70 | copy_message (const struct GNUNET_MESSENGER_Message *message) |
71 | { | 71 | { |
72 | GNUNET_assert(message); | ||
73 | |||
72 | struct GNUNET_MESSENGER_Message *copy = GNUNET_new(struct GNUNET_MESSENGER_Message); | 74 | struct GNUNET_MESSENGER_Message *copy = GNUNET_new(struct GNUNET_MESSENGER_Message); |
73 | 75 | ||
74 | GNUNET_memcpy(copy, message, sizeof(struct GNUNET_MESSENGER_Message)); | 76 | GNUNET_memcpy(copy, message, sizeof(struct GNUNET_MESSENGER_Message)); |
@@ -125,11 +127,28 @@ destroy_message_body (enum GNUNET_MESSENGER_MessageKind kind, struct GNUNET_MESS | |||
125 | void | 127 | void |
126 | destroy_message (struct GNUNET_MESSENGER_Message *message) | 128 | destroy_message (struct GNUNET_MESSENGER_Message *message) |
127 | { | 129 | { |
130 | GNUNET_assert(message); | ||
131 | |||
128 | destroy_message_body (message->header.kind, &(message->body)); | 132 | destroy_message_body (message->header.kind, &(message->body)); |
129 | 133 | ||
130 | GNUNET_free(message); | 134 | GNUNET_free(message); |
131 | } | 135 | } |
132 | 136 | ||
137 | int | ||
138 | is_message_session_bound (const struct GNUNET_MESSENGER_Message *message) | ||
139 | { | ||
140 | GNUNET_assert(message); | ||
141 | |||
142 | if ((GNUNET_MESSENGER_KIND_JOIN == message->header.kind) || | ||
143 | (GNUNET_MESSENGER_KIND_LEAVE == message->header.kind) || | ||
144 | (GNUNET_MESSENGER_KIND_NAME == message->header.kind) || | ||
145 | (GNUNET_MESSENGER_KIND_KEY == message->header.kind) || | ||
146 | (GNUNET_MESSENGER_KIND_ID == message->header.kind)) | ||
147 | return GNUNET_YES; | ||
148 | else | ||
149 | return GNUNET_NO; | ||
150 | } | ||
151 | |||
133 | static void | 152 | static void |
134 | fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_ShortMessage *shortened) | 153 | fold_short_message (const struct GNUNET_MESSENGER_Message *message, struct GNUNET_MESSENGER_ShortMessage *shortened) |
135 | { | 154 | { |
@@ -158,18 +177,7 @@ get_message_body_kind_size (enum GNUNET_MESSENGER_MessageKind kind) | |||
158 | switch (kind) | 177 | switch (kind) |
159 | { | 178 | { |
160 | case GNUNET_MESSENGER_KIND_INFO: | 179 | case GNUNET_MESSENGER_KIND_INFO: |
161 | length += member_size(struct GNUNET_MESSENGER_Message, body.info.host_key); | 180 | length += member_size(struct GNUNET_MESSENGER_Message, body.info.messenger_version); |
162 | length += member_size(struct GNUNET_MESSENGER_Message, body.info.unique_id); | ||
163 | break; | ||
164 | case GNUNET_MESSENGER_KIND_JOIN: | ||
165 | length += member_size(struct GNUNET_MESSENGER_Message, body.join.key); | ||
166 | break; | ||
167 | case GNUNET_MESSENGER_KIND_LEAVE: | ||
168 | break; | ||
169 | case GNUNET_MESSENGER_KIND_NAME: | ||
170 | break; | ||
171 | case GNUNET_MESSENGER_KIND_KEY: | ||
172 | length += member_size(struct GNUNET_MESSENGER_Message, body.key.key); | ||
173 | break; | 181 | break; |
174 | case GNUNET_MESSENGER_KIND_PEER: | 182 | case GNUNET_MESSENGER_KIND_PEER: |
175 | length += member_size(struct GNUNET_MESSENGER_Message, body.peer.peer); | 183 | length += member_size(struct GNUNET_MESSENGER_Message, body.peer.peer); |
@@ -195,7 +203,7 @@ get_message_body_kind_size (enum GNUNET_MESSENGER_MessageKind kind) | |||
195 | case GNUNET_MESSENGER_KIND_FILE: | 203 | case GNUNET_MESSENGER_KIND_FILE: |
196 | length += member_size(struct GNUNET_MESSENGER_Message, body.file.key); | 204 | length += member_size(struct GNUNET_MESSENGER_Message, body.file.key); |
197 | length += member_size(struct GNUNET_MESSENGER_Message, body.file.hash); | 205 | length += member_size(struct GNUNET_MESSENGER_Message, body.file.hash); |
198 | length += NAME_MAX; | 206 | length += member_size(struct GNUNET_MESSENGER_Message, body.file.name); |
199 | break; | 207 | break; |
200 | case GNUNET_MESSENGER_KIND_PRIVATE: | 208 | case GNUNET_MESSENGER_KIND_PRIVATE: |
201 | length += member_size(struct GNUNET_MESSENGER_Message, body.private.key); | 209 | length += member_size(struct GNUNET_MESSENGER_Message, body.private.key); |
@@ -207,16 +215,17 @@ get_message_body_kind_size (enum GNUNET_MESSENGER_MessageKind kind) | |||
207 | return length; | 215 | return length; |
208 | } | 216 | } |
209 | 217 | ||
218 | typedef uint32_t kind_t; | ||
219 | |||
210 | uint16_t | 220 | uint16_t |
211 | get_message_kind_size (enum GNUNET_MESSENGER_MessageKind kind) | 221 | get_message_kind_size (enum GNUNET_MESSENGER_MessageKind kind) |
212 | { | 222 | { |
213 | uint16_t length = 0; | 223 | uint16_t length = 0; |
214 | 224 | ||
215 | length += member_size(struct GNUNET_MESSENGER_Message, header.signature); | ||
216 | length += member_size(struct GNUNET_MESSENGER_Message, header.timestamp); | 225 | length += member_size(struct GNUNET_MESSENGER_Message, header.timestamp); |
217 | length += member_size(struct GNUNET_MESSENGER_Message, header.sender_id); | 226 | length += member_size(struct GNUNET_MESSENGER_Message, header.sender_id); |
218 | length += member_size(struct GNUNET_MESSENGER_Message, header.previous); | 227 | length += member_size(struct GNUNET_MESSENGER_Message, header.previous); |
219 | length += member_size(struct GNUNET_MESSENGER_Message, header.kind); | 228 | length += sizeof(kind_t); |
220 | 229 | ||
221 | return length + get_message_body_kind_size (kind); | 230 | return length + get_message_body_kind_size (kind); |
222 | } | 231 | } |
@@ -228,8 +237,17 @@ get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUN | |||
228 | 237 | ||
229 | switch (kind) | 238 | switch (kind) |
230 | { | 239 | { |
240 | case GNUNET_MESSENGER_KIND_INFO: | ||
241 | length += GNUNET_IDENTITY_key_get_length(&(body->info.host_key)); | ||
242 | break; | ||
243 | case GNUNET_MESSENGER_KIND_JOIN: | ||
244 | length += GNUNET_IDENTITY_key_get_length(&(body->join.key)); | ||
245 | break; | ||
231 | case GNUNET_MESSENGER_KIND_NAME: | 246 | case GNUNET_MESSENGER_KIND_NAME: |
232 | length += (body->name.name? strlen (body->name.name) : 0); | 247 | length += (body->name.name ? strlen (body->name.name) : 0); |
248 | break; | ||
249 | case GNUNET_MESSENGER_KIND_KEY: | ||
250 | length += GNUNET_IDENTITY_key_get_length(&(body->key.key)); | ||
233 | break; | 251 | break; |
234 | case GNUNET_MESSENGER_KIND_TEXT: | 252 | case GNUNET_MESSENGER_KIND_TEXT: |
235 | length += strlen (body->text.text); | 253 | length += strlen (body->text.text); |
@@ -248,19 +266,76 @@ get_message_body_size (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUN | |||
248 | } | 266 | } |
249 | 267 | ||
250 | uint16_t | 268 | uint16_t |
251 | get_message_size (const struct GNUNET_MESSENGER_Message *message) | 269 | get_message_size (const struct GNUNET_MESSENGER_Message *message, |
270 | int include_signature) | ||
252 | { | 271 | { |
253 | return get_message_kind_size (message->header.kind) + get_message_body_size (message->header.kind, &(message->body)); | 272 | GNUNET_assert(message); |
273 | |||
274 | uint16_t length = 0; | ||
275 | |||
276 | if (GNUNET_YES == include_signature) | ||
277 | length += GNUNET_IDENTITY_signature_get_length(&(message->header.signature)); | ||
278 | |||
279 | length += get_message_kind_size (message->header.kind); | ||
280 | length += get_message_body_size (message->header.kind, &(message->body)); | ||
281 | |||
282 | return length; | ||
254 | } | 283 | } |
255 | 284 | ||
256 | static uint16_t | 285 | static uint16_t |
257 | get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message) | 286 | get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message, int include_body) |
258 | { | 287 | { |
288 | const uint16_t minimum_size = sizeof(struct GNUNET_HashCode) + sizeof(kind_t); | ||
289 | |||
259 | if (message) | 290 | if (message) |
260 | return sizeof(message->kind) + get_message_body_kind_size (message->kind) | 291 | return minimum_size + get_message_body_kind_size (message->kind) |
261 | + get_message_body_size (message->kind, &(message->body)); | 292 | + (include_body == GNUNET_YES? get_message_body_size (message->kind, &(message->body)) : 0); |
262 | else | 293 | else |
263 | return sizeof(message->kind); | 294 | return minimum_size; |
295 | } | ||
296 | |||
297 | static uint16_t | ||
298 | calc_usual_padding () | ||
299 | { | ||
300 | uint16_t padding = 0; | ||
301 | uint16_t kind_size; | ||
302 | |||
303 | for (int i = 0; i <= GNUNET_MESSENGER_KIND_MAX; i++) { | ||
304 | kind_size = get_message_kind_size ((enum GNUNET_MESSENGER_MessageKind) i); | ||
305 | |||
306 | if (kind_size > padding) | ||
307 | padding = kind_size; | ||
308 | } | ||
309 | |||
310 | return padding + GNUNET_MESSENGER_PADDING_MIN; | ||
311 | } | ||
312 | |||
313 | #define max(x, y) (x > y? x : y) | ||
314 | |||
315 | static uint16_t | ||
316 | calc_padded_length (uint16_t length) | ||
317 | { | ||
318 | static uint16_t usual_padding = 0; | ||
319 | |||
320 | if (!usual_padding) | ||
321 | usual_padding = calc_usual_padding(); | ||
322 | |||
323 | const uint16_t padded_length = max( | ||
324 | length + GNUNET_MESSENGER_PADDING_MIN, | ||
325 | usual_padding | ||
326 | ); | ||
327 | |||
328 | if (padded_length <= GNUNET_MESSENGER_PADDING_LEVEL0) | ||
329 | return GNUNET_MESSENGER_PADDING_LEVEL0; | ||
330 | |||
331 | if (padded_length <= GNUNET_MESSENGER_PADDING_LEVEL1) | ||
332 | return GNUNET_MESSENGER_PADDING_LEVEL1; | ||
333 | |||
334 | if (padded_length <= GNUNET_MESSENGER_PADDING_LEVEL2) | ||
335 | return GNUNET_MESSENGER_PADDING_LEVEL2; | ||
336 | |||
337 | return GNUNET_MESSENGER_MAX_MESSAGE_SIZE; | ||
338 | |||
264 | } | 339 | } |
265 | 340 | ||
266 | #define min(x, y) (x < y? x : y) | 341 | #define min(x, y) (x < y? x : y) |
@@ -272,7 +347,27 @@ get_short_message_size (const struct GNUNET_MESSENGER_ShortMessage *message) | |||
272 | 347 | ||
273 | #define encode_step(dst, offset, src) do { \ | 348 | #define encode_step(dst, offset, src) do { \ |
274 | encode_step_ext(dst, offset, src, sizeof(*src)); \ | 349 | encode_step_ext(dst, offset, src, sizeof(*src)); \ |
275 | } while(0) | 350 | } while (0) |
351 | |||
352 | #define encode_step_key(dst, offset, src, length) do { \ | ||
353 | ssize_t result = GNUNET_IDENTITY_write_key_to_buffer( \ | ||
354 | src, dst + offset, length - offset \ | ||
355 | ); \ | ||
356 | if (result < 0) \ | ||
357 | GNUNET_break (0); \ | ||
358 | else \ | ||
359 | offset += result; \ | ||
360 | } while (0) | ||
361 | |||
362 | #define encode_step_signature(dst, offset, src, length) do { \ | ||
363 | ssize_t result = GNUNET_IDENTITY_write_signature_to_buffer( \ | ||
364 | src, dst + offset, length - offset \ | ||
365 | ); \ | ||
366 | if (result < 0) \ | ||
367 | GNUNET_break (0); \ | ||
368 | else \ | ||
369 | offset += result; \ | ||
370 | } while (0) | ||
276 | 371 | ||
277 | static void | 372 | static void |
278 | encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body, | 373 | encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET_MESSENGER_MessageBody *body, |
@@ -281,20 +376,18 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET | |||
281 | switch (kind) | 376 | switch (kind) |
282 | { | 377 | { |
283 | case GNUNET_MESSENGER_KIND_INFO: | 378 | case GNUNET_MESSENGER_KIND_INFO: |
284 | encode_step(buffer, offset, &(body->info.host_key)); | 379 | encode_step_key(buffer, offset, &(body->info.host_key), length); |
285 | encode_step(buffer, offset, &(body->info.unique_id)); | 380 | encode_step(buffer, offset, &(body->info.messenger_version)); |
286 | break; | 381 | break; |
287 | case GNUNET_MESSENGER_KIND_JOIN: | 382 | case GNUNET_MESSENGER_KIND_JOIN: |
288 | encode_step(buffer, offset, &(body->join.key)); | 383 | encode_step_key(buffer, offset, &(body->join.key), length); |
289 | break; | ||
290 | case GNUNET_MESSENGER_KIND_LEAVE: | ||
291 | break; | 384 | break; |
292 | case GNUNET_MESSENGER_KIND_NAME: | 385 | case GNUNET_MESSENGER_KIND_NAME: |
293 | if (body->name.name) | 386 | if (body->name.name) |
294 | encode_step_ext(buffer, offset, body->name.name, min(length - offset, strlen(body->name.name))); | 387 | encode_step_ext(buffer, offset, body->name.name, min(length - offset, strlen(body->name.name))); |
295 | break; | 388 | break; |
296 | case GNUNET_MESSENGER_KIND_KEY: | 389 | case GNUNET_MESSENGER_KIND_KEY: |
297 | encode_step(buffer, offset, &(body->key.key)); | 390 | encode_step_key(buffer, offset, &(body->key.key), length); |
298 | break; | 391 | break; |
299 | case GNUNET_MESSENGER_KIND_PEER: | 392 | case GNUNET_MESSENGER_KIND_PEER: |
300 | encode_step(buffer, offset, &(body->peer.peer)); | 393 | encode_step(buffer, offset, &(body->peer.peer)); |
@@ -321,7 +414,7 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET | |||
321 | case GNUNET_MESSENGER_KIND_FILE: | 414 | case GNUNET_MESSENGER_KIND_FILE: |
322 | encode_step(buffer, offset, &(body->file.key)); | 415 | encode_step(buffer, offset, &(body->file.key)); |
323 | encode_step(buffer, offset, &(body->file.hash)); | 416 | encode_step(buffer, offset, &(body->file.hash)); |
324 | encode_step_ext(buffer, offset, body->file.name, NAME_MAX); | 417 | encode_step_ext(buffer, offset, body->file.name, sizeof(body->file.name)); |
325 | encode_step_ext(buffer, offset, body->file.uri, min(length - offset, strlen(body->file.uri))); | 418 | encode_step_ext(buffer, offset, body->file.uri, min(length - offset, strlen(body->file.uri))); |
326 | break; | 419 | break; |
327 | case GNUNET_MESSENGER_KIND_PRIVATE: | 420 | case GNUNET_MESSENGER_KIND_PRIVATE: |
@@ -331,18 +424,40 @@ encode_message_body (enum GNUNET_MESSENGER_MessageKind kind, const struct GNUNET | |||
331 | default: | 424 | default: |
332 | break; | 425 | break; |
333 | } | 426 | } |
427 | |||
428 | if (offset >= length) | ||
429 | return; | ||
430 | |||
431 | const uint16_t padding = length - offset; | ||
432 | const uint16_t used_padding = sizeof(padding) + sizeof(char); | ||
433 | |||
434 | GNUNET_assert(padding >= used_padding); | ||
435 | |||
436 | buffer[offset++] = '\0'; | ||
437 | |||
438 | if (padding > used_padding) | ||
439 | GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, buffer + offset, padding - used_padding); | ||
440 | |||
441 | GNUNET_memcpy(buffer + length - sizeof(padding), &padding, sizeof(padding)); | ||
334 | } | 442 | } |
335 | 443 | ||
336 | void | 444 | void |
337 | encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer) | 445 | encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, |
446 | int include_signature) | ||
338 | { | 447 | { |
448 | GNUNET_assert((message) && (buffer)); | ||
449 | |||
339 | uint16_t offset = 0; | 450 | uint16_t offset = 0; |
340 | 451 | ||
341 | encode_step(buffer, offset, &(message->header.signature)); | 452 | if (GNUNET_YES == include_signature) |
453 | encode_step_signature(buffer, offset, &(message->header.signature), length); | ||
454 | |||
455 | const kind_t kind = (kind_t) message->header.kind; | ||
456 | |||
342 | encode_step(buffer, offset, &(message->header.timestamp)); | 457 | encode_step(buffer, offset, &(message->header.timestamp)); |
343 | encode_step(buffer, offset, &(message->header.sender_id)); | 458 | encode_step(buffer, offset, &(message->header.sender_id)); |
344 | encode_step(buffer, offset, &(message->header.previous)); | 459 | encode_step(buffer, offset, &(message->header.previous)); |
345 | encode_step(buffer, offset, &(message->header.kind)); | 460 | encode_step(buffer, offset, &kind); |
346 | 461 | ||
347 | encode_message_body (message->header.kind, &(message->body), length, buffer, offset); | 462 | encode_message_body (message->header.kind, &(message->body), length, buffer, offset); |
348 | } | 463 | } |
@@ -350,11 +465,22 @@ encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, | |||
350 | static void | 465 | static void |
351 | encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, char *buffer) | 466 | encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, char *buffer) |
352 | { | 467 | { |
353 | uint16_t offset = 0; | 468 | struct GNUNET_HashCode hash; |
469 | uint16_t offset = sizeof(hash); | ||
354 | 470 | ||
355 | encode_step(buffer, offset, &(message->kind)); | 471 | const kind_t kind = (kind_t) message->kind; |
472 | |||
473 | encode_step(buffer, offset, &kind); | ||
356 | 474 | ||
357 | encode_message_body (message->kind, &(message->body), length, buffer, offset); | 475 | encode_message_body (message->kind, &(message->body), length, buffer, offset); |
476 | |||
477 | GNUNET_CRYPTO_hash( | ||
478 | buffer + sizeof(hash), | ||
479 | length - sizeof(hash), | ||
480 | &hash | ||
481 | ); | ||
482 | |||
483 | GNUNET_memcpy(buffer, &hash, sizeof(hash)); | ||
358 | } | 484 | } |
359 | 485 | ||
360 | #define decode_step_ext(src, offset, dst, size) do { \ | 486 | #define decode_step_ext(src, offset, dst, size) do { \ |
@@ -372,29 +498,51 @@ encode_short_message (const struct GNUNET_MESSENGER_ShortMessage *message, uint1 | |||
372 | decode_step_ext(src, offset, dst, size); \ | 498 | decode_step_ext(src, offset, dst, size); \ |
373 | } while (0) | 499 | } while (0) |
374 | 500 | ||
375 | static void | 501 | #define decode_step_key(src, offset, dst, length) do { \ |
502 | ssize_t result = GNUNET_IDENTITY_read_key_from_buffer( \ | ||
503 | dst, src + offset, length - offset \ | ||
504 | ); \ | ||
505 | if (result < 0) \ | ||
506 | GNUNET_break(0); \ | ||
507 | else \ | ||
508 | offset += result; \ | ||
509 | } while (0) | ||
510 | |||
511 | static uint16_t | ||
376 | decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESSENGER_MessageBody *body, | 512 | decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESSENGER_MessageBody *body, |
377 | uint16_t length, const char *buffer, uint16_t offset) | 513 | uint16_t length, const char *buffer, uint16_t offset) |
378 | { | 514 | { |
515 | uint16_t padding = 0; | ||
516 | |||
517 | GNUNET_memcpy(&padding, buffer + length - sizeof(padding), sizeof(padding)); | ||
518 | |||
519 | if (padding > length - offset) | ||
520 | padding = 0; | ||
521 | |||
522 | const uint16_t end_zero = length - padding; | ||
523 | |||
524 | if ((padding) && (buffer[end_zero] != '\0')) | ||
525 | padding = 0; | ||
526 | |||
527 | length -= padding; | ||
528 | |||
379 | switch (*kind) | 529 | switch (*kind) |
380 | { | 530 | { |
381 | case GNUNET_MESSENGER_KIND_INFO: | 531 | case GNUNET_MESSENGER_KIND_INFO: { |
382 | decode_step(buffer, offset, &(body->info.host_key)); | 532 | decode_step_key(buffer, offset, &(body->info.host_key), length); |
383 | decode_step(buffer, offset, &(body->info.unique_id)); | 533 | decode_step(buffer, offset, &(body->info.messenger_version)); |
384 | break; | 534 | break; |
385 | case GNUNET_MESSENGER_KIND_JOIN: | 535 | } case GNUNET_MESSENGER_KIND_JOIN: { |
386 | decode_step(buffer, offset, &(body->join.key)); | 536 | decode_step_key(buffer, offset, &(body->join.key), length); |
387 | break; | ||
388 | case GNUNET_MESSENGER_KIND_LEAVE: | ||
389 | break; | 537 | break; |
390 | case GNUNET_MESSENGER_KIND_NAME: | 538 | } case GNUNET_MESSENGER_KIND_NAME: |
391 | if (length - offset > 0) | 539 | if (length - offset > 0) |
392 | decode_step_malloc(buffer, offset, body->name.name, length - offset, 1); | 540 | decode_step_malloc(buffer, offset, body->name.name, length - offset, 1); |
393 | else | 541 | else |
394 | body->name.name = NULL; | 542 | body->name.name = NULL; |
395 | break; | 543 | break; |
396 | case GNUNET_MESSENGER_KIND_KEY: | 544 | case GNUNET_MESSENGER_KIND_KEY: |
397 | decode_step(buffer, offset, &(body->key.key)); | 545 | decode_step_key(buffer, offset, &(body->key.key), length); |
398 | break; | 546 | break; |
399 | case GNUNET_MESSENGER_KIND_PEER: | 547 | case GNUNET_MESSENGER_KIND_PEER: |
400 | decode_step(buffer, offset, &(body->peer.peer)); | 548 | decode_step(buffer, offset, &(body->peer.peer)); |
@@ -421,7 +569,7 @@ decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESS | |||
421 | case GNUNET_MESSENGER_KIND_FILE: | 569 | case GNUNET_MESSENGER_KIND_FILE: |
422 | decode_step(buffer, offset, &(body->file.key)); | 570 | decode_step(buffer, offset, &(body->file.key)); |
423 | decode_step(buffer, offset, &(body->file.hash)); | 571 | decode_step(buffer, offset, &(body->file.hash)); |
424 | decode_step_ext(buffer, offset, body->file.name, NAME_MAX); | 572 | decode_step_ext(buffer, offset, body->file.name, sizeof(body->file.name)); |
425 | decode_step_malloc(buffer, offset, body->file.uri, length - offset, 1); | 573 | decode_step_malloc(buffer, offset, body->file.uri, length - offset, 1); |
426 | break; | 574 | break; |
427 | case GNUNET_MESSENGER_KIND_PRIVATE: | 575 | case GNUNET_MESSENGER_KIND_PRIVATE: |
@@ -434,26 +582,51 @@ decode_message_body (enum GNUNET_MESSENGER_MessageKind *kind, struct GNUNET_MESS | |||
434 | *kind = GNUNET_MESSENGER_KIND_UNKNOWN; | 582 | *kind = GNUNET_MESSENGER_KIND_UNKNOWN; |
435 | break; | 583 | break; |
436 | } | 584 | } |
585 | |||
586 | return padding; | ||
437 | } | 587 | } |
438 | 588 | ||
439 | int | 589 | int |
440 | decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer) | 590 | decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, |
591 | int include_signature, uint16_t *padding) | ||
441 | { | 592 | { |
593 | GNUNET_assert((message) && (buffer) && (length >= get_message_kind_size(GNUNET_MESSENGER_KIND_UNKNOWN))); | ||
594 | |||
442 | uint16_t offset = 0; | 595 | uint16_t offset = 0; |
443 | 596 | ||
444 | if (length < get_message_kind_size (GNUNET_MESSENGER_KIND_UNKNOWN)) | 597 | if (GNUNET_YES == include_signature) |
598 | { | ||
599 | ssize_t result = GNUNET_IDENTITY_read_signature_from_buffer( | ||
600 | &(message->header.signature), buffer, length - offset | ||
601 | ); | ||
602 | |||
603 | if (result < 0) | ||
604 | return GNUNET_NO; | ||
605 | else | ||
606 | offset += result; | ||
607 | } | ||
608 | |||
609 | const uint16_t count = length - offset; | ||
610 | |||
611 | if (count < get_message_kind_size (GNUNET_MESSENGER_KIND_UNKNOWN)) | ||
445 | return GNUNET_NO; | 612 | return GNUNET_NO; |
446 | 613 | ||
447 | decode_step(buffer, offset, &(message->header.signature)); | 614 | kind_t kind; |
615 | |||
448 | decode_step(buffer, offset, &(message->header.timestamp)); | 616 | decode_step(buffer, offset, &(message->header.timestamp)); |
449 | decode_step(buffer, offset, &(message->header.sender_id)); | 617 | decode_step(buffer, offset, &(message->header.sender_id)); |
450 | decode_step(buffer, offset, &(message->header.previous)); | 618 | decode_step(buffer, offset, &(message->header.previous)); |
451 | decode_step(buffer, offset, &(message->header.kind)); | 619 | decode_step(buffer, offset, &kind); |
452 | 620 | ||
453 | if (length < get_message_kind_size (message->header.kind)) | 621 | message->header.kind = (enum GNUNET_MESSENGER_MessageKind) kind; |
622 | |||
623 | if (count < get_message_kind_size (message->header.kind)) | ||
454 | return GNUNET_NO; | 624 | return GNUNET_NO; |
455 | 625 | ||
456 | decode_message_body (&(message->header.kind), &(message->body), length, buffer, offset); | 626 | const uint16_t result = decode_message_body (&(message->header.kind), &(message->body), length, buffer, offset); |
627 | |||
628 | if (padding) | ||
629 | *padding = result; | ||
457 | 630 | ||
458 | return GNUNET_YES; | 631 | return GNUNET_YES; |
459 | } | 632 | } |
@@ -461,47 +634,80 @@ decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const | |||
461 | static int | 634 | static int |
462 | decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, const char *buffer) | 635 | decode_short_message (struct GNUNET_MESSENGER_ShortMessage *message, uint16_t length, const char *buffer) |
463 | { | 636 | { |
464 | uint16_t offset = 0; | 637 | struct GNUNET_HashCode expected, hash; |
638 | uint16_t offset = sizeof(hash); | ||
639 | |||
640 | if (length < get_short_message_size (NULL, GNUNET_NO)) | ||
641 | return GNUNET_NO; | ||
642 | |||
643 | GNUNET_memcpy(&hash, buffer, sizeof(hash)); | ||
644 | |||
645 | GNUNET_CRYPTO_hash( | ||
646 | buffer + sizeof(hash), | ||
647 | length - sizeof(hash), | ||
648 | &expected | ||
649 | ); | ||
465 | 650 | ||
466 | if (length < get_short_message_size (NULL)) | 651 | if (0 != GNUNET_CRYPTO_hash_cmp(&hash, &expected)) |
467 | return GNUNET_NO; | 652 | return GNUNET_NO; |
468 | 653 | ||
469 | decode_step(buffer, offset, &(message->kind)); | 654 | kind_t kind; |
470 | 655 | ||
471 | if (length < get_short_message_size (message)) | 656 | decode_step(buffer, offset, &kind); |
657 | |||
658 | message->kind = (enum GNUNET_MESSENGER_MessageKind) kind; | ||
659 | |||
660 | if (length < get_short_message_size (message, GNUNET_NO)) | ||
472 | return GNUNET_NO; | 661 | return GNUNET_NO; |
473 | 662 | ||
474 | decode_message_body (&(message->kind), &(message->body), length, buffer, offset); | 663 | decode_message_body (&(message->kind), &(message->body), length, buffer, offset); |
475 | 664 | ||
665 | if (GNUNET_MESSENGER_KIND_UNKNOWN == message->kind) | ||
666 | return GNUNET_NO; | ||
667 | |||
476 | return GNUNET_YES; | 668 | return GNUNET_YES; |
477 | } | 669 | } |
478 | 670 | ||
479 | void | 671 | void |
480 | hash_message (uint16_t length, const char *buffer, struct GNUNET_HashCode *hash) | 672 | hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, |
673 | struct GNUNET_HashCode *hash) | ||
481 | { | 674 | { |
482 | GNUNET_CRYPTO_hash (buffer + sizeof(struct GNUNET_CRYPTO_EcdsaSignature), | 675 | GNUNET_assert((message) && (buffer) && (hash)); |
483 | length - sizeof(struct GNUNET_CRYPTO_EcdsaSignature), hash); | 676 | |
677 | const ssize_t offset = GNUNET_IDENTITY_signature_get_length( | ||
678 | &(message->header.signature) | ||
679 | ); | ||
680 | |||
681 | GNUNET_CRYPTO_hash (buffer + offset, length - offset, hash); | ||
484 | } | 682 | } |
485 | 683 | ||
486 | void | 684 | void |
487 | sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, | 685 | sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, |
488 | const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Ego *ego) | 686 | const struct GNUNET_HashCode *hash, const struct GNUNET_MESSENGER_Ego *ego) |
489 | { | 687 | { |
688 | GNUNET_assert((message) && (buffer) && (hash) && (ego)); | ||
689 | |||
490 | struct GNUNET_MESSENGER_MessageSignature signature; | 690 | struct GNUNET_MESSENGER_MessageSignature signature; |
491 | 691 | ||
492 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); | 692 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); |
493 | signature.purpose.size = htonl (sizeof(signature)); | 693 | signature.purpose.size = htonl (sizeof(signature)); |
494 | 694 | ||
495 | GNUNET_memcpy(&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); | 695 | GNUNET_memcpy(&(signature.hash), hash, sizeof(struct GNUNET_HashCode)); |
496 | |||
497 | GNUNET_IDENTITY_sign(&(ego->priv), &signature, &(message->header.signature)); | 696 | GNUNET_IDENTITY_sign(&(ego->priv), &signature, &(message->header.signature)); |
498 | GNUNET_memcpy(buffer, &(message->header.signature), sizeof(struct GNUNET_CRYPTO_EcdsaSignature)); | 697 | |
698 | uint16_t offset = 0; | ||
699 | encode_step_signature(buffer, offset, &(message->header.signature), length); | ||
499 | } | 700 | } |
500 | 701 | ||
501 | int | 702 | int |
502 | verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, | 703 | verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, |
503 | const struct GNUNET_IDENTITY_PublicKey *key) | 704 | const struct GNUNET_IDENTITY_PublicKey *key) |
504 | { | 705 | { |
706 | GNUNET_assert((message) && (hash) && (key)); | ||
707 | |||
708 | if (ntohl (key->type) != ntohl (message->header.signature.type)) | ||
709 | return GNUNET_SYSERR; | ||
710 | |||
505 | struct GNUNET_MESSENGER_MessageSignature signature; | 711 | struct GNUNET_MESSENGER_MessageSignature signature; |
506 | 712 | ||
507 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); | 713 | signature.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CHAT_MESSAGE); |
@@ -516,26 +722,32 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNU | |||
516 | int | 722 | int |
517 | encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key) | 723 | encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key) |
518 | { | 724 | { |
725 | GNUNET_assert((message) && (key)); | ||
726 | |||
519 | struct GNUNET_MESSENGER_ShortMessage shortened; | 727 | struct GNUNET_MESSENGER_ShortMessage shortened; |
520 | 728 | ||
521 | fold_short_message (message, &shortened); | 729 | fold_short_message (message, &shortened); |
522 | 730 | ||
523 | const uint16_t length = get_short_message_size (&shortened); | 731 | const uint16_t length = get_short_message_size (&shortened, GNUNET_YES); |
732 | const uint16_t padded_length = calc_padded_length(length); | ||
524 | 733 | ||
525 | message->header.kind = GNUNET_MESSENGER_KIND_PRIVATE; | 734 | message->header.kind = GNUNET_MESSENGER_KIND_PRIVATE; |
526 | message->body.private.data = GNUNET_malloc(length); | 735 | message->body.private.data = GNUNET_malloc(padded_length); |
736 | message->body.private.length = padded_length; | ||
527 | 737 | ||
528 | encode_short_message (&shortened, length, message->body.private.data); | 738 | encode_short_message (&shortened, padded_length, message->body.private.data); |
529 | 739 | ||
530 | if (GNUNET_IDENTITY_encrypt (message->body.private.data, length, key, &(message->body.private.key), | 740 | if (padded_length == GNUNET_IDENTITY_encrypt (message->body.private.data, padded_length, key, |
531 | message->body.private.data) | 741 | &(message->body.private.key), |
532 | == length) | 742 | message->body.private.data)) |
533 | { | 743 | { |
534 | destroy_message_body (shortened.kind, &(shortened.body)); | 744 | destroy_message_body (shortened.kind, &(shortened.body)); |
535 | return GNUNET_YES; | 745 | return GNUNET_YES; |
536 | } | 746 | } |
537 | else | 747 | else |
538 | { | 748 | { |
749 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Encrypting message failed!\n"); | ||
750 | |||
539 | unfold_short_message (&shortened, message); | 751 | unfold_short_message (&shortened, message); |
540 | return GNUNET_NO; | 752 | return GNUNET_NO; |
541 | } | 753 | } |
@@ -544,18 +756,28 @@ encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I | |||
544 | int | 756 | int |
545 | decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key) | 757 | decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key) |
546 | { | 758 | { |
547 | if (message->body.private.length != GNUNET_IDENTITY_decrypt (message->body.private.data, | 759 | GNUNET_assert((message) && (key)); |
548 | message->body.private.length, key, | 760 | |
549 | &(message->body.private.key), | 761 | if (message->body.private.length != GNUNET_IDENTITY_decrypt (message->body.private.data, message->body.private.length, |
762 | key, &(message->body.private.key), | ||
550 | message->body.private.data)) | 763 | message->body.private.data)) |
764 | { | ||
765 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Decrypting message failed!\n"); | ||
766 | |||
551 | return GNUNET_NO; | 767 | return GNUNET_NO; |
768 | } | ||
552 | 769 | ||
553 | struct GNUNET_MESSENGER_ShortMessage shortened; | 770 | struct GNUNET_MESSENGER_ShortMessage shortened; |
554 | 771 | ||
555 | if (GNUNET_YES != decode_short_message (&shortened, message->body.private.length, message->body.private.data)) | 772 | if (GNUNET_YES != decode_short_message (&shortened, message->body.private.length, message->body.private.data)) |
773 | { | ||
774 | GNUNET_log(GNUNET_ERROR_TYPE_WARNING, "Decoding decrypted message failed!\n"); | ||
775 | |||
556 | return GNUNET_NO; | 776 | return GNUNET_NO; |
777 | } | ||
557 | 778 | ||
558 | unfold_short_message (&shortened, message); | 779 | unfold_short_message (&shortened, message); |
780 | |||
559 | return GNUNET_YES; | 781 | return GNUNET_YES; |
560 | } | 782 | } |
561 | 783 | ||
@@ -563,18 +785,25 @@ struct GNUNET_MQ_Envelope* | |||
563 | pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, | 785 | pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, |
564 | const struct GNUNET_MESSENGER_Ego *ego, int mode) | 786 | const struct GNUNET_MESSENGER_Ego *ego, int mode) |
565 | { | 787 | { |
566 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Packing message: %u\n", message->header.kind); | 788 | GNUNET_assert(message); |
789 | |||
790 | if (ego) | ||
791 | message->header.signature.type = ego->priv.type; | ||
792 | |||
793 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "Packing message kind=%u and sender: %s\n", | ||
794 | message->header.kind, GNUNET_sh2s(&(message->header.sender_id))); | ||
567 | 795 | ||
568 | struct GNUNET_MessageHeader *header; | 796 | struct GNUNET_MessageHeader *header; |
569 | 797 | ||
570 | uint16_t length = get_message_size (message); | 798 | const uint16_t length = get_message_size (message, GNUNET_YES); |
799 | const uint16_t padded_length = calc_padded_length(length); | ||
571 | 800 | ||
572 | struct GNUNET_MQ_Envelope *env; | 801 | struct GNUNET_MQ_Envelope *env; |
573 | char *buffer; | 802 | char *buffer; |
574 | 803 | ||
575 | if (GNUNET_MESSENGER_PACK_MODE_ENVELOPE == mode) | 804 | if (GNUNET_MESSENGER_PACK_MODE_ENVELOPE == mode) |
576 | { | 805 | { |
577 | env = GNUNET_MQ_msg_extra(header, length, GNUNET_MESSAGE_TYPE_CADET_CLI); | 806 | env = GNUNET_MQ_msg_extra(header, padded_length, GNUNET_MESSAGE_TYPE_CADET_CLI); |
578 | 807 | ||
579 | buffer = (char*) &(header[1]); | 808 | buffer = (char*) &(header[1]); |
580 | } | 809 | } |
@@ -582,14 +811,14 @@ pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode * | |||
582 | { | 811 | { |
583 | env = NULL; | 812 | env = NULL; |
584 | 813 | ||
585 | buffer = GNUNET_malloc(length); | 814 | buffer = GNUNET_malloc(padded_length); |
586 | } | 815 | } |
587 | 816 | ||
588 | encode_message (message, length, buffer); | 817 | encode_message (message, padded_length, buffer, GNUNET_YES); |
589 | 818 | ||
590 | if (hash) | 819 | if (hash) |
591 | { | 820 | { |
592 | hash_message (length, buffer, hash); | 821 | hash_message (message, length, buffer, hash); |
593 | 822 | ||
594 | if (ego) | 823 | if (ego) |
595 | sign_message (message, length, buffer, hash, ego); | 824 | sign_message (message, length, buffer, hash, ego); |
@@ -600,3 +829,43 @@ pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode * | |||
600 | 829 | ||
601 | return env; | 830 | return env; |
602 | } | 831 | } |
832 | |||
833 | int | ||
834 | filter_message_sending (const struct GNUNET_MESSENGER_Message *message) | ||
835 | { | ||
836 | switch (message->header.kind) | ||
837 | { | ||
838 | case GNUNET_MESSENGER_KIND_INFO: | ||
839 | return GNUNET_SYSERR; // Reserved for connection handling only! | ||
840 | case GNUNET_MESSENGER_KIND_JOIN: | ||
841 | return GNUNET_NO; // Use #GNUNET_MESSENGER_enter_room(...) instead! | ||
842 | case GNUNET_MESSENGER_KIND_LEAVE: | ||
843 | return GNUNET_NO; // Use #GNUNET_MESSENGER_close_room(...) instead! | ||
844 | case GNUNET_MESSENGER_KIND_NAME: | ||
845 | return GNUNET_YES; | ||
846 | case GNUNET_MESSENGER_KIND_KEY: | ||
847 | return GNUNET_NO; // Use #GNUNET_MESSENGER_update(...) instead! | ||
848 | case GNUNET_MESSENGER_KIND_PEER: | ||
849 | return GNUNET_NO; // Use #GNUNET_MESSENGER_open_room(...) instead! | ||
850 | case GNUNET_MESSENGER_KIND_ID: | ||
851 | return GNUNET_SYSERR; // Reserved for member id handling only! | ||
852 | case GNUNET_MESSENGER_KIND_MISS: | ||
853 | return GNUNET_SYSERR; // Reserved for connection handling only! | ||
854 | case GNUNET_MESSENGER_KIND_MERGE: | ||
855 | return GNUNET_YES; | ||
856 | case GNUNET_MESSENGER_KIND_REQUEST: | ||
857 | return GNUNET_YES; | ||
858 | case GNUNET_MESSENGER_KIND_INVITE: | ||
859 | return GNUNET_YES; | ||
860 | case GNUNET_MESSENGER_KIND_TEXT: | ||
861 | return GNUNET_YES; | ||
862 | case GNUNET_MESSENGER_KIND_FILE: | ||
863 | return GNUNET_YES; | ||
864 | case GNUNET_MESSENGER_KIND_PRIVATE: | ||
865 | return GNUNET_NO; // Use #GNUNET_MESSENGER_send_message(...) with a contact instead! | ||
866 | case GNUNET_MESSENGER_KIND_DELETE: | ||
867 | return GNUNET_YES; | ||
868 | default: | ||
869 | return GNUNET_SYSERR; | ||
870 | } | ||
871 | } | ||
diff --git a/src/messenger/messenger_api_message.h b/src/messenger/messenger_api_message.h index 0f0a97e9c..7ce30dc92 100644 --- a/src/messenger/messenger_api_message.h +++ b/src/messenger/messenger_api_message.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -36,10 +36,17 @@ | |||
36 | 36 | ||
37 | #include "messenger_api_ego.h" | 37 | #include "messenger_api_ego.h" |
38 | 38 | ||
39 | #define GNUNET_MESSENGER_MAX_MESSAGE_SIZE (GNUNET_MAX_MESSAGE_SIZE - GNUNET_MIN_MESSAGE_SIZE) | ||
40 | |||
41 | #define GNUNET_MESSENGER_PADDING_MIN (sizeof(uint16_t) + sizeof(char)) | ||
42 | #define GNUNET_MESSENGER_PADDING_LEVEL0 (512) | ||
43 | #define GNUNET_MESSENGER_PADDING_LEVEL1 (4096) | ||
44 | #define GNUNET_MESSENGER_PADDING_LEVEL2 (32768) | ||
45 | |||
39 | /** | 46 | /** |
40 | * Creates and allocates a new message with a specific <i>kind</i>. | 47 | * Creates and allocates a new message with a specific <i>kind</i>. |
41 | * | 48 | * |
42 | * @param kind Kind of message | 49 | * @param[in] kind Kind of message |
43 | * @return New message | 50 | * @return New message |
44 | */ | 51 | */ |
45 | struct GNUNET_MESSENGER_Message* | 52 | struct GNUNET_MESSENGER_Message* |
@@ -48,7 +55,7 @@ create_message (enum GNUNET_MESSENGER_MessageKind kind); | |||
48 | /** | 55 | /** |
49 | * Creates and allocates a copy of a given <i>message</i>. | 56 | * Creates and allocates a copy of a given <i>message</i>. |
50 | * | 57 | * |
51 | * @param message Message | 58 | * @param[in] message Message |
52 | * @return New message | 59 | * @return New message |
53 | */ | 60 | */ |
54 | struct GNUNET_MESSENGER_Message* | 61 | struct GNUNET_MESSENGER_Message* |
@@ -57,15 +64,24 @@ copy_message (const struct GNUNET_MESSENGER_Message *message); | |||
57 | /** | 64 | /** |
58 | * Destroys a message and frees its memory fully. | 65 | * Destroys a message and frees its memory fully. |
59 | * | 66 | * |
60 | * @param message Message | 67 | * @param[in/out] message Message |
61 | */ | 68 | */ |
62 | void | 69 | void |
63 | destroy_message (struct GNUNET_MESSENGER_Message *message); | 70 | destroy_message (struct GNUNET_MESSENGER_Message *message); |
64 | 71 | ||
65 | /** | 72 | /** |
73 | * Returns if the message should be bound to a member session. | ||
74 | * | ||
75 | * @param[in] message Message | ||
76 | * @return #GNUNET_YES or #GNUNET_NO | ||
77 | */ | ||
78 | int | ||
79 | is_message_session_bound (const struct GNUNET_MESSENGER_Message *message); | ||
80 | |||
81 | /** | ||
66 | * Returns the minimal size in bytes to encode a message of a specific <i>kind</i>. | 82 | * Returns the minimal size in bytes to encode a message of a specific <i>kind</i>. |
67 | * | 83 | * |
68 | * @param kind Kind of message | 84 | * @param[in] kind Kind of message |
69 | * @return Minimal size to encode | 85 | * @return Minimal size to encode |
70 | */ | 86 | */ |
71 | uint16_t | 87 | uint16_t |
@@ -74,57 +90,66 @@ get_message_kind_size (enum GNUNET_MESSENGER_MessageKind kind); | |||
74 | /** | 90 | /** |
75 | * Returns the exact size in bytes to encode a given <i>message</i>. | 91 | * Returns the exact size in bytes to encode a given <i>message</i>. |
76 | * | 92 | * |
77 | * @param message Message | 93 | * @param[in] message Message |
94 | * @param[in] encode_signature Flag to include signature | ||
78 | * @return Size to encode | 95 | * @return Size to encode |
79 | */ | 96 | */ |
80 | uint16_t | 97 | uint16_t |
81 | get_message_size (const struct GNUNET_MESSENGER_Message *message); | 98 | get_message_size (const struct GNUNET_MESSENGER_Message *message, |
99 | int include_signature); | ||
82 | 100 | ||
83 | /** | 101 | /** |
84 | * Encodes a given <i>message</i> into a <i>buffer</i> of a maximal <i>length</i> in bytes. | 102 | * Encodes a given <i>message</i> into a <i>buffer</i> of a maximal <i>length</i> in bytes. |
85 | * | 103 | * |
86 | * @param message Message | 104 | * @param[in] message Message |
87 | * @param length Maximal length to encode | 105 | * @param[in] length Maximal length to encode |
88 | * @param[out] buffer Buffer | 106 | * @param[out] buffer Buffer |
107 | * @param[in] encode_signature Flag to include signature | ||
89 | */ | 108 | */ |
90 | void | 109 | void |
91 | encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer); | 110 | encode_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, |
111 | int include_signature); | ||
92 | 112 | ||
93 | /** | 113 | /** |
94 | * Decodes a <i>message</i> from a given <i>buffer</i> of a maximal <i>length</i> in bytes. | 114 | * Decodes a <i>message</i> from a given <i>buffer</i> of a maximal <i>length</i> in bytes. |
95 | * | 115 | * |
96 | * If the buffer is too small for a message of its decoded kind the function fails with | 116 | * If the buffer is too small for a message of its decoded kind the function fails with |
97 | * resulting GNUNET_NO after decoding only the messages header. | 117 | * resulting #GNUNET_NO after decoding only the messages header. |
98 | * | 118 | * |
99 | * On success the function returns GNUNET_YES. | 119 | * On success the function returns #GNUNET_YES. |
100 | * | 120 | * |
101 | * @param[out] message Message | 121 | * @param[out] message Message |
102 | * @param length Maximal length to decode | 122 | * @param[in] length Maximal length to decode |
103 | * @param buffer Buffer | 123 | * @param[in] buffer Buffer |
104 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 124 | * @param[out] padding Padding |
125 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO | ||
105 | */ | 126 | */ |
106 | int | 127 | int |
107 | decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer); | 128 | decode_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, |
129 | int include_signature, uint16_t *padding); | ||
108 | 130 | ||
109 | /** | 131 | /** |
110 | * Calculates a <i>hash</i> of a given <i>buffer</i> of a <i>length</i> in bytes. | 132 | * Calculates a <i>hash</i> of a given <i>buffer</i> with a <i>length</i> in bytes |
133 | * from a <i>message</i>. | ||
111 | * | 134 | * |
112 | * @param length Length of buffer | 135 | * @param[in] message Message |
113 | * @param buffer Buffer | 136 | * @param[in] length Length of buffer |
137 | * @param[in] buffer Buffer | ||
114 | * @param[out] hash Hash | 138 | * @param[out] hash Hash |
115 | */ | 139 | */ |
116 | void | 140 | void |
117 | hash_message (uint16_t length, const char *buffer, struct GNUNET_HashCode *hash); | 141 | hash_message (const struct GNUNET_MESSENGER_Message *message, uint16_t length, const char *buffer, |
142 | struct GNUNET_HashCode *hash); | ||
118 | 143 | ||
119 | /** | 144 | /** |
120 | * Signs the <i>hash</i> of a <i>message</i> with a given <i>ego</i> and writes the signature | 145 | * Signs the <i>hash</i> of a <i>message</i> with a given <i>ego</i> and writes the signature |
121 | * into the <i>buffer</i> as well. | 146 | * into the <i>buffer</i> as well. |
122 | * | 147 | * |
123 | * @param[out] message Message | 148 | * @param[in/out] message Message |
124 | * @param length Length of buffer | 149 | * @param[in] length Length of buffer |
125 | * @param[out] buffer Buffer | 150 | * @param[out] buffer Buffer |
126 | * @param hash Hash of message | 151 | * @param[in] hash Hash of message |
127 | * @param ego EGO | 152 | * @param[in] ego EGO |
128 | */ | 153 | */ |
129 | void | 154 | void |
130 | sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, | 155 | sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *buffer, |
@@ -132,13 +157,13 @@ sign_message (struct GNUNET_MESSENGER_Message *message, uint16_t length, char *b | |||
132 | 157 | ||
133 | /** | 158 | /** |
134 | * Verifies the signature of a given <i>message</i> and its <i>hash</i> with a specific | 159 | * Verifies the signature of a given <i>message</i> and its <i>hash</i> with a specific |
135 | * public key. The function returns GNUNET_OK if the signature was valid, otherwise | 160 | * public key. The function returns #GNUNET_OK if the signature was valid, otherwise |
136 | * GNUNET_SYSERR. | 161 | * #GNUNET_SYSERR. |
137 | * | 162 | * |
138 | * @param message Message | 163 | * @param[in] message Message |
139 | * @param hash Hash of message | 164 | * @param[in] hash Hash of message |
140 | * @param key Public key of EGO | 165 | * @param[in] key Public key of EGO |
141 | * @return GNUNET_OK on success, otherwise GNUNET_SYSERR | 166 | * @return #GNUNET_OK on success, otherwise #GNUNET_SYSERR |
142 | */ | 167 | */ |
143 | int | 168 | int |
144 | verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, | 169 | verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, |
@@ -147,23 +172,23 @@ verify_message (const struct GNUNET_MESSENGER_Message *message, const struct GNU | |||
147 | /** | 172 | /** |
148 | * Encrypts a <i>message</i> using a given public <i>key</i> and replaces its body | 173 | * Encrypts a <i>message</i> using a given public <i>key</i> and replaces its body |
149 | * and kind with the now private encrypted <i>message</i>. The function returns | 174 | * and kind with the now private encrypted <i>message</i>. The function returns |
150 | * GNUNET_YES if the operation succeeded, otherwise GNUNET_NO. | 175 | * #GNUNET_YES if the operation succeeded, otherwise #GNUNET_NO. |
151 | * | 176 | * |
152 | * @param message Message | 177 | * @param[in/out] message Message |
153 | * @param key Public key of EGO | 178 | * @param[in] key Public key of EGO |
154 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 179 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
155 | */ | 180 | */ |
156 | int | 181 | int |
157 | encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key); | 182 | encrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PublicKey *key); |
158 | 183 | ||
159 | /** | 184 | /** |
160 | * Decrypts a private <i>message</i> using a given private <i>key</i> and replaces its body | 185 | * Decrypts a private <i>message</i> using a given private <i>key</i> and replaces its body |
161 | * and kind with the inner encrypted message. The function returns GNUNET_YES if the | 186 | * and kind with the inner encrypted message. The function returns #GNUNET_YES if the |
162 | * operation succeeded, otherwise GNUNET_NO. | 187 | * operation succeeded, otherwise #GNUNET_NO. |
163 | * | 188 | * |
164 | * @param message Message | 189 | * @param[in/out] message Message |
165 | * @param key Private key of EGO | 190 | * @param[in] key Private key of EGO |
166 | * @return GNUNET_YES on success, otherwise GNUNET_NO | 191 | * @return #GNUNET_YES on success, otherwise #GNUNET_NO |
167 | */ | 192 | */ |
168 | int | 193 | int |
169 | decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key); | 194 | decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_IDENTITY_PrivateKey *key); |
@@ -173,18 +198,28 @@ decrypt_message (struct GNUNET_MESSENGER_Message *message, const struct GNUNET_I | |||
173 | 198 | ||
174 | /** | 199 | /** |
175 | * Encodes the <i>message</i> to pack it into a newly allocated envelope if <i>mode</i> | 200 | * Encodes the <i>message</i> to pack it into a newly allocated envelope if <i>mode</i> |
176 | * is equal to GNUNET_MESSENGER_PACK_MODE_ENVELOPE. Independent of the mode the message | 201 | * is equal to #GNUNET_MESSENGER_PACK_MODE_ENVELOPE. Independent of the mode the message |
177 | * will be hashed if <i>hash</i> is not NULL and it will be signed if the <i>ego</i> is | 202 | * will be hashed if <i>hash</i> is not NULL and it will be signed if the <i>ego</i> is |
178 | * not NULL. | 203 | * not NULL. |
179 | * | 204 | * |
180 | * @param[out] message Message | 205 | * @param[out] message Message |
181 | * @param[out] hash Hash of message | 206 | * @param[out] hash Hash of message |
182 | * @param ego EGO to sign | 207 | * @param[in] ego EGO to sign |
183 | * @param mode Mode of packing | 208 | * @param[in] mode Mode of packing |
184 | * @return Envelope or NULL | 209 | * @return Envelope or NULL |
185 | */ | 210 | */ |
186 | struct GNUNET_MQ_Envelope* | 211 | struct GNUNET_MQ_Envelope* |
187 | pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, | 212 | pack_message (struct GNUNET_MESSENGER_Message *message, struct GNUNET_HashCode *hash, |
188 | const struct GNUNET_MESSENGER_Ego *ego, int mode); | 213 | const struct GNUNET_MESSENGER_Ego *ego, int mode); |
189 | 214 | ||
215 | /** | ||
216 | * Returns if a specific kind of message should be sent by a client. The function returns | ||
217 | * #GNUNET_YES or #GNUNET_NO for recommendations and #GNUNET_SYSERR for specific kinds | ||
218 | * of messages which should not be sent manually at all. | ||
219 | * | ||
220 | * @param[in] message Message | ||
221 | */ | ||
222 | int | ||
223 | filter_message_sending (const struct GNUNET_MESSENGER_Message *message); | ||
224 | |||
190 | #endif //GNUNET_MESSENGER_API_MESSAGE_H | 225 | #endif //GNUNET_MESSENGER_API_MESSAGE_H |
diff --git a/src/messenger/messenger_api_room.c b/src/messenger/messenger_api_room.c index 5fedf1a78..5b7edee60 100644..100755 --- a/src/messenger/messenger_api_room.c +++ b/src/messenger/messenger_api_room.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -30,6 +30,8 @@ | |||
30 | struct GNUNET_MESSENGER_Room* | 30 | struct GNUNET_MESSENGER_Room* |
31 | create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) | 31 | create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCode *key) |
32 | { | 32 | { |
33 | GNUNET_assert((handle) && (key)); | ||
34 | |||
33 | struct GNUNET_MESSENGER_Room *room = GNUNET_new(struct GNUNET_MESSENGER_Room); | 35 | struct GNUNET_MESSENGER_Room *room = GNUNET_new(struct GNUNET_MESSENGER_Room); |
34 | 36 | ||
35 | room->handle = handle; | 37 | room->handle = handle; |
@@ -38,11 +40,10 @@ create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCod | |||
38 | room->opened = GNUNET_NO; | 40 | room->opened = GNUNET_NO; |
39 | room->contact_id = NULL; | 41 | room->contact_id = NULL; |
40 | 42 | ||
41 | room->members = GNUNET_CONTAINER_multishortmap_create (8, GNUNET_NO); | ||
42 | |||
43 | init_list_tunnels (&(room->entries)); | 43 | init_list_tunnels (&(room->entries)); |
44 | 44 | ||
45 | room->messages = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); | 45 | room->messages = GNUNET_CONTAINER_multihashmap_create (8, GNUNET_NO); |
46 | room->members = GNUNET_CONTAINER_multishortmap_create (8, GNUNET_NO); | ||
46 | 47 | ||
47 | return room; | 48 | return room; |
48 | } | 49 | } |
@@ -50,9 +51,10 @@ create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCod | |||
50 | static int | 51 | static int |
51 | iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *value) | 52 | iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *value) |
52 | { | 53 | { |
53 | struct GNUNET_MESSENGER_Message *message = value; | 54 | struct GNUNET_MESSENGER_RoomMessageEntry *entry = value; |
54 | 55 | ||
55 | destroy_message (message); | 56 | destroy_message (entry->message); |
57 | GNUNET_free(entry); | ||
56 | 58 | ||
57 | return GNUNET_YES; | 59 | return GNUNET_YES; |
58 | } | 60 | } |
@@ -60,8 +62,7 @@ iterate_destroy_message (void *cls, const struct GNUNET_HashCode *key, void *val | |||
60 | void | 62 | void |
61 | destroy_room (struct GNUNET_MESSENGER_Room *room) | 63 | destroy_room (struct GNUNET_MESSENGER_Room *room) |
62 | { | 64 | { |
63 | if (room->members) | 65 | GNUNET_assert(room); |
64 | GNUNET_CONTAINER_multishortmap_destroy (room->members); | ||
65 | 66 | ||
66 | clear_list_tunnels (&(room->entries)); | 67 | clear_list_tunnels (&(room->entries)); |
67 | 68 | ||
@@ -72,6 +73,9 @@ destroy_room (struct GNUNET_MESSENGER_Room *room) | |||
72 | GNUNET_CONTAINER_multihashmap_destroy (room->messages); | 73 | GNUNET_CONTAINER_multihashmap_destroy (room->messages); |
73 | } | 74 | } |
74 | 75 | ||
76 | if (room->members) | ||
77 | GNUNET_CONTAINER_multishortmap_destroy (room->members); | ||
78 | |||
75 | if (room->contact_id) | 79 | if (room->contact_id) |
76 | GNUNET_free(room->contact_id); | 80 | GNUNET_free(room->contact_id); |
77 | 81 | ||
@@ -81,65 +85,113 @@ destroy_room (struct GNUNET_MESSENGER_Room *room) | |||
81 | const struct GNUNET_MESSENGER_Message* | 85 | const struct GNUNET_MESSENGER_Message* |
82 | get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) | 86 | get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
83 | { | 87 | { |
84 | return GNUNET_CONTAINER_multihashmap_get (room->messages, hash); | 88 | GNUNET_assert((room) && (hash)); |
89 | |||
90 | struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_CONTAINER_multihashmap_get ( | ||
91 | room->messages, hash | ||
92 | ); | ||
93 | |||
94 | return (entry? entry->message : NULL); | ||
85 | } | 95 | } |
86 | 96 | ||
87 | static void | 97 | struct GNUNET_MESSENGER_Contact* |
88 | handle_join_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 98 | get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash) |
89 | const struct GNUNET_HashCode *hash) | 99 | { |
100 | GNUNET_assert((room) && (hash)); | ||
101 | |||
102 | struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_CONTAINER_multihashmap_get ( | ||
103 | room->messages, hash | ||
104 | ); | ||
105 | |||
106 | return (entry? entry->sender : NULL); | ||
107 | } | ||
108 | |||
109 | static struct GNUNET_MESSENGER_Contact* | ||
110 | handle_join_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | ||
111 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
90 | { | 112 | { |
91 | struct GNUNET_MESSENGER_Contact *contact = get_handle_contact_by_pubkey (room->handle, &(message->body.join.key)); | 113 | if (!sender) |
114 | { | ||
115 | struct GNUNET_MESSENGER_ContactStore *store = get_handle_contact_store(room->handle); | ||
116 | struct GNUNET_HashCode context; | ||
117 | |||
118 | get_context_from_member(&(room->key), &(message->header.sender_id), &context); | ||
119 | |||
120 | sender = get_store_contact(store, &context, &(message->body.join.key)); | ||
121 | } | ||
122 | |||
123 | if ((GNUNET_YES != GNUNET_CONTAINER_multishortmap_contains_value(room->members, &(message->header.sender_id), sender)) && | ||
124 | (GNUNET_OK == GNUNET_CONTAINER_multishortmap_put(room->members, &(message->header.sender_id), sender, | ||
125 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE))) | ||
126 | increase_contact_rc(sender); | ||
92 | 127 | ||
93 | if (contact) | 128 | return sender; |
94 | GNUNET_CONTAINER_multishortmap_put (room->members, &(message->header.sender_id), contact, | ||
95 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); | ||
96 | } | 129 | } |
97 | 130 | ||
98 | static void | 131 | static void |
99 | handle_leave_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 132 | handle_leave_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
100 | const struct GNUNET_HashCode *hash) | 133 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
101 | { | 134 | { |
102 | GNUNET_CONTAINER_multishortmap_remove_all (room->members, &(message->header.sender_id)); | 135 | if ((!sender) || |
136 | (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender))) | ||
137 | return; | ||
138 | |||
139 | struct GNUNET_HashCode context; | ||
140 | get_context_from_member(&(room->key), &(message->header.sender_id), &context); | ||
141 | |||
142 | struct GNUNET_MESSENGER_ContactStore *store = get_handle_contact_store(room->handle); | ||
143 | |||
144 | if (GNUNET_YES == decrease_contact_rc(sender)) | ||
145 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "A contact does not share any room with you anymore!\n"); | ||
103 | } | 146 | } |
104 | 147 | ||
105 | static void | 148 | static void |
106 | handle_name_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 149 | handle_name_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
107 | const struct GNUNET_HashCode *hash) | 150 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
108 | { | 151 | { |
109 | struct GNUNET_MESSENGER_Contact *contact = GNUNET_CONTAINER_multishortmap_get (room->members, | 152 | if (!sender) |
110 | &(message->header.sender_id)); | 153 | return; |
111 | 154 | ||
112 | if (contact) | 155 | set_contact_name (sender, message->body.name.name); |
113 | set_contact_name (contact, message->body.name.name); | ||
114 | } | 156 | } |
115 | 157 | ||
116 | static void | 158 | static void |
117 | handle_key_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 159 | handle_key_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
118 | const struct GNUNET_HashCode *hash) | 160 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
119 | { | 161 | { |
120 | struct GNUNET_MESSENGER_Contact *contact = GNUNET_CONTAINER_multishortmap_get (room->members, | 162 | if (!sender) |
121 | &(message->header.sender_id)); | 163 | return; |
122 | 164 | ||
123 | if (contact) | 165 | struct GNUNET_HashCode context; |
124 | swap_handle_contact_by_pubkey (room->handle, contact, &(message->body.key.key)); | 166 | get_context_from_member(&(room->key), &(message->header.sender_id), &context); |
167 | |||
168 | struct GNUNET_MESSENGER_ContactStore *store = get_handle_contact_store(room->handle); | ||
169 | |||
170 | update_store_contact(store, sender, &context, &context, &(message->body.key.key)); | ||
125 | } | 171 | } |
126 | 172 | ||
127 | static void | 173 | static void |
128 | handle_id_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 174 | handle_id_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
129 | const struct GNUNET_HashCode *hash) | 175 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
130 | { | 176 | { |
131 | struct GNUNET_MESSENGER_Contact *contact = GNUNET_CONTAINER_multishortmap_get (room->members, | 177 | if ((!sender) || |
132 | &(message->header.sender_id)); | 178 | (GNUNET_YES != GNUNET_CONTAINER_multishortmap_remove(room->members, &(message->header.sender_id), sender)) || |
179 | (GNUNET_OK != GNUNET_CONTAINER_multishortmap_put(room->members, &(message->body.id.id), sender, | ||
180 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE))) | ||
181 | return; | ||
182 | |||
183 | struct GNUNET_HashCode context, next_context; | ||
184 | get_context_from_member(&(room->key), &(message->header.sender_id), &context); | ||
185 | get_context_from_member(&(room->key), &(message->body.id.id), &next_context); | ||
133 | 186 | ||
134 | if ((contact) && (GNUNET_OK | 187 | struct GNUNET_MESSENGER_ContactStore *store = get_handle_contact_store(room->handle); |
135 | == GNUNET_CONTAINER_multishortmap_put (room->members, &(message->body.id.id), contact, | 188 | |
136 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST))) | 189 | update_store_contact(store, sender, &context, &next_context, get_contact_key(sender)); |
137 | GNUNET_CONTAINER_multishortmap_remove (room->members, &(message->header.sender_id), contact); | ||
138 | } | 190 | } |
139 | 191 | ||
140 | static void | 192 | static void |
141 | handle_miss_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 193 | handle_miss_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
142 | const struct GNUNET_HashCode *hash) | 194 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
143 | { | 195 | { |
144 | if ((room->contact_id) && (0 == GNUNET_memcmp(&(message->header.sender_id), room->contact_id))) | 196 | if ((room->contact_id) && (0 == GNUNET_memcmp(&(message->header.sender_id), room->contact_id))) |
145 | { | 197 | { |
@@ -150,40 +202,106 @@ handle_miss_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MES | |||
150 | } | 202 | } |
151 | } | 203 | } |
152 | 204 | ||
153 | void | 205 | static void |
154 | handle_room_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 206 | handle_delete_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
155 | const struct GNUNET_HashCode *hash) | 207 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) |
208 | { | ||
209 | struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_CONTAINER_multihashmap_get ( | ||
210 | room->messages, &(message->body.delete.hash) | ||
211 | ); | ||
212 | |||
213 | if ((entry) && ((entry->sender == sender) || (get_handle_contact (room->handle, &(room->key)) == sender)) && | ||
214 | (GNUNET_YES == GNUNET_CONTAINER_multihashmap_remove (room->messages, &(message->body.delete.hash), entry))) | ||
215 | { | ||
216 | destroy_message (entry->message); | ||
217 | GNUNET_free(entry); | ||
218 | } | ||
219 | } | ||
220 | |||
221 | struct GNUNET_MESSENGER_Contact* | ||
222 | handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, | ||
223 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash) | ||
156 | { | 224 | { |
157 | if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash)) | 225 | if (GNUNET_NO != GNUNET_CONTAINER_multihashmap_contains (room->messages, hash)) |
158 | return; | 226 | return sender; |
159 | 227 | ||
160 | switch (message->header.kind) | 228 | switch (message->header.kind) |
161 | { | 229 | { |
162 | case GNUNET_MESSENGER_KIND_JOIN: | 230 | case GNUNET_MESSENGER_KIND_JOIN: |
163 | handle_join_message (room, message, hash); | 231 | sender = handle_join_message (room, sender, message, hash); |
164 | break; | 232 | break; |
165 | case GNUNET_MESSENGER_KIND_LEAVE: | 233 | case GNUNET_MESSENGER_KIND_LEAVE: |
166 | handle_leave_message (room, message, hash); | 234 | handle_leave_message (room, sender, message, hash); |
167 | break; | 235 | break; |
168 | case GNUNET_MESSENGER_KIND_NAME: | 236 | case GNUNET_MESSENGER_KIND_NAME: |
169 | handle_name_message (room, message, hash); | 237 | handle_name_message (room, sender, message, hash); |
170 | break; | 238 | break; |
171 | case GNUNET_MESSENGER_KIND_KEY: | 239 | case GNUNET_MESSENGER_KIND_KEY: |
172 | handle_key_message (room, message, hash); | 240 | handle_key_message (room, sender, message, hash); |
173 | break; | 241 | break; |
174 | case GNUNET_MESSENGER_KIND_ID: | 242 | case GNUNET_MESSENGER_KIND_ID: |
175 | handle_id_message (room, message, hash); | 243 | handle_id_message (room, sender, message, hash); |
176 | break; | 244 | break; |
177 | case GNUNET_MESSENGER_KIND_MISS: | 245 | case GNUNET_MESSENGER_KIND_MISS: |
178 | handle_miss_message (room, message, hash); | 246 | handle_miss_message (room, sender, message, hash); |
247 | break; | ||
248 | case GNUNET_MESSENGER_KIND_DELETE: | ||
249 | handle_delete_message (room, sender, message, hash); | ||
179 | break; | 250 | break; |
180 | default: | 251 | default: |
181 | break; | 252 | break; |
182 | } | 253 | } |
183 | 254 | ||
184 | struct GNUNET_MESSENGER_Message *clone = copy_message (message); | 255 | struct GNUNET_MESSENGER_RoomMessageEntry *entry = GNUNET_new(struct GNUNET_MESSENGER_RoomMessageEntry); |
256 | |||
257 | if (!entry) | ||
258 | return sender; | ||
185 | 259 | ||
186 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (room->messages, hash, clone, | 260 | entry->sender = sender; |
261 | entry->message = copy_message (message); | ||
262 | |||
263 | if (GNUNET_OK != GNUNET_CONTAINER_multihashmap_put (room->messages, hash, entry, | ||
187 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) | 264 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST)) |
188 | destroy_message (clone); | 265 | { |
266 | destroy_message (entry->message); | ||
267 | GNUNET_free(entry); | ||
268 | } | ||
269 | |||
270 | return sender; | ||
271 | } | ||
272 | |||
273 | struct GNUNET_MESSENGER_MemberCall | ||
274 | { | ||
275 | struct GNUNET_MESSENGER_Room *room; | ||
276 | GNUNET_MESSENGER_MemberCallback callback; | ||
277 | void *cls; | ||
278 | }; | ||
279 | |||
280 | static int | ||
281 | iterate_local_members (void* cls, const struct GNUNET_ShortHashCode *key, void *value) | ||
282 | { | ||
283 | struct GNUNET_MESSENGER_MemberCall *call = cls; | ||
284 | struct GNUNET_MESSENGER_Contact *contact = value; | ||
285 | |||
286 | return call->callback(call->cls, call->room, contact); | ||
287 | } | ||
288 | |||
289 | int | ||
290 | iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | ||
291 | void* cls) | ||
292 | { | ||
293 | GNUNET_assert(room); | ||
294 | |||
295 | if (!callback) | ||
296 | return GNUNET_CONTAINER_multishortmap_iterate(room->members, NULL, NULL); | ||
297 | |||
298 | struct GNUNET_MESSENGER_MemberCall call; | ||
299 | |||
300 | call.room = room; | ||
301 | call.callback = callback; | ||
302 | call.cls = cls; | ||
303 | |||
304 | GNUNET_assert(callback); | ||
305 | |||
306 | return GNUNET_CONTAINER_multishortmap_iterate(room->members, iterate_local_members, &call); | ||
189 | } | 307 | } |
diff --git a/src/messenger/messenger_api_room.h b/src/messenger/messenger_api_room.h index 0038128d8..eb41cf740 100644..100755 --- a/src/messenger/messenger_api_room.h +++ b/src/messenger/messenger_api_room.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -36,6 +36,11 @@ | |||
36 | #include "messenger_api_contact.h" | 36 | #include "messenger_api_contact.h" |
37 | #include "messenger_api_message.h" | 37 | #include "messenger_api_message.h" |
38 | 38 | ||
39 | struct GNUNET_MESSENGER_RoomMessageEntry { | ||
40 | struct GNUNET_MESSENGER_Contact* sender; | ||
41 | struct GNUNET_MESSENGER_Message* message; | ||
42 | }; | ||
43 | |||
39 | struct GNUNET_MESSENGER_Room | 44 | struct GNUNET_MESSENGER_Room |
40 | { | 45 | { |
41 | struct GNUNET_MESSENGER_Handle *handle; | 46 | struct GNUNET_MESSENGER_Handle *handle; |
@@ -45,17 +50,17 @@ struct GNUNET_MESSENGER_Room | |||
45 | 50 | ||
46 | struct GNUNET_ShortHashCode *contact_id; | 51 | struct GNUNET_ShortHashCode *contact_id; |
47 | 52 | ||
48 | struct GNUNET_CONTAINER_MultiShortmap *members; | ||
49 | struct GNUNET_MESSENGER_ListTunnels entries; | 53 | struct GNUNET_MESSENGER_ListTunnels entries; |
50 | 54 | ||
51 | struct GNUNET_CONTAINER_MultiHashMap *messages; | 55 | struct GNUNET_CONTAINER_MultiHashMap *messages; |
56 | struct GNUNET_CONTAINER_MultiShortmap *members; | ||
52 | }; | 57 | }; |
53 | 58 | ||
54 | /** | 59 | /** |
55 | * Creates and allocates a new room for a <i>handle</i> with a given <i>key</i> for the client API. | 60 | * Creates and allocates a new room for a <i>handle</i> with a given <i>key</i> for the client API. |
56 | * | 61 | * |
57 | * @param handle Handle | 62 | * @param[in/out] handle Handle |
58 | * @param key Key of room | 63 | * @param[in] key Key of room |
59 | * @return New room | 64 | * @return New room |
60 | */ | 65 | */ |
61 | struct GNUNET_MESSENGER_Room* | 66 | struct GNUNET_MESSENGER_Room* |
@@ -64,7 +69,7 @@ create_room (struct GNUNET_MESSENGER_Handle *handle, const struct GNUNET_HashCod | |||
64 | /** | 69 | /** |
65 | * Destroys a room and frees its memory fully from the client API. | 70 | * Destroys a room and frees its memory fully from the client API. |
66 | * | 71 | * |
67 | * @param room Room | 72 | * @param[in/out] room Room |
68 | */ | 73 | */ |
69 | void | 74 | void |
70 | destroy_room (struct GNUNET_MESSENGER_Room *room); | 75 | destroy_room (struct GNUNET_MESSENGER_Room *room); |
@@ -73,23 +78,52 @@ destroy_room (struct GNUNET_MESSENGER_Room *room); | |||
73 | * Returns a message locally stored from a map for a given <i>hash</i> in a <i>room</i>. If no matching | 78 | * Returns a message locally stored from a map for a given <i>hash</i> in a <i>room</i>. If no matching |
74 | * message is found, NULL gets returned. | 79 | * message is found, NULL gets returned. |
75 | * | 80 | * |
76 | * @param room Room | 81 | * @param[in] room Room |
77 | * @param hash Hash of message | 82 | * @param[in] hash Hash of message |
78 | * @return Message or NULL | 83 | * @return Message or NULL |
79 | */ | 84 | */ |
80 | const struct GNUNET_MESSENGER_Message* | 85 | const struct GNUNET_MESSENGER_Message* |
81 | get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); | 86 | get_room_message (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); |
82 | 87 | ||
83 | /** | 88 | /** |
89 | * Returns a messages sender locally stored from a map for a given <i>hash</i> in a <i>room</i>. If no | ||
90 | * matching message is found, NULL gets returned. | ||
91 | * | ||
92 | * @param[in] room Room | ||
93 | * @param[in] hash Hash of message | ||
94 | * @return Contact of sender or NULL | ||
95 | */ | ||
96 | struct GNUNET_MESSENGER_Contact* | ||
97 | get_room_sender (const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_HashCode *hash); | ||
98 | |||
99 | /** | ||
84 | * Handles a <i>message</i> with a given <i>hash</i> in a <i>room</i> for the client API to update | 100 | * Handles a <i>message</i> with a given <i>hash</i> in a <i>room</i> for the client API to update |
85 | * members and its information. The function also stores the message in map locally for access afterwards. | 101 | * members and its information. The function also stores the message in map locally for access afterwards. |
86 | * | 102 | * |
87 | * @param room Room | 103 | * The contact of the message's sender could be updated or even created. It may not be freed or destroyed though! |
88 | * @param message Message | 104 | * (The contact may still be in use for old messages...) |
89 | * @param hash Hash of message | 105 | * |
106 | * @param[in/out] room Room | ||
107 | * @param[in/out] sender Contact of sender | ||
108 | * @param[in] message Message | ||
109 | * @param[in] hash Hash of message | ||
110 | * @return Contact of sender | ||
90 | */ | 111 | */ |
91 | void | 112 | struct GNUNET_MESSENGER_Contact* |
92 | handle_room_message (struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | 113 | handle_room_message (struct GNUNET_MESSENGER_Room *room, struct GNUNET_MESSENGER_Contact *sender, |
93 | const struct GNUNET_HashCode *hash); | 114 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash); |
115 | |||
116 | /** | ||
117 | * Iterates through all members of a given <i>room</i> to forward each of them to a selected | ||
118 | * <i>callback</i> with a custom closure. | ||
119 | * | ||
120 | * @param[in/out] room Room | ||
121 | * @param[in] callback Function called for each member | ||
122 | * @param[in/out] cls Closure | ||
123 | * @return Amount of members iterated | ||
124 | */ | ||
125 | int | ||
126 | iterate_room_members (struct GNUNET_MESSENGER_Room *room, GNUNET_MESSENGER_MemberCallback callback, | ||
127 | void* cls); | ||
94 | 128 | ||
95 | #endif //GNUNET_MESSENGER_API_ROOM_H | 129 | #endif //GNUNET_MESSENGER_API_ROOM_H |
diff --git a/src/messenger/gnunet-service-messenger_util.c b/src/messenger/messenger_api_util.c index 94fc9469d..68e15d789 100644 --- a/src/messenger/gnunet-service-messenger_util.c +++ b/src/messenger/messenger_api_util.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -19,11 +19,11 @@ | |||
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @author Tobias Frisch | 21 | * @author Tobias Frisch |
22 | * @file src/messenger/gnunet-service-messenger_util.c | 22 | * @file src/messenger/messenger_api_util.c |
23 | * @brief GNUnet MESSENGER service | 23 | * @brief messenger api: client implementation of GNUnet MESSENGER service |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #include "gnunet-service-messenger_util.h" | 26 | #include "messenger_api_util.h" |
27 | 27 | ||
28 | static void | 28 | static void |
29 | callback_close_channel (void *cls) | 29 | callback_close_channel (void *cls) |
@@ -37,13 +37,18 @@ callback_close_channel (void *cls) | |||
37 | void | 37 | void |
38 | delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel) | 38 | delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel) |
39 | { | 39 | { |
40 | GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_relative_get_zero_ (), GNUNET_SCHEDULER_PRIORITY_URGENT, | 40 | GNUNET_assert(channel); |
41 | |||
42 | GNUNET_SCHEDULER_add_delayed_with_priority (GNUNET_TIME_relative_get_zero_ (), | ||
43 | GNUNET_SCHEDULER_PRIORITY_URGENT, | ||
41 | callback_close_channel, channel); | 44 | callback_close_channel, channel); |
42 | } | 45 | } |
43 | 46 | ||
44 | int | 47 | int |
45 | generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members) | 48 | generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members) |
46 | { | 49 | { |
50 | GNUNET_assert(id); | ||
51 | |||
47 | size_t counter = 1 + (members ? GNUNET_CONTAINER_multishortmap_size (members) : 0); | 52 | size_t counter = 1 + (members ? GNUNET_CONTAINER_multishortmap_size (members) : 0); |
48 | 53 | ||
49 | do | 54 | do |
@@ -62,3 +67,18 @@ generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CO | |||
62 | 67 | ||
63 | return GNUNET_NO; | 68 | return GNUNET_NO; |
64 | } | 69 | } |
70 | |||
71 | const struct GNUNET_IDENTITY_PublicKey* | ||
72 | get_anonymous_public_key () | ||
73 | { | ||
74 | static struct GNUNET_IDENTITY_PublicKey public_key; | ||
75 | static struct GNUNET_IDENTITY_Ego* ego = NULL; | ||
76 | |||
77 | if (!ego) | ||
78 | { | ||
79 | ego = GNUNET_IDENTITY_ego_get_anonymous(); | ||
80 | GNUNET_IDENTITY_ego_get_public_key(ego, &public_key); | ||
81 | } | ||
82 | |||
83 | return &public_key; | ||
84 | } | ||
diff --git a/src/messenger/gnunet-service-messenger_util.h b/src/messenger/messenger_api_util.h index 20f8f0afe..c70a3601f 100644 --- a/src/messenger/gnunet-service-messenger_util.h +++ b/src/messenger/messenger_api_util.h | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -19,8 +19,8 @@ | |||
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @author Tobias Frisch | 21 | * @author Tobias Frisch |
22 | * @file src/messenger/gnunet-service-messenger_util.h | 22 | * @file src/messenger/messenger_api_util.h |
23 | * @brief GNUnet MESSENGER service | 23 | * @brief messenger api: client implementation of GNUnet MESSENGER service |
24 | */ | 24 | */ |
25 | 25 | ||
26 | #ifndef GNUNET_SERVICE_MESSENGER_UTIL_H | 26 | #ifndef GNUNET_SERVICE_MESSENGER_UTIL_H |
@@ -30,24 +30,35 @@ | |||
30 | #include "gnunet_cadet_service.h" | 30 | #include "gnunet_cadet_service.h" |
31 | #include "gnunet_container_lib.h" | 31 | #include "gnunet_container_lib.h" |
32 | #include "gnunet_crypto_lib.h" | 32 | #include "gnunet_crypto_lib.h" |
33 | #include "gnunet_disk_lib.h" | ||
34 | #include "gnunet_identity_service.h" | ||
33 | 35 | ||
34 | /** | 36 | /** |
35 | * Starts an urgent task to close a CADET channel asynchronously. | 37 | * Starts an urgent task to close a CADET channel asynchronously. |
36 | * | 38 | * |
37 | * @param channel Channel | 39 | * @param[in/out] channel Channel |
38 | */ | 40 | */ |
39 | void | 41 | void |
40 | delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel); | 42 | delayed_disconnect_channel (struct GNUNET_CADET_Channel *channel); |
41 | 43 | ||
42 | /** | 44 | /** |
43 | * Tries to generate an unused member id and store it into the <i>id</i> parameter. A map containing all currently | 45 | * Tries to generate an unused member id and store it into the <i>id</i> parameter. |
44 | * used member ids is used to check against. | 46 | * A map containing all currently used member ids is used to check against. |
45 | * | 47 | * |
46 | * @param[out] id New member id | 48 | * @param[out] id New member id |
47 | * @param members Map of member ids | 49 | * @param[in] members Map of member ids |
48 | * @return GNUNET_YES on success, GNUNET_NO on failure | 50 | * @return #GNUNET_YES on success, #GNUNET_NO on failure |
49 | */ | 51 | */ |
50 | int | 52 | int |
51 | generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members); | 53 | generate_free_member_id (struct GNUNET_ShortHashCode *id, const struct GNUNET_CONTAINER_MultiShortmap *members); |
52 | 54 | ||
55 | /** | ||
56 | * Returns the public identity key of #GNUNET_IDENTITY_ego_get_anonymous() without | ||
57 | * recalculating it every time. | ||
58 | * | ||
59 | * @return anonymous public key | ||
60 | */ | ||
61 | const struct GNUNET_IDENTITY_PublicKey* | ||
62 | get_anonymous_public_key (); | ||
63 | |||
53 | #endif //GNUNET_SERVICE_MESSENGER_UTIL_H | 64 | #endif //GNUNET_SERVICE_MESSENGER_UTIL_H |
diff --git a/src/messenger/test_messenger.c b/src/messenger/test_messenger.c index b42dfe6d9..fb3e3e1bc 100644 --- a/src/messenger/test_messenger.c +++ b/src/messenger/test_messenger.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -61,14 +61,13 @@ end (void *cls) | |||
61 | 61 | ||
62 | if (messenger) | 62 | if (messenger) |
63 | { | 63 | { |
64 | GNUNET_MESSENGER_disconnect(messenger); | 64 | GNUNET_MESSENGER_disconnect (messenger); |
65 | messenger = NULL; | 65 | messenger = NULL; |
66 | } | 66 | } |
67 | 67 | ||
68 | status = 0; | 68 | status = 0; |
69 | } | 69 | } |
70 | 70 | ||
71 | |||
72 | static void | 71 | static void |
73 | end_badly (void *cls) | 72 | end_badly (void *cls) |
74 | { | 73 | { |
@@ -83,7 +82,7 @@ end_operation (void *cls) | |||
83 | { | 82 | { |
84 | op_task = NULL; | 83 | op_task = NULL; |
85 | 84 | ||
86 | fprintf (stderr, "Testcase failed (operation: '%s').\n", cls? (const char*) cls : "unknown"); | 85 | fprintf (stderr, "Testcase failed (operation: '%s').\n", cls ? (const char*) cls : "unknown"); |
87 | 86 | ||
88 | if (die_task) | 87 | if (die_task) |
89 | GNUNET_SCHEDULER_cancel (die_task); | 88 | GNUNET_SCHEDULER_cancel (die_task); |
@@ -109,30 +108,25 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
109 | op_task = NULL; | 108 | op_task = NULL; |
110 | } | 109 | } |
111 | 110 | ||
112 | const char* name = GNUNET_MESSENGER_get_name(handle); | 111 | const char *name = GNUNET_MESSENGER_get_name (handle); |
113 | 112 | ||
114 | if (0 != strcmp(name, TESTER_NAME)) | 113 | if (0 != strcmp (name, TESTER_NAME)) |
115 | { | 114 | { |
116 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "name"); | 115 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "name"); |
117 | return; | 116 | return; |
118 | } | 117 | } |
119 | 118 | ||
120 | struct GNUNET_IDENTITY_Ego* ego = GNUNET_IDENTITY_ego_get_anonymous(); | 119 | const struct GNUNET_IDENTITY_PublicKey *key = GNUNET_MESSENGER_get_key (handle); |
121 | struct GNUNET_IDENTITY_PublicKey anonymous_key; | ||
122 | |||
123 | GNUNET_IDENTITY_ego_get_public_key(ego, &anonymous_key); | ||
124 | 120 | ||
125 | const struct GNUNET_IDENTITY_PublicKey* key = GNUNET_MESSENGER_get_key(handle); | 121 | if (((!identity_counter) && (key)) || ((identity_counter) && (!key))) |
126 | |||
127 | if (((!identity_counter) && (0 != GNUNET_memcmp(key, (&anonymous_key)))) || | ||
128 | ((identity_counter) && (0 == GNUNET_memcmp(key, (&anonymous_key))))) | ||
129 | { | 122 | { |
130 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "key"); | 123 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "key"); |
131 | return; | 124 | return; |
132 | } | 125 | } |
133 | 126 | ||
134 | if (identity_counter) { | 127 | if (identity_counter) |
135 | GNUNET_MESSENGER_disconnect(handle); | 128 | { |
129 | GNUNET_MESSENGER_disconnect (handle); | ||
136 | 130 | ||
137 | op_task = NULL; | 131 | op_task = NULL; |
138 | messenger = NULL; | 132 | messenger = NULL; |
@@ -144,7 +138,7 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
144 | return; | 138 | return; |
145 | } | 139 | } |
146 | 140 | ||
147 | GNUNET_MESSENGER_update(messenger); | 141 | GNUNET_MESSENGER_update (messenger); |
148 | identity_counter++; | 142 | identity_counter++; |
149 | } | 143 | } |
150 | 144 | ||
@@ -156,16 +150,14 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
156 | * @param peer Peer for testing | 150 | * @param peer Peer for testing |
157 | */ | 151 | */ |
158 | static void | 152 | static void |
159 | run (void *cls, | 153 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) |
160 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
161 | struct GNUNET_TESTING_Peer *peer) | ||
162 | { | 154 | { |
163 | die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); | 155 | die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); |
164 | 156 | ||
165 | identity_counter = 0; | 157 | identity_counter = 0; |
166 | 158 | ||
167 | op_task = GNUNET_SCHEDULER_add_delayed (BASE_TIMEOUT, &end_operation, "connect"); | 159 | op_task = GNUNET_SCHEDULER_add_delayed (BASE_TIMEOUT, &end_operation, "connect"); |
168 | messenger = GNUNET_MESSENGER_connect(cfg, TESTER_NAME, &on_identity, NULL, NULL, NULL); | 160 | messenger = GNUNET_MESSENGER_connect (cfg, TESTER_NAME, &on_identity, NULL, NULL, NULL); |
169 | } | 161 | } |
170 | 162 | ||
171 | /** | 163 | /** |
@@ -176,11 +168,9 @@ run (void *cls, | |||
176 | * @return 0 ok, 1 on error | 168 | * @return 0 ok, 1 on error |
177 | */ | 169 | */ |
178 | int | 170 | int |
179 | main(int argc, char **argv) | 171 | main (int argc, char **argv) |
180 | { | 172 | { |
181 | if (0 != GNUNET_TESTING_peer_run("test-messenger", | 173 | if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL)) |
182 | "test_messenger_api.conf", | ||
183 | &run, NULL)) | ||
184 | return 1; | 174 | return 1; |
185 | 175 | ||
186 | return status; | 176 | return status; |
diff --git a/src/messenger/test_messenger_adapt.c b/src/messenger/test_messenger_adapt.c new file mode 100644 index 000000000..90e8ac28d --- /dev/null +++ b/src/messenger/test_messenger_adapt.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_adapt.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 5, 1, 2, 3, 6, 7, 8, 4 }; | ||
39 | unsigned int stages [] = { 0x21, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x21 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 8; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_adapt", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_anonymous.c b/src/messenger/test_messenger_anonymous.c index e2057acc4..a70121a30 100644 --- a/src/messenger/test_messenger_anonymous.c +++ b/src/messenger/test_messenger_anonymous.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2020 GNUnet e.V. | 3 | Copyright (C) 2020--2021 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
@@ -59,14 +59,13 @@ end (void *cls) | |||
59 | 59 | ||
60 | if (messenger) | 60 | if (messenger) |
61 | { | 61 | { |
62 | GNUNET_MESSENGER_disconnect(messenger); | 62 | GNUNET_MESSENGER_disconnect (messenger); |
63 | messenger = NULL; | 63 | messenger = NULL; |
64 | } | 64 | } |
65 | 65 | ||
66 | status = 0; | 66 | status = 0; |
67 | } | 67 | } |
68 | 68 | ||
69 | |||
70 | static void | 69 | static void |
71 | end_badly (void *cls) | 70 | end_badly (void *cls) |
72 | { | 71 | { |
@@ -81,7 +80,7 @@ end_operation (void *cls) | |||
81 | { | 80 | { |
82 | op_task = NULL; | 81 | op_task = NULL; |
83 | 82 | ||
84 | fprintf (stderr, "Testcase failed (operation: '%s').\n", cls? (const char*) cls : "unknown"); | 83 | fprintf (stderr, "Testcase failed (operation: '%s').\n", cls ? (const char*) cls : "unknown"); |
85 | 84 | ||
86 | if (die_task) | 85 | if (die_task) |
87 | GNUNET_SCHEDULER_cancel (die_task); | 86 | GNUNET_SCHEDULER_cancel (die_task); |
@@ -105,7 +104,7 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
105 | op_task = NULL; | 104 | op_task = NULL; |
106 | } | 105 | } |
107 | 106 | ||
108 | const char* name = GNUNET_MESSENGER_get_name(handle); | 107 | const char *name = GNUNET_MESSENGER_get_name (handle); |
109 | 108 | ||
110 | if (NULL != name) | 109 | if (NULL != name) |
111 | { | 110 | { |
@@ -113,26 +112,21 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
113 | return; | 112 | return; |
114 | } | 113 | } |
115 | 114 | ||
116 | if (GNUNET_SYSERR != GNUNET_MESSENGER_update(handle)) | 115 | if (GNUNET_SYSERR != GNUNET_MESSENGER_update (handle)) |
117 | { | 116 | { |
118 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "update-fail"); | 117 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "update-fail"); |
119 | return; | 118 | return; |
120 | } | 119 | } |
121 | 120 | ||
122 | struct GNUNET_IDENTITY_Ego* ego = GNUNET_IDENTITY_ego_get_anonymous(); | 121 | const struct GNUNET_IDENTITY_PublicKey *key = GNUNET_MESSENGER_get_key (handle); |
123 | struct GNUNET_IDENTITY_PublicKey anonymous_key; | ||
124 | |||
125 | GNUNET_IDENTITY_ego_get_public_key(ego, &anonymous_key); | ||
126 | |||
127 | const struct GNUNET_IDENTITY_PublicKey* key = GNUNET_MESSENGER_get_key(handle); | ||
128 | 122 | ||
129 | if (0 != GNUNET_memcmp(key, (&anonymous_key))) | 123 | if (key) |
130 | { | 124 | { |
131 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "key-anonymous"); | 125 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "key-anonymous"); |
132 | return; | 126 | return; |
133 | } | 127 | } |
134 | 128 | ||
135 | GNUNET_MESSENGER_disconnect(handle); | 129 | GNUNET_MESSENGER_disconnect (handle); |
136 | 130 | ||
137 | messenger = NULL; | 131 | messenger = NULL; |
138 | 132 | ||
@@ -150,14 +144,12 @@ on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | |||
150 | * @param peer Peer for testing | 144 | * @param peer Peer for testing |
151 | */ | 145 | */ |
152 | static void | 146 | static void |
153 | run (void *cls, | 147 | run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) |
154 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
155 | struct GNUNET_TESTING_Peer *peer) | ||
156 | { | 148 | { |
157 | die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); | 149 | die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); |
158 | 150 | ||
159 | op_task = GNUNET_SCHEDULER_add_delayed (BASE_TIMEOUT, &end_operation, "connect"); | 151 | op_task = GNUNET_SCHEDULER_add_delayed (BASE_TIMEOUT, &end_operation, "connect"); |
160 | messenger = GNUNET_MESSENGER_connect(cfg, NULL, &on_identity, NULL, NULL, NULL); | 152 | messenger = GNUNET_MESSENGER_connect (cfg, NULL, &on_identity, NULL, NULL, NULL); |
161 | } | 153 | } |
162 | 154 | ||
163 | /** | 155 | /** |
@@ -168,11 +160,9 @@ run (void *cls, | |||
168 | * @return 0 ok, 1 on error | 160 | * @return 0 ok, 1 on error |
169 | */ | 161 | */ |
170 | int | 162 | int |
171 | main(int argc, char **argv) | 163 | main (int argc, char **argv) |
172 | { | 164 | { |
173 | if (0 != GNUNET_TESTING_peer_run("test-messenger", | 165 | if (0 != GNUNET_TESTING_peer_run ("test-messenger", "test_messenger_api.conf", &run, NULL)) |
174 | "test_messenger_api.conf", | ||
175 | &run, NULL)) | ||
176 | return 1; | 166 | return 1; |
177 | 167 | ||
178 | return status; | 168 | return status; |
diff --git a/src/messenger/test_messenger_api.conf b/src/messenger/test_messenger_api.conf index f5837392e..968f56f6d 100644 --- a/src/messenger/test_messenger_api.conf +++ b/src/messenger/test_messenger_api.conf | |||
@@ -1,11 +1,39 @@ | |||
1 | @INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf | 1 | @INLINE@ ../../contrib/conf/gnunet/no_forcestart.conf |
2 | @INLINE@ ../../contrib/conf/gnunet/no_autostart_above_core.conf | 2 | @INLINE@ ../../contrib/conf/gnunet/no_autostart_above_core.conf |
3 | 3 | ||
4 | [testbed] | ||
5 | HOSTNAME = localhost | ||
6 | OVERLAY_TOPOLOGY = CLIQUE | ||
7 | |||
8 | [arm] | ||
9 | GLOBAL_POSTFIX = -l $GNUNET_CACHE_HOME/{}-logs -L verbose | ||
10 | |||
11 | [transport] | ||
12 | IMMEDIATE_START = YES | ||
13 | |||
14 | [core] | ||
15 | START_ON_DEMAND = YES | ||
16 | IMMEDIATE_START = YES | ||
17 | USE_EPHEMERAL_KEYS = NO | ||
18 | |||
4 | [PATHS] | 19 | [PATHS] |
5 | GNUNET_TEST_HOME = $GNUNET_TMP/test-messenger-api/ | 20 | GNUNET_TEST_HOME = $GNUNET_TMP/test-messenger-api/ |
6 | 21 | ||
22 | [peerinfo] | ||
23 | NO_IO = YES | ||
24 | |||
7 | [cadet] | 25 | [cadet] |
8 | START_ON_DEMAND = YES | 26 | START_ON_DEMAND = YES |
27 | REFRESH_CONNECTION_TIME = 1 s | ||
28 | ID_ANNOUNCE_TIME = 5 s | ||
29 | CONNECT_TIMEOUT = 30 s | ||
30 | DEFAULT_TTL = 16 | ||
31 | DHT_REPLICATION_LEVEL = 10 | ||
32 | MAX_TUNNELS = 10 | ||
33 | MAX_CONNECTIONS = 10 | ||
34 | MAX_MSGS_QUEUE = 20 | ||
35 | DISABLE_TRY_CONNECT = YES | ||
36 | REKEY_PERIOD = 2 s | ||
9 | 37 | ||
10 | [identity] | 38 | [identity] |
11 | START_ON_DEMAND = YES | 39 | START_ON_DEMAND = YES |
@@ -14,4 +42,6 @@ START_ON_DEMAND = YES | |||
14 | START_ON_DEMAND = YES | 42 | START_ON_DEMAND = YES |
15 | 43 | ||
16 | [nat] | 44 | [nat] |
17 | ENABLE_UPNP = NO \ No newline at end of file | 45 | ENABLE_UPNP = NO |
46 | RETURN_LOCAL_ADDRESSES = YES | ||
47 | IMMEDIATE_START = NO \ No newline at end of file | ||
diff --git a/src/messenger/test_messenger_async_client.c b/src/messenger/test_messenger_async_client.c new file mode 100644 index 000000000..1067b9a6d --- /dev/null +++ b/src/messenger/test_messenger_async_client.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_async_client.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 0, 1 }; | ||
39 | unsigned int stages [] = { 0x10, 0x20 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 2; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_async_client", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_async_p2p.c b/src/messenger/test_messenger_async_p2p.c new file mode 100644 index 000000000..d827aae16 --- /dev/null +++ b/src/messenger/test_messenger_async_p2p.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_async_p2p.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 2, 1 }; | ||
39 | unsigned int stages [] = { 0x30, 0x30 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 2; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_async_p2p", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_comm0.c b/src/messenger/test_messenger_comm0.c deleted file mode 100644 index 631b5b2c9..000000000 --- a/src/messenger/test_messenger_comm0.c +++ /dev/null | |||
@@ -1,252 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_comm0.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | #include <stdio.h> | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_testbed_logger_service.h" | ||
29 | #include "gnunet_testbed_service.h" | ||
30 | #include "gnunet_testing_lib.h" | ||
31 | #include "gnunet_messenger_service.h" | ||
32 | |||
33 | /** | ||
34 | * How long until we really give up on a particular testcase portion? | ||
35 | */ | ||
36 | #define TOTAL_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, \ | ||
37 | 60) | ||
38 | |||
39 | /** | ||
40 | * How long until we give up on any particular operation (and retry)? | ||
41 | */ | ||
42 | #define BASE_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5) | ||
43 | |||
44 | static int status = 1; | ||
45 | |||
46 | static struct GNUNET_SCHEDULER_Task *die_task = NULL; | ||
47 | static struct GNUNET_SCHEDULER_Task *op_task = NULL; | ||
48 | |||
49 | static void | ||
50 | end (void *cls) | ||
51 | { | ||
52 | die_task = NULL; | ||
53 | |||
54 | if (op_task) | ||
55 | { | ||
56 | GNUNET_SCHEDULER_cancel (op_task); | ||
57 | op_task = NULL; | ||
58 | } | ||
59 | |||
60 | GNUNET_SCHEDULER_shutdown (); | ||
61 | status = 0; | ||
62 | } | ||
63 | |||
64 | |||
65 | static void | ||
66 | end_badly (void *cls) | ||
67 | { | ||
68 | fprintf (stderr, "Testcase failed (timeout).\n"); | ||
69 | |||
70 | end (NULL); | ||
71 | status = 1; | ||
72 | } | ||
73 | |||
74 | static void | ||
75 | end_operation (void *cls) | ||
76 | { | ||
77 | op_task = NULL; | ||
78 | |||
79 | fprintf (stderr, "Testcase failed (operation: '%s').\n", cls? (const char*) cls : "unknown"); | ||
80 | |||
81 | if (die_task) | ||
82 | GNUNET_SCHEDULER_cancel (die_task); | ||
83 | |||
84 | end (NULL); | ||
85 | status = 1; | ||
86 | } | ||
87 | |||
88 | static void | ||
89 | end_error (void *cls) | ||
90 | { | ||
91 | op_task = NULL; | ||
92 | |||
93 | fprintf (stderr, "Testcase failed (error: '%s').\n", cls? (const char*) cls : "unknown"); | ||
94 | GNUNET_free(cls); | ||
95 | |||
96 | if (die_task) | ||
97 | GNUNET_SCHEDULER_cancel (die_task); | ||
98 | |||
99 | end (NULL); | ||
100 | status = 1; | ||
101 | } | ||
102 | |||
103 | /** | ||
104 | * Function called whenever a message is received or sent. | ||
105 | * | ||
106 | * @param cls Closure | ||
107 | * @param room Room | ||
108 | * @param message Message | ||
109 | * @param hash Hash of message | ||
110 | */ | ||
111 | static void | ||
112 | on_message (void *cls, const struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Message *message, | ||
113 | const struct GNUNET_HashCode *hash) | ||
114 | { | ||
115 | // TODO | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * Function called when an identity is retrieved. | ||
120 | * | ||
121 | * @param cls Closure | ||
122 | * @param handle Handle of messenger service | ||
123 | */ | ||
124 | static void | ||
125 | on_identity (void *cls, struct GNUNET_MESSENGER_Handle *handle) | ||
126 | { | ||
127 | // TODO | ||
128 | } | ||
129 | |||
130 | static void | ||
131 | on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, | ||
132 | const struct GNUNET_TESTBED_PeerInformation *pinfo, | ||
133 | const char *emsg) | ||
134 | { | ||
135 | if (emsg) | ||
136 | { | ||
137 | op_task = GNUNET_SCHEDULER_add_now (&end_error, GNUNET_strdup(emsg)); | ||
138 | return; | ||
139 | } | ||
140 | |||
141 | if (pinfo->pit != GNUNET_TESTBED_PIT_CONFIGURATION) | ||
142 | { | ||
143 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "config"); | ||
144 | return; | ||
145 | } | ||
146 | |||
147 | struct GNUNET_MESSENGER_Handle *handle; | ||
148 | struct GNUNET_MESSENGER_Room *room; | ||
149 | |||
150 | fprintf (stderr, "MSG: connect\n"); | ||
151 | |||
152 | handle = GNUNET_MESSENGER_connect(pinfo->result.cfg, "tester", &on_identity, NULL, &on_message, NULL); | ||
153 | |||
154 | struct GNUNET_HashCode hash; | ||
155 | GNUNET_CRYPTO_hash("test", 4, &hash); | ||
156 | |||
157 | fprintf (stderr, "MSG: open\n"); | ||
158 | |||
159 | room = GNUNET_MESSENGER_open_room(handle, &hash); | ||
160 | |||
161 | fprintf (stderr, "MSG: close\n"); | ||
162 | |||
163 | GNUNET_MESSENGER_close_room(room); | ||
164 | |||
165 | fprintf (stderr, "MSG: disconnect\n"); | ||
166 | |||
167 | GNUNET_MESSENGER_disconnect(handle); | ||
168 | |||
169 | GNUNET_TESTBED_operation_done(op); | ||
170 | |||
171 | } | ||
172 | |||
173 | /** | ||
174 | * Main function for a peer of the testcase. | ||
175 | * | ||
176 | * @param cls Closure | ||
177 | * @param event Information about the event | ||
178 | */ | ||
179 | static void | ||
180 | run (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | ||
181 | { | ||
182 | if (GNUNET_TESTBED_ET_PEER_START != event->type) | ||
183 | { | ||
184 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "start"); | ||
185 | return; | ||
186 | } | ||
187 | |||
188 | GNUNET_TESTBED_peer_get_information(event->details.peer_start.peer, | ||
189 | GNUNET_TESTBED_PIT_CONFIGURATION, | ||
190 | on_peer, event->details.peer_start.peer); | ||
191 | |||
192 | fprintf (stderr, "MSG: barrier\n"); | ||
193 | |||
194 | GNUNET_TESTBED_barrier_wait("exit", NULL, NULL); | ||
195 | |||
196 | fprintf (stderr, "MSG: exit\n"); | ||
197 | } | ||
198 | |||
199 | static void | ||
200 | exit_status (void *cls, const char *name, | ||
201 | struct GNUNET_TESTBED_Barrier *barrier, | ||
202 | enum GNUNET_TESTBED_BarrierStatus status, | ||
203 | const char *emsg) | ||
204 | { | ||
205 | if (emsg) | ||
206 | { | ||
207 | op_task = GNUNET_SCHEDULER_add_now (&end_error, GNUNET_strdup(emsg)); | ||
208 | return; | ||
209 | } | ||
210 | |||
211 | if (GNUNET_TESTBED_BARRIERSTATUS_ERROR == status) | ||
212 | { | ||
213 | op_task = GNUNET_SCHEDULER_add_now (&end_operation, "exit"); | ||
214 | return; | ||
215 | } | ||
216 | else if (GNUNET_TESTBED_BARRIERSTATUS_CROSSED == status) | ||
217 | GNUNET_SCHEDULER_add_now(&end, NULL); | ||
218 | } | ||
219 | |||
220 | static void | ||
221 | init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, | ||
222 | struct GNUNET_TESTBED_Peer **peers, unsigned int links_succeeded, | ||
223 | unsigned int links_failed) | ||
224 | { | ||
225 | die_task = GNUNET_SCHEDULER_add_delayed (TOTAL_TIMEOUT, &end_badly, NULL); | ||
226 | |||
227 | struct GNUNET_TESTBED_Controller *controller; | ||
228 | |||
229 | controller = GNUNET_TESTBED_run_get_controller_handle(h); | ||
230 | |||
231 | GNUNET_TESTBED_barrier_init(controller, "exit", num_peers, exit_status, NULL); | ||
232 | } | ||
233 | |||
234 | /** | ||
235 | * The main function. | ||
236 | * | ||
237 | * @param argc number of arguments from the command line | ||
238 | * @param argv command line arguments | ||
239 | * @return 0 ok, 1 on error | ||
240 | */ | ||
241 | int | ||
242 | main(int argc, char **argv) | ||
243 | { | ||
244 | if (GNUNET_OK != GNUNET_TESTBED_test_run("test-messenger-comm0", | ||
245 | "test_messenger_api.conf", | ||
246 | 2, 0, | ||
247 | &run, NULL, | ||
248 | &init, NULL)) | ||
249 | return 1; | ||
250 | |||
251 | return status; | ||
252 | } | ||
diff --git a/src/messenger/test_messenger_growth.c b/src/messenger/test_messenger_growth.c new file mode 100644 index 000000000..3781f3ee5 --- /dev/null +++ b/src/messenger/test_messenger_growth.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_growth.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 }; | ||
39 | unsigned int stages [] = { 0x01, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 8; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_growth", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_ring.c b/src/messenger/test_messenger_ring.c new file mode 100644 index 000000000..07cfd0c47 --- /dev/null +++ b/src/messenger/test_messenger_ring.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_ring.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 8, 1, 2, 3, 4, 5, 6, 7 }; | ||
39 | unsigned int stages [] = { 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21, 0x21 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 8; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_ring", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_server.c b/src/messenger/test_messenger_server.c new file mode 100644 index 000000000..1cf2fcc27 --- /dev/null +++ b/src/messenger/test_messenger_server.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_server.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 0, 1, 1, 1, 1, 1, 1, 1 }; | ||
39 | unsigned int stages [] = { 0x01, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 8; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_server", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_sync_client.c b/src/messenger/test_messenger_sync_client.c new file mode 100644 index 000000000..99f26b018 --- /dev/null +++ b/src/messenger/test_messenger_sync_client.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_sync_client.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 0, 1 }; | ||
39 | unsigned int stages [] = { 0x01, 0x20 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 2; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_sync_client", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_sync_p2p.c b/src/messenger/test_messenger_sync_p2p.c new file mode 100644 index 000000000..77ce280a1 --- /dev/null +++ b/src/messenger/test_messenger_sync_p2p.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_sync_p2p.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 2, 1 }; | ||
39 | unsigned int stages [] = { 0x21, 0x21 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 2; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_sync_p2p", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_worst_client.c b/src/messenger/test_messenger_worst_client.c new file mode 100644 index 000000000..63826631c --- /dev/null +++ b/src/messenger/test_messenger_worst_client.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_worst_client.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 0, 1 }; | ||
39 | unsigned int stages [] = { 0x10, 0x02 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 2; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_worst_client", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/test_messenger_worst_p2p.c b/src/messenger/test_messenger_worst_p2p.c new file mode 100644 index 000000000..c89288eea --- /dev/null +++ b/src/messenger/test_messenger_worst_p2p.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/test_messenger_worst_p2p.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Test for the messenger service using cadet API. | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | /** | ||
29 | * The main function. | ||
30 | * | ||
31 | * @param argc number of arguments from the command line | ||
32 | * @param argv command line arguments | ||
33 | * @return 0 ok, 1 on error | ||
34 | */ | ||
35 | int | ||
36 | main (int argc, char **argv) | ||
37 | { | ||
38 | unsigned int doors [] = { 2, 1 }; | ||
39 | unsigned int stages [] = { 0x12, 0x12 }; | ||
40 | |||
41 | struct test_configuration cfg; | ||
42 | cfg.count = 2; | ||
43 | cfg.doors = doors; | ||
44 | cfg.stages = stages; | ||
45 | |||
46 | return GNUNET_run_messenger_setup ("test_messenger_worst_p2p", &cfg); | ||
47 | } | ||
diff --git a/src/messenger/testing_messenger_barrier.c b/src/messenger/testing_messenger_barrier.c new file mode 100644 index 000000000..618d255b7 --- /dev/null +++ b/src/messenger/testing_messenger_barrier.c | |||
@@ -0,0 +1,170 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/testing_messenger_barrier.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Pseudo-barriers for simple event handling | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_barrier.h" | ||
27 | |||
28 | struct GNUNET_BarrierHandle | ||
29 | { | ||
30 | unsigned int requirement; | ||
31 | GNUNET_BarrierStatusCallback cb; | ||
32 | void *cls; | ||
33 | |||
34 | struct GNUNET_BarrierWaitHandle *head; | ||
35 | struct GNUNET_BarrierWaitHandle *tail; | ||
36 | |||
37 | struct GNUNET_SCHEDULER_Task* task; | ||
38 | }; | ||
39 | |||
40 | struct GNUNET_BarrierHandle* | ||
41 | GNUNET_init_barrier (unsigned int requirement, | ||
42 | GNUNET_BarrierStatusCallback cb, | ||
43 | void *cb_cls) | ||
44 | { | ||
45 | if (0 == requirement) | ||
46 | return NULL; | ||
47 | |||
48 | struct GNUNET_BarrierHandle *barrier = GNUNET_new(struct GNUNET_BarrierHandle); | ||
49 | |||
50 | if (!barrier) | ||
51 | return NULL; | ||
52 | |||
53 | barrier->requirement = requirement; | ||
54 | barrier->cb = cb; | ||
55 | barrier->cls = cb_cls; | ||
56 | barrier->head = NULL; | ||
57 | barrier->tail = NULL; | ||
58 | barrier->task = NULL; | ||
59 | |||
60 | return barrier; | ||
61 | } | ||
62 | |||
63 | static void | ||
64 | exit_status (struct GNUNET_BarrierHandle *barrier, int status); | ||
65 | |||
66 | static void | ||
67 | cancel_barrier (void *cls) | ||
68 | { | ||
69 | exit_status ((struct GNUNET_BarrierHandle*) cls, GNUNET_SYSERR); | ||
70 | } | ||
71 | |||
72 | static void | ||
73 | complete_barrier (void *cls) | ||
74 | { | ||
75 | exit_status ((struct GNUNET_BarrierHandle*) cls, GNUNET_OK); | ||
76 | } | ||
77 | |||
78 | void | ||
79 | GNUNET_cancel_barrier (struct GNUNET_BarrierHandle *barrier) | ||
80 | { | ||
81 | if ((!barrier) || (barrier->task)) | ||
82 | return; | ||
83 | |||
84 | barrier->task = GNUNET_SCHEDULER_add_now(cancel_barrier, barrier); | ||
85 | } | ||
86 | |||
87 | struct GNUNET_BarrierWaitHandle | ||
88 | { | ||
89 | GNUNET_BarrierWaitStatusCallback cb; | ||
90 | void *cls; | ||
91 | |||
92 | struct GNUNET_BarrierWaitHandle *prev; | ||
93 | struct GNUNET_BarrierWaitHandle *next; | ||
94 | |||
95 | struct GNUNET_BarrierHandle *barrier; | ||
96 | }; | ||
97 | |||
98 | static void | ||
99 | exit_status (struct GNUNET_BarrierHandle *barrier, int status) | ||
100 | { | ||
101 | struct GNUNET_BarrierWaitHandle *waiting = barrier->head; | ||
102 | while (waiting) | ||
103 | { | ||
104 | struct GNUNET_BarrierWaitHandle *current = waiting; | ||
105 | |||
106 | if (current->cb) | ||
107 | current->cb(current->cls, current, status); | ||
108 | |||
109 | waiting = waiting->next; | ||
110 | |||
111 | GNUNET_CONTAINER_DLL_remove(barrier->head, barrier->tail, current); | ||
112 | GNUNET_free(current); | ||
113 | } | ||
114 | |||
115 | if (barrier->cb) | ||
116 | barrier->cb(barrier->cls, barrier, status); | ||
117 | |||
118 | GNUNET_free(barrier); | ||
119 | } | ||
120 | |||
121 | struct GNUNET_BarrierWaitHandle* | ||
122 | GNUNET_wait_barrier (struct GNUNET_BarrierHandle *barrier, | ||
123 | GNUNET_BarrierWaitStatusCallback cb, | ||
124 | void *cb_cls) | ||
125 | { | ||
126 | if ((!barrier) || (0 == barrier->requirement)) | ||
127 | return NULL; | ||
128 | |||
129 | struct GNUNET_BarrierWaitHandle *waiting = GNUNET_new(struct GNUNET_BarrierWaitHandle); | ||
130 | |||
131 | if (!waiting) | ||
132 | return NULL; | ||
133 | |||
134 | waiting->cb = cb; | ||
135 | waiting->cls = cb_cls; | ||
136 | waiting->prev = NULL; | ||
137 | waiting->next = NULL; | ||
138 | waiting->barrier = barrier; | ||
139 | |||
140 | GNUNET_CONTAINER_DLL_insert_tail(barrier->head, barrier->tail, waiting); | ||
141 | barrier->requirement--; | ||
142 | |||
143 | if ((barrier->requirement == 0) && (!barrier->task)) | ||
144 | barrier->task = GNUNET_SCHEDULER_add_now(complete_barrier, barrier); | ||
145 | |||
146 | return waiting; | ||
147 | } | ||
148 | |||
149 | void | ||
150 | GNUNET_cancel_wait_barrier (struct GNUNET_BarrierWaitHandle *waiting) | ||
151 | { | ||
152 | if (!waiting) | ||
153 | return; | ||
154 | |||
155 | struct GNUNET_BarrierHandle *barrier = waiting->barrier; | ||
156 | |||
157 | if (!barrier) | ||
158 | return; | ||
159 | |||
160 | if ((barrier->requirement == 0) && (barrier->task)) | ||
161 | { | ||
162 | GNUNET_SCHEDULER_cancel(barrier->task); | ||
163 | barrier->task = NULL; | ||
164 | } | ||
165 | |||
166 | barrier->requirement++; | ||
167 | GNUNET_CONTAINER_DLL_remove(barrier->head, barrier->tail, waiting); | ||
168 | |||
169 | GNUNET_free(waiting); | ||
170 | } | ||
diff --git a/src/messenger/testing_messenger_barrier.h b/src/messenger/testing_messenger_barrier.h new file mode 100644 index 000000000..3062a393a --- /dev/null +++ b/src/messenger/testing_messenger_barrier.h | |||
@@ -0,0 +1,131 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/testing_messenger_barrier.h | ||
22 | * @author Tobias Frisch | ||
23 | * @brief Pseudo-barriers for simple event handling | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_TESTING_MESSENGER_BARRIER_H_ | ||
27 | #define GNUNET_TESTING_MESSENGER_BARRIER_H_ | ||
28 | |||
29 | #include "platform.h" | ||
30 | #include "gnunet_util_lib.h" | ||
31 | |||
32 | /** | ||
33 | * Handle for pseudo-barrier | ||
34 | */ | ||
35 | struct GNUNET_BarrierHandle; | ||
36 | |||
37 | |||
38 | /** | ||
39 | * Functions of this type are to be given as callback argument to | ||
40 | * GNUNET_init_barrier(). The callback will be called when status | ||
41 | * information is available for the pseudo-barrier. | ||
42 | * | ||
43 | * @param cls the closure given to GNUNET_init_barrier() | ||
44 | * @param barrier the pseudo-barrier handle | ||
45 | * @param status status of the pseudo-barrier. The pseudo-barrier is removed | ||
46 | * once it has been crossed or an error occurs while processing it. | ||
47 | * Therefore it is invalid to call GNUNET_cancel_barrier() on a | ||
48 | * crossed or errored pseudo-barrier. | ||
49 | */ | ||
50 | typedef void | ||
51 | (*GNUNET_BarrierStatusCallback) (void *cls, | ||
52 | struct GNUNET_BarrierHandle *barrier, | ||
53 | int status); | ||
54 | |||
55 | |||
56 | /** | ||
57 | * Initialise a pseudo-barrier and call the given callback when the required | ||
58 | * amount of peers (requirement) reach the pseudo-barrier OR upon error. | ||
59 | * | ||
60 | * @param requirement the amount of peers that is required to reach the | ||
61 | * pseudo-barrier. Peers signal reaching a pseudo-barrier by calling | ||
62 | * GNUNET_wait_barrier(). | ||
63 | * @param cb the callback to call when the pseudo-barrier is reached or upon | ||
64 | * error. Can be NULL. | ||
65 | * @param cls closure for the above callback | ||
66 | * @return pseudo-barrier handle; NULL upon error | ||
67 | */ | ||
68 | struct GNUNET_BarrierHandle* | ||
69 | GNUNET_init_barrier (unsigned int requirement, | ||
70 | GNUNET_BarrierStatusCallback cb, | ||
71 | void *cb_cls); | ||
72 | |||
73 | |||
74 | /** | ||
75 | * Cancel a pseudo-barrier. | ||
76 | * | ||
77 | * @param barrier the pseudo-barrier handle | ||
78 | */ | ||
79 | void | ||
80 | GNUNET_cancel_barrier (struct GNUNET_BarrierHandle *barrier); | ||
81 | |||
82 | |||
83 | /** | ||
84 | * Handle for pseudo-barrier wait | ||
85 | */ | ||
86 | struct GNUNET_BarrierWaitHandle; | ||
87 | |||
88 | |||
89 | /** | ||
90 | * Functions of this type are to be given as acallback argument to | ||
91 | * GNUNET_wait_barrier(). The callback will be called when the pseudo-barrier | ||
92 | * corresponding given in GNUNET_wait_barrier() is crossed or cancelled. | ||
93 | * | ||
94 | * @param cls closure pointer given to GNUNET_wait_barrier() | ||
95 | * @param waiting the pseudo-barrier wait handle | ||
96 | * @param status #GNUNET_SYSERR in case of error while waiting for the | ||
97 | * pseudo-barrier; #GNUNET_OK if the pseudo-barrier is crossed | ||
98 | */ | ||
99 | typedef void | ||
100 | (*GNUNET_BarrierWaitStatusCallback) (void *cls, | ||
101 | struct GNUNET_BarrierWaitHandle *waiting, | ||
102 | int status); | ||
103 | |||
104 | |||
105 | /** | ||
106 | * Wait for a pseudo-barrier to be crossed. This function should be called for | ||
107 | * the peers which have been started by the testbed. | ||
108 | * | ||
109 | * @param barrier the pseudo-barrier handle | ||
110 | * @param cb the pseudo-barrier wait callback | ||
111 | * @param cls the closure for the above callback | ||
112 | * @return pseudo-barrier wait handle which can be used to cancel the waiting | ||
113 | * at anytime before the callback is called. NULL upon error. | ||
114 | */ | ||
115 | struct GNUNET_BarrierWaitHandle* | ||
116 | GNUNET_wait_barrier (struct GNUNET_BarrierHandle *barrier, | ||
117 | GNUNET_BarrierWaitStatusCallback cb, | ||
118 | void *cb_cls); | ||
119 | |||
120 | |||
121 | /** | ||
122 | * Cancel a pseudo-barrier wait handle. Should not be called in or after the | ||
123 | * callback given to GNUNET_wait_barrier() has been called. | ||
124 | * | ||
125 | * @param waiting the pseudo-barrier wait handle | ||
126 | */ | ||
127 | void | ||
128 | GNUNET_cancel_wait_barrier (struct GNUNET_BarrierWaitHandle *waiting); | ||
129 | |||
130 | |||
131 | #endif /* GNUNET_TESTING_MESSENGER_BARRIER_H_ */ | ||
diff --git a/src/messenger/testing_messenger_setup.c b/src/messenger/testing_messenger_setup.c new file mode 100644 index 000000000..98241fa08 --- /dev/null +++ b/src/messenger/testing_messenger_setup.c | |||
@@ -0,0 +1,528 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2020--2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/testing_messenger_barrier.c | ||
22 | * @author Tobias Frisch | ||
23 | * @brief A simple test-case setup for the messenger service | ||
24 | */ | ||
25 | |||
26 | #include "testing_messenger_setup.h" | ||
27 | |||
28 | #include <stdio.h> | ||
29 | #include "platform.h" | ||
30 | #include "gnunet_util_lib.h" | ||
31 | #include "gnunet_testbed_logger_service.h" | ||
32 | #include "gnunet_testbed_service.h" | ||
33 | #include "gnunet_testing_lib.h" | ||
34 | #include "gnunet_messenger_service.h" | ||
35 | #include "testing_messenger_barrier.h" | ||
36 | |||
37 | #define TEST_ROOM "test" | ||
38 | #define TEST_NAME "tester" | ||
39 | |||
40 | struct test_properties; | ||
41 | |||
42 | struct test_peer { | ||
43 | struct test_properties *props; | ||
44 | unsigned int num; | ||
45 | |||
46 | struct GNUNET_SCHEDULER_Task *op_task; | ||
47 | struct GNUNET_TESTBED_Operation *op; | ||
48 | |||
49 | struct GNUNET_TESTBED_Peer *peer; | ||
50 | struct GNUNET_PeerIdentity peer_id; | ||
51 | struct GNUNET_BarrierWaitHandle *wait; | ||
52 | |||
53 | struct GNUNET_MESSENGER_Handle *handle; | ||
54 | struct GNUNET_MESSENGER_Room *room; | ||
55 | |||
56 | unsigned int peer_messages; | ||
57 | |||
58 | const char *message; | ||
59 | }; | ||
60 | |||
61 | struct test_properties { | ||
62 | const struct test_configuration *cfg; | ||
63 | |||
64 | unsigned int num_hosts; | ||
65 | |||
66 | struct GNUNET_SCHEDULER_Task *die_task; | ||
67 | struct GNUNET_SCHEDULER_Task *end_task; | ||
68 | |||
69 | struct GNUNET_BarrierHandle *barrier; | ||
70 | |||
71 | struct test_peer *peers; | ||
72 | unsigned int num_peer; | ||
73 | |||
74 | int status; | ||
75 | }; | ||
76 | |||
77 | static void | ||
78 | shutdown_cb (void *cls) | ||
79 | { | ||
80 | struct test_properties *properties = cls; | ||
81 | |||
82 | |||
83 | for (unsigned int i = 0; i < properties->num_peer; i++) | ||
84 | { | ||
85 | struct test_peer *peer = &properties->peers[i]; | ||
86 | |||
87 | GNUNET_assert(peer != NULL); | ||
88 | |||
89 | if (peer->op_task) | ||
90 | GNUNET_SCHEDULER_cancel(peer->op_task); | ||
91 | |||
92 | peer->op_task = NULL; | ||
93 | |||
94 | if (peer->op) | ||
95 | GNUNET_TESTBED_operation_done (peer->op); | ||
96 | |||
97 | peer->op = NULL; | ||
98 | |||
99 | if (peer->wait) | ||
100 | GNUNET_cancel_wait_barrier(peer->wait); | ||
101 | |||
102 | peer->wait = NULL; | ||
103 | |||
104 | if (peer->room) | ||
105 | GNUNET_MESSENGER_close_room (peer->room); | ||
106 | |||
107 | peer->room = NULL; | ||
108 | |||
109 | if (peer->handle) | ||
110 | GNUNET_MESSENGER_disconnect (peer->handle); | ||
111 | |||
112 | peer->handle = NULL; | ||
113 | } | ||
114 | |||
115 | if (properties->die_task) | ||
116 | GNUNET_SCHEDULER_cancel(properties->die_task); | ||
117 | |||
118 | properties->die_task = NULL; | ||
119 | properties->end_task = NULL; | ||
120 | |||
121 | if (properties->barrier) | ||
122 | GNUNET_cancel_barrier(properties->barrier); | ||
123 | |||
124 | properties->barrier = NULL; | ||
125 | } | ||
126 | |||
127 | |||
128 | |||
129 | static void | ||
130 | end_cb (void *cls) | ||
131 | { | ||
132 | struct test_properties *properties = cls; | ||
133 | |||
134 | GNUNET_assert(properties != NULL); | ||
135 | |||
136 | properties->die_task = NULL; | ||
137 | |||
138 | int status = 0; | ||
139 | |||
140 | for (unsigned int i = 0; i < properties->num_peer; i++) | ||
141 | { | ||
142 | struct test_peer *peer = &properties->peers[i]; | ||
143 | |||
144 | GNUNET_assert(peer != NULL); | ||
145 | |||
146 | const int members = GNUNET_MESSENGER_iterate_members(peer->room, NULL, NULL); | ||
147 | |||
148 | GNUNET_assert (members >= 0); | ||
149 | |||
150 | if (peer->props->num_peer != (unsigned int) members) | ||
151 | { | ||
152 | fprintf (stderr, "Testcase failed (members: %d/%u).\n", members, peer->props->num_peer); | ||
153 | status = 1; | ||
154 | break; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | GNUNET_SCHEDULER_shutdown (); | ||
159 | |||
160 | properties->status = status; | ||
161 | } | ||
162 | |||
163 | static void | ||
164 | end_badly_cb (void *cls) | ||
165 | { | ||
166 | struct test_properties *properties = cls; | ||
167 | |||
168 | GNUNET_assert(properties != NULL); | ||
169 | |||
170 | fprintf (stderr, "Testcase failed (timeout).\n"); | ||
171 | |||
172 | end_cb (properties); | ||
173 | |||
174 | properties->status = 1; | ||
175 | } | ||
176 | |||
177 | static void | ||
178 | end_operation_cb (void *cls) | ||
179 | { | ||
180 | struct test_peer *peer = cls; | ||
181 | |||
182 | GNUNET_assert(peer != NULL); | ||
183 | |||
184 | peer->op_task = NULL; | ||
185 | |||
186 | fprintf (stderr, "Testcase failed (operation: '%s').\n", peer->message); | ||
187 | |||
188 | GNUNET_SCHEDULER_shutdown (); | ||
189 | } | ||
190 | |||
191 | static void | ||
192 | end_error_cb (void *cls) | ||
193 | { | ||
194 | struct test_peer *peer = cls; | ||
195 | |||
196 | GNUNET_assert(peer != NULL); | ||
197 | |||
198 | peer->op_task = NULL; | ||
199 | |||
200 | fprintf (stderr, "Testcase failed (error: '%s').\n", peer->message); | ||
201 | GNUNET_free (peer); | ||
202 | |||
203 | GNUNET_SCHEDULER_shutdown (); | ||
204 | } | ||
205 | |||
206 | static void | ||
207 | barrier2_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) | ||
208 | { | ||
209 | struct test_peer *peer = cls; | ||
210 | |||
211 | GNUNET_assert(peer != NULL); | ||
212 | |||
213 | if (peer->wait == waiting) | ||
214 | peer->wait = NULL; | ||
215 | } | ||
216 | |||
217 | static void | ||
218 | barrier_wait_cb (void *cls, struct GNUNET_BarrierWaitHandle *waiting, int status) | ||
219 | { | ||
220 | struct test_peer *peer = cls; | ||
221 | |||
222 | GNUNET_assert(peer != NULL); | ||
223 | |||
224 | if (peer->wait == waiting) | ||
225 | peer->wait = NULL; | ||
226 | |||
227 | if (0 != (peer->props->cfg->stages[peer->num - 1] & 0x02)) | ||
228 | { | ||
229 | unsigned int door = peer->props->cfg->doors[peer->num - 1]; | ||
230 | |||
231 | if (door == 0) | ||
232 | door = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, peer->props->cfg->count); | ||
233 | else | ||
234 | door = door - 1; | ||
235 | |||
236 | struct GNUNET_HashCode hash; | ||
237 | GNUNET_CRYPTO_hash (TEST_ROOM, sizeof(TEST_ROOM), &hash); | ||
238 | |||
239 | struct GNUNET_MESSENGER_Room *room; | ||
240 | room = GNUNET_MESSENGER_enter_room(peer->handle, &(peer->props->peers[door].peer_id), &hash); | ||
241 | |||
242 | if (peer->room) | ||
243 | GNUNET_assert(room == peer->room); | ||
244 | else | ||
245 | GNUNET_assert(room != NULL); | ||
246 | |||
247 | peer->room = room; | ||
248 | } | ||
249 | } | ||
250 | |||
251 | /** | ||
252 | * Function called whenever a message is received or sent. | ||
253 | * | ||
254 | * @param cls Closure | ||
255 | * @param room Room | ||
256 | * @param sender Sender | ||
257 | * @param message Message | ||
258 | * @param hash Hash of message | ||
259 | * @param flags Flags of message | ||
260 | */ | ||
261 | static void | ||
262 | on_message (void *cls, struct GNUNET_MESSENGER_Room *room, const struct GNUNET_MESSENGER_Contact *sender, | ||
263 | const struct GNUNET_MESSENGER_Message *message, const struct GNUNET_HashCode *hash, | ||
264 | enum GNUNET_MESSENGER_MessageFlags flags) | ||
265 | { | ||
266 | struct test_peer *peer = cls; | ||
267 | |||
268 | GNUNET_assert(peer != NULL); | ||
269 | |||
270 | fprintf (stderr, "Peer: %s; [%s] Message: %s (%s)\n", | ||
271 | GNUNET_i2s(&(peer->peer_id)), | ||
272 | GNUNET_sh2s(&(message->header.sender_id)), | ||
273 | GNUNET_MESSENGER_name_of_kind(message->header.kind), | ||
274 | GNUNET_h2s(hash)); | ||
275 | |||
276 | if (GNUNET_MESSENGER_KIND_PEER == message->header.kind) | ||
277 | peer->peer_messages++; | ||
278 | |||
279 | if (peer->props->num_hosts == peer->peer_messages) | ||
280 | peer->wait = GNUNET_wait_barrier (peer->props->barrier, &barrier2_wait_cb, peer); | ||
281 | else if (peer->props->num_hosts < peer->peer_messages) | ||
282 | { | ||
283 | if (peer->wait) | ||
284 | GNUNET_cancel_wait_barrier(peer->wait); | ||
285 | |||
286 | peer->wait = NULL; | ||
287 | |||
288 | if (peer->op_task) | ||
289 | GNUNET_SCHEDULER_cancel(peer->op_task); | ||
290 | |||
291 | peer->message = "peer"; | ||
292 | peer->op_task = GNUNET_SCHEDULER_add_now (&end_operation_cb, peer); | ||
293 | } | ||
294 | } | ||
295 | |||
296 | static void | ||
297 | second_stage (void *cls) | ||
298 | { | ||
299 | struct test_peer *peer = cls; | ||
300 | |||
301 | GNUNET_assert(peer != NULL); | ||
302 | |||
303 | peer->op_task = NULL; | ||
304 | |||
305 | struct GNUNET_HashCode hash; | ||
306 | GNUNET_CRYPTO_hash (TEST_ROOM, sizeof(TEST_ROOM), &hash); | ||
307 | |||
308 | if (0 != (peer->props->cfg->stages[peer->num - 1] & 0x10)) | ||
309 | { | ||
310 | struct GNUNET_MESSENGER_Room *room; | ||
311 | room = GNUNET_MESSENGER_open_room (peer->handle, &hash); | ||
312 | |||
313 | if (peer->room) | ||
314 | GNUNET_assert(room == peer->room); | ||
315 | else | ||
316 | GNUNET_assert(room != NULL); | ||
317 | |||
318 | peer->room = room; | ||
319 | } | ||
320 | |||
321 | if (0 != (peer->props->cfg->stages[peer->num - 1] & 0x20)) | ||
322 | { | ||
323 | unsigned int door = peer->props->cfg->doors[peer->num - 1]; | ||
324 | |||
325 | if (door == 0) | ||
326 | door = GNUNET_CRYPTO_random_u32(GNUNET_CRYPTO_QUALITY_WEAK, peer->props->cfg->count); | ||
327 | else | ||
328 | door = door - 1; | ||
329 | |||
330 | struct GNUNET_MESSENGER_Room *room; | ||
331 | room = GNUNET_MESSENGER_enter_room(peer->handle, &(peer->props->peers[door].peer_id), &hash); | ||
332 | |||
333 | if (peer->room) | ||
334 | GNUNET_assert(room == peer->room); | ||
335 | else | ||
336 | GNUNET_assert(room != NULL); | ||
337 | |||
338 | peer->room = room; | ||
339 | } | ||
340 | } | ||
341 | |||
342 | static void | ||
343 | on_peer (void *cb_cls, struct GNUNET_TESTBED_Operation *op, const struct GNUNET_TESTBED_PeerInformation *pinfo, | ||
344 | const char *emsg) | ||
345 | { | ||
346 | struct test_peer *peer = cb_cls; | ||
347 | |||
348 | GNUNET_assert(peer != NULL); | ||
349 | |||
350 | if (emsg) | ||
351 | { | ||
352 | peer->message = GNUNET_strdup(emsg); | ||
353 | peer->op_task = GNUNET_SCHEDULER_add_now (&end_error_cb, peer); | ||
354 | return; | ||
355 | } | ||
356 | |||
357 | if (!pinfo) | ||
358 | { | ||
359 | peer->message = "info"; | ||
360 | peer->op_task = GNUNET_SCHEDULER_add_now (&end_operation_cb, peer); | ||
361 | return; | ||
362 | } | ||
363 | |||
364 | if (pinfo->pit != GNUNET_TESTBED_PIT_CONFIGURATION) | ||
365 | { | ||
366 | peer->message = "config"; | ||
367 | peer->op_task = GNUNET_SCHEDULER_add_now (&end_operation_cb, peer); | ||
368 | return; | ||
369 | } | ||
370 | |||
371 | peer->handle = GNUNET_MESSENGER_connect (pinfo->result.cfg, TEST_NAME, NULL, NULL, &on_message, peer); | ||
372 | |||
373 | GNUNET_assert(GNUNET_OK == GNUNET_CRYPTO_get_peer_identity( | ||
374 | pinfo->result.cfg, &(peer->peer_id) | ||
375 | )); | ||
376 | |||
377 | if (0 != (peer->props->cfg->stages[peer->num - 1] & 0x01)) | ||
378 | { | ||
379 | struct GNUNET_HashCode hash; | ||
380 | GNUNET_CRYPTO_hash (TEST_ROOM, sizeof(TEST_ROOM), &hash); | ||
381 | |||
382 | peer->room = GNUNET_MESSENGER_open_room (peer->handle, &hash); | ||
383 | |||
384 | GNUNET_assert(peer->room != NULL); | ||
385 | } | ||
386 | else | ||
387 | peer->room = NULL; | ||
388 | |||
389 | peer->wait = GNUNET_wait_barrier (peer->props->barrier, &barrier_wait_cb, peer); | ||
390 | } | ||
391 | |||
392 | /** | ||
393 | * Main function for a peer of the testcase. | ||
394 | * | ||
395 | * @param cls Closure | ||
396 | * @param event Information about the event | ||
397 | */ | ||
398 | static void | ||
399 | run (void *cls, const struct GNUNET_TESTBED_EventInformation *event) | ||
400 | { | ||
401 | struct test_properties *properties = cls; | ||
402 | |||
403 | GNUNET_assert(properties != NULL); | ||
404 | |||
405 | if (GNUNET_TESTBED_ET_PEER_START != event->type) | ||
406 | { | ||
407 | fprintf (stderr, "Testcase failed (operation: 'start').\n"); | ||
408 | |||
409 | GNUNET_SCHEDULER_shutdown (); | ||
410 | return; | ||
411 | } | ||
412 | |||
413 | struct test_peer *peer = &(properties->peers[properties->num_peer++]); | ||
414 | |||
415 | peer->props = properties; | ||
416 | peer->num = properties->num_peer; | ||
417 | |||
418 | peer->peer = event->details.peer_start.peer; | ||
419 | peer->op = GNUNET_TESTBED_peer_get_information (peer->peer, GNUNET_TESTBED_PIT_CONFIGURATION, on_peer, peer); | ||
420 | } | ||
421 | |||
422 | static void | ||
423 | barrier2_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) | ||
424 | { | ||
425 | struct test_properties *properties = cls; | ||
426 | |||
427 | GNUNET_assert(properties != NULL); | ||
428 | |||
429 | if (properties->barrier == barrier) | ||
430 | properties->barrier = NULL; | ||
431 | |||
432 | if (GNUNET_SYSERR == status) | ||
433 | { | ||
434 | fprintf (stderr, "Testcase failed (operation: 'barrier2').\n"); | ||
435 | |||
436 | GNUNET_SCHEDULER_shutdown (); | ||
437 | return; | ||
438 | } | ||
439 | else if (GNUNET_OK == status) | ||
440 | { | ||
441 | if (properties->die_task) | ||
442 | GNUNET_SCHEDULER_cancel(properties->die_task); | ||
443 | |||
444 | properties->die_task = GNUNET_SCHEDULER_add_delayed ( | ||
445 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, properties->cfg->count), | ||
446 | &end_cb, properties | ||
447 | ); | ||
448 | } | ||
449 | } | ||
450 | |||
451 | static void | ||
452 | barrier_cb (void *cls, struct GNUNET_BarrierHandle *barrier, int status) | ||
453 | { | ||
454 | struct test_properties *properties = cls; | ||
455 | |||
456 | GNUNET_assert(properties != NULL); | ||
457 | |||
458 | if (properties->barrier == barrier) | ||
459 | properties->barrier = NULL; | ||
460 | else if (!properties->barrier) | ||
461 | return; | ||
462 | |||
463 | if (properties->num_peer != properties->cfg->count) | ||
464 | { | ||
465 | fprintf (stderr, "Testcase failed (operation: 'process').\n"); | ||
466 | |||
467 | GNUNET_SCHEDULER_shutdown (); | ||
468 | return; | ||
469 | } | ||
470 | |||
471 | if (GNUNET_SYSERR == status) | ||
472 | { | ||
473 | fprintf (stderr, "Testcase failed (operation: 'barrier').\n"); | ||
474 | |||
475 | GNUNET_SCHEDULER_shutdown (); | ||
476 | return; | ||
477 | } | ||
478 | else if (GNUNET_OK == status) | ||
479 | { | ||
480 | properties->barrier = GNUNET_init_barrier (properties->num_peer, &barrier2_cb, properties); | ||
481 | |||
482 | for (unsigned int i = 0; i < properties->num_peer; i++) | ||
483 | properties->peers[i].op_task = GNUNET_SCHEDULER_add_now (&second_stage, &(properties->peers[i])); | ||
484 | } | ||
485 | } | ||
486 | |||
487 | static void | ||
488 | init (void *cls, struct GNUNET_TESTBED_RunHandle *h, unsigned int num_peers, struct GNUNET_TESTBED_Peer **peers, | ||
489 | unsigned int links_succeeded, unsigned int links_failed) | ||
490 | { | ||
491 | struct test_properties *properties = cls; | ||
492 | |||
493 | GNUNET_assert(properties != NULL); | ||
494 | |||
495 | properties->end_task = GNUNET_SCHEDULER_add_shutdown(&shutdown_cb, properties); | ||
496 | properties->die_task = GNUNET_SCHEDULER_add_delayed ( | ||
497 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, properties->cfg->count * 5), | ||
498 | &end_badly_cb, properties | ||
499 | ); | ||
500 | } | ||
501 | |||
502 | int | ||
503 | GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg) | ||
504 | { | ||
505 | struct test_properties properties; | ||
506 | memset(&properties, 0, sizeof(properties)); | ||
507 | |||
508 | properties.cfg = cfg; | ||
509 | properties.peers = GNUNET_new_array(cfg->count, struct test_peer); | ||
510 | |||
511 | for (unsigned int i = 0; i < cfg->count; i++) | ||
512 | if (0 != (cfg->stages[i] & 0x11)) | ||
513 | properties.num_hosts++; | ||
514 | |||
515 | properties.status = 1; | ||
516 | properties.barrier = GNUNET_init_barrier (cfg->count, &barrier_cb, &properties); | ||
517 | |||
518 | if (GNUNET_OK != GNUNET_TESTBED_test_run (test_name, "test_messenger_api.conf", | ||
519 | cfg->count, | ||
520 | (1LL << GNUNET_TESTBED_ET_PEER_START), | ||
521 | &run, &properties, | ||
522 | &init, &properties)) | ||
523 | return 1; | ||
524 | |||
525 | GNUNET_free(properties.peers); | ||
526 | |||
527 | return properties.status; | ||
528 | } | ||
diff --git a/src/messenger/testing_messenger_setup.h b/src/messenger/testing_messenger_setup.h new file mode 100644 index 000000000..5e6b5d461 --- /dev/null +++ b/src/messenger/testing_messenger_setup.h | |||
@@ -0,0 +1,39 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | /** | ||
21 | * @file messenger/testing_messenger_setup.h | ||
22 | * @author Tobias Frisch | ||
23 | * @brief A simple test-case setup for the messenger service | ||
24 | */ | ||
25 | |||
26 | #ifndef GNUNET_TESTING_MESSENGER_SETUP_H_ | ||
27 | #define GNUNET_TESTING_MESSENGER_SETUP_H_ | ||
28 | |||
29 | struct test_configuration | ||
30 | { | ||
31 | unsigned int count; | ||
32 | unsigned int *doors; | ||
33 | unsigned int *stages; | ||
34 | }; | ||
35 | |||
36 | int | ||
37 | GNUNET_run_messenger_setup (const char* test_name, const struct test_configuration *cfg); | ||
38 | |||
39 | #endif /* GNUNET_TESTING_MESSENGER_SETUP_H_ */ | ||
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index d6774b37b..79210939f 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -743,13 +743,14 @@ send_lookup_response (struct NamestoreClient *nc, | |||
743 | nick->flags = | 743 | nick->flags = |
744 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; | 744 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; |
745 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); | 745 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); |
746 | GNUNET_free (nick); | ||
747 | } | 746 | } |
748 | else | 747 | else |
749 | { | 748 | { |
750 | res_count = rd_count; | 749 | res_count = rd_count; |
751 | res = (struct GNUNET_GNSRECORD_Data *) rd; | 750 | res = (struct GNUNET_GNSRECORD_Data *) rd; |
752 | } | 751 | } |
752 | if (NULL != nick) | ||
753 | GNUNET_free (nick); | ||
753 | 754 | ||
754 | GNUNET_assert (-1 != GNUNET_GNSRECORD_records_get_size (res_count, res)); | 755 | GNUNET_assert (-1 != GNUNET_GNSRECORD_records_get_size (res_count, res)); |
755 | 756 | ||
@@ -758,12 +759,16 @@ send_lookup_response (struct NamestoreClient *nc, | |||
758 | rd_ser_len = GNUNET_GNSRECORD_records_get_size (res_count, res); | 759 | rd_ser_len = GNUNET_GNSRECORD_records_get_size (res_count, res); |
759 | if (rd_ser_len < 0) | 760 | if (rd_ser_len < 0) |
760 | { | 761 | { |
762 | if (rd != res) | ||
763 | GNUNET_free (res); | ||
761 | GNUNET_break (0); | 764 | GNUNET_break (0); |
762 | GNUNET_SERVICE_client_drop (nc->client); | 765 | GNUNET_SERVICE_client_drop (nc->client); |
763 | return; | 766 | return; |
764 | } | 767 | } |
765 | if (((size_t) rd_ser_len) >= UINT16_MAX - name_len - sizeof(*zir_msg)) | 768 | if (((size_t) rd_ser_len) >= UINT16_MAX - name_len - sizeof(*zir_msg)) |
766 | { | 769 | { |
770 | if (rd != res) | ||
771 | GNUNET_free (res); | ||
767 | GNUNET_break (0); | 772 | GNUNET_break (0); |
768 | GNUNET_SERVICE_client_drop (nc->client); | 773 | GNUNET_SERVICE_client_drop (nc->client); |
769 | return; | 774 | return; |
@@ -920,12 +925,15 @@ refresh_block (struct NamestoreClient *nc, | |||
920 | nick->flags = | 925 | nick->flags = |
921 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; | 926 | (nick->flags | GNUNET_GNSRECORD_RF_PRIVATE) ^ GNUNET_GNSRECORD_RF_PRIVATE; |
922 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); | 927 | merge_with_nick_records (nick, rd_count, rd, &res_count, &res); |
923 | GNUNET_free (nick); | ||
924 | } | 928 | } |
929 | if (NULL != nick) | ||
930 | GNUNET_free (nick); | ||
925 | if (0 == res_count) | 931 | if (0 == res_count) |
926 | { | 932 | { |
927 | if (NULL != nc) | 933 | if (NULL != nc) |
928 | send_store_response (nc, GNUNET_OK, rid); | 934 | send_store_response (nc, GNUNET_OK, rid); |
935 | if (rd != res) | ||
936 | GNUNET_free (res); | ||
929 | return; /* no data, no need to update cache */ | 937 | return; /* no data, no need to update cache */ |
930 | } | 938 | } |
931 | if (GNUNET_YES == disable_namecache) | 939 | if (GNUNET_YES == disable_namecache) |
@@ -936,6 +944,8 @@ refresh_block (struct NamestoreClient *nc, | |||
936 | GNUNET_NO); | 944 | GNUNET_NO); |
937 | if (NULL != nc) | 945 | if (NULL != nc) |
938 | send_store_response (nc, GNUNET_OK, rid); | 946 | send_store_response (nc, GNUNET_OK, rid); |
947 | if (rd != res) | ||
948 | GNUNET_free (res); | ||
939 | return; | 949 | return; |
940 | } | 950 | } |
941 | exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count, res); | 951 | exp_time = GNUNET_GNSRECORD_record_get_expiration_time (res_count, res); |
@@ -970,6 +980,8 @@ refresh_block (struct NamestoreClient *nc, | |||
970 | &finish_cache_operation, | 980 | &finish_cache_operation, |
971 | cop); | 981 | cop); |
972 | GNUNET_free (block); | 982 | GNUNET_free (block); |
983 | if (rd != res) | ||
984 | GNUNET_free (res); | ||
973 | } | 985 | } |
974 | 986 | ||
975 | 987 | ||
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index c845b5019..2d5327e06 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -690,6 +690,12 @@ handle_zone_to_name_response (void *cls, | |||
690 | 690 | ||
691 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_TO_NAME_RESPONSE\n"); | 691 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received ZONE_TO_NAME_RESPONSE\n"); |
692 | qe = find_qe (h, ntohl (msg->gns_header.r_id)); | 692 | qe = find_qe (h, ntohl (msg->gns_header.r_id)); |
693 | if (NULL == qe) | ||
694 | { | ||
695 | LOG (GNUNET_ERROR_TYPE_WARNING, | ||
696 | "Response queue already gone...\n"); | ||
697 | return; | ||
698 | } | ||
693 | res = ntohs (msg->res); | 699 | res = ntohs (msg->res); |
694 | switch (res) | 700 | switch (res) |
695 | { | 701 | { |
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index edcbeb874..ae93e5eff 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c | |||
@@ -375,6 +375,8 @@ get_egoentry_namestore (struct RequestHandle *handle, char *name) | |||
375 | if (NULL == name) | 375 | if (NULL == name) |
376 | return NULL; | 376 | return NULL; |
377 | tmp = strtok (copy, "/"); | 377 | tmp = strtok (copy, "/"); |
378 | if (NULL == tmp) | ||
379 | return NULL; | ||
378 | for (ego_entry = ego_head; NULL != ego_entry; | 380 | for (ego_entry = ego_head; NULL != ego_entry; |
379 | ego_entry = ego_entry->next) | 381 | ego_entry = ego_entry->next) |
380 | { | 382 | { |
diff --git a/src/peerinfo-tool/plugin_rest_peerinfo.c b/src/peerinfo-tool/plugin_rest_peerinfo.c index 4bbc7442e..f969a175b 100644 --- a/src/peerinfo-tool/plugin_rest_peerinfo.c +++ b/src/peerinfo-tool/plugin_rest_peerinfo.c | |||
@@ -379,7 +379,9 @@ peerinfo_list_finished (void *cls) | |||
379 | result_str = json_dumps (handle->response, 0); | 379 | result_str = json_dumps (handle->response, 0); |
380 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); | 380 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); |
381 | resp = GNUNET_REST_create_response (result_str); | 381 | resp = GNUNET_REST_create_response (result_str); |
382 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 382 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
383 | "Content-Type", | ||
384 | "application/json")); | ||
383 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 385 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
384 | GNUNET_free (result_str); | 386 | GNUNET_free (result_str); |
385 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 387 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); |
diff --git a/src/peerstore/gnunet-service-peerstore.c b/src/peerstore/gnunet-service-peerstore.c index c92e4d3f0..959d088f9 100644 --- a/src/peerstore/gnunet-service-peerstore.c +++ b/src/peerstore/gnunet-service-peerstore.c | |||
@@ -77,6 +77,8 @@ static unsigned int num_clients; | |||
77 | static void | 77 | static void |
78 | do_shutdown () | 78 | do_shutdown () |
79 | { | 79 | { |
80 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
81 | "Shutting down peerstore, bye.\n"); | ||
80 | if (NULL != db_lib_name) | 82 | if (NULL != db_lib_name) |
81 | { | 83 | { |
82 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, db)); | 84 | GNUNET_break (NULL == GNUNET_PLUGIN_unload (db_lib_name, db)); |
@@ -105,6 +107,8 @@ do_shutdown () | |||
105 | static void | 107 | static void |
106 | shutdown_task (void *cls) | 108 | shutdown_task (void *cls) |
107 | { | 109 | { |
110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
111 | "Priming PEERSTORE for shutdown.\n"); | ||
108 | in_shutdown = GNUNET_YES; | 112 | in_shutdown = GNUNET_YES; |
109 | if (0 == num_clients) /* Only when no connected clients. */ | 113 | if (0 == num_clients) /* Only when no connected clients. */ |
110 | do_shutdown (); | 114 | do_shutdown (); |
@@ -176,6 +180,8 @@ client_connect_cb (void *cls, | |||
176 | struct GNUNET_MQ_Handle *mq) | 180 | struct GNUNET_MQ_Handle *mq) |
177 | { | 181 | { |
178 | num_clients++; | 182 | num_clients++; |
183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
184 | "A client connected (now %u)\n", num_clients); | ||
179 | return client; | 185 | return client; |
180 | } | 186 | } |
181 | 187 | ||
@@ -195,7 +201,7 @@ client_disconnect_it (void *cls, const struct GNUNET_HashCode *key, void *value) | |||
195 | { | 201 | { |
196 | GNUNET_assert (GNUNET_YES == | 202 | GNUNET_assert (GNUNET_YES == |
197 | GNUNET_CONTAINER_multihashmap_remove (watchers, key, value)); | 203 | GNUNET_CONTAINER_multihashmap_remove (watchers, key, value)); |
198 | num_clients++; | 204 | num_clients++; /* Watchers do not count */ |
199 | } | 205 | } |
200 | return GNUNET_OK; | 206 | return GNUNET_OK; |
201 | } | 207 | } |
@@ -212,12 +218,14 @@ client_disconnect_cb (void *cls, | |||
212 | struct GNUNET_SERVICE_Client *client, | 218 | struct GNUNET_SERVICE_Client *client, |
213 | void *app_cls) | 219 | void *app_cls) |
214 | { | 220 | { |
215 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "A client disconnected, cleaning up.\n"); | 221 | num_clients--; |
216 | if (NULL != watchers) | 222 | if (NULL != watchers) |
217 | GNUNET_CONTAINER_multihashmap_iterate (watchers, | 223 | GNUNET_CONTAINER_multihashmap_iterate (watchers, |
218 | &client_disconnect_it, | 224 | &client_disconnect_it, |
219 | client); | 225 | client); |
220 | num_clients--; | 226 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
227 | "A client disconnected (%u remaining).\n", | ||
228 | num_clients); | ||
221 | if ((0 == num_clients) && in_shutdown) | 229 | if ((0 == num_clients) && in_shutdown) |
222 | do_shutdown (); | 230 | do_shutdown (); |
223 | } | 231 | } |
@@ -540,6 +548,7 @@ run (void *cls, | |||
540 | char *database; | 548 | char *database; |
541 | 549 | ||
542 | in_shutdown = GNUNET_NO; | 550 | in_shutdown = GNUNET_NO; |
551 | num_clients = 0; | ||
543 | cfg = c; | 552 | cfg = c; |
544 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, | 553 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_string (cfg, |
545 | "peerstore", | 554 | "peerstore", |
diff --git a/src/peerstore/peerstore_api.c b/src/peerstore/peerstore_api.c index db5aee0d5..196d44faa 100644 --- a/src/peerstore/peerstore_api.c +++ b/src/peerstore/peerstore_api.c | |||
@@ -823,7 +823,12 @@ reconnect (void *cls) | |||
823 | &handle_client_error, | 823 | &handle_client_error, |
824 | h); | 824 | h); |
825 | if (NULL == h->mq) | 825 | if (NULL == h->mq) |
826 | { | ||
827 | h->reconnect_task = | ||
828 | GNUNET_SCHEDULER_add_delayed (h->reconnect_delay, &reconnect, h); | ||
829 | h->reconnect_delay = GNUNET_TIME_STD_BACKOFF (h->reconnect_delay); | ||
826 | return; | 830 | return; |
831 | } | ||
827 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 832 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
828 | "Resending pending requests after reconnect.\n"); | 833 | "Resending pending requests after reconnect.\n"); |
829 | if (NULL != h->watches) | 834 | if (NULL != h->watches) |
diff --git a/src/peerstore/test_peerstore_api_sync.c b/src/peerstore/test_peerstore_api_sync.c index 4c826c654..5057c98b5 100644 --- a/src/peerstore/test_peerstore_api_sync.c +++ b/src/peerstore/test_peerstore_api_sync.c | |||
@@ -67,6 +67,24 @@ static const char *val = "test_peerstore_api_store_val"; | |||
67 | 67 | ||
68 | 68 | ||
69 | /** | 69 | /** |
70 | * Timeout | ||
71 | */ | ||
72 | #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10) | ||
73 | |||
74 | /** | ||
75 | * Timeout task | ||
76 | */ | ||
77 | static struct GNUNET_SCHEDULER_Task *to; | ||
78 | |||
79 | /** | ||
80 | * Iterate handle | ||
81 | */ | ||
82 | static struct GNUNET_PEERSTORE_IterateContext *it; | ||
83 | |||
84 | static void | ||
85 | test_cont (void *cls); | ||
86 | |||
87 | /** | ||
70 | * Function that should be called with the result of the | 88 | * Function that should be called with the result of the |
71 | * lookup, and finally once with NULL to signal the end | 89 | * lookup, and finally once with NULL to signal the end |
72 | * of the iteration. | 90 | * of the iteration. |
@@ -89,9 +107,24 @@ iterate_cb (void *cls, | |||
89 | GNUNET_break (NULL == emsg); | 107 | GNUNET_break (NULL == emsg); |
90 | if (NULL == record) | 108 | if (NULL == record) |
91 | { | 109 | { |
92 | GNUNET_PEERSTORE_disconnect (h, | 110 | it = NULL; |
93 | GNUNET_NO); | 111 | if (0 == ok) |
94 | GNUNET_SCHEDULER_shutdown (); | 112 | { |
113 | GNUNET_PEERSTORE_disconnect (h, | ||
114 | GNUNET_NO); | ||
115 | if (NULL != to) | ||
116 | { | ||
117 | GNUNET_SCHEDULER_cancel (to); | ||
118 | to = NULL; | ||
119 | } | ||
120 | GNUNET_SCHEDULER_shutdown (); | ||
121 | return; | ||
122 | } | ||
123 | /** | ||
124 | * Try again | ||
125 | */ | ||
126 | GNUNET_SCHEDULER_add_now (&test_cont, | ||
127 | NULL); | ||
95 | return; | 128 | return; |
96 | } | 129 | } |
97 | rec_val = record->value; | 130 | rec_val = record->value; |
@@ -100,6 +133,22 @@ iterate_cb (void *cls, | |||
100 | } | 133 | } |
101 | 134 | ||
102 | 135 | ||
136 | static void | ||
137 | timeout_task (void *cls) | ||
138 | { | ||
139 | to = NULL; | ||
140 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
141 | "Timeout reached\n"); | ||
142 | if (NULL != it) | ||
143 | GNUNET_PEERSTORE_iterate_cancel (it); | ||
144 | it = NULL; | ||
145 | GNUNET_PEERSTORE_disconnect (h, | ||
146 | GNUNET_NO); | ||
147 | GNUNET_SCHEDULER_shutdown (); | ||
148 | return; | ||
149 | } | ||
150 | |||
151 | |||
103 | /** | 152 | /** |
104 | * Run the 2nd stage of the test where we fetch the | 153 | * Run the 2nd stage of the test where we fetch the |
105 | * data that should have been stored. | 154 | * data that should have been stored. |
@@ -109,12 +158,11 @@ iterate_cb (void *cls, | |||
109 | static void | 158 | static void |
110 | test_cont (void *cls) | 159 | test_cont (void *cls) |
111 | { | 160 | { |
112 | h = GNUNET_PEERSTORE_connect (cfg); | 161 | it = GNUNET_PEERSTORE_iterate (h, |
113 | GNUNET_PEERSTORE_iterate (h, | 162 | subsystem, |
114 | subsystem, | 163 | &pid, key, |
115 | &pid, key, | 164 | &iterate_cb, |
116 | &iterate_cb, | 165 | NULL); |
117 | NULL); | ||
118 | } | 166 | } |
119 | 167 | ||
120 | 168 | ||
@@ -122,10 +170,9 @@ static void | |||
122 | disc_cont (void *cls) | 170 | disc_cont (void *cls) |
123 | { | 171 | { |
124 | GNUNET_PEERSTORE_disconnect (h, GNUNET_YES); | 172 | GNUNET_PEERSTORE_disconnect (h, GNUNET_YES); |
125 | h = NULL; | 173 | h = GNUNET_PEERSTORE_connect (cfg); |
126 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 174 | GNUNET_SCHEDULER_add_now (&test_cont, |
127 | &test_cont, | 175 | NULL); |
128 | NULL); | ||
129 | } | 176 | } |
130 | 177 | ||
131 | 178 | ||
@@ -133,12 +180,17 @@ static void | |||
133 | store_cont (void *cls, int success) | 180 | store_cont (void *cls, int success) |
134 | { | 181 | { |
135 | ok = success; | 182 | ok = success; |
183 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
184 | "Success: %s\n", | ||
185 | (GNUNET_SYSERR == ok) ? "no" : "yes"); | ||
136 | /* We need to wait a little bit to give the disconnect | 186 | /* We need to wait a little bit to give the disconnect |
137 | a chance to actually finish the operation; otherwise, | 187 | a chance to actually finish the operation; otherwise, |
138 | the test may fail non-deterministically if the new | 188 | the test may fail non-deterministically if the new |
139 | connection is faster than the cleanup routine of the | 189 | connection is faster than the cleanup routine of the |
140 | old one. */GNUNET_SCHEDULER_add_now (&disc_cont, | 190 | old one. */ |
141 | NULL); | 191 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
192 | &disc_cont, | ||
193 | NULL); | ||
142 | } | 194 | } |
143 | 195 | ||
144 | 196 | ||
@@ -174,7 +226,10 @@ run (void *cls, | |||
174 | { | 226 | { |
175 | cfg = c; | 227 | cfg = c; |
176 | memset (&pid, 1, sizeof(pid)); | 228 | memset (&pid, 1, sizeof(pid)); |
177 | test1 (); | 229 | to = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
230 | &timeout_task, | ||
231 | NULL); | ||
232 | GNUNET_SCHEDULER_add_now (&test1, NULL); | ||
178 | } | 233 | } |
179 | 234 | ||
180 | 235 | ||
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 913b667b7..04c12735b 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -731,9 +731,12 @@ static int | |||
731 | check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) | 731 | check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) |
732 | { | 732 | { |
733 | uint16_t size; | 733 | uint16_t size; |
734 | size_t attrs_len; | ||
734 | 735 | ||
735 | size = ntohs (im->header.size); | 736 | size = ntohs (im->header.size); |
736 | if (size <= sizeof(struct IssueTicketMessage)) | 737 | attrs_len = ntohs (im->attr_len); |
738 | |||
739 | if (attrs_len > size - sizeof(struct IssueTicketMessage)) | ||
737 | { | 740 | { |
738 | GNUNET_break (0); | 741 | GNUNET_break (0); |
739 | return GNUNET_SYSERR; | 742 | return GNUNET_SYSERR; |
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c index ef2303bd7..48b3fe214 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.c +++ b/src/reclaim/gnunet-service-reclaim_tickets.c | |||
@@ -690,7 +690,10 @@ rvk_move_attr_cb (void *cls, | |||
690 | return; | 690 | return; |
691 | } | 691 | } |
692 | GNUNET_RECLAIM_id_generate (&rvk->move_attr->new_id); | 692 | GNUNET_RECLAIM_id_generate (&rvk->move_attr->new_id); |
693 | new_label = NULL; | 693 | new_label = |
694 | GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, | ||
695 | sizeof (rvk->move_attr->new_id)); | ||
696 | |||
694 | attr_data = NULL; | 697 | attr_data = NULL; |
695 | // new_rd = *rd; | 698 | // new_rd = *rd; |
696 | for (int i = 0; i < rd_count; i++) | 699 | for (int i = 0; i < rd_count; i++) |
@@ -714,9 +717,6 @@ rvk_move_attr_cb (void *cls, | |||
714 | new_rd[i].record_type = rd[i].record_type; | 717 | new_rd[i].record_type = rd[i].record_type; |
715 | new_rd[i].flags = rd[i].flags; | 718 | new_rd[i].flags = rd[i].flags; |
716 | new_rd[i].expiration_time = rd[i].expiration_time; | 719 | new_rd[i].expiration_time = rd[i].expiration_time; |
717 | new_label = | ||
718 | GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, | ||
719 | sizeof (rvk->move_attr->new_id)); | ||
720 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); | 720 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); |
721 | GNUNET_free (claim); | 721 | GNUNET_free (claim); |
722 | } | 722 | } |
@@ -738,9 +738,6 @@ rvk_move_attr_cb (void *cls, | |||
738 | new_rd[i].record_type = rd[i].record_type; | 738 | new_rd[i].record_type = rd[i].record_type; |
739 | new_rd[i].flags = rd[i].flags; | 739 | new_rd[i].flags = rd[i].flags; |
740 | new_rd[i].expiration_time = rd[i].expiration_time; | 740 | new_rd[i].expiration_time = rd[i].expiration_time; |
741 | new_label = | ||
742 | GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id, | ||
743 | sizeof (rvk->move_attr->new_id)); | ||
744 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential %s\n", | 741 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding credential %s\n", |
745 | new_label); | 742 | new_label); |
746 | GNUNET_free (credential); | 743 | GNUNET_free (credential); |
@@ -1400,7 +1397,7 @@ issue_ticket (struct TicketIssueHandle *ih) | |||
1400 | attrs_record, | 1397 | attrs_record, |
1401 | &store_ticket_issue_cont, | 1398 | &store_ticket_issue_cont, |
1402 | ih); | 1399 | ih); |
1403 | for (j = 0; j > i; j++) | 1400 | for (j = 0; j < i; j++) |
1404 | { | 1401 | { |
1405 | if (attrs_record[j].record_type | 1402 | if (attrs_record[j].record_type |
1406 | != GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION) | 1403 | != GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION) |
@@ -1585,7 +1582,7 @@ filter_tickets_cb (void *cls, | |||
1585 | cleanup_issue_handle (tih); | 1582 | cleanup_issue_handle (tih); |
1586 | return; | 1583 | return; |
1587 | } | 1584 | } |
1588 | 1585 | GNUNET_RECLAIM_presentation_list_destroy (ticket_presentations); | |
1589 | // ticket not found in current record, checking next record set | 1586 | // ticket not found in current record, checking next record set |
1590 | GNUNET_NAMESTORE_zone_iterator_next (tih->ns_it, 1); | 1587 | GNUNET_NAMESTORE_zone_iterator_next (tih->ns_it, 1); |
1591 | } | 1588 | } |
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c index bd3a8ee05..7b24ee598 100644 --- a/src/reclaim/oidc_helper.c +++ b/src/reclaim/oidc_helper.c | |||
@@ -839,11 +839,17 @@ int | |||
839 | OIDC_access_token_parse (const char *token, | 839 | OIDC_access_token_parse (const char *token, |
840 | struct GNUNET_RECLAIM_Ticket **ticket) | 840 | struct GNUNET_RECLAIM_Ticket **ticket) |
841 | { | 841 | { |
842 | if (sizeof (struct GNUNET_RECLAIM_Ticket) != | 842 | size_t sret; |
843 | GNUNET_STRINGS_base64_decode (token, | 843 | char *decoded; |
844 | strlen (token), | 844 | sret = GNUNET_STRINGS_base64_decode (token, |
845 | (void**) ticket)) | 845 | strlen (token), |
846 | (void**) &decoded); | ||
847 | if (sizeof (struct GNUNET_RECLAIM_Ticket) != sret) | ||
848 | { | ||
849 | GNUNET_free (decoded); | ||
846 | return GNUNET_SYSERR; | 850 | return GNUNET_SYSERR; |
851 | } | ||
852 | *ticket = (struct GNUNET_RECLAIM_Ticket *) decoded; | ||
847 | return GNUNET_OK; | 853 | return GNUNET_OK; |
848 | } | 854 | } |
849 | 855 | ||
diff --git a/src/reclaim/pabc_helper.c b/src/reclaim/pabc_helper.c index e76977d03..c435ad5b3 100644 --- a/src/reclaim/pabc_helper.c +++ b/src/reclaim/pabc_helper.c | |||
@@ -29,7 +29,8 @@ write_file (char const *const filename, const char *buffer) | |||
29 | struct GNUNET_DISK_FileHandle *fh; | 29 | struct GNUNET_DISK_FileHandle *fh; |
30 | fh = GNUNET_DISK_file_open (filename, | 30 | fh = GNUNET_DISK_file_open (filename, |
31 | GNUNET_DISK_OPEN_WRITE | 31 | GNUNET_DISK_OPEN_WRITE |
32 | | GNUNET_DISK_OPEN_TRUNCATE, | 32 | | GNUNET_DISK_OPEN_TRUNCATE |
33 | | GNUNET_DISK_OPEN_CREATE, | ||
33 | GNUNET_DISK_PERM_USER_WRITE); | 34 | GNUNET_DISK_PERM_USER_WRITE); |
34 | if (fh == NULL) | 35 | if (fh == NULL) |
35 | return GNUNET_SYSERR; | 36 | return GNUNET_SYSERR; |
diff --git a/src/reclaim/plugin_gnsrecord_reclaim.c b/src/reclaim/plugin_gnsrecord_reclaim.c index 60c49fd6a..9e4f0a5c4 100644 --- a/src/reclaim/plugin_gnsrecord_reclaim.c +++ b/src/reclaim/plugin_gnsrecord_reclaim.c | |||
@@ -50,7 +50,6 @@ value_to_string (void *cls, uint32_t type, const void *data, size_t data_size) | |||
50 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE: | 50 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE: |
51 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF: | 51 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF: |
52 | case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: | 52 | case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: |
53 | case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: | ||
54 | case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL: | 53 | case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL: |
55 | case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: | 54 | case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: |
56 | return GNUNET_STRINGS_data_to_string_alloc (data, data_size); | 55 | return GNUNET_STRINGS_data_to_string_alloc (data, data_size); |
@@ -87,7 +86,6 @@ string_to_value (void *cls, uint32_t type, const char *s, void **data, | |||
87 | return GNUNET_OK; | 86 | return GNUNET_OK; |
88 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE: | 87 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE: |
89 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF: | 88 | case GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF: |
90 | case GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER: | ||
91 | case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: | 89 | case GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET: |
92 | case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL: | 90 | case GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL: |
93 | case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: | 91 | case GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION: |
@@ -112,7 +110,6 @@ static struct | |||
112 | { "RECLAIM_ATTRIBUTE_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF }, | 110 | { "RECLAIM_ATTRIBUTE_REF", GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE_REF }, |
113 | { "RECLAIM_CREDENTIAL", GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL }, | 111 | { "RECLAIM_CREDENTIAL", GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL }, |
114 | { "RECLAIM_PRESENTATION", GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION }, | 112 | { "RECLAIM_PRESENTATION", GNUNET_GNSRECORD_TYPE_RECLAIM_PRESENTATION }, |
115 | { "RECLAIM_MASTER", GNUNET_GNSRECORD_TYPE_RECLAIM_MASTER }, | ||
116 | { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT }, | 113 | { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT }, |
117 | { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT }, | 114 | { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT }, |
118 | { "RECLAIM_TICKET", GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET }, | 115 | { "RECLAIM_TICKET", GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET }, |
diff --git a/src/reclaim/plugin_reclaim_credential_pabc.c b/src/reclaim/plugin_reclaim_credential_pabc.c index 148cfec13..87406e60b 100644 --- a/src/reclaim/plugin_reclaim_credential_pabc.c +++ b/src/reclaim/plugin_reclaim_credential_pabc.c | |||
@@ -144,6 +144,22 @@ pabc_number_to_typename (void *cls, uint32_t type) | |||
144 | } | 144 | } |
145 | 145 | ||
146 | 146 | ||
147 | static void | ||
148 | inspect_attrs (char const *const key, | ||
149 | char const *const value, | ||
150 | void *ctx) | ||
151 | { | ||
152 | struct GNUNET_RECLAIM_AttributeList *attrs = ctx; | ||
153 | |||
154 | GNUNET_RECLAIM_attribute_list_add (attrs, | ||
155 | key, | ||
156 | NULL, | ||
157 | GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, | ||
158 | value, | ||
159 | strlen (value)); | ||
160 | } | ||
161 | |||
162 | |||
147 | /** | 163 | /** |
148 | * Parse a pabc and return the respective claim value as Attribute | 164 | * Parse a pabc and return the respective claim value as Attribute |
149 | * | 165 | * |
@@ -156,14 +172,9 @@ pabc_parse_attributes (void *cls, | |||
156 | const char *data, | 172 | const char *data, |
157 | size_t data_size) | 173 | size_t data_size) |
158 | { | 174 | { |
159 | const char *key; | ||
160 | struct GNUNET_RECLAIM_AttributeList *attrs; | 175 | struct GNUNET_RECLAIM_AttributeList *attrs; |
161 | char *val_str = NULL; | ||
162 | char *tmp; | ||
163 | json_t *value; | ||
164 | json_t *attr; | ||
165 | json_t *json_attrs; | ||
166 | json_t *json_root; | 176 | json_t *json_root; |
177 | json_t *json_attrs; | ||
167 | json_error_t *json_err = NULL; | 178 | json_error_t *json_err = NULL; |
168 | 179 | ||
169 | json_root = json_loads (data, JSON_DECODE_ANY, json_err); | 180 | json_root = json_loads (data, JSON_DECODE_ANY, json_err); |
@@ -177,55 +188,20 @@ pabc_parse_attributes (void *cls, | |||
177 | json_decref (json_root); | 188 | json_decref (json_root); |
178 | return NULL; | 189 | return NULL; |
179 | } | 190 | } |
180 | json_attrs = json_object_get (json_root, "attributes"); | 191 | json_attrs = json_object_get (json_root, PABC_JSON_PLAIN_ATTRS_KEY); |
181 | if ((NULL == json_attrs) || | 192 | if ((NULL == json_attrs) || |
182 | (! json_is_array (json_attrs))) | 193 | (! json_is_object (json_attrs))) |
183 | { | 194 | { |
184 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 195 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
185 | "%s is not a valid pabc credentials (attributes not an array)\n", | 196 | "%s is not a valid pabc credentials (attributes not an object)\n", |
186 | data); | 197 | data); |
187 | json_decref (json_root); | 198 | json_decref (json_root); |
188 | return NULL; | 199 | return NULL; |
189 | } | 200 | } |
190 | 201 | ||
191 | attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 202 | attrs = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
192 | for (int i = 0; i < json_array_size (json_attrs); i++) | 203 | char *attr_str = json_dumps (json_attrs, JSON_DECODE_ANY); |
193 | { | 204 | pabc_cred_inspect_credential (attr_str, &inspect_attrs, attrs); |
194 | attr = json_array_get (json_attrs, i); | ||
195 | if (! json_is_object (attr)) | ||
196 | { | ||
197 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
198 | "Found json entry is not an object!\n"); | ||
199 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | ||
200 | json_decref (json_root); | ||
201 | return NULL; | ||
202 | } | ||
203 | /** | ||
204 | * This *should* only contain a single pair. | ||
205 | */ | ||
206 | json_object_foreach (attr, key, value) | ||
207 | { | ||
208 | if ((0 == strcmp ("issuer", key)) || | ||
209 | (0 == strcmp ("expiration", key)) || | ||
210 | (0 == strcmp ("subject", key))) | ||
211 | continue; | ||
212 | val_str = json_dumps (value, JSON_ENCODE_ANY); | ||
213 | tmp = val_str; | ||
214 | // Remove leading " from jasson conversion | ||
215 | if (tmp[0] == '"') | ||
216 | tmp++; | ||
217 | // Remove trailing " from jansson conversion | ||
218 | if (tmp[strlen (tmp) - 1] == '"') | ||
219 | tmp[strlen (tmp) - 1] = '\0'; | ||
220 | GNUNET_RECLAIM_attribute_list_add (attrs, | ||
221 | key, | ||
222 | NULL, | ||
223 | GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, | ||
224 | tmp, | ||
225 | strlen (tmp)); | ||
226 | GNUNET_free (val_str); | ||
227 | } | ||
228 | } | ||
229 | json_decref (json_root); | 205 | json_decref (json_root); |
230 | return attrs; | 206 | return attrs; |
231 | } | 207 | } |
@@ -260,6 +236,22 @@ pabc_parse_attributes_p (void *cls, | |||
260 | return pabc_parse_attributes (cls, cred->data, cred->data_size); | 236 | return pabc_parse_attributes (cls, cred->data, cred->data_size); |
261 | } | 237 | } |
262 | 238 | ||
239 | struct Finder | ||
240 | { | ||
241 | const char* target; | ||
242 | char *result; | ||
243 | }; | ||
244 | |||
245 | static void | ||
246 | find_attr (char const *const key, | ||
247 | char const *const value, | ||
248 | void *ctx) | ||
249 | { | ||
250 | struct Finder *fdr = ctx; | ||
251 | if (0 == strcmp (key, fdr->target)) | ||
252 | fdr->result = GNUNET_strdup (value); | ||
253 | } | ||
254 | |||
263 | 255 | ||
264 | /** | 256 | /** |
265 | * Parse a pabc and return an attribute value. | 257 | * Parse a pabc and return an attribute value. |
@@ -267,7 +259,7 @@ pabc_parse_attributes_p (void *cls, | |||
267 | * @param cls the plugin | 259 | * @param cls the plugin |
268 | * @param data the pabc credential data | 260 | * @param data the pabc credential data |
269 | * @param data_size the pabc credential size | 261 | * @param data_size the pabc credential size |
270 | * @param key the attribute key to look for. | 262 | * @param skey the attribute key to look for. |
271 | * @return a string, containing the isser | 263 | * @return a string, containing the isser |
272 | */ | 264 | */ |
273 | char * | 265 | char * |
@@ -276,13 +268,8 @@ pabc_get_attribute (void *cls, | |||
276 | size_t data_size, | 268 | size_t data_size, |
277 | const char *skey) | 269 | const char *skey) |
278 | { | 270 | { |
279 | const char *key; | ||
280 | char *val_str = NULL; | ||
281 | char *tmp; | ||
282 | json_t *json_root; | 271 | json_t *json_root; |
283 | json_t *json_attrs; | 272 | json_t *json_attrs; |
284 | json_t *value; | ||
285 | json_t *attr; | ||
286 | json_error_t *json_err = NULL; | 273 | json_error_t *json_err = NULL; |
287 | 274 | ||
288 | json_root = json_loads (data, JSON_DECODE_ANY, json_err); | 275 | json_root = json_loads (data, JSON_DECODE_ANY, json_err); |
@@ -290,50 +277,29 @@ pabc_get_attribute (void *cls, | |||
290 | (! json_is_object (json_root))) | 277 | (! json_is_object (json_root))) |
291 | { | 278 | { |
292 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 279 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
293 | "%s is not a valid pabc credentials (not an object)\n", | 280 | "%s is not a valid pabc credential (not an object)\n", |
294 | data); | 281 | data); |
295 | if (NULL != json_root) | 282 | if (NULL != json_root) |
296 | json_decref (json_root); | 283 | json_decref (json_root); |
297 | return NULL; | 284 | return NULL; |
298 | } | 285 | } |
299 | json_attrs = json_object_get (json_root, "attributes"); | 286 | json_attrs = json_object_get (json_root, PABC_JSON_PLAIN_ATTRS_KEY); |
300 | if ((NULL == json_attrs) || | 287 | if ((NULL == json_attrs) || |
301 | (! json_is_array (json_attrs))) | 288 | (! json_is_object (json_attrs))) |
302 | { | 289 | { |
303 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 290 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
304 | "%s is not a valid pabc credentials (attributes not an array)\n", | 291 | "%s is not a valid pabc credential (attributes not an object)\n", |
305 | data); | 292 | data); |
306 | json_decref (json_root); | 293 | json_decref (json_root); |
307 | return NULL; | 294 | return NULL; |
308 | } | 295 | } |
309 | 296 | char *attr_str = json_dumps (json_attrs, JSON_DECODE_ANY); | |
310 | for (int i = 0; i < json_array_size (json_attrs); i++) | ||
311 | { | ||
312 | attr = json_array_get (json_attrs, i); | ||
313 | if (! json_is_object (attr)) | ||
314 | continue; | ||
315 | /** | ||
316 | * This *should* only contain a single pair. | ||
317 | */ | ||
318 | json_object_foreach (attr, key, value) | ||
319 | { | ||
320 | if (0 != strcmp (skey, key)) | ||
321 | continue; | ||
322 | val_str = json_dumps (value, JSON_ENCODE_ANY); | ||
323 | tmp = val_str; | ||
324 | // Remove leading " from jasson conversion | ||
325 | if (tmp[0] == '"') | ||
326 | tmp++; | ||
327 | // Remove trailing " from jansson conversion | ||
328 | if (tmp[strlen (tmp) - 1] == '"') | ||
329 | tmp[strlen (tmp) - 1] = '\0'; | ||
330 | GNUNET_free (val_str); | ||
331 | json_decref (json_root); | ||
332 | return tmp; | ||
333 | } | ||
334 | } | ||
335 | json_decref (json_root); | 297 | json_decref (json_root); |
336 | return NULL; | 298 | struct Finder fdr; |
299 | memset (&fdr, 0, sizeof (fdr)); | ||
300 | fdr.target = skey; | ||
301 | pabc_cred_inspect_credential (attr_str, &find_attr, &fdr); | ||
302 | return fdr.result; | ||
337 | } | 303 | } |
338 | 304 | ||
339 | 305 | ||
@@ -403,9 +369,8 @@ pabc_get_expiration (void *cls, | |||
403 | json_t *json_root; | 369 | json_t *json_root; |
404 | json_t *json_attrs; | 370 | json_t *json_attrs; |
405 | json_t *value; | 371 | json_t *value; |
406 | json_t *attr; | 372 | json_t *exp_j; |
407 | json_error_t *json_err = NULL; | 373 | json_error_t *json_err = NULL; |
408 | const char*key; | ||
409 | 374 | ||
410 | json_root = json_loads (data, JSON_DECODE_ANY, json_err); | 375 | json_root = json_loads (data, JSON_DECODE_ANY, json_err); |
411 | if ((NULL == json_root) || | 376 | if ((NULL == json_root) || |
@@ -418,24 +383,23 @@ pabc_get_expiration (void *cls, | |||
418 | json_decref (json_root); | 383 | json_decref (json_root); |
419 | return GNUNET_SYSERR; | 384 | return GNUNET_SYSERR; |
420 | } | 385 | } |
421 | for (int i = 0; i < json_array_size (json_attrs); i++) | 386 | json_attrs = json_object_get (json_root, PABC_JSON_PLAIN_ATTRS_KEY); |
387 | if ((NULL == json_attrs) || | ||
388 | (! json_is_object (json_attrs))) | ||
422 | { | 389 | { |
423 | attr = json_array_get (json_attrs, i); | 390 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
424 | if (! json_is_object (attr)) | 391 | "%s is not a valid pabc credential (attributes not an object)\n", |
425 | continue; | 392 | data); |
426 | /** | 393 | json_decref (json_root); |
427 | * This *should* only contain a single pair. | 394 | return GNUNET_SYSERR; |
428 | */ | 395 | } |
429 | json_object_foreach (attr, key, value) | 396 | exp_j = json_object_get (json_attrs, "expiration"); |
430 | { | 397 | if ((NULL != exp_j) && |
431 | if (0 != strcmp ("expiration", key)) | 398 | json_is_integer (exp_j)) |
432 | continue; | 399 | { |
433 | if (! json_is_integer (value)) | 400 | exp->abs_value_us = json_integer_value (value) * 1000 * 1000; |
434 | continue; | 401 | json_decref (json_root); |
435 | exp->abs_value_us = json_integer_value (value) * 1000 * 1000; | 402 | return GNUNET_OK; |
436 | json_decref (json_root); | ||
437 | return GNUNET_OK; | ||
438 | } | ||
439 | } | 403 | } |
440 | json_decref (json_root); | 404 | json_decref (json_root); |
441 | return GNUNET_SYSERR; | 405 | return GNUNET_SYSERR; |
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c index 0ee61755b..c6259d745 100644 --- a/src/reclaim/plugin_rest_openid_connect.c +++ b/src/reclaim/plugin_rest_openid_connect.c | |||
@@ -686,7 +686,10 @@ do_userinfo_error (void *cls) | |||
686 | handle->emsg, | 686 | handle->emsg, |
687 | (NULL != handle->edesc) ? handle->edesc : ""); | 687 | (NULL != handle->edesc) ? handle->edesc : ""); |
688 | resp = GNUNET_REST_create_response (""); | 688 | resp = GNUNET_REST_create_response (""); |
689 | MHD_add_response_header (resp, MHD_HTTP_HEADER_WWW_AUTHENTICATE, "Bearer"); | 689 | GNUNET_assert (MHD_NO != |
690 | MHD_add_response_header (resp, | ||
691 | MHD_HTTP_HEADER_WWW_AUTHENTICATE, | ||
692 | "Bearer")); | ||
690 | handle->proc (handle->proc_cls, resp, handle->response_code); | 693 | handle->proc (handle->proc_cls, resp, handle->response_code); |
691 | cleanup_handle (handle); | 694 | cleanup_handle (handle); |
692 | GNUNET_free (error); | 695 | GNUNET_free (error); |
@@ -713,7 +716,8 @@ do_redirect_error (void *cls) | |||
713 | (NULL != handle->oidc->state) ? "&state=" : "", | 716 | (NULL != handle->oidc->state) ? "&state=" : "", |
714 | (NULL != handle->oidc->state) ? handle->oidc->state : ""); | 717 | (NULL != handle->oidc->state) ? handle->oidc->state : ""); |
715 | resp = GNUNET_REST_create_response (""); | 718 | resp = GNUNET_REST_create_response (""); |
716 | MHD_add_response_header (resp, "Location", redirect); | 719 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
720 | "Location", redirect)); | ||
717 | handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND); | 721 | handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND); |
718 | cleanup_handle (handle); | 722 | cleanup_handle (handle); |
719 | GNUNET_free (redirect); | 723 | GNUNET_free (redirect); |
@@ -1022,7 +1026,8 @@ oidc_ticket_issue_cb (void *cls, | |||
1022 | handle->oidc->state); | 1026 | handle->oidc->state); |
1023 | } | 1027 | } |
1024 | resp = GNUNET_REST_create_response (""); | 1028 | resp = GNUNET_REST_create_response (""); |
1025 | MHD_add_response_header (resp, "Location", redirect_uri); | 1029 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
1030 | "Location", redirect_uri)); | ||
1026 | handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND); | 1031 | handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND); |
1027 | cleanup_handle (handle); | 1032 | cleanup_handle (handle); |
1028 | GNUNET_free (redirect_uri); | 1033 | GNUNET_free (redirect_uri); |
@@ -1381,7 +1386,8 @@ build_redirect (void *cls) | |||
1381 | handle->oidc->state); | 1386 | handle->oidc->state); |
1382 | } | 1387 | } |
1383 | resp = GNUNET_REST_create_response (""); | 1388 | resp = GNUNET_REST_create_response (""); |
1384 | MHD_add_response_header (resp, "Location", redirect_uri); | 1389 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
1390 | "Location", redirect_uri)); | ||
1385 | handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND); | 1391 | handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND); |
1386 | cleanup_handle (handle); | 1392 | cleanup_handle (handle); |
1387 | GNUNET_free (redirect_uri); | 1393 | GNUNET_free (redirect_uri); |
@@ -1764,8 +1770,12 @@ login_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1764 | "%s;Max-Age=%d", | 1770 | "%s;Max-Age=%d", |
1765 | cookie, | 1771 | cookie, |
1766 | OIDC_COOKIE_EXPIRATION); | 1772 | OIDC_COOKIE_EXPIRATION); |
1767 | MHD_add_response_header (resp, "Set-Cookie", header_val); | 1773 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
1768 | MHD_add_response_header (resp, "Access-Control-Allow-Methods", "POST"); | 1774 | "Set-Cookie", header_val)); |
1775 | GNUNET_assert (MHD_NO != | ||
1776 | MHD_add_response_header (resp, | ||
1777 | "Access-Control-Allow-Methods", | ||
1778 | "POST")); | ||
1769 | GNUNET_CRYPTO_hash (cookie, strlen (cookie), &cache_key); | 1779 | GNUNET_CRYPTO_hash (cookie, strlen (cookie), &cache_key); |
1770 | 1780 | ||
1771 | if (0 != strcmp (json_string_value (identity), "Denied")) | 1781 | if (0 != strcmp (json_string_value (identity), "Denied")) |
@@ -1880,7 +1890,8 @@ parse_credentials_post_body (struct RequestHandle *handle, | |||
1880 | } | 1890 | } |
1881 | pass = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, | 1891 | pass = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map, |
1882 | &cache_key); | 1892 | &cache_key); |
1883 | if (NULL == pass) { | 1893 | if (NULL == pass) |
1894 | { | ||
1884 | GNUNET_free (*client_id); | 1895 | GNUNET_free (*client_id); |
1885 | *client_id = NULL; | 1896 | *client_id = NULL; |
1886 | return GNUNET_SYSERR; | 1897 | return GNUNET_SYSERR; |
@@ -2134,6 +2145,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2134 | GNUNET_free (code); | 2145 | GNUNET_free (code); |
2135 | if (NULL != nonce) | 2146 | if (NULL != nonce) |
2136 | GNUNET_free (nonce); | 2147 | GNUNET_free (nonce); |
2148 | GNUNET_RECLAIM_attribute_list_destroy (cl); | ||
2149 | GNUNET_RECLAIM_presentation_list_destroy (pl); | ||
2137 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 2150 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
2138 | return; | 2151 | return; |
2139 | } | 2152 | } |
@@ -2149,6 +2162,8 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2149 | handle->edesc = GNUNET_strdup ("No signing secret configured!"); | 2162 | handle->edesc = GNUNET_strdup ("No signing secret configured!"); |
2150 | handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; | 2163 | handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; |
2151 | GNUNET_free (code); | 2164 | GNUNET_free (code); |
2165 | GNUNET_RECLAIM_attribute_list_destroy (cl); | ||
2166 | GNUNET_RECLAIM_presentation_list_destroy (pl); | ||
2152 | if (NULL != nonce) | 2167 | if (NULL != nonce) |
2153 | GNUNET_free (nonce); | 2168 | GNUNET_free (nonce); |
2154 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 2169 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
@@ -2191,9 +2206,14 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
2191 | &json_response); | 2206 | &json_response); |
2192 | 2207 | ||
2193 | resp = GNUNET_REST_create_response (json_response); | 2208 | resp = GNUNET_REST_create_response (json_response); |
2194 | MHD_add_response_header (resp, "Cache-Control", "no-store"); | 2209 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
2195 | MHD_add_response_header (resp, "Pragma", "no-cache"); | 2210 | "Cache-Control", |
2196 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 2211 | "no-store")); |
2212 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, | ||
2213 | "Pragma", "no-cache")); | ||
2214 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, | ||
2215 | "Content-Type", | ||
2216 | "application/json")); | ||
2197 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 2217 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
2198 | GNUNET_RECLAIM_attribute_list_destroy (cl); | 2218 | GNUNET_RECLAIM_attribute_list_destroy (cl); |
2199 | GNUNET_RECLAIM_presentation_list_destroy (pl); | 2219 | GNUNET_RECLAIM_presentation_list_destroy (pl); |
@@ -2665,8 +2685,14 @@ oidc_config_cors (struct GNUNET_REST_RequestHandle *con_handle, | |||
2665 | 2685 | ||
2666 | // For now, independent of path return all options | 2686 | // For now, independent of path return all options |
2667 | resp = GNUNET_REST_create_response (NULL); | 2687 | resp = GNUNET_REST_create_response (NULL); |
2668 | MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods); | 2688 | GNUNET_assert (MHD_NO != |
2669 | MHD_add_response_header (resp, "Access-Control-Allow-Origin", "*"); | 2689 | MHD_add_response_header (resp, |
2690 | "Access-Control-Allow-Methods", | ||
2691 | allow_methods)); | ||
2692 | GNUNET_assert (MHD_NO != | ||
2693 | MHD_add_response_header (resp, | ||
2694 | "Access-Control-Allow-Origin", | ||
2695 | "*")); | ||
2670 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 2696 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
2671 | cleanup_handle (handle); | 2697 | cleanup_handle (handle); |
2672 | return; | 2698 | return; |
diff --git a/src/reclaim/plugin_rest_pabc.c b/src/reclaim/plugin_rest_pabc.c index 1c766a716..9c1ac3c47 100644 --- a/src/reclaim/plugin_rest_pabc.c +++ b/src/reclaim/plugin_rest_pabc.c | |||
@@ -264,9 +264,8 @@ set_attributes_from_idtoken (const struct pabc_context *ctx, | |||
264 | json_string_value (value)); | 264 | json_string_value (value)); |
265 | if (PABC_OK != status) | 265 | if (PABC_OK != status) |
266 | { | 266 | { |
267 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 267 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
268 | "Failed to set attribute.\n"); | 268 | "Failed to set attribute `%s'.\n", key); |
269 | return PABC_FAILURE; | ||
270 | } | 269 | } |
271 | } | 270 | } |
272 | return PABC_OK; | 271 | return PABC_OK; |
@@ -370,7 +369,7 @@ cr_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
370 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 369 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
371 | return; | 370 | return; |
372 | } | 371 | } |
373 | idtoken_json = json_object_get (idtoken_json, "id_token"); | 372 | idtoken_json = json_object_get (data_json, "id_token"); |
374 | if (NULL == idtoken_json) | 373 | if (NULL == idtoken_json) |
375 | { | 374 | { |
376 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 375 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -390,13 +389,18 @@ cr_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
390 | } | 389 | } |
391 | 390 | ||
392 | PABC_ASSERT (pabc_new_ctx (&ctx)); | 391 | PABC_ASSERT (pabc_new_ctx (&ctx)); |
393 | // FIXME jansson does stupid escaping here maybe expect ecoded? | 392 | char *pp_str = json_dumps (pp_json, JSON_ENCODE_ANY); |
394 | status = pabc_decode_and_new_public_parameters (ctx, | 393 | status = pabc_decode_and_new_public_parameters (ctx, |
395 | &pp, | 394 | &pp, |
396 | json_string_value (pp_json)); | 395 | pp_str); |
396 | char *ppid; | ||
397 | GNUNET_assert (PABC_OK == pabc_cred_get_ppid_from_pp (pp_str, &ppid)); | ||
398 | GNUNET_free (pp_str); | ||
397 | if (status != PABC_OK) | 399 | if (status != PABC_OK) |
398 | { | 400 | { |
399 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to read public parameters.\n"); | 401 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
402 | "Failed to read public parameters: %s\n", | ||
403 | pp_str); | ||
400 | json_decref (data_json); | 404 | json_decref (data_json); |
401 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 405 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
402 | return; | 406 | return; |
@@ -457,8 +461,8 @@ cr_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
457 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 461 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
458 | return; | 462 | return; |
459 | } | 463 | } |
460 | // FIXME: where does this come from??? | 464 | char *nonce_str = json_dumps (nonce_json, JSON_ENCODE_ANY); |
461 | status = pabc_decode_nonce (ctx, nonce, json_string_value (nonce_json)); | 465 | status = pabc_decode_nonce (ctx, nonce, nonce_str); |
462 | if (status != PABC_OK) | 466 | if (status != PABC_OK) |
463 | { | 467 | { |
464 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to decode nonce.\n"); | 468 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to decode nonce.\n"); |
@@ -496,7 +500,9 @@ cr_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
496 | return; | 500 | return; |
497 | } | 501 | } |
498 | handle->resp_object = json_object (); | 502 | handle->resp_object = json_object (); |
499 | pabc_encode_credential_request (ctx, pp, cr, &response_str); | 503 | GNUNET_assert (PABC_OK == pabc_cred_encode_cr (ctx, pp, cr, |
504 | json_string_value (identity_json), | ||
505 | ppid, &response_str)); | ||
500 | if (PABC_OK != status) | 506 | if (PABC_OK != status) |
501 | { | 507 | { |
502 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to serialize cr.\n"); | 508 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Failed to serialize cr.\n"); |
@@ -508,9 +514,9 @@ cr_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
508 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 514 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
509 | return; | 515 | return; |
510 | } | 516 | } |
517 | json_decref (handle->resp_object); | ||
518 | handle->resp_object = json_loads (response_str, JSON_DECODE_ANY, &err); | ||
511 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s\n", response_str); | 519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s\n", response_str); |
512 | json_object_set_new (handle->resp_object, "cr", | ||
513 | json_string (response_str)); | ||
514 | GNUNET_free (response_str); | 520 | GNUNET_free (response_str); |
515 | 521 | ||
516 | // clean up | 522 | // clean up |
@@ -593,7 +599,7 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
593 | * @return NULL on error, otherwise the plugin context | 599 | * @return NULL on error, otherwise the plugin context |
594 | */ | 600 | */ |
595 | void * | 601 | void * |
596 | libgnunet_plugin_rest_reclaim_init (void *cls) | 602 | libgnunet_plugin_rest_pabc_init (void *cls) |
597 | { | 603 | { |
598 | static struct Plugin plugin; | 604 | static struct Plugin plugin; |
599 | struct GNUNET_REST_Plugin *api; | 605 | struct GNUNET_REST_Plugin *api; |
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index 84456b386..39d24ea61 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c | |||
@@ -353,14 +353,18 @@ finished_cont (void *cls, int32_t success, const char *emsg) | |||
353 | struct MHD_Response *resp; | 353 | struct MHD_Response *resp; |
354 | 354 | ||
355 | handle->idp_op = NULL; | 355 | handle->idp_op = NULL; |
356 | resp = GNUNET_REST_create_response (emsg); | ||
357 | MHD_add_response_header (resp, "Content-Type", "application/json"); | ||
358 | MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods); | ||
359 | if (GNUNET_OK != success) | 356 | if (GNUNET_OK != success) |
360 | { | 357 | { |
361 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 358 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
362 | return; | 359 | return; |
363 | } | 360 | } |
361 | resp = GNUNET_REST_create_response (emsg); | ||
362 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, | ||
363 | "Content-Type", | ||
364 | "application/json")); | ||
365 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, | ||
366 | "Access-Control-Allow-Methods", | ||
367 | allow_methods)); | ||
364 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 368 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
365 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 369 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); |
366 | } | 370 | } |
@@ -372,13 +376,15 @@ delete_finished_cb (void *cls, int32_t success, const char *emsg) | |||
372 | struct RequestHandle *handle = cls; | 376 | struct RequestHandle *handle = cls; |
373 | struct MHD_Response *resp; | 377 | struct MHD_Response *resp; |
374 | 378 | ||
375 | resp = GNUNET_REST_create_response (emsg); | ||
376 | MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods); | ||
377 | if (GNUNET_OK != success) | 379 | if (GNUNET_OK != success) |
378 | { | 380 | { |
379 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 381 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
380 | return; | 382 | return; |
381 | } | 383 | } |
384 | resp = GNUNET_REST_create_response (emsg); | ||
385 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, | ||
386 | "Access-Control-Allow-Methods", | ||
387 | allow_methods)); | ||
382 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 388 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
383 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 389 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); |
384 | } | 390 | } |
@@ -399,7 +405,10 @@ return_response (void *cls) | |||
399 | result_str = json_dumps (handle->resp_object, 0); | 405 | result_str = json_dumps (handle->resp_object, 0); |
400 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); | 406 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); |
401 | resp = GNUNET_REST_create_response (result_str); | 407 | resp = GNUNET_REST_create_response (result_str); |
402 | MHD_add_response_header (resp, "Access-Control-Allow-Methods", allow_methods); | 408 | GNUNET_assert (MHD_NO != |
409 | MHD_add_response_header (resp, | ||
410 | "Access-Control-Allow-Methods", | ||
411 | allow_methods)); | ||
403 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 412 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
404 | GNUNET_free (result_str); | 413 | GNUNET_free (result_str); |
405 | cleanup_handle (handle); | 414 | cleanup_handle (handle); |
@@ -461,8 +470,8 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) | |||
461 | 470 | ||
462 | static void | 471 | static void |
463 | add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | 472 | add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, |
464 | const char *url, | 473 | const char *url, |
465 | void *cls) | 474 | void *cls) |
466 | { | 475 | { |
467 | struct RequestHandle *handle = cls; | 476 | struct RequestHandle *handle = cls; |
468 | const struct GNUNET_IDENTITY_PrivateKey *identity_priv; | 477 | const struct GNUNET_IDENTITY_PrivateKey *identity_priv; |
@@ -513,7 +522,15 @@ add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
513 | handle->rest_handle->data, | 522 | handle->rest_handle->data, |
514 | handle->rest_handle->data_size); | 523 | handle->rest_handle->data_size); |
515 | data_json = json_loads (term_data, JSON_DECODE_ANY, &err); | 524 | data_json = json_loads (term_data, JSON_DECODE_ANY, &err); |
516 | GNUNET_JSON_parse (data_json, attrspec, NULL, NULL); | 525 | if (GNUNET_OK != GNUNET_JSON_parse (data_json, attrspec, NULL, NULL)) |
526 | { | ||
527 | json_decref (data_json); | ||
528 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
529 | "Unable to parse JSON from %s\n", | ||
530 | term_data); | ||
531 | GNUNET_SCHEDULER_add_now (&do_error, handle); | ||
532 | return; | ||
533 | } | ||
517 | json_decref (data_json); | 534 | json_decref (data_json); |
518 | if (NULL == attribute) | 535 | if (NULL == attribute) |
519 | { | 536 | { |
@@ -530,11 +547,11 @@ add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
530 | GNUNET_RECLAIM_id_generate (&attribute->id); | 547 | GNUNET_RECLAIM_id_generate (&attribute->id); |
531 | exp = GNUNET_TIME_UNIT_HOURS; | 548 | exp = GNUNET_TIME_UNIT_HOURS; |
532 | handle->idp_op = GNUNET_RECLAIM_credential_store (idp, | 549 | handle->idp_op = GNUNET_RECLAIM_credential_store (idp, |
533 | identity_priv, | 550 | identity_priv, |
534 | attribute, | 551 | attribute, |
535 | &exp, | 552 | &exp, |
536 | &finished_cont, | 553 | &finished_cont, |
537 | handle); | 554 | handle); |
538 | GNUNET_JSON_parse_free (attrspec); | 555 | GNUNET_JSON_parse_free (attrspec); |
539 | } | 556 | } |
540 | 557 | ||
@@ -545,8 +562,8 @@ add_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
545 | */ | 562 | */ |
546 | static void | 563 | static void |
547 | cred_collect (void *cls, | 564 | cred_collect (void *cls, |
548 | const struct GNUNET_IDENTITY_PublicKey *identity, | 565 | const struct GNUNET_IDENTITY_PublicKey *identity, |
549 | const struct GNUNET_RECLAIM_Credential *cred) | 566 | const struct GNUNET_RECLAIM_Credential *cred) |
550 | { | 567 | { |
551 | struct RequestHandle *handle = cls; | 568 | struct RequestHandle *handle = cls; |
552 | struct GNUNET_RECLAIM_AttributeList *attrs; | 569 | struct GNUNET_RECLAIM_AttributeList *attrs; |
@@ -565,8 +582,8 @@ cred_collect (void *cls, | |||
565 | attrs = GNUNET_RECLAIM_credential_get_attributes (cred); | 582 | attrs = GNUNET_RECLAIM_credential_get_attributes (cred); |
566 | issuer = GNUNET_RECLAIM_credential_get_issuer (cred); | 583 | issuer = GNUNET_RECLAIM_credential_get_issuer (cred); |
567 | tmp_value = GNUNET_RECLAIM_credential_value_to_string (cred->type, | 584 | tmp_value = GNUNET_RECLAIM_credential_value_to_string (cred->type, |
568 | cred->data, | 585 | cred->data, |
569 | cred->data_size); | 586 | cred->data_size); |
570 | cred_obj = json_object (); | 587 | cred_obj = json_object (); |
571 | json_object_set_new (cred_obj, "value", json_string (tmp_value)); | 588 | json_object_set_new (cred_obj, "value", json_string (tmp_value)); |
572 | json_object_set_new (cred_obj, "name", json_string (cred->name)); | 589 | json_object_set_new (cred_obj, "name", json_string (cred->name)); |
@@ -578,7 +595,7 @@ cred_collect (void *cls, | |||
578 | GNUNET_free (issuer); | 595 | GNUNET_free (issuer); |
579 | } | 596 | } |
580 | if (GNUNET_OK == GNUNET_RECLAIM_credential_get_expiration (cred, | 597 | if (GNUNET_OK == GNUNET_RECLAIM_credential_get_expiration (cred, |
581 | &exp)) | 598 | &exp)) |
582 | { | 599 | { |
583 | json_object_set_new (cred_obj, "expiration", json_integer ( | 600 | json_object_set_new (cred_obj, "expiration", json_integer ( |
584 | exp.abs_value_us)); | 601 | exp.abs_value_us)); |
@@ -613,7 +630,8 @@ cred_collect (void *cls, | |||
613 | json_object_set_new (cred_obj, "attributes", attr_arr); | 630 | json_object_set_new (cred_obj, "attributes", attr_arr); |
614 | } | 631 | } |
615 | json_array_append_new (handle->resp_object, cred_obj); | 632 | json_array_append_new (handle->resp_object, cred_obj); |
616 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | 633 | if (NULL != attrs) |
634 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | ||
617 | GNUNET_RECLAIM_get_credentials_next (handle->cred_it); | 635 | GNUNET_RECLAIM_get_credentials_next (handle->cred_it); |
618 | } | 636 | } |
619 | 637 | ||
@@ -627,8 +645,8 @@ cred_collect (void *cls, | |||
627 | */ | 645 | */ |
628 | static void | 646 | static void |
629 | list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | 647 | list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, |
630 | const char *url, | 648 | const char *url, |
631 | void *cls) | 649 | void *cls) |
632 | { | 650 | { |
633 | struct RequestHandle *handle = cls; | 651 | struct RequestHandle *handle = cls; |
634 | const struct GNUNET_IDENTITY_PrivateKey *priv_key; | 652 | const struct GNUNET_IDENTITY_PrivateKey *priv_key; |
@@ -664,14 +682,14 @@ list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
664 | } | 682 | } |
665 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 683 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
666 | handle->cred_it = GNUNET_RECLAIM_get_credentials_start (idp, | 684 | handle->cred_it = GNUNET_RECLAIM_get_credentials_start (idp, |
667 | priv_key, | 685 | priv_key, |
668 | &collect_error_cb, | 686 | &collect_error_cb, |
669 | handle, | 687 | handle, |
670 | &cred_collect, | 688 | &cred_collect, |
671 | handle, | 689 | handle, |
672 | & | 690 | & |
673 | collect_finished_cb, | 691 | collect_finished_cb, |
674 | handle); | 692 | handle); |
675 | } | 693 | } |
676 | 694 | ||
677 | 695 | ||
@@ -684,8 +702,8 @@ list_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
684 | */ | 702 | */ |
685 | static void | 703 | static void |
686 | delete_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | 704 | delete_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, |
687 | const char *url, | 705 | const char *url, |
688 | void *cls) | 706 | void *cls) |
689 | { | 707 | { |
690 | struct RequestHandle *handle = cls; | 708 | struct RequestHandle *handle = cls; |
691 | const struct GNUNET_IDENTITY_PrivateKey *priv_key; | 709 | const struct GNUNET_IDENTITY_PrivateKey *priv_key; |
@@ -734,10 +752,10 @@ delete_credential_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
734 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id)); | 752 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof(attr.id)); |
735 | attr.name = ""; | 753 | attr.name = ""; |
736 | handle->idp_op = GNUNET_RECLAIM_credential_delete (idp, | 754 | handle->idp_op = GNUNET_RECLAIM_credential_delete (idp, |
737 | priv_key, | 755 | priv_key, |
738 | &attr, | 756 | &attr, |
739 | &delete_finished_cb, | 757 | &delete_finished_cb, |
740 | handle); | 758 | handle); |
741 | GNUNET_free (identity_id_str); | 759 | GNUNET_free (identity_id_str); |
742 | } | 760 | } |
743 | 761 | ||
@@ -900,8 +918,8 @@ parse_jwt (const struct GNUNET_RECLAIM_Credential *cred, | |||
900 | json_error_t *json_err = NULL; | 918 | json_error_t *json_err = NULL; |
901 | 919 | ||
902 | jwt_string = GNUNET_RECLAIM_credential_value_to_string (cred->type, | 920 | jwt_string = GNUNET_RECLAIM_credential_value_to_string (cred->type, |
903 | cred->data, | 921 | cred->data, |
904 | cred->data_size); | 922 | cred->data_size); |
905 | char *jwt_body = strtok (jwt_string, delim); | 923 | char *jwt_body = strtok (jwt_string, delim); |
906 | jwt_body = strtok (NULL, delim); | 924 | jwt_body = strtok (NULL, delim); |
907 | GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body), | 925 | GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body), |
@@ -1424,25 +1442,24 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
1424 | static const struct GNUNET_REST_RequestHandler handlers[] = | 1442 | static const struct GNUNET_REST_RequestHandler handlers[] = |
1425 | { { MHD_HTTP_METHOD_GET, | 1443 | { { MHD_HTTP_METHOD_GET, |
1426 | GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &list_attribute_cont }, | 1444 | GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &list_attribute_cont }, |
1427 | { MHD_HTTP_METHOD_POST, | 1445 | { MHD_HTTP_METHOD_POST, |
1428 | GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &add_attribute_cont }, | 1446 | GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &add_attribute_cont }, |
1429 | { MHD_HTTP_METHOD_DELETE, | 1447 | { MHD_HTTP_METHOD_DELETE, |
1430 | GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &delete_attribute_cont }, | 1448 | GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &delete_attribute_cont }, |
1431 | { MHD_HTTP_METHOD_GET, | 1449 | { MHD_HTTP_METHOD_GET, |
1432 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &list_credential_cont }, | 1450 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &list_credential_cont }, |
1433 | { MHD_HTTP_METHOD_POST, | 1451 | { MHD_HTTP_METHOD_POST, |
1434 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &add_credential_cont }, | 1452 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &add_credential_cont }, |
1435 | { MHD_HTTP_METHOD_DELETE, | 1453 | { MHD_HTTP_METHOD_DELETE, |
1436 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &delete_credential_cont }, | 1454 | GNUNET_REST_API_NS_RECLAIM_CREDENTIAL, &delete_credential_cont }, |
1437 | { MHD_HTTP_METHOD_GET, | 1455 | { MHD_HTTP_METHOD_GET, |
1438 | GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont }, | 1456 | GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont }, |
1439 | { MHD_HTTP_METHOD_POST, | 1457 | { MHD_HTTP_METHOD_POST, |
1440 | GNUNET_REST_API_NS_IDENTITY_REVOKE, &revoke_ticket_cont }, | 1458 | GNUNET_REST_API_NS_IDENTITY_REVOKE, &revoke_ticket_cont }, |
1441 | { MHD_HTTP_METHOD_POST, | 1459 | { MHD_HTTP_METHOD_POST, |
1442 | GNUNET_REST_API_NS_IDENTITY_CONSUME, &consume_ticket_cont }, | 1460 | GNUNET_REST_API_NS_IDENTITY_CONSUME, &consume_ticket_cont }, |
1443 | { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont }, | 1461 | { MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont }, |
1444 | GNUNET_REST_HANDLER_END | 1462 | GNUNET_REST_HANDLER_END}; |
1445 | }; | ||
1446 | 1463 | ||
1447 | handle->response_code = 0; | 1464 | handle->response_code = 0; |
1448 | handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL; | 1465 | handle->timeout = GNUNET_TIME_UNIT_FOREVER_REL; |
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index f4f2b946a..c08cc868c 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -651,18 +651,15 @@ handle_consume_ticket_result (void *cls, | |||
651 | le->attribute, NULL); | 651 | le->attribute, NULL); |
652 | } | 652 | } |
653 | } | 653 | } |
654 | if (NULL != attrs) | ||
655 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | ||
656 | if (NULL != pl) | ||
657 | GNUNET_RECLAIM_presentation_list_destroy (pl); | ||
658 | attrs = NULL; | ||
659 | pl = NULL; | ||
660 | } | 654 | } |
661 | op->atr_cb (op->cls, NULL, NULL, NULL); | 655 | op->atr_cb (op->cls, NULL, NULL, NULL); |
662 | } | 656 | } |
657 | if (NULL != attrs) | ||
658 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | ||
659 | if (NULL != pl) | ||
660 | GNUNET_RECLAIM_presentation_list_destroy (pl); | ||
663 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); | 661 | GNUNET_CONTAINER_DLL_remove (h->op_head, h->op_tail, op); |
664 | free_op (op); | 662 | free_op (op); |
665 | GNUNET_free (attrs); | ||
666 | return; | 663 | return; |
667 | } | 664 | } |
668 | GNUNET_assert (0); | 665 | GNUNET_assert (0); |
@@ -804,7 +801,7 @@ check_credential_result (void *cls, const struct CredentialResultMessage *msg) | |||
804 | */ | 801 | */ |
805 | static void | 802 | static void |
806 | handle_credential_result (void *cls, const struct | 803 | handle_credential_result (void *cls, const struct |
807 | CredentialResultMessage *msg) | 804 | CredentialResultMessage *msg) |
808 | { | 805 | { |
809 | static struct GNUNET_IDENTITY_PrivateKey identity_dummy; | 806 | static struct GNUNET_IDENTITY_PrivateKey identity_dummy; |
810 | struct GNUNET_RECLAIM_Handle *h = cls; | 807 | struct GNUNET_RECLAIM_Handle *h = cls; |
@@ -871,6 +868,7 @@ handle_credential_result (void *cls, const struct | |||
871 | GNUNET_assert (0); | 868 | GNUNET_assert (0); |
872 | } | 869 | } |
873 | 870 | ||
871 | |||
874 | /** | 872 | /** |
875 | * Handle an incoming message of type | 873 | * Handle an incoming message of type |
876 | * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT | 874 | * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT |
@@ -925,7 +923,7 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg) | |||
925 | if (NULL != op) | 923 | if (NULL != op) |
926 | { | 924 | { |
927 | if (0 < pres_len) | 925 | if (0 < pres_len) |
928 | pres = GNUNET_RECLAIM_presentation_list_deserialize ((char*)&msg[1], | 926 | pres = GNUNET_RECLAIM_presentation_list_deserialize ((char*) &msg[1], |
929 | pres_len); | 927 | pres_len); |
930 | GNUNET_CONTAINER_DLL_remove (handle->op_head, handle->op_tail, op); | 928 | GNUNET_CONTAINER_DLL_remove (handle->op_head, handle->op_tail, op); |
931 | if (0 == | 929 | if (0 == |
@@ -1485,7 +1483,7 @@ GNUNET_RECLAIM_get_credentials_start ( | |||
1485 | */ | 1483 | */ |
1486 | void | 1484 | void |
1487 | GNUNET_RECLAIM_get_credentials_next (struct | 1485 | GNUNET_RECLAIM_get_credentials_next (struct |
1488 | GNUNET_RECLAIM_CredentialIterator *ait) | 1486 | GNUNET_RECLAIM_CredentialIterator *ait) |
1489 | { | 1487 | { |
1490 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1488 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1491 | struct CredentialIterationNextMessage *msg; | 1489 | struct CredentialIterationNextMessage *msg; |
@@ -1507,7 +1505,7 @@ GNUNET_RECLAIM_get_credentials_next (struct | |||
1507 | */ | 1505 | */ |
1508 | void | 1506 | void |
1509 | GNUNET_RECLAIM_get_credentials_stop (struct | 1507 | GNUNET_RECLAIM_get_credentials_stop (struct |
1510 | GNUNET_RECLAIM_CredentialIterator *ait) | 1508 | GNUNET_RECLAIM_CredentialIterator *ait) |
1511 | { | 1509 | { |
1512 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1510 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1513 | struct GNUNET_MQ_Envelope *env; | 1511 | struct GNUNET_MQ_Envelope *env; |
diff --git a/src/reclaim/reclaim_attribute.c b/src/reclaim/reclaim_attribute.c index 14690d7c9..21fdd83a2 100644 --- a/src/reclaim/reclaim_attribute.c +++ b/src/reclaim/reclaim_attribute.c | |||
@@ -96,10 +96,11 @@ init () | |||
96 | if (GNUNET_YES == initialized) | 96 | if (GNUNET_YES == initialized) |
97 | return; | 97 | return; |
98 | initialized = GNUNET_YES; | 98 | initialized = GNUNET_YES; |
99 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attribute_", | 99 | GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (), |
100 | NULL, | 100 | "libgnunet_plugin_reclaim_attribute_", |
101 | &add_plugin, | 101 | NULL, |
102 | NULL); | 102 | &add_plugin, |
103 | NULL); | ||
103 | } | 104 | } |
104 | 105 | ||
105 | /** | 106 | /** |
diff --git a/src/reclaim/reclaim_credential.c b/src/reclaim/reclaim_credential.c index 05601c3d3..c8c0d397c 100644 --- a/src/reclaim/reclaim_credential.c +++ b/src/reclaim/reclaim_credential.c | |||
@@ -96,10 +96,11 @@ init () | |||
96 | if (GNUNET_YES == initialized) | 96 | if (GNUNET_YES == initialized) |
97 | return; | 97 | return; |
98 | initialized = GNUNET_YES; | 98 | initialized = GNUNET_YES; |
99 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_credential_", | 99 | GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (), |
100 | NULL, | 100 | "libgnunet_plugin_reclaim_credential_", |
101 | &add_plugin, | 101 | NULL, |
102 | NULL); | 102 | &add_plugin, |
103 | NULL); | ||
103 | } | 104 | } |
104 | 105 | ||
105 | 106 | ||
diff --git a/src/rest/gnunet-rest-server.c b/src/rest/gnunet-rest-server.c index e6e03b16d..ecb3e2ae5 100644 --- a/src/rest/gnunet-rest-server.c +++ b/src/rest/gnunet-rest-server.c | |||
@@ -1229,10 +1229,11 @@ run (void *cls, | |||
1229 | return; | 1229 | return; |
1230 | } | 1230 | } |
1231 | /* Load plugins */ | 1231 | /* Load plugins */ |
1232 | GNUNET_PLUGIN_load_all ("libgnunet_plugin_rest", | 1232 | GNUNET_PLUGIN_load_all_in_context (GNUNET_OS_project_data_default (), |
1233 | (void *) cfg, | 1233 | "libgnunet_plugin_rest", |
1234 | &load_plugin, | 1234 | (void *) cfg, |
1235 | NULL); | 1235 | &load_plugin, |
1236 | NULL); | ||
1236 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | 1237 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); |
1237 | } | 1238 | } |
1238 | 1239 | ||
diff --git a/src/rest/plugin_rest_copying.c b/src/rest/plugin_rest_copying.c index 6d074d3d1..52783a81a 100644 --- a/src/rest/plugin_rest_copying.c +++ b/src/rest/plugin_rest_copying.c | |||
@@ -138,9 +138,9 @@ options_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
138 | struct RequestHandle *handle = cls; | 138 | struct RequestHandle *handle = cls; |
139 | 139 | ||
140 | resp = GNUNET_REST_create_response (NULL); | 140 | resp = GNUNET_REST_create_response (NULL); |
141 | MHD_add_response_header (resp, | 141 | GNUNET_assert (MHD_NO != MHD_add_response_header (resp, |
142 | "Access-Control-Allow-Methods", | 142 | "Access-Control-Allow-Methods", |
143 | MHD_HTTP_METHOD_GET); | 143 | MHD_HTTP_METHOD_GET)); |
144 | handle->proc (handle->proc_cls, | 144 | handle->proc (handle->proc_cls, |
145 | resp, | 145 | resp, |
146 | MHD_HTTP_OK); | 146 | MHD_HTTP_OK); |
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index b5737158b..99fecdd35 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -307,17 +307,9 @@ calculate_pow (void *cls) | |||
307 | return; | 307 | return; |
308 | } | 308 | } |
309 | pow_passes++; | 309 | pow_passes++; |
310 | /** | 310 | pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, |
311 | * Otherwise CTRL-C does not work | 311 | &calculate_pow, |
312 | */ | 312 | ph); |
313 | if (0 == pow_passes % 128) | ||
314 | pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, | ||
315 | &calculate_pow, | ||
316 | ph); | ||
317 | else | ||
318 | pow_task = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_MILLISECONDS, | ||
319 | &calculate_pow, | ||
320 | ph); | ||
321 | 313 | ||
322 | } | 314 | } |
323 | 315 | ||
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index 863289aae..6f70720ba 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -306,12 +306,19 @@ publicize_rm (const struct RevokeMessage *rm) | |||
306 | struct RevokeMessage *cp; | 306 | struct RevokeMessage *cp; |
307 | struct GNUNET_HashCode hc; | 307 | struct GNUNET_HashCode hc; |
308 | struct GNUNET_SETU_Element e; | 308 | struct GNUNET_SETU_Element e; |
309 | ssize_t pklen; | ||
309 | const struct GNUNET_IDENTITY_PublicKey *pk; | 310 | const struct GNUNET_IDENTITY_PublicKey *pk; |
310 | 311 | ||
311 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; | 312 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
312 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 313 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; |
314 | pklen = GNUNET_IDENTITY_key_get_length (pk); | ||
315 | if (0 > pklen) | ||
316 | { | ||
317 | GNUNET_break_op (0); | ||
318 | return GNUNET_SYSERR; | ||
319 | } | ||
313 | GNUNET_CRYPTO_hash (pk, | 320 | GNUNET_CRYPTO_hash (pk, |
314 | GNUNET_IDENTITY_key_get_length (pk), | 321 | pklen, |
315 | &hc); | 322 | &hc); |
316 | if (GNUNET_YES == | 323 | if (GNUNET_YES == |
317 | GNUNET_CONTAINER_multihashmap_contains (revocation_map, | 324 | GNUNET_CONTAINER_multihashmap_contains (revocation_map, |
@@ -384,7 +391,8 @@ check_revoke_message (void *cls, | |||
384 | uint16_t size; | 391 | uint16_t size; |
385 | 392 | ||
386 | size = ntohs (rm->header.size); | 393 | size = ntohs (rm->header.size); |
387 | if (size <= sizeof(struct RevokeMessage)) | 394 | if (size <= sizeof(struct RevokeMessage) || |
395 | (size > UINT16_MAX)) | ||
388 | { | 396 | { |
389 | GNUNET_break (0); | 397 | GNUNET_break (0); |
390 | return GNUNET_SYSERR; | 398 | return GNUNET_SYSERR; |
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c index 3c9344a49..1928d09cd 100644 --- a/src/revocation/plugin_block_revocation.c +++ b/src/revocation/plugin_block_revocation.c | |||
@@ -134,6 +134,7 @@ block_plugin_revocation_evaluate (void *cls, | |||
134 | { | 134 | { |
135 | struct InternalContext *ic = cls; | 135 | struct InternalContext *ic = cls; |
136 | struct GNUNET_HashCode chash; | 136 | struct GNUNET_HashCode chash; |
137 | ssize_t pklen; | ||
137 | const struct RevokeMessage *rm = reply_block; | 138 | const struct RevokeMessage *rm = reply_block; |
138 | 139 | ||
139 | if (NULL == reply_block) | 140 | if (NULL == reply_block) |
@@ -153,8 +154,14 @@ block_plugin_revocation_evaluate (void *cls, | |||
153 | GNUNET_break_op (0); | 154 | GNUNET_break_op (0); |
154 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 155 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
155 | } | 156 | } |
157 | pklen = GNUNET_IDENTITY_key_get_length (pk); | ||
158 | if (0 > pklen) | ||
159 | { | ||
160 | GNUNET_break_op (0); | ||
161 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | ||
162 | } | ||
156 | GNUNET_CRYPTO_hash (pk, | 163 | GNUNET_CRYPTO_hash (pk, |
157 | GNUNET_IDENTITY_key_get_length (pk), | 164 | pklen, |
158 | &chash); | 165 | &chash); |
159 | if (GNUNET_YES == | 166 | if (GNUNET_YES == |
160 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, | 167 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, |
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 5cf191847..e2f871c23 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -492,6 +492,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
492 | unsigned int tmp_score = 0; | 492 | unsigned int tmp_score = 0; |
493 | unsigned int epochs; | 493 | unsigned int epochs; |
494 | uint64_t pow_val; | 494 | uint64_t pow_val; |
495 | ssize_t pklen; | ||
495 | const struct GNUNET_IDENTITY_PublicKey *pk; | 496 | const struct GNUNET_IDENTITY_PublicKey *pk; |
496 | 497 | ||
497 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; | 498 | pk = (const struct GNUNET_IDENTITY_PublicKey *) &pow[1]; |
@@ -517,9 +518,15 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
517 | GNUNET_memcpy (&buf[sizeof(uint64_t)], | 518 | GNUNET_memcpy (&buf[sizeof(uint64_t)], |
518 | &pow->timestamp, | 519 | &pow->timestamp, |
519 | sizeof (uint64_t)); | 520 | sizeof (uint64_t)); |
521 | pklen = GNUNET_IDENTITY_key_get_length (pk); | ||
522 | if (0 > pklen) | ||
523 | { | ||
524 | GNUNET_break (0); | ||
525 | return GNUNET_NO; | ||
526 | } | ||
520 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | 527 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], |
521 | pk, | 528 | pk, |
522 | GNUNET_IDENTITY_key_get_length (pk)); | 529 | pklen); |
523 | for (unsigned int i = 0; i < POW_COUNT; i++) | 530 | for (unsigned int i = 0; i < POW_COUNT; i++) |
524 | { | 531 | { |
525 | pow_val = GNUNET_ntohll (pow->pow[i]); | 532 | pow_val = GNUNET_ntohll (pow->pow[i]); |
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c index 82aeffb79..908dcca17 100644 --- a/src/rps/gnunet-rps-profiler.c +++ b/src/rps/gnunet-rps-profiler.c | |||
@@ -3067,9 +3067,10 @@ run (void *cls, | |||
3067 | } | 3067 | } |
3068 | else | 3068 | else |
3069 | { | 3069 | { |
3070 | duration = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, | 3070 | duration = GNUNET_TIME_relative_multiply ( |
3071 | (timeout.rel_value_us / 1000000) | 3071 | GNUNET_TIME_UNIT_SECONDS, |
3072 | * 0.75); | 3072 | ( (double) timeout.rel_value_us / (double) 1000000) |
3073 | * 0.75); | ||
3073 | } | 3074 | } |
3074 | } | 3075 | } |
3075 | else | 3076 | else |
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c index dc4c5dab7..56eab288e 100644 --- a/src/rps/gnunet-service-rps.c +++ b/src/rps/gnunet-service-rps.c | |||
@@ -965,8 +965,6 @@ remove_channel_ctx (struct ChannelCtx *channel_ctx) | |||
965 | channel_ctx->destruction_task = NULL; | 965 | channel_ctx->destruction_task = NULL; |
966 | } | 966 | } |
967 | 967 | ||
968 | GNUNET_free (channel_ctx); | ||
969 | |||
970 | if (NULL == peer_ctx) | 968 | if (NULL == peer_ctx) |
971 | return; | 969 | return; |
972 | if (channel_ctx == peer_ctx->send_channel_ctx) | 970 | if (channel_ctx == peer_ctx->send_channel_ctx) |
@@ -978,6 +976,7 @@ remove_channel_ctx (struct ChannelCtx *channel_ctx) | |||
978 | { | 976 | { |
979 | peer_ctx->recv_channel_ctx = NULL; | 977 | peer_ctx->recv_channel_ctx = NULL; |
980 | } | 978 | } |
979 | GNUNET_free (channel_ctx); | ||
981 | } | 980 | } |
982 | 981 | ||
983 | 982 | ||
@@ -2637,7 +2636,7 @@ insert_in_sampler (void *cls, | |||
2637 | } | 2636 | } |
2638 | #ifdef TO_FILE | 2637 | #ifdef TO_FILE |
2639 | sub->num_observed_peers++; | 2638 | sub->num_observed_peers++; |
2640 | GNUNET_CONTAINER_multipeermap_put | 2639 | (void) GNUNET_CONTAINER_multipeermap_put |
2641 | (sub->observed_unique_peers, | 2640 | (sub->observed_unique_peers, |
2642 | peer, | 2641 | peer, |
2643 | NULL, | 2642 | NULL, |
@@ -2802,7 +2801,7 @@ clean_peer (struct Sub *sub, | |||
2802 | peer))) && | 2801 | peer))) && |
2803 | (GNUNET_NO == View_contains_peer (sub->view, peer)) && | 2802 | (GNUNET_NO == View_contains_peer (sub->view, peer)) && |
2804 | (GNUNET_NO == CustomPeerMap_contains_peer (sub->push_map, peer)) && | 2803 | (GNUNET_NO == CustomPeerMap_contains_peer (sub->push_map, peer)) && |
2805 | (GNUNET_NO == CustomPeerMap_contains_peer (sub->push_map, peer)) && | 2804 | (GNUNET_NO == CustomPeerMap_contains_peer (sub->pull_map, peer)) && |
2806 | (0 == RPS_sampler_count_id (sub->sampler, peer)) && | 2805 | (0 == RPS_sampler_count_id (sub->sampler, peer)) && |
2807 | (GNUNET_YES == check_removable (get_peer_ctx (sub->peer_map, peer)))) | 2806 | (GNUNET_YES == check_removable (get_peer_ctx (sub->peer_map, peer)))) |
2808 | { /* We can safely remove this peer */ | 2807 | { /* We can safely remove this peer */ |
@@ -2836,13 +2835,20 @@ cleanup_destroyed_channel (void *cls, | |||
2836 | (void) channel; | 2835 | (void) channel; |
2837 | 2836 | ||
2838 | channel_ctx->channel = NULL; | 2837 | channel_ctx->channel = NULL; |
2839 | remove_channel_ctx (channel_ctx); | ||
2840 | if ((NULL != peer_ctx) && | 2838 | if ((NULL != peer_ctx) && |
2841 | (peer_ctx->send_channel_ctx == channel_ctx) && | 2839 | (peer_ctx->send_channel_ctx == channel_ctx) && |
2842 | (GNUNET_YES == check_sending_channel_needed (channel_ctx->peer_ctx)) ) | 2840 | (GNUNET_YES == check_sending_channel_needed (peer_ctx)) ) |
2843 | { | 2841 | { |
2842 | remove_channel_ctx (channel_ctx); | ||
2844 | remove_peer (peer_ctx->sub, &peer_ctx->peer_id); | 2843 | remove_peer (peer_ctx->sub, &peer_ctx->peer_id); |
2845 | } | 2844 | } |
2845 | else | ||
2846 | { | ||
2847 | /* We need this if-else construct because we need to make sure the channel | ||
2848 | * (context) is cleaned up before removing the peer, but still neet to | ||
2849 | * compare it while checking the condition */ | ||
2850 | remove_channel_ctx (channel_ctx); | ||
2851 | } | ||
2846 | } | 2852 | } |
2847 | 2853 | ||
2848 | 2854 | ||
diff --git a/src/rps/gnunet-service-rps_custommap.c b/src/rps/gnunet-service-rps_custommap.c index 54e361d32..392c29397 100644 --- a/src/rps/gnunet-service-rps_custommap.c +++ b/src/rps/gnunet-service-rps_custommap.c | |||
@@ -206,6 +206,7 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map, | |||
206 | struct GNUNET_PeerIdentity *p; | 206 | struct GNUNET_PeerIdentity *p; |
207 | uint32_t *last_index; | 207 | uint32_t *last_index; |
208 | struct GNUNET_PeerIdentity *last_p; | 208 | struct GNUNET_PeerIdentity *last_p; |
209 | int ret; | ||
209 | 210 | ||
210 | if (GNUNET_NO == CustomPeerMap_contains_peer (c_peer_map, | 211 | if (GNUNET_NO == CustomPeerMap_contains_peer (c_peer_map, |
211 | peer)) | 212 | peer)) |
@@ -234,9 +235,11 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map, | |||
234 | last_p); | 235 | last_p); |
235 | GNUNET_assert (NULL != last_index); | 236 | GNUNET_assert (NULL != last_index); |
236 | GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index); | 237 | GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index); |
237 | GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map, | 238 | ret = GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map, |
238 | *index, last_p, | 239 | *index, |
239 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 240 | last_p, |
241 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | ||
242 | GNUNET_assert (GNUNET_OK == ret); | ||
240 | GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, | 243 | GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, |
241 | *last_index); | 244 | *last_index); |
242 | *last_index = *index; | 245 | *last_index = *index; |
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c index 497225973..6dee20c95 100644 --- a/src/rps/rps-test_util.c +++ b/src/rps/rps-test_util.c | |||
@@ -152,12 +152,16 @@ close_all_files () | |||
152 | { | 152 | { |
153 | int ret; | 153 | int ret; |
154 | 154 | ||
155 | ret = GNUNET_CONTAINER_multihashmap_iterate (open_files, | 155 | if (NULL != open_files) |
156 | close_files_iter, | 156 | { |
157 | NULL); | 157 | ret = GNUNET_CONTAINER_multihashmap_iterate (open_files, |
158 | GNUNET_CONTAINER_multihashmap_destroy (open_files); | 158 | close_files_iter, |
159 | open_files = NULL; | 159 | NULL); |
160 | return ret; | 160 | GNUNET_CONTAINER_multihashmap_destroy (open_files); |
161 | open_files = NULL; | ||
162 | return ret; | ||
163 | } | ||
164 | return GNUNET_YES; | ||
161 | } | 165 | } |
162 | 166 | ||
163 | 167 | ||
diff --git a/src/setu/.gitignore b/src/setu/.gitignore index 35295449b..0ac10295e 100644 --- a/src/setu/.gitignore +++ b/src/setu/.gitignore | |||
@@ -4,3 +4,4 @@ gnunet-setu-ibf-profiler | |||
4 | test_setu_api | 4 | test_setu_api |
5 | test_setu_copy | 5 | test_setu_copy |
6 | test_setu_result_symmetric | 6 | test_setu_result_symmetric |
7 | perf_setu_api | ||
diff --git a/src/setu/Makefile.am b/src/setu/Makefile.am index cc7711462..77d048add 100644 --- a/src/setu/Makefile.am +++ b/src/setu/Makefile.am | |||
@@ -69,7 +69,8 @@ libgnunetsetu_la_LDFLAGS = \ | |||
69 | 69 | ||
70 | if HAVE_TESTING | 70 | if HAVE_TESTING |
71 | check_PROGRAMS = \ | 71 | check_PROGRAMS = \ |
72 | test_setu_api | 72 | test_setu_api \ |
73 | perf_setu_api | ||
73 | endif | 74 | endif |
74 | 75 | ||
75 | if ENABLE_TEST_RUN | 76 | if ENABLE_TEST_RUN |
@@ -84,6 +85,15 @@ test_setu_api_LDADD = \ | |||
84 | $(top_builddir)/src/testing/libgnunettesting.la \ | 85 | $(top_builddir)/src/testing/libgnunettesting.la \ |
85 | libgnunetsetu.la | 86 | libgnunetsetu.la |
86 | 87 | ||
88 | |||
89 | perf_setu_api_SOURCES = \ | ||
90 | perf_setu_api.c | ||
91 | perf_setu_api_LDADD = \ | ||
92 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
93 | $(top_builddir)/src/testing/libgnunettesting.la \ | ||
94 | libgnunetsetu.la | ||
95 | |||
96 | |||
87 | plugin_LTLIBRARIES = \ | 97 | plugin_LTLIBRARIES = \ |
88 | libgnunet_plugin_block_setu_test.la | 98 | libgnunet_plugin_block_setu_test.la |
89 | 99 | ||
diff --git a/src/setu/gnunet-service-setu.c b/src/setu/gnunet-service-setu.c index 540628afa..862b78aa9 100644 --- a/src/setu/gnunet-service-setu.c +++ b/src/setu/gnunet-service-setu.c | |||
@@ -400,6 +400,22 @@ struct Operation | |||
400 | * was created. | 400 | * was created. |
401 | */ | 401 | */ |
402 | unsigned int generation_created; | 402 | unsigned int generation_created; |
403 | |||
404 | /** | ||
405 | * User defined Bandwidth Round Trips Tradeoff | ||
406 | */ | ||
407 | double rtt_bandwidth_tradeoff; | ||
408 | |||
409 | /** | ||
410 | * Number of Element per bucket in IBF | ||
411 | */ | ||
412 | unsigned int ibf_number_buckets_per_element; | ||
413 | |||
414 | /** | ||
415 | * Number of buckets in IBF | ||
416 | */ | ||
417 | unsigned ibf_bucket_number; | ||
418 | |||
403 | }; | 419 | }; |
404 | 420 | ||
405 | 421 | ||
@@ -621,6 +637,98 @@ static uint32_t suggest_id; | |||
621 | 637 | ||
622 | 638 | ||
623 | /** | 639 | /** |
640 | * Added Roundtripscounter | ||
641 | */ | ||
642 | |||
643 | |||
644 | struct perf_num_send_resived_msg { | ||
645 | int sent; | ||
646 | int sent_var_bytes; | ||
647 | int received; | ||
648 | int received_var_bytes; | ||
649 | }; | ||
650 | |||
651 | |||
652 | struct perf_rtt_struct | ||
653 | { | ||
654 | struct perf_num_send_resived_msg operation_request; | ||
655 | struct perf_num_send_resived_msg se; | ||
656 | struct perf_num_send_resived_msg request_full; | ||
657 | struct perf_num_send_resived_msg element_full; | ||
658 | struct perf_num_send_resived_msg full_done; | ||
659 | struct perf_num_send_resived_msg ibf; | ||
660 | struct perf_num_send_resived_msg inquery; | ||
661 | struct perf_num_send_resived_msg element; | ||
662 | struct perf_num_send_resived_msg demand; | ||
663 | struct perf_num_send_resived_msg offer; | ||
664 | struct perf_num_send_resived_msg done; | ||
665 | struct perf_num_send_resived_msg over; | ||
666 | }; | ||
667 | |||
668 | struct perf_rtt_struct perf_rtt; | ||
669 | |||
670 | |||
671 | static int | ||
672 | sum_sent_received_bytes(int size, struct perf_num_send_resived_msg perf_rtt_struct) { | ||
673 | return (size * perf_rtt_struct.sent) + | ||
674 | (size * perf_rtt_struct.received) + | ||
675 | perf_rtt_struct.sent_var_bytes + | ||
676 | perf_rtt_struct.received_var_bytes; | ||
677 | } | ||
678 | |||
679 | static float | ||
680 | calculate_perf_rtt() { | ||
681 | /** | ||
682 | * Calculate RTT of init phase normally always 1 | ||
683 | */ | ||
684 | float rtt = 1; | ||
685 | int bytes_transmitted = 0; | ||
686 | |||
687 | /** | ||
688 | * Calculate RGNUNET_SETU_AcceptMessageRT of Fullsync normaly 1 or 1.5 depending | ||
689 | */ | ||
690 | if (( perf_rtt.element_full.received != 0 ) || | ||
691 | ( perf_rtt.element_full.sent != 0) | ||
692 | ) rtt += 1; | ||
693 | |||
694 | if (( perf_rtt.request_full.received != 0 ) || | ||
695 | ( perf_rtt.request_full.sent != 0) | ||
696 | ) rtt += 0.5; | ||
697 | |||
698 | /** | ||
699 | * In case of a differential sync 3 rtt's are needed. | ||
700 | * for every active/passive switch additional 3.5 rtt's are used | ||
701 | */ | ||
702 | |||
703 | int iterations = perf_rtt.ibf.received; | ||
704 | if(iterations > 1) | ||
705 | rtt += (iterations - 1 ) * 0.5; | ||
706 | rtt += 3 * iterations; | ||
707 | |||
708 | /** | ||
709 | * Calculate data sended size | ||
710 | */ | ||
711 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL), perf_rtt.request_full); | ||
712 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT), perf_rtt.element_full); | ||
713 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS), perf_rtt.element); | ||
714 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST), perf_rtt.operation_request); | ||
715 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_SE), perf_rtt.se); | ||
716 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE), perf_rtt.full_done); | ||
717 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_IBF), perf_rtt.ibf); | ||
718 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_INQUIRY), perf_rtt.inquery); | ||
719 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND), perf_rtt.demand); | ||
720 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER), perf_rtt.offer); | ||
721 | bytes_transmitted += sum_sent_received_bytes(sizeof(GNUNET_MESSAGE_TYPE_SETU_P2P_DONE), perf_rtt.done); | ||
722 | |||
723 | LOG(GNUNET_ERROR_TYPE_ERROR,"Bytes Transmitted: %d\n", bytes_transmitted); | ||
724 | |||
725 | LOG(GNUNET_ERROR_TYPE_ERROR,"Reached tradeoff bandwidth/rtt: %f\n", (bytes_transmitted / rtt )); | ||
726 | |||
727 | return rtt; | ||
728 | } | ||
729 | |||
730 | |||
731 | /** | ||
624 | * Iterator over hash map entries, called to | 732 | * Iterator over hash map entries, called to |
625 | * destroy the linked list of colliding ibf key entries. | 733 | * destroy the linked list of colliding ibf key entries. |
626 | * | 734 | * |
@@ -1192,8 +1300,8 @@ send_ibf (struct Operation *op, | |||
1192 | 1 << ibf_order); | 1300 | 1 << ibf_order); |
1193 | 1301 | ||
1194 | { | 1302 | { |
1195 | char name[64] = { 0 }; | 1303 | char name[64]; |
1196 | snprintf (name, sizeof(name), "# sent IBF (order %u)", ibf_order); | 1304 | GNUNET_snprintf (name, sizeof(name), "# sent IBF (order %u)", ibf_order); |
1197 | GNUNET_STATISTICS_update (_GSS_statistics, name, 1, GNUNET_NO); | 1305 | GNUNET_STATISTICS_update (_GSS_statistics, name, 1, GNUNET_NO); |
1198 | } | 1306 | } |
1199 | 1307 | ||
@@ -1210,6 +1318,8 @@ send_ibf (struct Operation *op, | |||
1210 | if (buckets_in_message > MAX_BUCKETS_PER_MESSAGE) | 1318 | if (buckets_in_message > MAX_BUCKETS_PER_MESSAGE) |
1211 | buckets_in_message = MAX_BUCKETS_PER_MESSAGE; | 1319 | buckets_in_message = MAX_BUCKETS_PER_MESSAGE; |
1212 | 1320 | ||
1321 | perf_rtt.ibf.sent += 1; | ||
1322 | perf_rtt.ibf.sent_var_bytes += ( buckets_in_message * IBF_BUCKET_SIZE ); | ||
1213 | ev = GNUNET_MQ_msg_extra (msg, | 1323 | ev = GNUNET_MQ_msg_extra (msg, |
1214 | buckets_in_message * IBF_BUCKET_SIZE, | 1324 | buckets_in_message * IBF_BUCKET_SIZE, |
1215 | GNUNET_MESSAGE_TYPE_SETU_P2P_IBF); | 1325 | GNUNET_MESSAGE_TYPE_SETU_P2P_IBF); |
@@ -1281,6 +1391,8 @@ send_full_element_iterator (void *cls, | |||
1281 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1391 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1282 | "Sending element %s\n", | 1392 | "Sending element %s\n", |
1283 | GNUNET_h2s (key)); | 1393 | GNUNET_h2s (key)); |
1394 | perf_rtt.element_full.received += 1; | ||
1395 | perf_rtt.element_full.received_var_bytes += el->size; | ||
1284 | ev = GNUNET_MQ_msg_extra (emsg, | 1396 | ev = GNUNET_MQ_msg_extra (emsg, |
1285 | el->size, | 1397 | el->size, |
1286 | GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT); | 1398 | GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT); |
@@ -1312,6 +1424,7 @@ send_full_set (struct Operation *op) | |||
1312 | (void) GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements, | 1424 | (void) GNUNET_CONTAINER_multihashmap_iterate (op->set->content->elements, |
1313 | &send_full_element_iterator, | 1425 | &send_full_element_iterator, |
1314 | op); | 1426 | op); |
1427 | perf_rtt.full_done.sent += 1; | ||
1315 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE); | 1428 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE); |
1316 | GNUNET_MQ_send (op->mq, | 1429 | GNUNET_MQ_send (op->mq, |
1317 | ev); | 1430 | ev); |
@@ -1360,6 +1473,8 @@ static void | |||
1360 | handle_union_p2p_strata_estimator (void *cls, | 1473 | handle_union_p2p_strata_estimator (void *cls, |
1361 | const struct StrataEstimatorMessage *msg) | 1474 | const struct StrataEstimatorMessage *msg) |
1362 | { | 1475 | { |
1476 | perf_rtt.se.received += 1; | ||
1477 | perf_rtt.se.received_var_bytes += ntohs (msg->header.size) - sizeof(struct StrataEstimatorMessage); | ||
1363 | struct Operation *op = cls; | 1478 | struct Operation *op = cls; |
1364 | struct StrataEstimator *remote_se; | 1479 | struct StrataEstimator *remote_se; |
1365 | unsigned int diff; | 1480 | unsigned int diff; |
@@ -1431,6 +1546,13 @@ handle_union_p2p_strata_estimator (void *cls, | |||
1431 | return; | 1546 | return; |
1432 | } | 1547 | } |
1433 | 1548 | ||
1549 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
1550 | "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx: %f\n", op->rtt_bandwidth_tradeoff); | ||
1551 | |||
1552 | |||
1553 | /** | ||
1554 | * Added rtt_bandwidth_tradeoff directly need future improvements | ||
1555 | */ | ||
1434 | if ((GNUNET_YES == op->force_full) || | 1556 | if ((GNUNET_YES == op->force_full) || |
1435 | (diff > op->initial_size / 4) || | 1557 | (diff > op->initial_size / 4) || |
1436 | (0 == other_size)) | 1558 | (0 == other_size)) |
@@ -1455,6 +1577,7 @@ handle_union_p2p_strata_estimator (void *cls, | |||
1455 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1577 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1456 | "Telling other peer that we expect its full set\n"); | 1578 | "Telling other peer that we expect its full set\n"); |
1457 | op->phase = PHASE_FULL_RECEIVING; | 1579 | op->phase = PHASE_FULL_RECEIVING; |
1580 | perf_rtt.request_full.sent += 1; | ||
1458 | ev = GNUNET_MQ_msg_header ( | 1581 | ev = GNUNET_MQ_msg_header ( |
1459 | GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL); | 1582 | GNUNET_MESSAGE_TYPE_SETU_P2P_REQUEST_FULL); |
1460 | GNUNET_MQ_send (op->mq, | 1583 | GNUNET_MQ_send (op->mq, |
@@ -1504,6 +1627,9 @@ send_offers_iterator (void *cls, | |||
1504 | if (ke->ibf_key.key_val != sec->ibf_key.key_val) | 1627 | if (ke->ibf_key.key_val != sec->ibf_key.key_val) |
1505 | return GNUNET_YES; | 1628 | return GNUNET_YES; |
1506 | 1629 | ||
1630 | perf_rtt.offer.sent += 1; | ||
1631 | perf_rtt.offer.sent_var_bytes += sizeof(struct GNUNET_HashCode); | ||
1632 | |||
1507 | ev = GNUNET_MQ_msg_header_extra (mh, | 1633 | ev = GNUNET_MQ_msg_header_extra (mh, |
1508 | sizeof(struct GNUNET_HashCode), | 1634 | sizeof(struct GNUNET_HashCode), |
1509 | GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER); | 1635 | GNUNET_MESSAGE_TYPE_SETU_P2P_OFFER); |
@@ -1659,6 +1785,8 @@ decode_and_send (struct Operation *op) | |||
1659 | 1785 | ||
1660 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 1786 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1661 | "transmitted all values, sending DONE\n"); | 1787 | "transmitted all values, sending DONE\n"); |
1788 | |||
1789 | perf_rtt.done.sent += 1; | ||
1662 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_DONE); | 1790 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_DONE); |
1663 | GNUNET_MQ_send (op->mq, ev); | 1791 | GNUNET_MQ_send (op->mq, ev); |
1664 | /* We now wait until we get a DONE message back | 1792 | /* We now wait until we get a DONE message back |
@@ -1681,6 +1809,8 @@ decode_and_send (struct Operation *op) | |||
1681 | struct GNUNET_MQ_Envelope *ev; | 1809 | struct GNUNET_MQ_Envelope *ev; |
1682 | struct InquiryMessage *msg; | 1810 | struct InquiryMessage *msg; |
1683 | 1811 | ||
1812 | perf_rtt.inquery.sent += 1; | ||
1813 | perf_rtt.inquery.sent_var_bytes += sizeof(struct IBF_Key); | ||
1684 | /* It may be nice to merge multiple requests, but with CADET's corking it is not worth | 1814 | /* It may be nice to merge multiple requests, but with CADET's corking it is not worth |
1685 | * the effort additional complexity. */ | 1815 | * the effort additional complexity. */ |
1686 | ev = GNUNET_MQ_msg_extra (msg, | 1816 | ev = GNUNET_MQ_msg_extra (msg, |
@@ -1780,6 +1910,9 @@ handle_union_p2p_ibf (void *cls, | |||
1780 | struct Operation *op = cls; | 1910 | struct Operation *op = cls; |
1781 | unsigned int buckets_in_message; | 1911 | unsigned int buckets_in_message; |
1782 | 1912 | ||
1913 | perf_rtt.ibf.received += 1; | ||
1914 | perf_rtt.ibf.received_var_bytes += (ntohs (msg->header.size) - sizeof *msg); | ||
1915 | |||
1783 | buckets_in_message = (ntohs (msg->header.size) - sizeof *msg) | 1916 | buckets_in_message = (ntohs (msg->header.size) - sizeof *msg) |
1784 | / IBF_BUCKET_SIZE; | 1917 | / IBF_BUCKET_SIZE; |
1785 | if ((op->phase == PHASE_PASSIVE_DECODING) || | 1918 | if ((op->phase == PHASE_PASSIVE_DECODING) || |
@@ -1908,6 +2041,7 @@ maybe_finish (struct Operation *op) | |||
1908 | struct GNUNET_MQ_Envelope *ev; | 2041 | struct GNUNET_MQ_Envelope *ev; |
1909 | 2042 | ||
1910 | op->phase = PHASE_FINISHED; | 2043 | op->phase = PHASE_FINISHED; |
2044 | perf_rtt.done.sent += 1; | ||
1911 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_DONE); | 2045 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_DONE); |
1912 | GNUNET_MQ_send (op->mq, | 2046 | GNUNET_MQ_send (op->mq, |
1913 | ev); | 2047 | ev); |
@@ -1968,8 +2102,12 @@ handle_union_p2p_elements (void *cls, | |||
1968 | struct KeyEntry *ke; | 2102 | struct KeyEntry *ke; |
1969 | uint16_t element_size; | 2103 | uint16_t element_size; |
1970 | 2104 | ||
2105 | |||
1971 | element_size = ntohs (emsg->header.size) - sizeof(struct | 2106 | element_size = ntohs (emsg->header.size) - sizeof(struct |
1972 | GNUNET_SETU_ElementMessage); | 2107 | GNUNET_SETU_ElementMessage); |
2108 | perf_rtt.element.received += 1; | ||
2109 | perf_rtt.element.received_var_bytes += element_size; | ||
2110 | |||
1973 | ee = GNUNET_malloc (sizeof(struct ElementEntry) + element_size); | 2111 | ee = GNUNET_malloc (sizeof(struct ElementEntry) + element_size); |
1974 | GNUNET_memcpy (&ee[1], | 2112 | GNUNET_memcpy (&ee[1], |
1975 | &emsg[1], | 2113 | &emsg[1], |
@@ -2080,19 +2218,33 @@ handle_union_p2p_full_element (void *cls, | |||
2080 | uint16_t element_size; | 2218 | uint16_t element_size; |
2081 | 2219 | ||
2082 | 2220 | ||
2221 | |||
2222 | if(PHASE_EXPECT_IBF == op->phase) { | ||
2223 | op->phase = PHASE_FULL_RECEIVING; | ||
2224 | } | ||
2225 | |||
2226 | |||
2227 | |||
2083 | /* Allow only receiving of full element message if in expect IBF or in PHASE_FULL_RECEIVING state */ | 2228 | /* Allow only receiving of full element message if in expect IBF or in PHASE_FULL_RECEIVING state */ |
2084 | if ( (PHASE_EXPECT_IBF != op->phase) && | 2229 | if ((PHASE_FULL_RECEIVING != op->phase) && |
2085 | (PHASE_FULL_RECEIVING != op->phase) ) | 2230 | (PHASE_FULL_SENDING != op->phase)) |
2086 | { | 2231 | { |
2087 | GNUNET_break_op (0); | 2232 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2088 | fail_union_operation (op); | 2233 | "Handle full element phase is %u\n", |
2089 | return; | 2234 | (unsigned) op->phase); |
2090 | } | 2235 | GNUNET_break_op (0); |
2236 | fail_union_operation (op); | ||
2237 | return; | ||
2238 | } | ||
2239 | |||
2091 | 2240 | ||
2092 | op->phase = PHASE_FULL_RECEIVING; | ||
2093 | 2241 | ||
2094 | element_size = ntohs (emsg->header.size) | 2242 | element_size = ntohs (emsg->header.size) |
2095 | - sizeof(struct GNUNET_SETU_ElementMessage); | 2243 | - sizeof(struct GNUNET_SETU_ElementMessage); |
2244 | |||
2245 | perf_rtt.element_full.received += 1; | ||
2246 | perf_rtt.element_full.received_var_bytes += element_size; | ||
2247 | |||
2096 | ee = GNUNET_malloc (sizeof(struct ElementEntry) + element_size); | 2248 | ee = GNUNET_malloc (sizeof(struct ElementEntry) + element_size); |
2097 | GNUNET_memcpy (&ee[1], &emsg[1], element_size); | 2249 | GNUNET_memcpy (&ee[1], &emsg[1], element_size); |
2098 | ee->element.size = element_size; | 2250 | ee->element.size = element_size; |
@@ -2204,6 +2356,9 @@ handle_union_p2p_inquiry (void *cls, | |||
2204 | const struct IBF_Key *ibf_key; | 2356 | const struct IBF_Key *ibf_key; |
2205 | unsigned int num_keys; | 2357 | unsigned int num_keys; |
2206 | 2358 | ||
2359 | perf_rtt.inquery.received += 1; | ||
2360 | perf_rtt.inquery.received_var_bytes += (ntohs (msg->header.size) - sizeof(struct InquiryMessage)); | ||
2361 | |||
2207 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2362 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2208 | "Received union inquiry\n"); | 2363 | "Received union inquiry\n"); |
2209 | num_keys = (ntohs (msg->header.size) - sizeof(struct InquiryMessage)) | 2364 | num_keys = (ntohs (msg->header.size) - sizeof(struct InquiryMessage)) |
@@ -2247,6 +2402,7 @@ send_missing_full_elements_iter (void *cls, | |||
2247 | 2402 | ||
2248 | if (GNUNET_YES == ke->received) | 2403 | if (GNUNET_YES == ke->received) |
2249 | return GNUNET_YES; | 2404 | return GNUNET_YES; |
2405 | perf_rtt.element_full.received += 1; | ||
2250 | ev = GNUNET_MQ_msg_extra (emsg, | 2406 | ev = GNUNET_MQ_msg_extra (emsg, |
2251 | ee->element.size, | 2407 | ee->element.size, |
2252 | GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT); | 2408 | GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_ELEMENT); |
@@ -2272,7 +2428,9 @@ handle_union_p2p_request_full (void *cls, | |||
2272 | { | 2428 | { |
2273 | struct Operation *op = cls; | 2429 | struct Operation *op = cls; |
2274 | 2430 | ||
2275 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2431 | perf_rtt.request_full.received += 1; |
2432 | |||
2433 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
2276 | "Received request for full set transmission\n"); | 2434 | "Received request for full set transmission\n"); |
2277 | if (PHASE_EXPECT_IBF != op->phase) | 2435 | if (PHASE_EXPECT_IBF != op->phase) |
2278 | { | 2436 | { |
@@ -2300,9 +2458,11 @@ handle_union_p2p_full_done (void *cls, | |||
2300 | { | 2458 | { |
2301 | struct Operation *op = cls; | 2459 | struct Operation *op = cls; |
2302 | 2460 | ||
2461 | perf_rtt.full_done.received += 1; | ||
2462 | |||
2303 | switch (op->phase) | 2463 | switch (op->phase) |
2304 | { | 2464 | { |
2305 | case PHASE_EXPECT_IBF: | 2465 | case PHASE_FULL_RECEIVING: |
2306 | { | 2466 | { |
2307 | struct GNUNET_MQ_Envelope *ev; | 2467 | struct GNUNET_MQ_Envelope *ev; |
2308 | 2468 | ||
@@ -2313,6 +2473,7 @@ handle_union_p2p_full_done (void *cls, | |||
2313 | GNUNET_CONTAINER_multihashmap32_iterate (op->key_to_element, | 2473 | GNUNET_CONTAINER_multihashmap32_iterate (op->key_to_element, |
2314 | &send_missing_full_elements_iter, | 2474 | &send_missing_full_elements_iter, |
2315 | op); | 2475 | op); |
2476 | perf_rtt.full_done.sent += 1; | ||
2316 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE); | 2477 | ev = GNUNET_MQ_msg_header (GNUNET_MESSAGE_TYPE_SETU_P2P_FULL_DONE); |
2317 | GNUNET_MQ_send (op->mq, | 2478 | GNUNET_MQ_send (op->mq, |
2318 | ev); | 2479 | ev); |
@@ -2332,10 +2493,9 @@ handle_union_p2p_full_done (void *cls, | |||
2332 | _GSS_operation_destroy2 (op); | 2493 | _GSS_operation_destroy2 (op); |
2333 | return; | 2494 | return; |
2334 | } | 2495 | } |
2335 | break; | ||
2336 | 2496 | ||
2337 | default: | 2497 | default: |
2338 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2498 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2339 | "Handle full done phase is %u\n", | 2499 | "Handle full done phase is %u\n", |
2340 | (unsigned) op->phase); | 2500 | (unsigned) op->phase); |
2341 | GNUNET_break_op (0); | 2501 | GNUNET_break_op (0); |
@@ -2392,6 +2552,9 @@ handle_union_p2p_demand (void *cls, | |||
2392 | unsigned int num_hashes; | 2552 | unsigned int num_hashes; |
2393 | struct GNUNET_MQ_Envelope *ev; | 2553 | struct GNUNET_MQ_Envelope *ev; |
2394 | 2554 | ||
2555 | perf_rtt.demand.received += 1; | ||
2556 | perf_rtt.demand.received_var_bytes += (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)); | ||
2557 | |||
2395 | num_hashes = (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)) | 2558 | num_hashes = (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)) |
2396 | / sizeof(struct GNUNET_HashCode); | 2559 | / sizeof(struct GNUNET_HashCode); |
2397 | for (hash = (const struct GNUNET_HashCode *) &mh[1]; | 2560 | for (hash = (const struct GNUNET_HashCode *) &mh[1]; |
@@ -2414,6 +2577,8 @@ handle_union_p2p_demand (void *cls, | |||
2414 | fail_union_operation (op); | 2577 | fail_union_operation (op); |
2415 | return; | 2578 | return; |
2416 | } | 2579 | } |
2580 | perf_rtt.element.sent += 1; | ||
2581 | perf_rtt.element.sent_var_bytes += ee->element.size; | ||
2417 | ev = GNUNET_MQ_msg_extra (emsg, | 2582 | ev = GNUNET_MQ_msg_extra (emsg, |
2418 | ee->element.size, | 2583 | ee->element.size, |
2419 | GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS); | 2584 | GNUNET_MESSAGE_TYPE_SETU_P2P_ELEMENTS); |
@@ -2489,6 +2654,9 @@ handle_union_p2p_offer (void *cls, | |||
2489 | const struct GNUNET_HashCode *hash; | 2654 | const struct GNUNET_HashCode *hash; |
2490 | unsigned int num_hashes; | 2655 | unsigned int num_hashes; |
2491 | 2656 | ||
2657 | perf_rtt.offer.received += 1; | ||
2658 | perf_rtt.offer.received_var_bytes += (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)); | ||
2659 | |||
2492 | num_hashes = (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)) | 2660 | num_hashes = (ntohs (mh->size) - sizeof(struct GNUNET_MessageHeader)) |
2493 | / sizeof(struct GNUNET_HashCode); | 2661 | / sizeof(struct GNUNET_HashCode); |
2494 | for (hash = (const struct GNUNET_HashCode *) &mh[1]; | 2662 | for (hash = (const struct GNUNET_HashCode *) &mh[1]; |
@@ -2524,6 +2692,9 @@ handle_union_p2p_offer (void *cls, | |||
2524 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 2692 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2525 | "[OP %p] Requesting element (hash %s)\n", | 2693 | "[OP %p] Requesting element (hash %s)\n", |
2526 | op, GNUNET_h2s (hash)); | 2694 | op, GNUNET_h2s (hash)); |
2695 | |||
2696 | perf_rtt.demand.sent += 1; | ||
2697 | perf_rtt.demand.sent_var_bytes += sizeof(struct GNUNET_HashCode); | ||
2527 | ev = GNUNET_MQ_msg_header_extra (demands, | 2698 | ev = GNUNET_MQ_msg_header_extra (demands, |
2528 | sizeof(struct GNUNET_HashCode), | 2699 | sizeof(struct GNUNET_HashCode), |
2529 | GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND); | 2700 | GNUNET_MESSAGE_TYPE_SETU_P2P_DEMAND); |
@@ -2548,6 +2719,7 @@ handle_union_p2p_done (void *cls, | |||
2548 | { | 2719 | { |
2549 | struct Operation *op = cls; | 2720 | struct Operation *op = cls; |
2550 | 2721 | ||
2722 | perf_rtt.done.received += 1; | ||
2551 | switch (op->phase) | 2723 | switch (op->phase) |
2552 | { | 2724 | { |
2553 | case PHASE_PASSIVE_DECODING: | 2725 | case PHASE_PASSIVE_DECODING: |
@@ -2597,6 +2769,7 @@ static void | |||
2597 | handle_union_p2p_over (void *cls, | 2769 | handle_union_p2p_over (void *cls, |
2598 | const struct GNUNET_MessageHeader *mh) | 2770 | const struct GNUNET_MessageHeader *mh) |
2599 | { | 2771 | { |
2772 | perf_rtt.over.received += 1; | ||
2600 | send_client_done (cls); | 2773 | send_client_done (cls); |
2601 | } | 2774 | } |
2602 | 2775 | ||
@@ -2770,7 +2943,7 @@ check_incoming_msg (void *cls, | |||
2770 | struct Listener *listener = op->listener; | 2943 | struct Listener *listener = op->listener; |
2771 | const struct GNUNET_MessageHeader *nested_context; | 2944 | const struct GNUNET_MessageHeader *nested_context; |
2772 | 2945 | ||
2773 | /* double operation request */ | 2946 | /* double operation request */ |
2774 | if (0 != op->suggest_id) | 2947 | if (0 != op->suggest_id) |
2775 | { | 2948 | { |
2776 | GNUNET_break_op (0); | 2949 | GNUNET_break_op (0); |
@@ -3377,6 +3550,7 @@ handle_client_evaluate (void *cls, | |||
3377 | struct GNUNET_MQ_Envelope *ev; | 3550 | struct GNUNET_MQ_Envelope *ev; |
3378 | struct OperationRequestMessage *msg; | 3551 | struct OperationRequestMessage *msg; |
3379 | 3552 | ||
3553 | perf_rtt.operation_request.sent += 1; | ||
3380 | ev = GNUNET_MQ_msg_nested_mh (msg, | 3554 | ev = GNUNET_MQ_msg_nested_mh (msg, |
3381 | GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST, | 3555 | GNUNET_MESSAGE_TYPE_SETU_P2P_OPERATION_REQUEST, |
3382 | context); | 3556 | context); |
@@ -3575,6 +3749,9 @@ handle_client_accept (void *cls, | |||
3575 | buf = GNUNET_malloc (se->strata_count * IBF_BUCKET_SIZE * se->ibf_size); | 3749 | buf = GNUNET_malloc (se->strata_count * IBF_BUCKET_SIZE * se->ibf_size); |
3576 | len = strata_estimator_write (se, | 3750 | len = strata_estimator_write (se, |
3577 | buf); | 3751 | buf); |
3752 | perf_rtt.se.sent += 1; | ||
3753 | perf_rtt.se.sent_var_bytes += len; | ||
3754 | |||
3578 | if (len < se->strata_count * IBF_BUCKET_SIZE * se->ibf_size) | 3755 | if (len < se->strata_count * IBF_BUCKET_SIZE * se->ibf_size) |
3579 | type = GNUNET_MESSAGE_TYPE_SETU_P2P_SEC; | 3756 | type = GNUNET_MESSAGE_TYPE_SETU_P2P_SEC; |
3580 | else | 3757 | else |
@@ -3623,6 +3800,8 @@ shutdown_task (void *cls) | |||
3623 | GNUNET_YES); | 3800 | GNUNET_YES); |
3624 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3801 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3625 | "handled shutdown request\n"); | 3802 | "handled shutdown request\n"); |
3803 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
3804 | "RTT:%f\n", calculate_perf_rtt()); | ||
3626 | } | 3805 | } |
3627 | 3806 | ||
3628 | 3807 | ||
diff --git a/src/setu/gnunet-service-setu_strata_estimator.c b/src/setu/gnunet-service-setu_strata_estimator.c index 0fa6a6f17..7c9a4deb6 100644 --- a/src/setu/gnunet-service-setu_strata_estimator.c +++ b/src/setu/gnunet-service-setu_strata_estimator.c | |||
@@ -30,13 +30,6 @@ | |||
30 | 30 | ||
31 | 31 | ||
32 | /** | 32 | /** |
33 | * Should we try compressing the strata estimator? This will | ||
34 | * break compatibility with the 0.10.1-network. | ||
35 | */ | ||
36 | #define FAIL_10_1_COMPATIBILTIY 1 | ||
37 | |||
38 | |||
39 | /** | ||
40 | * Write the given strata estimator to the buffer. | 33 | * Write the given strata estimator to the buffer. |
41 | * | 34 | * |
42 | * @param se strata estimator to serialize | 35 | * @param se strata estimator to serialize |
@@ -48,11 +41,10 @@ strata_estimator_write (const struct StrataEstimator *se, | |||
48 | void *buf) | 41 | void *buf) |
49 | { | 42 | { |
50 | char *sbuf = buf; | 43 | char *sbuf = buf; |
51 | unsigned int i; | ||
52 | size_t osize; | 44 | size_t osize; |
53 | 45 | ||
54 | GNUNET_assert (NULL != se); | 46 | GNUNET_assert (NULL != se); |
55 | for (i = 0; i < se->strata_count; i++) | 47 | for (unsigned int i = 0; i < se->strata_count; i++) |
56 | { | 48 | { |
57 | ibf_write_slice (se->strata[i], | 49 | ibf_write_slice (se->strata[i], |
58 | 0, | 50 | 0, |
@@ -60,7 +52,6 @@ strata_estimator_write (const struct StrataEstimator *se, | |||
60 | &sbuf[se->ibf_size * IBF_BUCKET_SIZE * i]); | 52 | &sbuf[se->ibf_size * IBF_BUCKET_SIZE * i]); |
61 | } | 53 | } |
62 | osize = se->ibf_size * IBF_BUCKET_SIZE * se->strata_count; | 54 | osize = se->ibf_size * IBF_BUCKET_SIZE * se->strata_count; |
63 | #if FAIL_10_1_COMPATIBILTIY | ||
64 | { | 55 | { |
65 | char *cbuf; | 56 | char *cbuf; |
66 | size_t nsize; | 57 | size_t nsize; |
@@ -71,12 +62,13 @@ strata_estimator_write (const struct StrataEstimator *se, | |||
71 | &cbuf, | 62 | &cbuf, |
72 | &nsize)) | 63 | &nsize)) |
73 | { | 64 | { |
74 | GNUNET_memcpy (buf, cbuf, nsize); | 65 | GNUNET_memcpy (buf, |
66 | cbuf, | ||
67 | nsize); | ||
75 | osize = nsize; | 68 | osize = nsize; |
76 | GNUNET_free (cbuf); | 69 | GNUNET_free (cbuf); |
77 | } | 70 | } |
78 | } | 71 | } |
79 | #endif | ||
80 | return osize; | 72 | return osize; |
81 | } | 73 | } |
82 | 74 | ||
@@ -97,7 +89,6 @@ strata_estimator_read (const void *buf, | |||
97 | int is_compressed, | 89 | int is_compressed, |
98 | struct StrataEstimator *se) | 90 | struct StrataEstimator *se) |
99 | { | 91 | { |
100 | unsigned int i; | ||
101 | size_t osize; | 92 | size_t osize; |
102 | char *dbuf; | 93 | char *dbuf; |
103 | 94 | ||
@@ -124,7 +115,7 @@ strata_estimator_read (const void *buf, | |||
124 | return GNUNET_SYSERR; | 115 | return GNUNET_SYSERR; |
125 | } | 116 | } |
126 | 117 | ||
127 | for (i = 0; i < se->strata_count; i++) | 118 | for (unsigned int i = 0; i < se->strata_count; i++) |
128 | { | 119 | { |
129 | ibf_read_slice (buf, 0, se->ibf_size, se->strata[i]); | 120 | ibf_read_slice (buf, 0, se->ibf_size, se->strata[i]); |
130 | buf += se->ibf_size * IBF_BUCKET_SIZE; | 121 | buf += se->ibf_size * IBF_BUCKET_SIZE; |
@@ -190,22 +181,20 @@ strata_estimator_create (unsigned int strata_count, | |||
190 | uint8_t ibf_hashnum) | 181 | uint8_t ibf_hashnum) |
191 | { | 182 | { |
192 | struct StrataEstimator *se; | 183 | struct StrataEstimator *se; |
193 | unsigned int i; | ||
194 | unsigned int j; | ||
195 | 184 | ||
196 | se = GNUNET_new (struct StrataEstimator); | 185 | se = GNUNET_new (struct StrataEstimator); |
197 | se->strata_count = strata_count; | 186 | se->strata_count = strata_count; |
198 | se->ibf_size = ibf_size; | 187 | se->ibf_size = ibf_size; |
199 | se->strata = GNUNET_new_array (strata_count, | 188 | se->strata = GNUNET_new_array (strata_count, |
200 | struct InvertibleBloomFilter *); | 189 | struct InvertibleBloomFilter *); |
201 | for (i = 0; i < strata_count; i++) | 190 | for (unsigned int i = 0; i < strata_count; i++) |
202 | { | 191 | { |
203 | se->strata[i] = ibf_create (ibf_size, ibf_hashnum); | 192 | se->strata[i] = ibf_create (ibf_size, ibf_hashnum); |
204 | if (NULL == se->strata[i]) | 193 | if (NULL == se->strata[i]) |
205 | { | 194 | { |
206 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 195 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
207 | "Failed to allocate memory for strata estimator\n"); | 196 | "Failed to allocate memory for strata estimator\n"); |
208 | for (j = 0; j < i; j++) | 197 | for (unsigned int j = 0; j < i; j++) |
209 | ibf_destroy (se->strata[i]); | 198 | ibf_destroy (se->strata[i]); |
210 | GNUNET_free (se); | 199 | GNUNET_free (se); |
211 | return NULL; | 200 | return NULL; |
@@ -239,19 +228,23 @@ strata_estimator_difference (const struct StrataEstimator *se1, | |||
239 | 228 | ||
240 | /* FIXME: implement this without always allocating new IBFs */ | 229 | /* FIXME: implement this without always allocating new IBFs */ |
241 | diff = ibf_dup (se1->strata[i]); | 230 | diff = ibf_dup (se1->strata[i]); |
242 | ibf_subtract (diff, se2->strata[i]); | 231 | ibf_subtract (diff, |
232 | se2->strata[i]); | ||
243 | for (int ibf_count = 0; GNUNET_YES; ibf_count++) | 233 | for (int ibf_count = 0; GNUNET_YES; ibf_count++) |
244 | { | 234 | { |
245 | int more; | 235 | int more; |
246 | 236 | ||
247 | more = ibf_decode (diff, NULL, NULL); | 237 | more = ibf_decode (diff, |
238 | NULL, | ||
239 | NULL); | ||
248 | if (GNUNET_NO == more) | 240 | if (GNUNET_NO == more) |
249 | { | 241 | { |
250 | count += ibf_count; | 242 | count += ibf_count; |
251 | break; | 243 | break; |
252 | } | 244 | } |
253 | /* Estimate if decoding fails or would not terminate */ | 245 | /* Estimate if decoding fails or would not terminate */ |
254 | if ((GNUNET_SYSERR == more) || (ibf_count > diff->size)) | 246 | if ( (GNUNET_SYSERR == more) || |
247 | (ibf_count > diff->size) ) | ||
255 | { | 248 | { |
256 | ibf_destroy (diff); | 249 | ibf_destroy (diff); |
257 | return count * (1 << (i + 1)); | 250 | return count * (1 << (i + 1)); |
@@ -273,14 +266,13 @@ struct StrataEstimator * | |||
273 | strata_estimator_dup (struct StrataEstimator *se) | 266 | strata_estimator_dup (struct StrataEstimator *se) |
274 | { | 267 | { |
275 | struct StrataEstimator *c; | 268 | struct StrataEstimator *c; |
276 | unsigned int i; | ||
277 | 269 | ||
278 | c = GNUNET_new (struct StrataEstimator); | 270 | c = GNUNET_new (struct StrataEstimator); |
279 | c->strata_count = se->strata_count; | 271 | c->strata_count = se->strata_count; |
280 | c->ibf_size = se->ibf_size; | 272 | c->ibf_size = se->ibf_size; |
281 | c->strata = GNUNET_new_array (se->strata_count, | 273 | c->strata = GNUNET_new_array (se->strata_count, |
282 | struct InvertibleBloomFilter *); | 274 | struct InvertibleBloomFilter *); |
283 | for (i = 0; i < se->strata_count; i++) | 275 | for (unsigned int i = 0; i < se->strata_count; i++) |
284 | c->strata[i] = ibf_dup (se->strata[i]); | 276 | c->strata[i] = ibf_dup (se->strata[i]); |
285 | return c; | 277 | return c; |
286 | } | 278 | } |
@@ -294,9 +286,7 @@ strata_estimator_dup (struct StrataEstimator *se) | |||
294 | void | 286 | void |
295 | strata_estimator_destroy (struct StrataEstimator *se) | 287 | strata_estimator_destroy (struct StrataEstimator *se) |
296 | { | 288 | { |
297 | unsigned int i; | 289 | for (unsigned int i = 0; i < se->strata_count; i++) |
298 | |||
299 | for (i = 0; i < se->strata_count; i++) | ||
300 | ibf_destroy (se->strata[i]); | 290 | ibf_destroy (se->strata[i]); |
301 | GNUNET_free (se->strata); | 291 | GNUNET_free (se->strata); |
302 | GNUNET_free (se); | 292 | GNUNET_free (se); |
diff --git a/src/setu/ibf.c b/src/setu/ibf.c index 79b4f28db..1beba9065 100644 --- a/src/setu/ibf.c +++ b/src/setu/ibf.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file set/ibf.c | 22 | * @file set/ibf.c |
23 | * @brief implementation of the invertible bloom filter | 23 | * @brief implementation of the invertible Bloom filter |
24 | * @author Florian Dold | 24 | * @author Florian Dold |
25 | */ | 25 | */ |
26 | 26 | ||
@@ -58,12 +58,11 @@ ibf_hashcode_from_key (struct IBF_Key key, | |||
58 | struct GNUNET_HashCode *dst) | 58 | struct GNUNET_HashCode *dst) |
59 | { | 59 | { |
60 | struct IBF_Key *p; | 60 | struct IBF_Key *p; |
61 | unsigned int i; | ||
62 | const unsigned int keys_per_hashcode = sizeof(struct GNUNET_HashCode) | 61 | const unsigned int keys_per_hashcode = sizeof(struct GNUNET_HashCode) |
63 | / sizeof(struct IBF_Key); | 62 | / sizeof(struct IBF_Key); |
64 | 63 | ||
65 | p = (struct IBF_Key *) dst; | 64 | p = (struct IBF_Key *) dst; |
66 | for (i = 0; i < keys_per_hashcode; i++) | 65 | for (unsigned int i = 0; i < keys_per_hashcode; i++) |
67 | *p++ = key; | 66 | *p++ = key; |
68 | } | 67 | } |
69 | 68 | ||
@@ -76,12 +75,12 @@ ibf_hashcode_from_key (struct IBF_Key key, | |||
76 | * @return the newly created invertible bloom filter, NULL on error | 75 | * @return the newly created invertible bloom filter, NULL on error |
77 | */ | 76 | */ |
78 | struct InvertibleBloomFilter * | 77 | struct InvertibleBloomFilter * |
79 | ibf_create (uint32_t size, uint8_t hash_num) | 78 | ibf_create (uint32_t size, |
79 | uint8_t hash_num) | ||
80 | { | 80 | { |
81 | struct InvertibleBloomFilter *ibf; | 81 | struct InvertibleBloomFilter *ibf; |
82 | 82 | ||
83 | GNUNET_assert (0 != size); | 83 | GNUNET_assert (0 != size); |
84 | |||
85 | ibf = GNUNET_new (struct InvertibleBloomFilter); | 84 | ibf = GNUNET_new (struct InvertibleBloomFilter); |
86 | ibf->count = GNUNET_malloc_large (size * sizeof(uint8_t)); | 85 | ibf->count = GNUNET_malloc_large (size * sizeof(uint8_t)); |
87 | if (NULL == ibf->count) | 86 | if (NULL == ibf->count) |
@@ -106,7 +105,6 @@ ibf_create (uint32_t size, uint8_t hash_num) | |||
106 | } | 105 | } |
107 | ibf->size = size; | 106 | ibf->size = size; |
108 | ibf->hash_num = hash_num; | 107 | ibf->hash_num = hash_num; |
109 | |||
110 | return ibf; | 108 | return ibf; |
111 | } | 109 | } |
112 | 110 | ||
@@ -123,7 +121,8 @@ ibf_get_indices (const struct InvertibleBloomFilter *ibf, | |||
123 | uint32_t i; | 121 | uint32_t i; |
124 | uint32_t bucket; | 122 | uint32_t bucket; |
125 | 123 | ||
126 | bucket = GNUNET_CRYPTO_crc32_n (&key, sizeof key); | 124 | bucket = GNUNET_CRYPTO_crc32_n (&key, |
125 | sizeof (key)); | ||
127 | for (i = 0, filled = 0; filled < ibf->hash_num; i++) | 126 | for (i = 0, filled = 0; filled < ibf->hash_num; i++) |
128 | { | 127 | { |
129 | uint64_t x; | 128 | uint64_t x; |
@@ -134,7 +133,8 @@ ibf_get_indices (const struct InvertibleBloomFilter *ibf, | |||
134 | dst[filled++] = bucket % ibf->size; | 133 | dst[filled++] = bucket % ibf->size; |
135 | try_next: | 134 | try_next: |
136 | x = ((uint64_t) bucket << 32) | i; | 135 | x = ((uint64_t) bucket << 32) | i; |
137 | bucket = GNUNET_CRYPTO_crc32_n (&x, sizeof x); | 136 | bucket = GNUNET_CRYPTO_crc32_n (&x, |
137 | sizeof (x)); | ||
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
@@ -170,8 +170,13 @@ ibf_insert (struct InvertibleBloomFilter *ibf, | |||
170 | int buckets[ibf->hash_num]; | 170 | int buckets[ibf->hash_num]; |
171 | 171 | ||
172 | GNUNET_assert (ibf->hash_num <= ibf->size); | 172 | GNUNET_assert (ibf->hash_num <= ibf->size); |
173 | ibf_get_indices (ibf, key, buckets); | 173 | ibf_get_indices (ibf, |
174 | ibf_insert_into (ibf, key, buckets, 1); | 174 | key, |
175 | buckets); | ||
176 | ibf_insert_into (ibf, | ||
177 | key, | ||
178 | buckets, | ||
179 | 1); | ||
175 | } | 180 | } |
176 | 181 | ||
177 | 182 | ||
@@ -188,8 +193,13 @@ ibf_remove (struct InvertibleBloomFilter *ibf, | |||
188 | int buckets[ibf->hash_num]; | 193 | int buckets[ibf->hash_num]; |
189 | 194 | ||
190 | GNUNET_assert (ibf->hash_num <= ibf->size); | 195 | GNUNET_assert (ibf->hash_num <= ibf->size); |
191 | ibf_get_indices (ibf, key, buckets); | 196 | ibf_get_indices (ibf, |
192 | ibf_insert_into (ibf, key, buckets, -1); | 197 | key, |
198 | buckets); | ||
199 | ibf_insert_into (ibf, | ||
200 | key, | ||
201 | buckets, | ||
202 | -1); | ||
193 | } | 203 | } |
194 | 204 | ||
195 | 205 | ||
@@ -234,8 +244,6 @@ ibf_decode (struct InvertibleBloomFilter *ibf, | |||
234 | 244 | ||
235 | for (uint32_t i = 0; i < ibf->size; i++) | 245 | for (uint32_t i = 0; i < ibf->size; i++) |
236 | { | 246 | { |
237 | int hit; | ||
238 | |||
239 | /* we can only decode from pure buckets */ | 247 | /* we can only decode from pure buckets */ |
240 | if ( (1 != ibf->count[i].count_val) && | 248 | if ( (1 != ibf->count[i].count_val) && |
241 | (-1 != ibf->count[i].count_val) ) | 249 | (-1 != ibf->count[i].count_val) ) |
@@ -249,23 +257,30 @@ ibf_decode (struct InvertibleBloomFilter *ibf, | |||
249 | 257 | ||
250 | /* test if key in bucket hits its own location, | 258 | /* test if key in bucket hits its own location, |
251 | * if not, the key hash was subject to collision */ | 259 | * if not, the key hash was subject to collision */ |
252 | hit = GNUNET_NO; | 260 | { |
253 | ibf_get_indices (ibf, ibf->key_sum[i], buckets); | 261 | bool hit = false; |
254 | for (int j = 0; j < ibf->hash_num; j++) | 262 | |
255 | if (buckets[j] == i) | 263 | ibf_get_indices (ibf, |
256 | hit = GNUNET_YES; | 264 | ibf->key_sum[i], |
257 | 265 | buckets); | |
258 | if (GNUNET_NO == hit) | 266 | for (int j = 0; j < ibf->hash_num; j++) |
259 | continue; | 267 | if (buckets[j] == i) |
260 | 268 | { | |
269 | hit = true; | ||
270 | break; | ||
271 | } | ||
272 | if (! hit) | ||
273 | continue; | ||
274 | } | ||
261 | if (NULL != ret_side) | 275 | if (NULL != ret_side) |
262 | *ret_side = ibf->count[i].count_val; | 276 | *ret_side = ibf->count[i].count_val; |
263 | if (NULL != ret_id) | 277 | if (NULL != ret_id) |
264 | *ret_id = ibf->key_sum[i]; | 278 | *ret_id = ibf->key_sum[i]; |
265 | 279 | ||
266 | /* insert on the opposite side, effectively removing the element */ | 280 | /* insert on the opposite side, effectively removing the element */ |
267 | ibf_insert_into (ibf, ibf->key_sum[i], buckets, -ibf->count[i].count_val); | 281 | ibf_insert_into (ibf, |
268 | 282 | ibf->key_sum[i], buckets, | |
283 | -ibf->count[i].count_val); | ||
269 | return GNUNET_YES; | 284 | return GNUNET_YES; |
270 | } | 285 | } |
271 | 286 | ||
@@ -287,7 +302,8 @@ ibf_decode (struct InvertibleBloomFilter *ibf, | |||
287 | void | 302 | void |
288 | ibf_write_slice (const struct InvertibleBloomFilter *ibf, | 303 | ibf_write_slice (const struct InvertibleBloomFilter *ibf, |
289 | uint32_t start, | 304 | uint32_t start, |
290 | uint32_t count, void *buf) | 305 | uint32_t count, |
306 | void *buf) | ||
291 | { | 307 | { |
292 | struct IBF_Key *key_dst; | 308 | struct IBF_Key *key_dst; |
293 | struct IBF_KeyHash *key_hash_dst; | 309 | struct IBF_KeyHash *key_hash_dst; |
diff --git a/src/setu/perf_setu_api.c b/src/setu/perf_setu_api.c new file mode 100644 index 000000000..3b82e8af9 --- /dev/null +++ b/src/setu/perf_setu_api.c | |||
@@ -0,0 +1,428 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2012 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file set/test_setu_api.c | ||
23 | * @brief testcase for setu_api.c | ||
24 | * @author Florian Dold | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_testing_lib.h" | ||
29 | #include "gnunet_setu_service.h" | ||
30 | |||
31 | |||
32 | static struct GNUNET_PeerIdentity local_id; | ||
33 | |||
34 | static struct GNUNET_HashCode app_id; | ||
35 | |||
36 | static struct GNUNET_SETU_Handle *set1; | ||
37 | |||
38 | static struct GNUNET_SETU_Handle *set2; | ||
39 | |||
40 | static struct GNUNET_SETU_ListenHandle *listen_handle; | ||
41 | |||
42 | static struct GNUNET_SETU_OperationHandle *oh1; | ||
43 | |||
44 | static struct GNUNET_SETU_OperationHandle *oh2; | ||
45 | |||
46 | static const struct GNUNET_CONFIGURATION_Handle *config; | ||
47 | |||
48 | static int ret; | ||
49 | |||
50 | static struct GNUNET_SCHEDULER_Task *tt; | ||
51 | |||
52 | |||
53 | |||
54 | static void | ||
55 | result_cb_set1 (void *cls, | ||
56 | const struct GNUNET_SETU_Element *element, | ||
57 | uint64_t size, | ||
58 | enum GNUNET_SETU_Status status) | ||
59 | { | ||
60 | switch (status) | ||
61 | { | ||
62 | case GNUNET_SETU_STATUS_ADD_LOCAL: | ||
63 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: got element\n"); | ||
64 | break; | ||
65 | |||
66 | case GNUNET_SETU_STATUS_FAILURE: | ||
67 | GNUNET_break (0); | ||
68 | oh1 = NULL; | ||
69 | fprintf (stderr, "set 1: received failure status!\n"); | ||
70 | ret = 1; | ||
71 | if (NULL != tt) | ||
72 | { | ||
73 | GNUNET_SCHEDULER_cancel (tt); | ||
74 | tt = NULL; | ||
75 | } | ||
76 | GNUNET_SCHEDULER_shutdown (); | ||
77 | break; | ||
78 | |||
79 | case GNUNET_SETU_STATUS_DONE: | ||
80 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 1: done\n"); | ||
81 | oh1 = NULL; | ||
82 | if (NULL != set1) | ||
83 | { | ||
84 | GNUNET_SETU_destroy (set1); | ||
85 | set1 = NULL; | ||
86 | } | ||
87 | if (NULL == set2) | ||
88 | { | ||
89 | GNUNET_SCHEDULER_cancel (tt); | ||
90 | tt = NULL; | ||
91 | GNUNET_SCHEDULER_shutdown (); | ||
92 | } | ||
93 | break; | ||
94 | |||
95 | default: | ||
96 | GNUNET_assert (0); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | |||
101 | static void | ||
102 | result_cb_set2 (void *cls, | ||
103 | const struct GNUNET_SETU_Element *element, | ||
104 | uint64_t size, | ||
105 | enum GNUNET_SETU_Status status) | ||
106 | { | ||
107 | switch (status) | ||
108 | { | ||
109 | case GNUNET_SETU_STATUS_ADD_LOCAL: | ||
110 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 2: got element\n"); | ||
111 | break; | ||
112 | |||
113 | case GNUNET_SETU_STATUS_FAILURE: | ||
114 | GNUNET_break (0); | ||
115 | oh2 = NULL; | ||
116 | fprintf (stderr, "set 2: received failure status\n"); | ||
117 | GNUNET_SCHEDULER_shutdown (); | ||
118 | ret = 1; | ||
119 | break; | ||
120 | |||
121 | case GNUNET_SETU_STATUS_DONE: | ||
122 | oh2 = NULL; | ||
123 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "set 2: done\n"); | ||
124 | GNUNET_SETU_destroy (set2); | ||
125 | set2 = NULL; | ||
126 | if (NULL == set1) | ||
127 | { | ||
128 | GNUNET_SCHEDULER_cancel (tt); | ||
129 | tt = NULL; | ||
130 | GNUNET_SCHEDULER_shutdown (); | ||
131 | } | ||
132 | break; | ||
133 | |||
134 | default: | ||
135 | GNUNET_assert (0); | ||
136 | } | ||
137 | } | ||
138 | |||
139 | |||
140 | static void | ||
141 | listen_cb (void *cls, | ||
142 | const struct GNUNET_PeerIdentity *other_peer, | ||
143 | const struct GNUNET_MessageHeader *context_msg, | ||
144 | struct GNUNET_SETU_Request *request) | ||
145 | { | ||
146 | GNUNET_assert (NULL != context_msg); | ||
147 | GNUNET_assert (ntohs (context_msg->type) == GNUNET_MESSAGE_TYPE_DUMMY); | ||
148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "listen cb called\n"); | ||
149 | oh2 = GNUNET_SETU_accept (request, | ||
150 | (struct GNUNET_SETU_Option[]){ 0 }, | ||
151 | &result_cb_set2, | ||
152 | NULL); | ||
153 | GNUNET_SETU_commit (oh2, set2); | ||
154 | } | ||
155 | |||
156 | |||
157 | /** | ||
158 | * Start the set operation. | ||
159 | * | ||
160 | * @param cls closure, unused | ||
161 | */ | ||
162 | static void | ||
163 | start (void *cls) | ||
164 | { | ||
165 | struct GNUNET_MessageHeader context_msg; | ||
166 | |||
167 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting reconciliation\n"); | ||
168 | context_msg.size = htons (sizeof context_msg); | ||
169 | context_msg.type = htons (GNUNET_MESSAGE_TYPE_DUMMY); | ||
170 | listen_handle = GNUNET_SETU_listen (config, | ||
171 | &app_id, | ||
172 | &listen_cb, | ||
173 | NULL); | ||
174 | oh1 = GNUNET_SETU_prepare (&local_id, | ||
175 | &app_id, | ||
176 | &context_msg, | ||
177 | (struct GNUNET_SETU_Option[]){ 0 }, | ||
178 | &result_cb_set1, | ||
179 | NULL); | ||
180 | GNUNET_SETU_commit (oh1, set1); | ||
181 | } | ||
182 | |||
183 | |||
184 | /** | ||
185 | * Initialize the second set, continue | ||
186 | * | ||
187 | * @param cls closure, unused | ||
188 | */ | ||
189 | static void | ||
190 | init_set2 (void *cls) | ||
191 | { | ||
192 | struct GNUNET_SETU_Element element; | ||
193 | |||
194 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n"); | ||
195 | |||
196 | element.element_type = 0; | ||
197 | element.data = "hello1"; | ||
198 | element.size = strlen (element.data); | ||
199 | GNUNET_SETU_add_element (set2, &element, NULL, NULL); | ||
200 | element.data = "quux"; | ||
201 | element.size = strlen (element.data); | ||
202 | GNUNET_SETU_add_element (set2, &element, NULL, NULL); | ||
203 | element.data = "baz"; | ||
204 | element.size = strlen (element.data); | ||
205 | GNUNET_SETU_add_element (set2, &element, &start, NULL); | ||
206 | } | ||
207 | |||
208 | /** | ||
209 | * Generate random byte stream | ||
210 | */ | ||
211 | |||
212 | unsigned char *gen_rdm_bytestream (size_t num_bytes) | ||
213 | { | ||
214 | unsigned char *stream = GNUNET_malloc (num_bytes); | ||
215 | GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, stream, num_bytes); | ||
216 | return stream; | ||
217 | } | ||
218 | |||
219 | /** | ||
220 | * Generate random sets | ||
221 | */ | ||
222 | |||
223 | static void | ||
224 | initRandomSets(int overlap, int set1_size, int set2_size, int element_size_in_bytes) | ||
225 | { | ||
226 | struct GNUNET_SETU_Element element; | ||
227 | element.element_type = 0; | ||
228 | |||
229 | // Add elements to both sets | ||
230 | for (int i = 0; i < overlap; i++) { | ||
231 | element.data = gen_rdm_bytestream(element_size_in_bytes); | ||
232 | element.size = element_size_in_bytes; | ||
233 | GNUNET_SETU_add_element (set1, &element, NULL, NULL); | ||
234 | GNUNET_SETU_add_element (set2, &element, NULL, NULL); | ||
235 | set1_size--; | ||
236 | set2_size--; | ||
237 | } | ||
238 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in both sets\n"); | ||
239 | |||
240 | // Add other elements to set 1 | ||
241 | while(set1_size>0) { | ||
242 | element.data = gen_rdm_bytestream(element_size_in_bytes); | ||
243 | element.size = element_size_in_bytes; | ||
244 | GNUNET_SETU_add_element (set1, &element, NULL, NULL); | ||
245 | set1_size--; | ||
246 | } | ||
247 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set1\n"); | ||
248 | |||
249 | // Add other elements to set 2 | ||
250 | while(set2_size > 0) { | ||
251 | element.data = gen_rdm_bytestream(element_size_in_bytes); | ||
252 | element.size = element_size_in_bytes; | ||
253 | |||
254 | if(set2_size != 1) { | ||
255 | GNUNET_SETU_add_element (set2, &element,NULL, NULL); | ||
256 | } else { | ||
257 | GNUNET_SETU_add_element (set2, &element,&start, NULL); | ||
258 | } | ||
259 | |||
260 | set2_size--; | ||
261 | } | ||
262 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set2\n"); | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * Initialize the first set, continue. | ||
267 | */ | ||
268 | static void | ||
269 | init_set1 (void) | ||
270 | { | ||
271 | struct GNUNET_SETU_Element element; | ||
272 | |||
273 | element.element_type = 0; | ||
274 | element.data = "hello"; | ||
275 | element.size = strlen (element.data); | ||
276 | GNUNET_SETU_add_element (set1, &element, NULL, NULL); | ||
277 | element.data = "bar"; | ||
278 | element.size = strlen (element.data); | ||
279 | GNUNET_SETU_add_element (set1, &element, &init_set2, NULL); | ||
280 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized set 1\n"); | ||
281 | } | ||
282 | |||
283 | |||
284 | /** | ||
285 | * Function run on timeout. | ||
286 | * | ||
287 | * @param cls closure | ||
288 | */ | ||
289 | static void | ||
290 | timeout_fail (void *cls) | ||
291 | { | ||
292 | tt = NULL; | ||
293 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Testcase failed with timeout\n"); | ||
294 | GNUNET_SCHEDULER_shutdown (); | ||
295 | ret = 1; | ||
296 | } | ||
297 | |||
298 | |||
299 | /** | ||
300 | * Function run on shutdown. | ||
301 | * | ||
302 | * @param cls closure | ||
303 | */ | ||
304 | static void | ||
305 | do_shutdown (void *cls) | ||
306 | { | ||
307 | if (NULL != tt) | ||
308 | { | ||
309 | GNUNET_SCHEDULER_cancel (tt); | ||
310 | tt = NULL; | ||
311 | } | ||
312 | if (NULL != oh1) | ||
313 | { | ||
314 | GNUNET_SETU_operation_cancel (oh1); | ||
315 | oh1 = NULL; | ||
316 | } | ||
317 | if (NULL != oh2) | ||
318 | { | ||
319 | GNUNET_SETU_operation_cancel (oh2); | ||
320 | oh2 = NULL; | ||
321 | } | ||
322 | if (NULL != set1) | ||
323 | { | ||
324 | GNUNET_SETU_destroy (set1); | ||
325 | set1 = NULL; | ||
326 | } | ||
327 | if (NULL != set2) | ||
328 | { | ||
329 | GNUNET_SETU_destroy (set2); | ||
330 | set2 = NULL; | ||
331 | } | ||
332 | if (NULL != listen_handle) | ||
333 | { | ||
334 | GNUNET_SETU_listen_cancel (listen_handle); | ||
335 | listen_handle = NULL; | ||
336 | } | ||
337 | } | ||
338 | |||
339 | |||
340 | /** | ||
341 | * Signature of the 'main' function for a (single-peer) testcase that | ||
342 | * is run using 'GNUNET_TESTING_peer_run'. | ||
343 | * | ||
344 | * @param cls closure | ||
345 | * @param cfg configuration of the peer that was started | ||
346 | * @param peer identity of the peer that was created | ||
347 | */ | ||
348 | static void | ||
349 | run (void *cls, | ||
350 | const struct GNUNET_CONFIGURATION_Handle *cfg, | ||
351 | struct GNUNET_TESTING_Peer *peer) | ||
352 | { | ||
353 | struct GNUNET_SETU_OperationHandle *my_oh; | ||
354 | |||
355 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
356 | "Running preparatory tests\n"); | ||
357 | tt = GNUNET_SCHEDULER_add_delayed ( | ||
358 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5), | ||
359 | &timeout_fail, | ||
360 | NULL); | ||
361 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | ||
362 | |||
363 | config = cfg; | ||
364 | GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_get_peer_identity (cfg, | ||
365 | &local_id)); | ||
366 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
367 | "my id (from CRYPTO): %s\n", | ||
368 | GNUNET_i2s (&local_id)); | ||
369 | GNUNET_TESTING_peer_get_identity (peer, | ||
370 | &local_id); | ||
371 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
372 | "my id (from TESTING): %s\n", | ||
373 | GNUNET_i2s (&local_id)); | ||
374 | set1 = GNUNET_SETU_create (cfg); | ||
375 | set2 = GNUNET_SETU_create (cfg); | ||
376 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
377 | "Created sets %p and %p for union operation\n", | ||
378 | set1, | ||
379 | set2); | ||
380 | GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &app_id); | ||
381 | |||
382 | /* test if canceling an uncommited request works! */ | ||
383 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
384 | "Launching and instantly stopping set operation\n"); | ||
385 | my_oh = GNUNET_SETU_prepare (&local_id, | ||
386 | &app_id, | ||
387 | NULL, | ||
388 | (struct GNUNET_SETU_Option[]){ 0 }, | ||
389 | NULL, | ||
390 | NULL); | ||
391 | GNUNET_SETU_operation_cancel (my_oh); | ||
392 | |||
393 | /* test the real set reconciliation */ | ||
394 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
395 | "Running real set-reconciliation\n"); | ||
396 | //init_set1 (); | ||
397 | // limit ~23800 element total | ||
398 | initRandomSets(50,100,100,128); | ||
399 | } | ||
400 | |||
401 | static void execute_perf() | ||
402 | { | ||
403 | for( int repeat_ctr = 0; repeat_ctr<1; repeat_ctr++ ) { | ||
404 | |||
405 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
406 | "Executing perf round %d\n", repeat_ctr); | ||
407 | |||
408 | GNUNET_TESTING_service_run ("perf_setu_api", | ||
409 | "arm", | ||
410 | "test_setu.conf", | ||
411 | &run, | ||
412 | NULL); | ||
413 | } | ||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | |||
418 | |||
419 | int | ||
420 | main (int argc, char **argv) | ||
421 | { | ||
422 | GNUNET_log_setup ("perf_setu_api", | ||
423 | "WARNING", | ||
424 | NULL); | ||
425 | |||
426 | execute_perf(); | ||
427 | return 0; | ||
428 | } | ||
diff --git a/src/setu/setu.h b/src/setu/setu.h index e9a0def95..f806c8eb1 100644 --- a/src/setu/setu.h +++ b/src/setu/setu.h | |||
@@ -121,6 +121,7 @@ struct GNUNET_SETU_AcceptMessage | |||
121 | * byzantine mode is enabled. | 121 | * byzantine mode is enabled. |
122 | */ | 122 | */ |
123 | uint32_t byzantine_lower_bound; | 123 | uint32_t byzantine_lower_bound; |
124 | |||
124 | }; | 125 | }; |
125 | 126 | ||
126 | 127 | ||
diff --git a/src/setu/test_setu_api.c b/src/setu/test_setu_api.c index 95119873c..d5c9f5b7a 100644 --- a/src/setu/test_setu_api.c +++ b/src/setu/test_setu_api.c | |||
@@ -193,7 +193,7 @@ init_set2 (void *cls) | |||
193 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n"); | 193 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initializing set 2\n"); |
194 | 194 | ||
195 | element.element_type = 0; | 195 | element.element_type = 0; |
196 | element.data = "hello"; | 196 | element.data = "hello1"; |
197 | element.size = strlen (element.data); | 197 | element.size = strlen (element.data); |
198 | GNUNET_SETU_add_element (set2, &element, NULL, NULL); | 198 | GNUNET_SETU_add_element (set2, &element, NULL, NULL); |
199 | element.data = "quux"; | 199 | element.data = "quux"; |
@@ -204,6 +204,62 @@ init_set2 (void *cls) | |||
204 | GNUNET_SETU_add_element (set2, &element, &start, NULL); | 204 | GNUNET_SETU_add_element (set2, &element, &start, NULL); |
205 | } | 205 | } |
206 | 206 | ||
207 | /** | ||
208 | * Generate random byte stream | ||
209 | */ | ||
210 | |||
211 | unsigned char *gen_rdm_bytestream (size_t num_bytes) | ||
212 | { | ||
213 | unsigned char *stream = GNUNET_malloc (num_bytes); | ||
214 | GNUNET_CRYPTO_random_block(GNUNET_CRYPTO_QUALITY_WEAK, stream, num_bytes); | ||
215 | return stream; | ||
216 | } | ||
217 | |||
218 | /** | ||
219 | * Generate random sets | ||
220 | */ | ||
221 | |||
222 | static void | ||
223 | initRandomSets(int overlap, int set1_size, int set2_size, int element_size_in_bytes) | ||
224 | { | ||
225 | struct GNUNET_SETU_Element element; | ||
226 | element.element_type = 0; | ||
227 | |||
228 | // Add elements to both sets | ||
229 | for (int i = 0; i < overlap; i++) { | ||
230 | element.data = gen_rdm_bytestream(element_size_in_bytes); | ||
231 | element.size = element_size_in_bytes; | ||
232 | GNUNET_SETU_add_element (set1, &element, NULL, NULL); | ||
233 | GNUNET_SETU_add_element (set2, &element, NULL, NULL); | ||
234 | set1_size--; | ||
235 | set2_size--; | ||
236 | } | ||
237 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in both sets\n"); | ||
238 | |||
239 | // Add other elements to set 1 | ||
240 | while(set1_size>0) { | ||
241 | element.data = gen_rdm_bytestream(element_size_in_bytes); | ||
242 | element.size = element_size_in_bytes; | ||
243 | GNUNET_SETU_add_element (set1, &element, NULL, NULL); | ||
244 | set1_size--; | ||
245 | } | ||
246 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set1\n"); | ||
247 | |||
248 | // Add other elements to set 2 | ||
249 | while(set2_size > 0) { | ||
250 | element.data = gen_rdm_bytestream(element_size_in_bytes); | ||
251 | element.size = element_size_in_bytes; | ||
252 | |||
253 | if(set2_size != 1) { | ||
254 | GNUNET_SETU_add_element (set2, &element,NULL, NULL); | ||
255 | } else { | ||
256 | GNUNET_SETU_add_element (set2, &element,&start, NULL); | ||
257 | } | ||
258 | |||
259 | set2_size--; | ||
260 | } | ||
261 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "initialized elements in set2\n"); | ||
262 | } | ||
207 | 263 | ||
208 | /** | 264 | /** |
209 | * Initialize the first set, continue. | 265 | * Initialize the first set, continue. |
@@ -336,7 +392,9 @@ run (void *cls, | |||
336 | /* test the real set reconciliation */ | 392 | /* test the real set reconciliation */ |
337 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
338 | "Running real set-reconciliation\n"); | 394 | "Running real set-reconciliation\n"); |
339 | init_set1 (); | 395 | //init_set1 (); |
396 | initRandomSets(19500,20000,20000,4096); | ||
397 | //initRandomSets(19500,20000,20000,32); | ||
340 | } | 398 | } |
341 | 399 | ||
342 | 400 | ||
diff --git a/src/testbed/Makefile.am b/src/testbed/Makefile.am index 7c1e217bb..740be2742 100644 --- a/src/testbed/Makefile.am +++ b/src/testbed/Makefile.am | |||
@@ -94,6 +94,8 @@ lib_LTLIBRARIES = \ | |||
94 | libgnunettestbed_la_SOURCES = \ | 94 | libgnunettestbed_la_SOURCES = \ |
95 | testbed_api.c testbed_api.h testbed.h \ | 95 | testbed_api.c testbed_api.h testbed.h \ |
96 | testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \ | 96 | testbed_api_hosts.c testbed_api_hosts.h testbed_helper.h \ |
97 | testbed_api_cmd_controller.c \ | ||
98 | testbed_api_cmd_peer.c \ | ||
97 | testbed_api_operations.c testbed_api_operations.h \ | 99 | testbed_api_operations.c testbed_api_operations.h \ |
98 | testbed_api_peers.c testbed_api_peers.h \ | 100 | testbed_api_peers.c testbed_api_peers.h \ |
99 | testbed_api_services.c \ | 101 | testbed_api_services.c \ |
@@ -192,12 +194,6 @@ if ENABLE_TEST_RUN | |||
192 | $(underlay_testcases) | 194 | $(underlay_testcases) |
193 | endif | 195 | endif |
194 | 196 | ||
195 | test_testbed_api_hosts_SOURCES = \ | ||
196 | test_testbed_api_hosts.c | ||
197 | test_testbed_api_hosts_LDADD = \ | ||
198 | $(top_builddir)/src/util/libgnunetutil.la \ | ||
199 | libgnunettestbed.la | ||
200 | |||
201 | test_testbed_api_SOURCES = \ | 197 | test_testbed_api_SOURCES = \ |
202 | test_testbed_api.c | 198 | test_testbed_api.c |
203 | test_testbed_api_LDADD = \ | 199 | test_testbed_api_LDADD = \ |
diff --git a/src/testbed/testbed_api_cmd_controller.c b/src/testbed/testbed_api_cmd_controller.c new file mode 100644 index 000000000..da23df1ef --- /dev/null +++ b/src/testbed/testbed_api_cmd_controller.c | |||
@@ -0,0 +1,293 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testbed/testbed_api_cmd_controller.c | ||
23 | * @brief Command to create a controller. | ||
24 | * @author t3sserakt | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_testing_ng_lib.h" | ||
29 | #include "gnunet-service-testbed.h" | ||
30 | #include "testbed_api_hosts.h" | ||
31 | #include "gnunet_testbed_ng_service.h" | ||
32 | |||
33 | |||
34 | /** | ||
35 | * Generic logging shortcut | ||
36 | */ | ||
37 | #define LOG(kind, ...) \ | ||
38 | GNUNET_log (kind, __VA_ARGS__) | ||
39 | |||
40 | |||
41 | /** | ||
42 | * abort task to run on test timed out | ||
43 | * | ||
44 | * @param cls NULL | ||
45 | * @param tc the task context | ||
46 | */ | ||
47 | static void | ||
48 | do_abort (void *cls) | ||
49 | { | ||
50 | struct ControllerState *cs = cls; | ||
51 | |||
52 | if (GNUNET_NO == cs->host_ready) | ||
53 | { | ||
54 | LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); | ||
55 | cs->abort_task = NULL; | ||
56 | GNUNET_TESTBED_shutdown_controller (cs); | ||
57 | } | ||
58 | } | ||
59 | |||
60 | |||
61 | /** | ||
62 | * | ||
63 | * | ||
64 | * @param cls closure | ||
65 | * @param cmd current CMD being cleaned up. | ||
66 | */ | ||
67 | static void | ||
68 | controller_cleanup (void *cls, | ||
69 | const struct GNUNET_TESTING_Command *cmd) | ||
70 | { | ||
71 | (void) cls; | ||
72 | } | ||
73 | |||
74 | |||
75 | /** | ||
76 | * Signature of the event handler function called by the | ||
77 | * respective event controller. | ||
78 | * | ||
79 | * @param cls closure | ||
80 | * @param event information about the event | ||
81 | */ | ||
82 | static void | ||
83 | controller_cb (void *cls, | ||
84 | const struct GNUNET_TESTBED_EventInformation *event) | ||
85 | { | ||
86 | struct ControllerState *cs = cls; | ||
87 | |||
88 | if (NULL != event->details.operation_finished.emsg) | ||
89 | { | ||
90 | LOG (GNUNET_ERROR_TYPE_ERROR, "There was an operation error: %s\n", | ||
91 | event->details.operation_finished.emsg); | ||
92 | GNUNET_TESTBED_shutdown_controller (cs); | ||
93 | } | ||
94 | else if (NULL == event->details.operation_finished.generic) | ||
95 | { | ||
96 | GNUNET_TESTBED_operation_done (event->op); | ||
97 | } | ||
98 | } | ||
99 | |||
100 | |||
101 | /** | ||
102 | * Callback which will be called to after a host registration succeeded or failed | ||
103 | * | ||
104 | * @param cls the host which has been registered | ||
105 | * @param emsg the error message; NULL if host registration is successful | ||
106 | */ | ||
107 | static void | ||
108 | registration_comp (void *cls, | ||
109 | const char *emsg) | ||
110 | { | ||
111 | struct ControllerState *cs = cls; | ||
112 | |||
113 | if (NULL != emsg) | ||
114 | { | ||
115 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
116 | "There was an error during host registration: %s\n", | ||
117 | emsg); | ||
118 | GNUNET_TESTBED_shutdown_controller (cs); | ||
119 | } | ||
120 | else | ||
121 | { | ||
122 | cs->reg_handle = NULL; | ||
123 | cs->host_ready = GNUNET_YES; | ||
124 | } | ||
125 | } | ||
126 | |||
127 | |||
128 | /** | ||
129 | * Callback to signal successfull startup of the controller process | ||
130 | * | ||
131 | * @param cls the closure from GNUNET_TESTBED_controller_start() | ||
132 | * @param cfg the configuration with which the controller has been started; | ||
133 | * NULL if status is not #GNUNET_OK | ||
134 | * @param status #GNUNET_OK if the startup is successfull; #GNUNET_SYSERR if not, | ||
135 | * GNUNET_TESTBED_controller_stop() shouldn't be called in this case | ||
136 | */ | ||
137 | static void | ||
138 | controller_status_cb (void *cls, | ||
139 | const struct GNUNET_CONFIGURATION_Handle *cfg_, | ||
140 | int status) | ||
141 | { | ||
142 | struct ControllerState *cs = cls; | ||
143 | |||
144 | if (GNUNET_OK != status) | ||
145 | { | ||
146 | cs->cp = NULL; | ||
147 | return; | ||
148 | } | ||
149 | |||
150 | cs->controller = | ||
151 | GNUNET_TESTBED_controller_connect (cs->host, cs->event_mask, &controller_cb, | ||
152 | cs); | ||
153 | cs->reg_handle = | ||
154 | GNUNET_TESTBED_register_host (cs->controller, cs->host, ®istration_comp, | ||
155 | cs); | ||
156 | } | ||
157 | |||
158 | |||
159 | static void | ||
160 | controller_run (void *cls, | ||
161 | const struct GNUNET_TESTING_Command *cmd, | ||
162 | struct GNUNET_TESTING_Interpreter *is) | ||
163 | { | ||
164 | struct ControllerState *cs = cls; | ||
165 | |||
166 | cs->is = is; | ||
167 | cs->host = GNUNET_TESTBED_host_create (cs->hostname, cs->username, cs->cfg, | ||
168 | cs->port); | ||
169 | cs->cp = GNUNET_TESTBED_controller_start (cs->trusted_ip, | ||
170 | cs->host, | ||
171 | &controller_status_cb, | ||
172 | cs); | ||
173 | cs->abort_task = | ||
174 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
175 | (GNUNET_TIME_UNIT_MINUTES, 5), | ||
176 | &do_abort, | ||
177 | cs); | ||
178 | } | ||
179 | |||
180 | /** | ||
181 | * | ||
182 | * | ||
183 | * @param cls closure. | ||
184 | * @param[out] ret result | ||
185 | * @param trait name of the trait. | ||
186 | * @param index index number of the object to offer. | ||
187 | * @return #GNUNET_OK on success. | ||
188 | */ | ||
189 | static int | ||
190 | controller_traits (void *cls, | ||
191 | const void **ret, | ||
192 | const char *trait, | ||
193 | unsigned int index) | ||
194 | { | ||
195 | (void) cls; | ||
196 | |||
197 | struct ControllerState *cs = cls; | ||
198 | |||
199 | |||
200 | struct GNUNET_TESTING_Trait traits[] = { | ||
201 | { | ||
202 | .index = 0, | ||
203 | .trait_name = "controller", | ||
204 | .ptr = (const void *) cs->controller, | ||
205 | }, | ||
206 | GNUNET_TESTING_trait_end () | ||
207 | }; | ||
208 | |||
209 | return GNUNET_TESTING_get_trait (traits, | ||
210 | ret, | ||
211 | trait, | ||
212 | index); | ||
213 | return GNUNET_OK; | ||
214 | } | ||
215 | |||
216 | |||
217 | /** | ||
218 | * Offer data from trait | ||
219 | * | ||
220 | * @param cmd command to extract the controller from. | ||
221 | * @param pt pointer to controller. | ||
222 | * @return #GNUNET_OK on success. | ||
223 | */ | ||
224 | int | ||
225 | GNUNET_TESTBED_get_trait_controller (const struct GNUNET_TESTING_Command *cmd, | ||
226 | struct GNUNET_TESTBED_Controller ** | ||
227 | controller) | ||
228 | { | ||
229 | return cmd->traits (cmd->cls, | ||
230 | (const void **) controller, | ||
231 | "controller", | ||
232 | (unsigned int) 0); | ||
233 | } | ||
234 | |||
235 | |||
236 | /** | ||
237 | * Shutdown nicely | ||
238 | * | ||
239 | * @param cs controller state. | ||
240 | */ | ||
241 | void | ||
242 | GNUNET_TESTBED_shutdown_controller (struct ControllerState *cs) | ||
243 | { | ||
244 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
245 | "Shutting down...\n"); | ||
246 | |||
247 | cs->controller_going_down = GNUNET_YES; | ||
248 | |||
249 | if (NULL != cs->abort_task) | ||
250 | GNUNET_SCHEDULER_cancel (cs->abort_task); | ||
251 | if (NULL != cs->reg_handle) | ||
252 | GNUNET_TESTBED_cancel_registration (cs->reg_handle); | ||
253 | if (NULL != cs->controller) | ||
254 | GNUNET_TESTBED_controller_disconnect (cs->controller); | ||
255 | if (NULL != cs->cfg) | ||
256 | GNUNET_CONFIGURATION_destroy (cs->cfg); | ||
257 | if (NULL != cs->cp) | ||
258 | GNUNET_TESTBED_controller_stop (cs->cp); | ||
259 | if (NULL != cs->host) | ||
260 | GNUNET_TESTBED_host_destroy (cs->host); | ||
261 | } | ||
262 | |||
263 | |||
264 | |||
265 | struct GNUNET_TESTING_Command | ||
266 | GNUNET_TESTBED_cmd_controller (const char *label, | ||
267 | const char *trusted_ip, | ||
268 | const char *hostname, | ||
269 | const char *username, | ||
270 | uint16_t port, | ||
271 | struct GNUNET_CONFIGURATION_Handle *cfg, | ||
272 | uint64_t event_mask) | ||
273 | { | ||
274 | struct ControllerState *cs; | ||
275 | |||
276 | cs = GNUNET_new (struct ControllerState); | ||
277 | cs->event_mask = event_mask; | ||
278 | cs->trusted_ip = trusted_ip; | ||
279 | cs->hostname = hostname; | ||
280 | cs->username = username; | ||
281 | cs->port = port; | ||
282 | cs->cfg = cfg; | ||
283 | |||
284 | struct GNUNET_TESTING_Command cmd = { | ||
285 | .cls = cs, | ||
286 | .label = label, | ||
287 | .run = &controller_run, | ||
288 | .cleanup = &controller_cleanup, | ||
289 | .traits = &controller_traits | ||
290 | }; | ||
291 | |||
292 | return cmd; | ||
293 | } | ||
diff --git a/src/testbed/testbed_api_cmd_peer.c b/src/testbed/testbed_api_cmd_peer.c new file mode 100644 index 000000000..2e253e408 --- /dev/null +++ b/src/testbed/testbed_api_cmd_peer.c | |||
@@ -0,0 +1,281 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | |||
22 | /** | ||
23 | * @file testbed/testbed_api_cmd_peer.c | ||
24 | * @brief Command to create a peer. | ||
25 | * @author t3sserakt | ||
26 | */ | ||
27 | #include "platform.h" | ||
28 | #include "gnunet_util_lib.h" | ||
29 | #include "gnunet_testing_ng_lib.h" | ||
30 | #include "gnunet_testbed_ng_service.h" | ||
31 | #include "gnunet-service-testbed.h" | ||
32 | #include "testbed_api_peers.h" | ||
33 | |||
34 | |||
35 | /** | ||
36 | * Generic logging shortcut | ||
37 | */ | ||
38 | #define LOG(kind, ...) \ | ||
39 | GNUNET_log (kind, __VA_ARGS__) | ||
40 | |||
41 | |||
42 | /** | ||
43 | * | ||
44 | * | ||
45 | * @param cls closure. | ||
46 | * @param[out] ret result | ||
47 | * @param trait name of the trait. | ||
48 | * @param index index number of the object to offer. | ||
49 | * @return #GNUNET_OK on success. | ||
50 | */ | ||
51 | static int | ||
52 | peer_traits (void *cls, | ||
53 | const void **ret, | ||
54 | const char *trait, | ||
55 | unsigned int index) | ||
56 | { | ||
57 | struct PeerCmdState *ps = cls; | ||
58 | |||
59 | struct GNUNET_TESTING_Trait traits[] = { | ||
60 | { | ||
61 | .index = 0, | ||
62 | .trait_name = "peer", | ||
63 | .ptr = (const void *) ps->peer, | ||
64 | }, | ||
65 | GNUNET_TESTING_trait_end () | ||
66 | }; | ||
67 | |||
68 | return GNUNET_TESTING_get_trait (traits, | ||
69 | ret, | ||
70 | trait, | ||
71 | index); | ||
72 | |||
73 | return GNUNET_OK; | ||
74 | } | ||
75 | |||
76 | /** | ||
77 | * Offer data from trait | ||
78 | * | ||
79 | * @param cmd command to extract the controller from. | ||
80 | * @param peer pointer GNUNET_TESTBED_PEER | ||
81 | * @return #GNUNET_OK on success. | ||
82 | */ | ||
83 | int | ||
84 | GNUNET_TESTBED_get_trait_peer (const struct GNUNET_TESTING_Command *cmd, | ||
85 | struct GNUNET_TESTBED_Peer ** | ||
86 | peer) | ||
87 | { | ||
88 | return cmd->traits (cmd->cls, | ||
89 | (const void **) peer, | ||
90 | "peer", | ||
91 | (unsigned int) 0); | ||
92 | } | ||
93 | |||
94 | |||
95 | /** | ||
96 | * | ||
97 | * | ||
98 | * @param cls closure | ||
99 | * @param cmd current CMD being cleaned up. | ||
100 | */ | ||
101 | static void | ||
102 | peer_cleanup (void *cls, | ||
103 | const struct GNUNET_TESTING_Command *cmd) | ||
104 | { | ||
105 | (void) cls; | ||
106 | } | ||
107 | |||
108 | |||
109 | /** | ||
110 | * abort task to run on test timed out | ||
111 | * | ||
112 | * @param cls NULL | ||
113 | * @param tc the task context | ||
114 | */ | ||
115 | static void | ||
116 | do_abort (void *cls) | ||
117 | { | ||
118 | struct PeerCmdState *ps = cls; | ||
119 | |||
120 | if (GNUNET_NO == ps->peer_ready) | ||
121 | { | ||
122 | LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); | ||
123 | ps->abort_task = NULL; | ||
124 | GNUNET_TESTBED_shutdown_peer (ps); | ||
125 | } | ||
126 | } | ||
127 | |||
128 | |||
129 | /** | ||
130 | * Functions of this signature are called when a peer has been successfully | ||
131 | * created | ||
132 | * | ||
133 | * @param cls the closure from GNUNET_TESTBED_peer_create() | ||
134 | * @param emsg MAY contain an error description, if starting peer failed. | ||
135 | */ | ||
136 | static void | ||
137 | peer_started_cb (void *cls, | ||
138 | const char *emsg) | ||
139 | { | ||
140 | struct PeerCmdState *ps = cls; | ||
141 | |||
142 | GNUNET_TESTBED_operation_done (ps->operation); | ||
143 | if (NULL == emsg) | ||
144 | { | ||
145 | ps->peer_ready = GNUNET_YES; | ||
146 | } | ||
147 | else | ||
148 | { | ||
149 | LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error starting a peer: %s\n", | ||
150 | emsg); | ||
151 | } | ||
152 | |||
153 | } | ||
154 | |||
155 | |||
156 | /** | ||
157 | * Functions of this signature are called when a peer has been successfully | ||
158 | * created | ||
159 | * | ||
160 | * @param cls the closure from GNUNET_TESTBED_peer_create() | ||
161 | * @param peer the handle for the created peer; NULL on any error during | ||
162 | * creation | ||
163 | * @param emsg NULL if peer is not NULL; else MAY contain the error description | ||
164 | */ | ||
165 | static void | ||
166 | peer_create_cb (void *cls, | ||
167 | struct GNUNET_TESTBED_Peer *peer, | ||
168 | const char *emsg) | ||
169 | { | ||
170 | struct PeerCmdState *ps = cls; | ||
171 | |||
172 | ps->peer = peer; | ||
173 | GNUNET_TESTBED_operation_done (ps->operation); | ||
174 | ps->operation = GNUNET_TESTBED_peer_start (NULL, | ||
175 | peer, | ||
176 | &peer_started_cb, | ||
177 | ps); | ||
178 | } | ||
179 | |||
180 | |||
181 | static void | ||
182 | peer_run (void *cls, | ||
183 | const struct GNUNET_TESTING_Command *cmd, | ||
184 | struct GNUNET_TESTING_Interpreter *is) | ||
185 | { | ||
186 | struct PeerCmdState *ps = cls; | ||
187 | const struct GNUNET_TESTING_Command *controller_cmd; | ||
188 | struct GNUNET_TESTBED_Controller *controller; | ||
189 | |||
190 | ps->is = is; | ||
191 | controller_cmd = GNUNET_TESTING_interpreter_lookup_command ( | ||
192 | ps->controller_label); | ||
193 | GNUNET_TESTBED_get_trait_controller (controller_cmd, | ||
194 | &controller); | ||
195 | ps->host = GNUNET_TESTBED_host_create (ps->hostname, ps->username, ps->cfg, | ||
196 | ps->port); | ||
197 | ps->operation = | ||
198 | GNUNET_TESTBED_peer_create (controller, | ||
199 | ps->host, | ||
200 | ps->cfg, | ||
201 | &peer_create_cb, | ||
202 | ps); | ||
203 | |||
204 | ps->abort_task = | ||
205 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply | ||
206 | (GNUNET_TIME_UNIT_MINUTES, 5), | ||
207 | &do_abort, | ||
208 | ps); | ||
209 | } | ||
210 | |||
211 | |||
212 | void | ||
213 | peer_stopped_cb (void *cls, | ||
214 | const char *emsg) | ||
215 | { | ||
216 | struct PeerCmdState *ps = cls; | ||
217 | |||
218 | if (NULL != emsg) | ||
219 | { | ||
220 | LOG (GNUNET_ERROR_TYPE_ERROR, "There was an error stopping a peer: %s\n", | ||
221 | emsg); | ||
222 | } | ||
223 | GNUNET_TESTBED_operation_done (ps->operation); | ||
224 | GNUNET_TESTBED_peer_destroy (ps->peer); | ||
225 | } | ||
226 | |||
227 | |||
228 | /** | ||
229 | * Shutdown nicely | ||
230 | * | ||
231 | * @param cs controller state. | ||
232 | */ | ||
233 | void | ||
234 | GNUNET_TESTBED_shutdown_peer (struct PeerCmdState *ps) | ||
235 | { | ||
236 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
237 | "Shutting down...\n"); | ||
238 | |||
239 | ps->peer_going_down = GNUNET_YES; | ||
240 | |||
241 | if (NULL != ps->abort_task) | ||
242 | GNUNET_SCHEDULER_cancel (ps->abort_task); | ||
243 | if (NULL != ps->cfg) | ||
244 | GNUNET_CONFIGURATION_destroy (ps->cfg); | ||
245 | if (NULL != ps->host) | ||
246 | GNUNET_TESTBED_host_destroy (ps->host); | ||
247 | |||
248 | GNUNET_TESTBED_operation_done (ps->operation); | ||
249 | ps->operation = GNUNET_TESTBED_peer_stop (NULL, ps->peer, peer_stopped_cb, | ||
250 | ps); | ||
251 | |||
252 | } | ||
253 | |||
254 | |||
255 | struct GNUNET_TESTING_Command | ||
256 | GNUNET_TESTBED_cmd_peer (const char *label, | ||
257 | const char *controller_label, | ||
258 | const char *hostname, | ||
259 | const char *username, | ||
260 | uint16_t port, | ||
261 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
262 | { | ||
263 | struct PeerCmdState *ps; | ||
264 | |||
265 | ps = GNUNET_new (struct PeerCmdState); | ||
266 | ps->hostname = hostname; | ||
267 | ps->username = username; | ||
268 | ps->port = port; | ||
269 | ps->cfg = cfg; | ||
270 | ps->controller_label = controller_label; | ||
271 | |||
272 | struct GNUNET_TESTING_Command cmd = { | ||
273 | .cls = ps, | ||
274 | .label = label, | ||
275 | .run = &peer_run, | ||
276 | .cleanup = &peer_cleanup, | ||
277 | .traits = &peer_traits | ||
278 | }; | ||
279 | |||
280 | return cmd; | ||
281 | } | ||
diff --git a/src/testbed/testbed_api_cmd_peer_store.c b/src/testbed/testbed_api_cmd_peer_store.c new file mode 100644 index 000000000..fc96f589c --- /dev/null +++ b/src/testbed/testbed_api_cmd_peer_store.c | |||
@@ -0,0 +1,60 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testbed/testbed_api_cmd_peer_store.c | ||
23 | * @brief Command to start the peer store service of a peer. | ||
24 | * @author t3sserakt | ||
25 | */ | ||
26 | |||
27 | |||
28 | static void | ||
29 | service_run (void *cls, | ||
30 | const struct GNUNET_TESTING_Command *cmd, | ||
31 | struct GNUNET_TESTING_Interpreter *is) | ||
32 | { | ||
33 | struct PeerStoreState *pss = cls; | ||
34 | |||
35 | pss->psh = GNUNET_PEERSTORE_connect (pss->cfg); | ||
36 | GNUNET_TESTING_interpreter_next (ps->is); | ||
37 | } | ||
38 | |||
39 | |||
40 | struct GNUNET_TESTING_Command | ||
41 | GNUNET_TESTBED_cmd_peer_store (const char *label, | ||
42 | struct GNUNET_CONFIGURATION_Handle *cfg) | ||
43 | { | ||
44 | |||
45 | struct PeerStoreState *pss; | ||
46 | |||
47 | pss = GNUNET_new (struct PeerStoreState); | ||
48 | pss->cfg = cfg; | ||
49 | |||
50 | struct GNUNET_TESTING_Command cmd = { | ||
51 | .cls = pss, | ||
52 | .label = label, | ||
53 | .run = &peer_store_run, | ||
54 | .cleanup = &peer_store_cleanup, | ||
55 | .traits = &peer_store_traits | ||
56 | }; | ||
57 | |||
58 | return cmd; | ||
59 | |||
60 | } | ||
diff --git a/src/testbed/testbed_api_cmd_tng_connect.c b/src/testbed/testbed_api_cmd_tng_connect.c new file mode 100644 index 000000000..e52cd3c76 --- /dev/null +++ b/src/testbed/testbed_api_cmd_tng_connect.c | |||
@@ -0,0 +1,55 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | |||
22 | /** | ||
23 | * @file testbed/testbed_api_cmd_peer.c | ||
24 | * @brief Command to create a peer. | ||
25 | * @author t3sserakt | ||
26 | */ | ||
27 | |||
28 | |||
29 | static void | ||
30 | tng_connect_run (void *cls, | ||
31 | const struct GNUNET_TESTING_Command *cmd, | ||
32 | struct GNUNET_TESTING_Interpreter *is) | ||
33 | { | ||
34 | struct TngConnectState *tcs = cls; | ||
35 | |||
36 | tcs->ah = GNUNET_TRANSPORT_application_init (tcs->cfg); | ||
37 | } | ||
38 | |||
39 | struct GNUNET_TESTING_Command | ||
40 | GNUNET_TESTBED_cmd_tng_connect (const char *label) | ||
41 | { | ||
42 | struct TngConnectState *tcs; | ||
43 | |||
44 | ts = GNUNET_new (struct TngConnectState); | ||
45 | |||
46 | struct GNUNET_TESTING_Command cmd = { | ||
47 | .cls = tcs, | ||
48 | .label = label, | ||
49 | .run = &tng_connect_run, | ||
50 | .cleanup = &tmg_connect_cleanup, | ||
51 | .traits = &tng_connect_traits | ||
52 | }; | ||
53 | |||
54 | return cmd; | ||
55 | } | ||
diff --git a/src/testbed/testbed_api_cmd_tng_service.c b/src/testbed/testbed_api_cmd_tng_service.c new file mode 100644 index 000000000..f9ef44bad --- /dev/null +++ b/src/testbed/testbed_api_cmd_tng_service.c | |||
@@ -0,0 +1,276 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testbed/testbed_api_cmd_tng.c | ||
23 | * @brief Command to start the transport service of a peer. | ||
24 | * @author t3sserakt | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_testing_ng_lib.h" | ||
29 | #include "gnunet-service-testbed.h" | ||
30 | #include "testbed_api_hosts.h" | ||
31 | #include "gnunet_testbed_ng_service.h" | ||
32 | |||
33 | /** | ||
34 | * Generic logging shortcut | ||
35 | */ | ||
36 | #define LOG(kind, ...) \ | ||
37 | GNUNET_log (kind, __VA_ARGS__) | ||
38 | |||
39 | |||
40 | /** | ||
41 | * abort task to run on test timed out | ||
42 | * | ||
43 | * @param cls NULL | ||
44 | * @param tc the task context | ||
45 | */ | ||
46 | static void | ||
47 | do_abort (void *cls) | ||
48 | { | ||
49 | struct TngState *ts = cls; | ||
50 | |||
51 | if (GNUNET_NO == ts->service_ready) | ||
52 | { | ||
53 | LOG (GNUNET_ERROR_TYPE_WARNING, "Test timedout -- Aborting\n"); | ||
54 | ts->abort_task = NULL; | ||
55 | GNUNET_TESTBED_shutdown_service (ts); | ||
56 | } | ||
57 | } | ||
58 | |||
59 | /** | ||
60 | * | ||
61 | * | ||
62 | * @param cls closure | ||
63 | * @param cmd current CMD being cleaned up. | ||
64 | */ | ||
65 | static void | ||
66 | tng_service_cleanup (void *cls, | ||
67 | const struct GNUNET_TESTING_Command *cmd) | ||
68 | { | ||
69 | (void) cls; | ||
70 | } | ||
71 | |||
72 | /** | ||
73 | * | ||
74 | * | ||
75 | * @param cls closure. | ||
76 | * @param[out] ret result | ||
77 | * @param trait name of the trait. | ||
78 | * @param index index number of the object to offer. | ||
79 | * @return #GNUNET_OK on success. | ||
80 | */ | ||
81 | static int | ||
82 | tng_service_traits (void *cls, | ||
83 | const void **ret, | ||
84 | const char *trait, | ||
85 | unsigned int index) | ||
86 | { | ||
87 | (void) cls; | ||
88 | return GNUNET_OK; | ||
89 | } | ||
90 | |||
91 | |||
92 | static void * | ||
93 | notify_connect (void *cls, | ||
94 | const struct GNUNET_PeerIdentity *peer, | ||
95 | struct GNUNET_MQ_Handle *mq) | ||
96 | { | ||
97 | struct TngState *ts = cls; | ||
98 | |||
99 | if (NULL != emsg) | ||
100 | { | ||
101 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
102 | "There was an error starting the transport subsystem: %s\n", | ||
103 | emsg); | ||
104 | } | ||
105 | GNUNET_TESTING_interpreter_next (ps->is); | ||
106 | return ts->nc (ts->cb_cls); | ||
107 | |||
108 | } | ||
109 | |||
110 | |||
111 | static void | ||
112 | notify_disconnect (void *cls, | ||
113 | const struct GNUNET_PeerIdentity *peer, | ||
114 | void *handler_cls) | ||
115 | { | ||
116 | } | ||
117 | |||
118 | |||
119 | |||
120 | |||
121 | /** | ||
122 | * Adapter function called to establish a connection to | ||
123 | * a service. | ||
124 | * | ||
125 | * @param cls closure | ||
126 | * @param cfg configuration of the peer to connect to; will be available until | ||
127 | * GNUNET_TESTBED_operation_done() is called on the operation returned | ||
128 | * from GNUNET_TESTBED_service_connect() | ||
129 | * @return service handle to return in 'op_result', NULL on error | ||
130 | */ | ||
131 | static void * | ||
132 | connect_adapter (void *cls, | ||
133 | const struct GNUNET_CONFIGURATION_Handle *cfg) | ||
134 | { | ||
135 | struct TngState *ts = cls; | ||
136 | |||
137 | service_handle = GNUNET_TRANSPORT_core_connect (cfg, | ||
138 | ts->peer_identity, | ||
139 | ts->handlers, | ||
140 | ts, | ||
141 | ¬ify_connect, | ||
142 | ¬ify_disconnect); | ||
143 | return service_handle; | ||
144 | } | ||
145 | |||
146 | |||
147 | /** | ||
148 | * Adapter function called to destroy a connection to | ||
149 | * a service. | ||
150 | * | ||
151 | * @param cls closure | ||
152 | * @param op_result service handle returned from the connect adapter | ||
153 | */ | ||
154 | static void | ||
155 | disconnect_adapter (void *cls, | ||
156 | void *op_result) | ||
157 | { | ||
158 | } | ||
159 | |||
160 | /** | ||
161 | * Callback to be called when a service connect operation is completed | ||
162 | * | ||
163 | * @param cls the callback closure from functions generating an operation | ||
164 | * @param op the operation that has been finished | ||
165 | * @param ca_result the service handle returned from GNUNET_TESTBED_ConnectAdapter() | ||
166 | * @param emsg error message in case the operation has failed; will be NULL if | ||
167 | * operation has executed successfully. | ||
168 | */ | ||
169 | static void | ||
170 | service_connect_comp_cb (void *cls, | ||
171 | struct GNUNET_TESTBED_Operation *op, | ||
172 | void *ca_result, | ||
173 | const char *emsg) | ||
174 | { | ||
175 | struct TngState *ts = cls; | ||
176 | |||
177 | if (NULL != emsg) | ||
178 | { | ||
179 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
180 | "An error occured connecting to service %s\n", | ||
181 | emsg); | ||
182 | GNUNET_TESTBED_operation_done (ts->operation); | ||
183 | } | ||
184 | } | ||
185 | |||
186 | |||
187 | /** | ||
188 | * Callback to be called when the requested peer information is available | ||
189 | * | ||
190 | * @param cls the closure from GNUNET_TESTBED_peer_getinformation() | ||
191 | * @param op the operation this callback corresponds to | ||
192 | * @param pinfo the result; will be NULL if the operation has failed | ||
193 | * @param emsg error message if the operation has failed; | ||
194 | * NULL if the operation is successfull | ||
195 | */ | ||
196 | static void | ||
197 | pi_cb (void *cls, | ||
198 | struct GNUNET_TESTBED_Operation *op, | ||
199 | const struct GNUNET_TESTBED_PeerInformation *pinfo, | ||
200 | const char *emsg) | ||
201 | { | ||
202 | struct TngState *ts = cls; | ||
203 | |||
204 | ts->peer_identity = pinfo->id; | ||
205 | ts->operation = | ||
206 | GNUNET_TESTBED_service_connect (NULL, peer, NULL, | ||
207 | &service_connect_comp_cb, ts, | ||
208 | &connect_adapter, | ||
209 | &disconnect_adapter, | ||
210 | ts); | ||
211 | } | ||
212 | |||
213 | |||
214 | static void | ||
215 | tng_service_run (void *cls, | ||
216 | const struct GNUNET_TESTING_Command *cmd, | ||
217 | struct GNUNET_TESTING_Interpreter *is) | ||
218 | { | ||
219 | struct TngState *ts = cls; | ||
220 | struct GNUNET_TESTBED_Peer *peer; | ||
221 | const struct GNUNET_TESTING_Command *peer_cmd; | ||
222 | |||
223 | ts->is = is; | ||
224 | peer_cmd = GNUNET_TESTING_interpreter_lookup_command ( | ||
225 | ts->peer_label); | ||
226 | GNUNET_TESTBED_get_trait_peer (peer_cmd, | ||
227 | &peer); | ||
228 | |||
229 | ts->operation = GNUNET_TESTBED_peer_get_information (peer, | ||
230 | GNUNET_TESTBED_PIT_IDENTITY, | ||
231 | &pi_cb, | ||
232 | ts); | ||
233 | } | ||
234 | |||
235 | /** | ||
236 | * Shutdown nicely | ||
237 | * | ||
238 | * @param cs service state. | ||
239 | */ | ||
240 | void | ||
241 | GNUNET_TESTBED_shutdown_service (struct TngState *cs) | ||
242 | { | ||
243 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
244 | "Shutting down...\n"); | ||
245 | } | ||
246 | |||
247 | |||
248 | struct GNUNET_TESTING_Command | ||
249 | GNUNET_TESTBED_cmd_tng_service (const char *label, | ||
250 | const char *peer_label, | ||
251 | const struct GNUNET_MQ_MessageHandler *handlers, | ||
252 | GNUNET_TRANSPORT_NotifyConnect nc, | ||
253 | void *cb_cls) | ||
254 | |||
255 | { | ||
256 | struct TngState *ts; | ||
257 | |||
258 | ts = GNUNET_new (struct TngState); | ||
259 | ts->servicename = servicename; | ||
260 | ts->peer_label = peer_label; | ||
261 | ts->handlers = handlers; | ||
262 | ts->nc = nc; | ||
263 | ts->nd = nd; | ||
264 | ts->cb_cls; | ||
265 | |||
266 | |||
267 | struct GNUNET_TESTING_Command cmd = { | ||
268 | .cls = ts, | ||
269 | .label = label, | ||
270 | .run = &tng_service_run, | ||
271 | .cleanup = &tmg_service_cleanup, | ||
272 | .traits = &tng_service_traits | ||
273 | }; | ||
274 | |||
275 | return cmd; | ||
276 | } | ||
diff --git a/src/testing/Makefile.am b/src/testing/Makefile.am index 2b599f55b..95fc5c805 100644 --- a/src/testing/Makefile.am +++ b/src/testing/Makefile.am | |||
@@ -15,7 +15,14 @@ lib_LTLIBRARIES = \ | |||
15 | libgnunettesting.la | 15 | libgnunettesting.la |
16 | 16 | ||
17 | libgnunettesting_la_SOURCES = \ | 17 | libgnunettesting_la_SOURCES = \ |
18 | testing.c | 18 | testing.c \ |
19 | testing_api_cmd_batch.c \ | ||
20 | testing_api_cmd_hello_world.c \ | ||
21 | testing_api_cmd_hello_world_birth.c \ | ||
22 | testing_api_loop.c \ | ||
23 | testing_api_trait_cmd.c \ | ||
24 | testing_api_trait_process.c \ | ||
25 | testing_api_traits.c | ||
19 | libgnunettesting_la_LIBADD = \ | 26 | libgnunettesting_la_LIBADD = \ |
20 | $(top_builddir)/src/arm/libgnunetarm.la \ | 27 | $(top_builddir)/src/arm/libgnunetarm.la \ |
21 | $(top_builddir)/src/util/libgnunetutil.la \ | 28 | $(top_builddir)/src/util/libgnunetutil.la \ |
@@ -48,6 +55,7 @@ list_keys_LDADD = \ | |||
48 | 55 | ||
49 | 56 | ||
50 | check_PROGRAMS = \ | 57 | check_PROGRAMS = \ |
58 | test_testing_hello_world \ | ||
51 | test_testing_portreservation \ | 59 | test_testing_portreservation \ |
52 | test_testing_servicestartup \ | 60 | test_testing_servicestartup \ |
53 | test_testing_peerstartup \ | 61 | test_testing_peerstartup \ |
@@ -57,12 +65,19 @@ check_PROGRAMS = \ | |||
57 | if ENABLE_TEST_RUN | 65 | if ENABLE_TEST_RUN |
58 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; | 66 | AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; |
59 | TESTS = \ | 67 | TESTS = \ |
68 | test_testing_hello_world \ | ||
60 | test_testing_portreservation \ | 69 | test_testing_portreservation \ |
61 | test_testing_peerstartup \ | 70 | test_testing_peerstartup \ |
62 | test_testing_peerstartup2 \ | 71 | test_testing_peerstartup2 \ |
63 | test_testing_servicestartup | 72 | test_testing_servicestartup |
64 | endif | 73 | endif |
65 | 74 | ||
75 | test_testing_hello_world_SOURCES = \ | ||
76 | test_testing_hello_world.c | ||
77 | test_testing_hello_world_LDADD = \ | ||
78 | libgnunettesting.la \ | ||
79 | $(top_builddir)/src/util/libgnunetutil.la | ||
80 | |||
66 | test_testing_portreservation_SOURCES = \ | 81 | test_testing_portreservation_SOURCES = \ |
67 | test_testing_portreservation.c | 82 | test_testing_portreservation.c |
68 | test_testing_portreservation_LDADD = \ | 83 | test_testing_portreservation_LDADD = \ |
diff --git a/src/testing/test_testing_hello_world.c b/src/testing/test_testing_hello_world.c new file mode 100644 index 000000000..6300e26a4 --- /dev/null +++ b/src/testing/test_testing_hello_world.c | |||
@@ -0,0 +1,68 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/test_testing_hello_world.c | ||
23 | * @brief hello world test case | ||
24 | * @author t3sserakt | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_testing_ng_lib.h" | ||
28 | #include "gnunet_util_lib.h" | ||
29 | |||
30 | /** | ||
31 | * Main function to run the test cases. | ||
32 | * | ||
33 | * @param cls not used. | ||
34 | * | ||
35 | */ | ||
36 | static void | ||
37 | run (void *cls) | ||
38 | { | ||
39 | (void *) cls; | ||
40 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | ||
41 | |||
42 | struct GNUNET_TESTING_Command commands[] = { | ||
43 | GNUNET_TESTING_cmd_hello_world_birth ("hello-world-birth-0", | ||
44 | &now), | ||
45 | GNUNET_TESTING_cmd_hello_world ("hello-world-0","hello-world-birth-0",""), | ||
46 | GNUNET_TESTING_cmd_end () | ||
47 | }; | ||
48 | |||
49 | GNUNET_TESTING_run (NULL, | ||
50 | commands, | ||
51 | GNUNET_TIME_UNIT_FOREVER_REL); | ||
52 | } | ||
53 | |||
54 | int | ||
55 | main (int argc, | ||
56 | char *const *argv) | ||
57 | { | ||
58 | int rv = 0; | ||
59 | |||
60 | GNUNET_log_setup ("test-hello-world", | ||
61 | "DEBUG", | ||
62 | NULL); | ||
63 | |||
64 | GNUNET_SCHEDULER_run (&run, | ||
65 | NULL); | ||
66 | |||
67 | return rv; | ||
68 | } | ||
diff --git a/src/testing/testing.h b/src/testing/testing.h new file mode 100644 index 000000000..b12466530 --- /dev/null +++ b/src/testing/testing.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author t3sserakt | ||
23 | */ | ||
24 | |||
25 | #include "gnunet_util_lib.h" | ||
26 | |||
27 | /** | ||
28 | * Global state of the interpreter, used by a command | ||
29 | * to access information about other commands. | ||
30 | */ | ||
31 | // SUGGESTION: consider making this struct opaque (only known inside of libgnunettesting, | ||
32 | // say main loop and a few select commands, like next/fail/batch); + helper | ||
33 | // function to access 'cfg'? | ||
34 | struct GNUNET_TESTING_Interpreter | ||
35 | { | ||
36 | |||
37 | /** | ||
38 | * Commands the interpreter will run. | ||
39 | */ | ||
40 | struct GNUNET_TESTING_Command *commands; | ||
41 | |||
42 | /** | ||
43 | * Interpreter task (if one is scheduled). | ||
44 | */ | ||
45 | struct GNUNET_SCHEDULER_Task *task; | ||
46 | |||
47 | /** | ||
48 | * Finish task of a blocking call to a commands finish method. | ||
49 | */ | ||
50 | struct GNUNET_SCHEDULER_Task *finish_task; | ||
51 | |||
52 | /** | ||
53 | * Our configuration. | ||
54 | */ | ||
55 | const struct GNUNET_CONFIGURATION_Handle *cfg; | ||
56 | |||
57 | /** | ||
58 | * Task run on timeout. | ||
59 | */ | ||
60 | struct GNUNET_SCHEDULER_Task *timeout_task; | ||
61 | |||
62 | /** | ||
63 | * Instruction pointer. Tells #interpreter_run() which instruction to run | ||
64 | * next. Need (signed) int because it gets -1 when rewinding the | ||
65 | * interpreter to the first CMD. | ||
66 | */ | ||
67 | int ip; | ||
68 | |||
69 | /** | ||
70 | * Result of the testcases, #GNUNET_OK on success | ||
71 | */ | ||
72 | int result; | ||
73 | |||
74 | }; | ||
diff --git a/src/testing/testing_api_cmd_batch.c b/src/testing/testing_api_cmd_batch.c new file mode 100644 index 000000000..af260f80d --- /dev/null +++ b/src/testing/testing_api_cmd_batch.c | |||
@@ -0,0 +1,256 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/testing_api_cmd_batch.c | ||
23 | * @brief Implement batch-execution of CMDs. | ||
24 | * @author Marcello Stanisci (GNU Taler testing) | ||
25 | * @author t3sserakt | ||
26 | */ | ||
27 | #include "platform.h" | ||
28 | #include "gnunet_testing_ng_lib.h" | ||
29 | #include "testing.h" | ||
30 | |||
31 | /** | ||
32 | * State for a "batch" CMD. | ||
33 | */ | ||
34 | struct BatchState | ||
35 | { | ||
36 | /** | ||
37 | * CMDs batch. | ||
38 | */ | ||
39 | struct GNUNET_TESTING_Command *batch; | ||
40 | |||
41 | /** | ||
42 | * Internal command pointer. | ||
43 | */ | ||
44 | unsigned int batch_ip; | ||
45 | }; | ||
46 | |||
47 | |||
48 | /** | ||
49 | * Run the command. | ||
50 | * | ||
51 | * @param cls closure. | ||
52 | * @param cmd the command being executed. | ||
53 | * @param is the interpreter state. | ||
54 | */ | ||
55 | static void | ||
56 | batch_run (void *cls, | ||
57 | const struct GNUNET_TESTING_Command *cmd, | ||
58 | struct GNUNET_TESTING_Interpreter *is) | ||
59 | { | ||
60 | struct BatchState *bs = cls; | ||
61 | |||
62 | if (NULL != bs->batch[bs->batch_ip].label) | ||
63 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
64 | "Running batched command: %s\n", | ||
65 | bs->batch[bs->batch_ip].label); | ||
66 | |||
67 | /* hit end command, leap to next top-level command. */ | ||
68 | if (NULL == bs->batch[bs->batch_ip].label) | ||
69 | { | ||
70 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
71 | "Exiting from batch: %s\n", | ||
72 | cmd->label); | ||
73 | return; | ||
74 | } | ||
75 | bs->batch[bs->batch_ip].start_time | ||
76 | = bs->batch[bs->batch_ip].last_req_time | ||
77 | = GNUNET_TIME_absolute_get (); | ||
78 | bs->batch[bs->batch_ip].num_tries = 1; | ||
79 | bs->batch[bs->batch_ip].run (bs->batch[bs->batch_ip].cls, | ||
80 | &bs->batch[bs->batch_ip], | ||
81 | is); | ||
82 | } | ||
83 | |||
84 | |||
85 | /** | ||
86 | * Cleanup the state from a "reserve status" CMD, and possibly | ||
87 | * cancel a pending operation thereof. | ||
88 | * | ||
89 | * @param cls closure. | ||
90 | * @param cmd the command which is being cleaned up. | ||
91 | */ | ||
92 | static void | ||
93 | batch_cleanup (void *cls, | ||
94 | const struct GNUNET_TESTING_Command *cmd) | ||
95 | { | ||
96 | struct BatchState *bs = cls; | ||
97 | |||
98 | (void) cmd; | ||
99 | for (unsigned int i = 0; | ||
100 | NULL != bs->batch[i].label; | ||
101 | i++) | ||
102 | bs->batch[i].cleanup (bs->batch[i].cls, | ||
103 | &bs->batch[i]); | ||
104 | GNUNET_free (bs->batch); | ||
105 | GNUNET_free (bs); | ||
106 | } | ||
107 | |||
108 | |||
109 | /** | ||
110 | * Offer internal data from a "batch" CMD, to other commands. | ||
111 | * | ||
112 | * @param cls closure. | ||
113 | * @param[out] ret result. | ||
114 | * @param trait name of the trait. | ||
115 | * @param index index number of the object to offer. | ||
116 | * @return #GNUNET_OK on success. | ||
117 | */ | ||
118 | static int | ||
119 | batch_traits (void *cls, | ||
120 | const void **ret, | ||
121 | const char *trait, | ||
122 | unsigned int index) | ||
123 | { | ||
124 | #define CURRENT_CMD_INDEX 0 | ||
125 | #define BATCH_INDEX 1 | ||
126 | |||
127 | struct BatchState *bs = cls; | ||
128 | |||
129 | struct GNUNET_TESTING_Trait traits[] = { | ||
130 | GNUNET_TESTING_make_trait_cmd | ||
131 | (CURRENT_CMD_INDEX, &bs->batch[bs->batch_ip]), | ||
132 | GNUNET_TESTING_make_trait_cmd | ||
133 | (BATCH_INDEX, bs->batch), | ||
134 | GNUNET_TESTING_trait_end () | ||
135 | }; | ||
136 | |||
137 | /* Always return current command. */ | ||
138 | return GNUNET_TESTING_get_trait (traits, | ||
139 | ret, | ||
140 | trait, | ||
141 | index); | ||
142 | } | ||
143 | |||
144 | |||
145 | /** | ||
146 | * Create a "batch" command. Such command takes a | ||
147 | * end_CMD-terminated array of CMDs and executed them. | ||
148 | * Once it hits the end CMD, it passes the control | ||
149 | * to the next top-level CMD, regardless of it being | ||
150 | * another batch or ordinary CMD. | ||
151 | * | ||
152 | * @param label the command label. | ||
153 | * @param batch array of CMDs to execute. | ||
154 | * | ||
155 | * @return the command. | ||
156 | */ | ||
157 | struct GNUNET_TESTING_Command | ||
158 | GNUNET_TESTING_cmd_batch (const char *label, | ||
159 | struct GNUNET_TESTING_Command *batch) | ||
160 | { | ||
161 | struct BatchState *bs; | ||
162 | unsigned int i; | ||
163 | |||
164 | bs = GNUNET_new (struct BatchState); | ||
165 | |||
166 | /* Get number of commands. */ | ||
167 | for (i = 0; NULL != batch[i].label; i++) | ||
168 | /* noop */ | ||
169 | ; | ||
170 | |||
171 | bs->batch = GNUNET_new_array (i + 1, | ||
172 | struct GNUNET_TESTING_Command); | ||
173 | memcpy (bs->batch, | ||
174 | batch, | ||
175 | sizeof (struct GNUNET_TESTING_Command) * i); | ||
176 | { | ||
177 | struct GNUNET_TESTING_Command cmd = { | ||
178 | .cls = bs, | ||
179 | .label = label, | ||
180 | .run = &batch_run, | ||
181 | .cleanup = &batch_cleanup, | ||
182 | .traits = &batch_traits | ||
183 | }; | ||
184 | |||
185 | return cmd; | ||
186 | } | ||
187 | } | ||
188 | |||
189 | |||
190 | /** | ||
191 | * Advance internal pointer to next command. | ||
192 | * | ||
193 | * @param is interpreter state. | ||
194 | */ | ||
195 | void | ||
196 | GNUNET_TESTING_cmd_batch_next (struct GNUNET_TESTING_Interpreter *is) | ||
197 | { | ||
198 | struct BatchState *bs = is->commands[is->ip].cls; | ||
199 | |||
200 | if (NULL == bs->batch[bs->batch_ip].label) | ||
201 | { | ||
202 | is->commands[is->ip].finish_time = GNUNET_TIME_absolute_get (); | ||
203 | is->ip++; | ||
204 | return; | ||
205 | } | ||
206 | bs->batch[bs->batch_ip].finish_time = GNUNET_TIME_absolute_get (); | ||
207 | bs->batch_ip++; | ||
208 | } | ||
209 | |||
210 | |||
211 | /** | ||
212 | * Test if this command is a batch command. | ||
213 | * | ||
214 | * @return false if not, true if it is a batch command | ||
215 | */ | ||
216 | int | ||
217 | GNUNET_TESTING_cmd_is_batch (const struct GNUNET_TESTING_Command *cmd) | ||
218 | { | ||
219 | return cmd->run == &batch_run; | ||
220 | } | ||
221 | |||
222 | |||
223 | /** | ||
224 | * Obtain what command the batch is at. | ||
225 | * | ||
226 | * @return cmd current batch command | ||
227 | */ | ||
228 | struct GNUNET_TESTING_Command * | ||
229 | GNUNET_TESTING_cmd_batch_get_current (const struct GNUNET_TESTING_Command *cmd) | ||
230 | { | ||
231 | struct BatchState *bs = cmd->cls; | ||
232 | |||
233 | GNUNET_assert (cmd->run == &batch_run); | ||
234 | return &bs->batch[bs->batch_ip]; | ||
235 | } | ||
236 | |||
237 | |||
238 | /** | ||
239 | * Set what command the batch should be at. | ||
240 | * | ||
241 | * @param cmd current batch command | ||
242 | * @param new_ip where to move the IP | ||
243 | */ | ||
244 | void | ||
245 | GNUNET_TESTING_cmd_batch_set_current (const struct GNUNET_TESTING_Command *cmd, | ||
246 | unsigned int new_ip) | ||
247 | { | ||
248 | struct BatchState *bs = cmd->cls; | ||
249 | |||
250 | /* sanity checks */ | ||
251 | GNUNET_assert (cmd->run == &batch_run); | ||
252 | for (unsigned int i = 0; i < new_ip; i++) | ||
253 | GNUNET_assert (NULL != bs->batch[i].label); | ||
254 | /* actual logic */ | ||
255 | bs->batch_ip = new_ip; | ||
256 | } | ||
diff --git a/src/testing/testing_api_cmd_hello_world.c b/src/testing/testing_api_cmd_hello_world.c new file mode 100644 index 000000000..4347ac818 --- /dev/null +++ b/src/testing/testing_api_cmd_hello_world.c | |||
@@ -0,0 +1,121 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/testing_api_cmd_hello_world.c | ||
23 | * @brief implementation of a hello world command. | ||
24 | * @author t3sserakt | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_testing_ng_lib.h" | ||
28 | |||
29 | struct HelloWorldState | ||
30 | { | ||
31 | char *message; | ||
32 | const char *birthLabel; | ||
33 | }; | ||
34 | |||
35 | /** | ||
36 | * | ||
37 | * | ||
38 | * @param cls closure | ||
39 | * @param cmd current CMD being cleaned up. | ||
40 | */ | ||
41 | static void | ||
42 | hello_world_cleanup (void *cls, | ||
43 | const struct GNUNET_TESTING_Command *cmd) | ||
44 | { | ||
45 | struct HelloWorldState *hs = cls; | ||
46 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
47 | "Cleaning up message %s\n", | ||
48 | hs->message); | ||
49 | } | ||
50 | |||
51 | /** | ||
52 | * | ||
53 | * | ||
54 | * @param cls closure. | ||
55 | * @param[out] ret result | ||
56 | * @param trait name of the trait. | ||
57 | * @param index index number of the object to offer. | ||
58 | * @return #GNUNET_OK on success. | ||
59 | */ | ||
60 | static int | ||
61 | hello_world_traits (void *cls, | ||
62 | const void **ret, | ||
63 | const char *trait, | ||
64 | unsigned int index) | ||
65 | { | ||
66 | return GNUNET_OK; | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * Run the "hello world" CMD. | ||
71 | * | ||
72 | * @param cls closure. | ||
73 | * @param cmd CMD being run. | ||
74 | * @param is interpreter state. | ||
75 | */ | ||
76 | static void | ||
77 | hello_world_run (void *cls, | ||
78 | const struct GNUNET_TESTING_Command *cmd, | ||
79 | struct GNUNET_TESTING_Interpreter *is) | ||
80 | { | ||
81 | struct HelloWorldState *hs = cls; | ||
82 | const struct GNUNET_TESTING_Command *birth_cmd; | ||
83 | |||
84 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
85 | "%s\n", | ||
86 | hs->message); | ||
87 | birth_cmd = GNUNET_TESTING_interpreter_lookup_command (hs->birthLabel); | ||
88 | GNUNET_TESTING_get_trait_what_am_i (birth_cmd, &hs->message); | ||
89 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
90 | "Now I am a %s\n", | ||
91 | hs->message); | ||
92 | } | ||
93 | |||
94 | /** | ||
95 | * Create command. | ||
96 | * | ||
97 | * @param label name for command. | ||
98 | * @param message initial message. | ||
99 | * @return command. | ||
100 | */ | ||
101 | struct GNUNET_TESTING_Command | ||
102 | GNUNET_TESTING_cmd_hello_world (const char *label, | ||
103 | const char *birthLabel, | ||
104 | char *message) | ||
105 | { | ||
106 | struct HelloWorldState *hs; | ||
107 | |||
108 | hs = GNUNET_new (struct HelloWorldState); | ||
109 | hs->message = "Hello World, I was nobody!"; | ||
110 | hs->birthLabel = birthLabel; | ||
111 | |||
112 | struct GNUNET_TESTING_Command cmd = { | ||
113 | .cls = hs, | ||
114 | .label = label, | ||
115 | .run = &hello_world_run, | ||
116 | .cleanup = &hello_world_cleanup, | ||
117 | .traits = &hello_world_traits | ||
118 | }; | ||
119 | |||
120 | return cmd; | ||
121 | } | ||
diff --git a/src/testing/testing_api_cmd_hello_world_birth.c b/src/testing/testing_api_cmd_hello_world_birth.c new file mode 100644 index 000000000..2a5bded92 --- /dev/null +++ b/src/testing/testing_api_cmd_hello_world_birth.c | |||
@@ -0,0 +1,159 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/testing_api_cmd_hello_world.c | ||
23 | * @brief implementation of a hello world command. | ||
24 | * @author t3sserakt | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | #include "gnunet_testing_ng_lib.h" | ||
29 | |||
30 | struct HelloWorldBirthState | ||
31 | { | ||
32 | struct GNUNET_TIME_Absolute *date; | ||
33 | char *what_am_i; | ||
34 | }; | ||
35 | |||
36 | /** | ||
37 | * | ||
38 | * | ||
39 | * @param cls closure | ||
40 | * @param cmd current CMD being cleaned up. | ||
41 | */ | ||
42 | static void | ||
43 | hello_world_birth_cleanup (void *cls, | ||
44 | const struct GNUNET_TESTING_Command *cmd) | ||
45 | { | ||
46 | struct HelloWorldBirthState *hbs = cls; | ||
47 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
48 | "Finished birth of %s\n", | ||
49 | hbs->what_am_i); | ||
50 | } | ||
51 | |||
52 | /** | ||
53 | * | ||
54 | * | ||
55 | * @param cls closure. | ||
56 | * @param[out] ret result | ||
57 | * @param trait name of the trait. | ||
58 | * @param index index number of the object to offer. | ||
59 | * @return #GNUNET_OK on success. | ||
60 | */ | ||
61 | static int | ||
62 | hello_world_birth_traits (void *cls, | ||
63 | const void **ret, | ||
64 | const char *trait, | ||
65 | unsigned int index) | ||
66 | { | ||
67 | struct HelloWorldBirthState *hbs = cls; | ||
68 | const char *what_am_i = hbs->what_am_i; | ||
69 | |||
70 | struct GNUNET_TESTING_Trait traits[] = { | ||
71 | { | ||
72 | .index = 0, | ||
73 | .trait_name = "what_am_i", | ||
74 | .ptr = (const void *) what_am_i, | ||
75 | }, | ||
76 | GNUNET_TESTING_trait_end () | ||
77 | }; | ||
78 | |||
79 | return GNUNET_TESTING_get_trait (traits, | ||
80 | ret, | ||
81 | trait, | ||
82 | index); | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * Run the "hello world" CMD. | ||
87 | * | ||
88 | * @param cls closure. | ||
89 | * @param cmd CMD being run. | ||
90 | * @param is interpreter state. | ||
91 | */ | ||
92 | static void | ||
93 | hello_world_birth_run (void *cls, | ||
94 | const struct GNUNET_TESTING_Command *cmd, | ||
95 | struct GNUNET_TESTING_Interpreter *is) | ||
96 | { | ||
97 | struct HelloWorldBirthState *hbs = cls; | ||
98 | struct GNUNET_TIME_Relative relativ; | ||
99 | |||
100 | relativ = GNUNET_TIME_absolute_get_difference (*hbs->date, | ||
101 | GNUNET_TIME_absolute_get ()); | ||
102 | |||
103 | if (0 == relativ.rel_value_us % 10) | ||
104 | { | ||
105 | hbs->what_am_i = "creature!"; | ||
106 | } | ||
107 | else if (0 == relativ.rel_value_us % 2) | ||
108 | { | ||
109 | hbs->what_am_i = "girl!"; | ||
110 | } | ||
111 | else | ||
112 | { | ||
113 | hbs->what_am_i = "boy!"; | ||
114 | } | ||
115 | } | ||
116 | |||
117 | /** | ||
118 | * Offer data from trait | ||
119 | * | ||
120 | * @param cmd command to extract the message from. | ||
121 | * @param pt pointer to message. | ||
122 | * @return #GNUNET_OK on success. | ||
123 | */ | ||
124 | int | ||
125 | GNUNET_TESTING_get_trait_what_am_i (const struct GNUNET_TESTING_Command *cmd, | ||
126 | char **what_am_i) | ||
127 | { | ||
128 | return cmd->traits (cmd->cls, | ||
129 | (const void **) what_am_i, | ||
130 | "what_am_i", | ||
131 | (unsigned int) 0); | ||
132 | } | ||
133 | |||
134 | /** | ||
135 | * Create command. | ||
136 | * | ||
137 | * @param label name for command. | ||
138 | * @param now when the command was started. | ||
139 | * @return command. | ||
140 | */ | ||
141 | struct GNUNET_TESTING_Command | ||
142 | GNUNET_TESTING_cmd_hello_world_birth (const char *label, | ||
143 | struct GNUNET_TIME_Absolute *now) | ||
144 | { | ||
145 | struct HelloWorldBirthState *hbs; | ||
146 | |||
147 | hbs = GNUNET_new (struct HelloWorldBirthState); | ||
148 | hbs->date = now; | ||
149 | |||
150 | struct GNUNET_TESTING_Command cmd = { | ||
151 | .cls = hbs, | ||
152 | .label = label, | ||
153 | .run = &hello_world_birth_run, | ||
154 | .cleanup = &hello_world_birth_cleanup, | ||
155 | .traits = &hello_world_birth_traits | ||
156 | }; | ||
157 | |||
158 | return cmd; | ||
159 | } | ||
diff --git a/src/testing/testing_api_loop.c b/src/testing/testing_api_loop.c new file mode 100644 index 000000000..dbd86ba90 --- /dev/null +++ b/src/testing/testing_api_loop.c | |||
@@ -0,0 +1,510 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/testing_api_loop.c | ||
23 | * @brief main interpreter loop for testcases | ||
24 | * @author Christian Grothoff (GNU Taler testing) | ||
25 | * @author Marcello Stanisci (GNU Taler testing) | ||
26 | * @author t3sserakt | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_util_lib.h" | ||
30 | #include "gnunet_testing_ng_lib.h" | ||
31 | #include "testing.h" | ||
32 | |||
33 | struct GNUNET_TESTING_Interpreter *is; | ||
34 | |||
35 | /** | ||
36 | * Closure used to sync an asynchronous with an synchronous command. | ||
37 | */ | ||
38 | struct SyncTaskClosure | ||
39 | { | ||
40 | |||
41 | /** | ||
42 | * The asynchronous command the synchronous command waits for. | ||
43 | */ | ||
44 | const struct GNUNET_TESTING_Command *async_cmd; | ||
45 | |||
46 | /** | ||
47 | * The synchronous command that waits for the asynchronous command. | ||
48 | */ | ||
49 | const struct GNUNET_TESTING_Command *sync_cmd; | ||
50 | |||
51 | /** | ||
52 | * The interpreter of the test. | ||
53 | */ | ||
54 | struct GNUNET_TESTING_Interpreter *is; | ||
55 | }; | ||
56 | |||
57 | /** | ||
58 | * Closure used to run the finish task. | ||
59 | */ | ||
60 | struct FinishTaskClosure | ||
61 | { | ||
62 | |||
63 | /** | ||
64 | * The asynchronous command the synchronous command waits for. | ||
65 | */ | ||
66 | const struct GNUNET_TESTING_Command *cmd; | ||
67 | |||
68 | /** | ||
69 | * The interpreter of the test. | ||
70 | */ | ||
71 | struct GNUNET_TESTING_Interpreter *is; | ||
72 | }; | ||
73 | |||
74 | /** | ||
75 | * Lookup command by label. | ||
76 | * | ||
77 | * @param label label to look for | ||
78 | * @return NULL if command was not found | ||
79 | */ | ||
80 | const struct GNUNET_TESTING_Command * | ||
81 | GNUNET_TESTING_interpreter_lookup_command (const char *label) | ||
82 | { | ||
83 | if (NULL == label) | ||
84 | { | ||
85 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
86 | "Attempt to lookup command for empty label\n"); | ||
87 | return NULL; | ||
88 | } | ||
89 | /* Search backwards as we most likely reference recent commands */ | ||
90 | for (int i = is->ip; i >= 0; i--) | ||
91 | { | ||
92 | const struct GNUNET_TESTING_Command *cmd = &is->commands[i]; | ||
93 | |||
94 | /* Give precedence to top-level commands. */ | ||
95 | if ( (NULL != cmd->label) && | ||
96 | (0 == strcmp (cmd->label, | ||
97 | label)) ) | ||
98 | return cmd; | ||
99 | |||
100 | if (GNUNET_TESTING_cmd_is_batch (cmd)) | ||
101 | { | ||
102 | #define BATCH_INDEX 1 | ||
103 | struct GNUNET_TESTING_Command *batch; | ||
104 | struct GNUNET_TESTING_Command *current; | ||
105 | struct GNUNET_TESTING_Command *icmd; | ||
106 | const struct GNUNET_TESTING_Command *match; | ||
107 | |||
108 | current = GNUNET_TESTING_cmd_batch_get_current (cmd); | ||
109 | GNUNET_assert (GNUNET_OK == | ||
110 | GNUNET_TESTING_get_trait_cmd (cmd, | ||
111 | BATCH_INDEX, | ||
112 | &batch)); | ||
113 | /* We must do the loop forward, but we can find the last match */ | ||
114 | match = NULL; | ||
115 | for (unsigned int j = 0; | ||
116 | NULL != (icmd = &batch[j])->label; | ||
117 | j++) | ||
118 | { | ||
119 | if (current == icmd) | ||
120 | break; /* do not go past current command */ | ||
121 | if ( (NULL != icmd->label) && | ||
122 | (0 == strcmp (icmd->label, | ||
123 | label)) ) | ||
124 | match = icmd; | ||
125 | } | ||
126 | if (NULL != match) | ||
127 | return match; | ||
128 | } | ||
129 | } | ||
130 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
131 | "Command not found: %s\n", | ||
132 | label); | ||
133 | return NULL; | ||
134 | |||
135 | } | ||
136 | |||
137 | |||
138 | /** | ||
139 | * Run the main interpreter loop that performs exchange operations. | ||
140 | * | ||
141 | * @param cls contains the `struct InterpreterState` | ||
142 | */ | ||
143 | static void | ||
144 | interpreter_run (void *cls); | ||
145 | |||
146 | |||
147 | /** | ||
148 | * Current command is done, run the next one. | ||
149 | */ | ||
150 | static void | ||
151 | interpreter_next (void *cls) | ||
152 | { | ||
153 | struct GNUNET_TESTING_Interpreter *is = cls; | ||
154 | static unsigned long long ipc; | ||
155 | static struct GNUNET_TIME_Absolute last_report; | ||
156 | struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip]; | ||
157 | |||
158 | if (GNUNET_SYSERR == is->result) | ||
159 | return; /* ignore, we already failed! */ | ||
160 | if (GNUNET_TESTING_cmd_is_batch (cmd)) | ||
161 | { | ||
162 | GNUNET_TESTING_cmd_batch_next (is); | ||
163 | } | ||
164 | else | ||
165 | { | ||
166 | cmd->finish_time = GNUNET_TIME_absolute_get (); | ||
167 | is->ip++; | ||
168 | } | ||
169 | if (0 == (ipc % 1000)) | ||
170 | { | ||
171 | if (0 != ipc) | ||
172 | GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, | ||
173 | "Interpreter executed 1000 instructions in %s\n", | ||
174 | GNUNET_STRINGS_relative_time_to_string ( | ||
175 | GNUNET_TIME_absolute_get_duration (last_report), | ||
176 | GNUNET_YES)); | ||
177 | last_report = GNUNET_TIME_absolute_get (); | ||
178 | } | ||
179 | ipc++; | ||
180 | is->task = GNUNET_SCHEDULER_add_now (&interpreter_run, | ||
181 | is); | ||
182 | } | ||
183 | |||
184 | |||
185 | static void | ||
186 | run_finish_task_next (void *cls) | ||
187 | { | ||
188 | struct FinishTaskClosure *ftc = cls; | ||
189 | const struct GNUNET_TESTING_Command *cmd = ftc->cmd; | ||
190 | struct GNUNET_TESTING_Interpreter *is = ftc->is; | ||
191 | |||
192 | if (cmd->finish (cmd->cls, &interpreter_next, is)) | ||
193 | { | ||
194 | is->finish_task = GNUNET_SCHEDULER_add_now (&run_finish_task_next, ftc); | ||
195 | } | ||
196 | else | ||
197 | { | ||
198 | is->finish_task = NULL; | ||
199 | } | ||
200 | |||
201 | } | ||
202 | |||
203 | |||
204 | static void | ||
205 | run_finish_task_sync (void *cls) | ||
206 | { | ||
207 | struct SyncTaskClosure *stc = cls; | ||
208 | const struct GNUNET_TESTING_Command *cmd = stc->async_cmd; | ||
209 | const struct GNUNET_TESTING_Command *sync_cmd = stc->sync_cmd; | ||
210 | struct FinishTaskClosure *ftc; | ||
211 | struct SyncState *sync_state = sync_cmd->cls; | ||
212 | struct GNUNET_SCHEDULER_Task *finish_task = sync_state->finish_task; | ||
213 | |||
214 | GNUNET_assert (NULL != finish_task); | ||
215 | ftc = GNUNET_new (struct FinishTaskClosure); | ||
216 | ftc->cmd = stc->sync_cmd; | ||
217 | ftc->is = stc->is; | ||
218 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | ||
219 | if (cmd->default_timeout.rel_value_us < now.abs_value_us | ||
220 | - sync_state->start_finish_time.abs_value_us) | ||
221 | { | ||
222 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
223 | "The command with label %s did not finish its asyncronous task in time.\n", | ||
224 | cmd->label); | ||
225 | is->result = GNUNET_SYSERR; | ||
226 | GNUNET_SCHEDULER_shutdown (); | ||
227 | } | ||
228 | |||
229 | if (cmd->finish (cmd->cls, run_finish_task_next, ftc)) | ||
230 | { | ||
231 | finish_task = GNUNET_SCHEDULER_add_now (&run_finish_task_sync, stc); | ||
232 | } | ||
233 | else | ||
234 | { | ||
235 | finish_task = NULL; | ||
236 | } | ||
237 | } | ||
238 | |||
239 | |||
240 | static void | ||
241 | start_finish_on_ref (void *cls, | ||
242 | const struct GNUNET_TESTING_Command *cmd, | ||
243 | struct GNUNET_TESTING_Interpreter *is) | ||
244 | { | ||
245 | struct SyncState *sync_state = cls; | ||
246 | struct SyncTaskClosure *stc; | ||
247 | const struct GNUNET_TESTING_Command *async_cmd; | ||
248 | |||
249 | async_cmd = sync_state->async_cmd; | ||
250 | stc = GNUNET_new (struct SyncTaskClosure); | ||
251 | stc->async_cmd = async_cmd; | ||
252 | stc->sync_cmd = cmd; | ||
253 | stc->is = is; | ||
254 | sync_state->start_finish_time = GNUNET_TIME_absolute_get (); | ||
255 | sync_state->finish_task = GNUNET_SCHEDULER_add_now (&run_finish_task_sync, | ||
256 | stc); | ||
257 | } | ||
258 | |||
259 | |||
260 | const struct GNUNET_TESTING_Command | ||
261 | GNUNET_TESTING_cmd_finish (const char *finish_label, | ||
262 | const char *cmd_ref, | ||
263 | struct GNUNET_TIME_Relative timeout) | ||
264 | { | ||
265 | const struct GNUNET_TESTING_Command *async_cmd; | ||
266 | struct SyncState *sync_state; | ||
267 | |||
268 | async_cmd = GNUNET_TESTING_interpreter_lookup_command (cmd_ref); | ||
269 | sync_state = GNUNET_new (struct SyncState); | ||
270 | sync_state->async_cmd = async_cmd; | ||
271 | |||
272 | struct GNUNET_TESTING_Command cmd = { | ||
273 | .cls = sync_state, | ||
274 | .label = finish_label, | ||
275 | .run = &start_finish_on_ref, | ||
276 | .asynchronous_finish = GNUNET_NO | ||
277 | }; | ||
278 | |||
279 | return cmd; | ||
280 | } | ||
281 | |||
282 | |||
283 | const struct GNUNET_TESTING_Command | ||
284 | GNUNET_TESTING_cmd_make_asynchronous (const struct GNUNET_TESTING_Command cmd) | ||
285 | { | ||
286 | |||
287 | GNUNET_assert (NULL != cmd.finish); | ||
288 | const struct GNUNET_TESTING_Command async_cmd = { | ||
289 | .cls = cmd.cls, | ||
290 | .label = cmd.label, | ||
291 | .run = cmd.run, | ||
292 | .cleanup = cmd.cleanup, | ||
293 | .traits = cmd.traits, | ||
294 | .finish = cmd.finish, | ||
295 | .asynchronous_finish = GNUNET_YES | ||
296 | }; | ||
297 | |||
298 | return async_cmd; | ||
299 | } | ||
300 | |||
301 | |||
302 | /** | ||
303 | * Current command failed, clean up and fail the test case. | ||
304 | * | ||
305 | * @param is interpreter of the test | ||
306 | */ | ||
307 | void | ||
308 | GNUNET_TESTING_interpreter_fail (struct GNUNET_TESTING_Interpreter *is) | ||
309 | { | ||
310 | struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip]; | ||
311 | |||
312 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
313 | "Failed at command `%s'\n", | ||
314 | cmd->label); | ||
315 | while (GNUNET_TESTING_cmd_is_batch (cmd)) | ||
316 | { | ||
317 | cmd = GNUNET_TESTING_cmd_batch_get_current (cmd); | ||
318 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
319 | "Batch is at command `%s'\n", | ||
320 | cmd->label); | ||
321 | } | ||
322 | is->result = GNUNET_SYSERR; | ||
323 | GNUNET_SCHEDULER_shutdown (); | ||
324 | } | ||
325 | |||
326 | |||
327 | /** | ||
328 | * Create command array terminator. | ||
329 | * | ||
330 | * @return a end-command. | ||
331 | */ | ||
332 | struct GNUNET_TESTING_Command | ||
333 | GNUNET_TESTING_cmd_end (void) | ||
334 | { | ||
335 | static struct GNUNET_TESTING_Command cmd; | ||
336 | cmd.label = NULL; | ||
337 | |||
338 | return cmd; | ||
339 | } | ||
340 | |||
341 | |||
342 | /** | ||
343 | * Obtain current label. | ||
344 | */ | ||
345 | const char * | ||
346 | GNUNET_TESTING_interpreter_get_current_label (struct | ||
347 | GNUNET_TESTING_Interpreter *is) | ||
348 | { | ||
349 | struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip]; | ||
350 | |||
351 | return cmd->label; | ||
352 | } | ||
353 | |||
354 | |||
355 | /** | ||
356 | * Run the main interpreter loop. | ||
357 | * | ||
358 | * @param cls contains the `struct GNUNET_TESTING_Interpreter` | ||
359 | */ | ||
360 | static void | ||
361 | interpreter_run (void *cls) | ||
362 | { | ||
363 | struct FinishTaskClosure *ftc; | ||
364 | struct GNUNET_TESTING_Interpreter *is = cls; | ||
365 | struct GNUNET_TESTING_Command *cmd = &is->commands[is->ip]; | ||
366 | |||
367 | is->task = NULL; | ||
368 | |||
369 | if (NULL == cmd->label) | ||
370 | { | ||
371 | |||
372 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
373 | "Running command END\n"); | ||
374 | is->result = GNUNET_OK; | ||
375 | GNUNET_SCHEDULER_shutdown (); | ||
376 | return; | ||
377 | } | ||
378 | |||
379 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
380 | "Running command `%s'\n", | ||
381 | cmd->label); | ||
382 | cmd->start_time | ||
383 | = cmd->last_req_time | ||
384 | = GNUNET_TIME_absolute_get (); | ||
385 | cmd->num_tries = 1; | ||
386 | cmd->run (cmd->cls, | ||
387 | cmd, | ||
388 | is); | ||
389 | if ((NULL != cmd->finish) && (GNUNET_NO == cmd->asynchronous_finish)) | ||
390 | { | ||
391 | ftc = GNUNET_new (struct FinishTaskClosure); | ||
392 | ftc->cmd = cmd; | ||
393 | ftc->is = is; | ||
394 | cmd->finish_task = GNUNET_SCHEDULER_add_now (run_finish_task_next, ftc); | ||
395 | } | ||
396 | else | ||
397 | { | ||
398 | interpreter_next (is); | ||
399 | } | ||
400 | } | ||
401 | |||
402 | |||
403 | /** | ||
404 | * Function run when the test terminates (good or bad). | ||
405 | * Cleans up our state. | ||
406 | * | ||
407 | * @param cls the interpreter state. | ||
408 | */ | ||
409 | static void | ||
410 | do_shutdown (void *cls) | ||
411 | { | ||
412 | (void) cls; | ||
413 | struct GNUNET_TESTING_Command *cmd; | ||
414 | const char *label; | ||
415 | |||
416 | label = is->commands[is->ip].label; | ||
417 | if (NULL == label) | ||
418 | label = "END"; | ||
419 | |||
420 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
421 | "Executing shutdown at `%s'\n", | ||
422 | label); | ||
423 | |||
424 | for (unsigned int j = 0; | ||
425 | NULL != (cmd = &is->commands[j])->label; | ||
426 | j++) { | ||
427 | cmd->cleanup (cmd->cls, | ||
428 | cmd); | ||
429 | if (NULL != cmd->finish_task) | ||
430 | { | ||
431 | GNUNET_SCHEDULER_cancel (cmd->finish_task); | ||
432 | cmd->finish_task = NULL; | ||
433 | } | ||
434 | } | ||
435 | |||
436 | if (NULL != is->task) | ||
437 | { | ||
438 | GNUNET_SCHEDULER_cancel (is->task); | ||
439 | is->task = NULL; | ||
440 | } | ||
441 | if (NULL != is->timeout_task) | ||
442 | { | ||
443 | GNUNET_SCHEDULER_cancel (is->timeout_task); | ||
444 | is->timeout_task = NULL; | ||
445 | } | ||
446 | GNUNET_free (is->commands); | ||
447 | } | ||
448 | |||
449 | |||
450 | /** | ||
451 | * Function run when the test terminates (good or bad) with timeout. | ||
452 | * | ||
453 | * @param cls NULL | ||
454 | */ | ||
455 | static void | ||
456 | do_timeout (void *cls) | ||
457 | { | ||
458 | (void) cls; | ||
459 | |||
460 | is->timeout_task = NULL; | ||
461 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
462 | "Terminating test due to timeout\n"); | ||
463 | GNUNET_SCHEDULER_shutdown (); | ||
464 | } | ||
465 | |||
466 | |||
467 | /** | ||
468 | * Run the testsuite. Note, CMDs are copied into | ||
469 | * the interpreter state because they are _usually_ | ||
470 | * defined into the "run" method that returns after | ||
471 | * having scheduled the test interpreter. | ||
472 | * | ||
473 | * @param is the interpreter state | ||
474 | * @param commands the list of command to execute | ||
475 | * @param timeout how long to wait | ||
476 | */ | ||
477 | int | ||
478 | GNUNET_TESTING_run (const char *cfg_filename, | ||
479 | struct GNUNET_TESTING_Command *commands, | ||
480 | struct GNUNET_TIME_Relative timeout) | ||
481 | { | ||
482 | unsigned int i; | ||
483 | |||
484 | is = GNUNET_new (struct GNUNET_TESTING_Interpreter); | ||
485 | |||
486 | if (NULL != is->timeout_task) | ||
487 | { | ||
488 | GNUNET_SCHEDULER_cancel (is->timeout_task); | ||
489 | is->timeout_task = NULL; | ||
490 | } | ||
491 | /* get the number of commands */ | ||
492 | for (i = 0; NULL != commands[i].label; i++) | ||
493 | ; | ||
494 | is->commands = GNUNET_new_array (i + 1, | ||
495 | struct GNUNET_TESTING_Command); | ||
496 | memcpy (is->commands, | ||
497 | commands, | ||
498 | sizeof (struct GNUNET_TESTING_Command) * i); | ||
499 | |||
500 | is->timeout_task = GNUNET_SCHEDULER_add_delayed | ||
501 | (timeout, | ||
502 | &do_timeout, | ||
503 | is); | ||
504 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, is); | ||
505 | is->task = GNUNET_SCHEDULER_add_now (&interpreter_run, is); | ||
506 | return GNUNET_OK; | ||
507 | } | ||
508 | |||
509 | |||
510 | /* end of testing_api_loop.c */ | ||
diff --git a/src/testing/testing_api_trait_cmd.c b/src/testing/testing_api_trait_cmd.c new file mode 100644 index 000000000..886baee5b --- /dev/null +++ b/src/testing/testing_api_trait_cmd.c | |||
@@ -0,0 +1,79 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/testing_api_trait_cmd.c | ||
23 | * @brief offers CMDs as traits. | ||
24 | * @author Marcello Stanisci (GNU Taler testing) | ||
25 | * @author t3sserakt | ||
26 | */ | ||
27 | #include "platform.h" | ||
28 | #include "gnunet_testing_ng_lib.h" | ||
29 | |||
30 | #define GNUNET_TESTING_TRAIT_CMD "cmd" | ||
31 | |||
32 | |||
33 | /** | ||
34 | * Obtain a command from @a cmd. | ||
35 | * | ||
36 | * @param cmd command to extract the command from. | ||
37 | * @param index always zero. Commands offering this | ||
38 | * kind of traits do not need this index. For | ||
39 | * example, a "batch" CMD returns always the | ||
40 | * CMD currently being executed. | ||
41 | * @param[out] _cmd where to write the wire details. | ||
42 | * @return #GNUNET_OK on success. | ||
43 | */ | ||
44 | int | ||
45 | GNUNET_TESTING_get_trait_cmd (const struct GNUNET_TESTING_Command *cmd, | ||
46 | unsigned int index, | ||
47 | struct GNUNET_TESTING_Command **_cmd) | ||
48 | { | ||
49 | return cmd->traits (cmd->cls, | ||
50 | (const void **) _cmd, | ||
51 | GNUNET_TESTING_TRAIT_CMD, | ||
52 | index); | ||
53 | } | ||
54 | |||
55 | |||
56 | /** | ||
57 | * Offer a command in a trait. | ||
58 | * | ||
59 | * @param index always zero. Commands offering this | ||
60 | * kind of traits do not need this index. For | ||
61 | * example, a "meta" CMD returns always the | ||
62 | * CMD currently being executed. | ||
63 | * @param cmd wire details to offer. | ||
64 | * @return the trait. | ||
65 | */ | ||
66 | struct GNUNET_TESTING_Trait | ||
67 | GNUNET_TESTING_make_trait_cmd (unsigned int index, | ||
68 | const struct GNUNET_TESTING_Command *cmd) | ||
69 | { | ||
70 | struct GNUNET_TESTING_Trait ret = { | ||
71 | .index = index, | ||
72 | .trait_name = GNUNET_TESTING_TRAIT_CMD, | ||
73 | .ptr = (const struct GNUNET_TESTING_Command *) cmd | ||
74 | }; | ||
75 | return ret; | ||
76 | } | ||
77 | |||
78 | |||
79 | /* end of testing_api_trait_cmd.c */ | ||
diff --git a/src/testing/testing_api_trait_process.c b/src/testing/testing_api_trait_process.c new file mode 100644 index 000000000..31cdb01df --- /dev/null +++ b/src/testing/testing_api_trait_process.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/testing_api_trait_process.c | ||
23 | * @brief trait offering process handles. | ||
24 | * @author Christian Grothoff (GNU Taler testing) | ||
25 | * @author Marcello Stanisci (GNU Taler testing) | ||
26 | * @author t3sserakt | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_testing_ng_lib.h" | ||
30 | |||
31 | #define GNUNET_TESTING_TRAIT_PROCESS "process" | ||
32 | |||
33 | |||
34 | /** | ||
35 | * Obtain location where a command stores a pointer to a process. | ||
36 | * | ||
37 | * @param cmd command to extract trait from. | ||
38 | * @param index which process to pick if @a cmd | ||
39 | * has multiple on offer. | ||
40 | * @param[out] processp set to the address of the pointer to the | ||
41 | * process. | ||
42 | * @return #GNUNET_OK on success. | ||
43 | */ | ||
44 | int | ||
45 | GNUNET_TESTING_get_trait_process | ||
46 | (const struct GNUNET_TESTING_Command *cmd, | ||
47 | unsigned int index, | ||
48 | struct GNUNET_OS_Process ***processp) | ||
49 | { | ||
50 | return cmd->traits (cmd->cls, | ||
51 | (const void **) processp, | ||
52 | GNUNET_TESTING_TRAIT_PROCESS, | ||
53 | index); | ||
54 | } | ||
55 | |||
56 | |||
57 | /** | ||
58 | * Offer location where a command stores a pointer to a process. | ||
59 | * | ||
60 | * @param index offered location index number, in case there are | ||
61 | * multiple on offer. | ||
62 | * @param processp process location to offer. | ||
63 | * | ||
64 | * @return the trait. | ||
65 | */ | ||
66 | struct GNUNET_TESTING_Trait | ||
67 | GNUNET_TESTING_make_trait_process | ||
68 | (unsigned int index, | ||
69 | struct GNUNET_OS_Process **processp) | ||
70 | { | ||
71 | struct GNUNET_TESTING_Trait ret = { | ||
72 | .index = index, | ||
73 | .trait_name = GNUNET_TESTING_TRAIT_PROCESS, | ||
74 | .ptr = (const void *) processp | ||
75 | }; | ||
76 | |||
77 | return ret; | ||
78 | } | ||
79 | |||
80 | |||
81 | /* end of testing_api_trait_process.c */ | ||
diff --git a/src/testing/testing_api_traits.c b/src/testing/testing_api_traits.c new file mode 100644 index 000000000..66626833d --- /dev/null +++ b/src/testing/testing_api_traits.c | |||
@@ -0,0 +1,81 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file testing/testing_api_traits.c | ||
23 | * @brief loop for trait resolution | ||
24 | * @author Christian Grothoff (GNU Taler testing) | ||
25 | * @author Marcello Stanisci (GNU Taler testing) | ||
26 | * @author t3sserakt | ||
27 | */ | ||
28 | #include "platform.h" | ||
29 | #include "gnunet_testing_ng_lib.h" | ||
30 | |||
31 | |||
32 | /** | ||
33 | * End a trait array. Usually, commands offer several traits, | ||
34 | * and put them in arrays. | ||
35 | */ | ||
36 | struct GNUNET_TESTING_Trait | ||
37 | GNUNET_TESTING_trait_end () | ||
38 | { | ||
39 | struct GNUNET_TESTING_Trait end = { | ||
40 | .index = 0, | ||
41 | .trait_name = NULL, | ||
42 | .ptr = NULL | ||
43 | }; | ||
44 | |||
45 | return end; | ||
46 | } | ||
47 | |||
48 | |||
49 | /** | ||
50 | * Pick the chosen trait from the traits array. | ||
51 | * | ||
52 | * @param traits the traits array. | ||
53 | * @param ret where to store the result. | ||
54 | * @param trait type of the trait to extract. | ||
55 | * @param index index number of the object to extract. | ||
56 | * @return #GNUNET_OK if no error occurred, #GNUNET_SYSERR otherwise. | ||
57 | */ | ||
58 | int | ||
59 | GNUNET_TESTING_get_trait (const struct GNUNET_TESTING_Trait *traits, | ||
60 | const void **ret, | ||
61 | const char *trait, | ||
62 | unsigned int index) | ||
63 | { | ||
64 | for (unsigned int i = 0; NULL != traits[i].trait_name; i++) | ||
65 | { | ||
66 | if ( (0 == strcmp (trait, traits[i].trait_name)) && | ||
67 | (index == traits[i].index) ) | ||
68 | { | ||
69 | *ret = (void *) traits[i].ptr; | ||
70 | return GNUNET_OK; | ||
71 | } | ||
72 | } | ||
73 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
74 | "Trait %s/%u not found.\n", | ||
75 | trait, index); | ||
76 | |||
77 | return GNUNET_SYSERR; | ||
78 | } | ||
79 | |||
80 | |||
81 | /* end of testing_api_traits.c */ | ||
diff --git a/src/transport/Makefile.am b/src/transport/Makefile.am index 67b35365d..bc3004a70 100644 --- a/src/transport/Makefile.am +++ b/src/transport/Makefile.am | |||
@@ -174,7 +174,6 @@ libgnunettransporttesting2_la_SOURCES = \ | |||
174 | transport-testing-send2.c \ | 174 | transport-testing-send2.c \ |
175 | transport-testing-communicator.c transport-testing-communicator.h | 175 | transport-testing-communicator.c transport-testing-communicator.h |
176 | libgnunettransporttesting2_la_LIBADD = \ | 176 | libgnunettransporttesting2_la_LIBADD = \ |
177 | libgnunettransport.la \ | ||
178 | libgnunettransportapplication.la \ | 177 | libgnunettransportapplication.la \ |
179 | libgnunettransportcore.la \ | 178 | libgnunettransportcore.la \ |
180 | $(top_builddir)/src/arm/libgnunetarm.la \ | 179 | $(top_builddir)/src/arm/libgnunetarm.la \ |
@@ -954,9 +953,8 @@ test_transport_api_tcp_LDADD = \ | |||
954 | libgnunettransporttesting.la | 953 | libgnunettransporttesting.la |
955 | 954 | ||
956 | test_transport_api2_tcp_SOURCES = \ | 955 | test_transport_api2_tcp_SOURCES = \ |
957 | test_transport_api.c | 956 | test_transport_api2.c |
958 | test_transport_api2_tcp_LDADD = \ | 957 | test_transport_api2_tcp_LDADD = \ |
959 | libgnunettransport.la \ | ||
960 | $(top_builddir)/src/hello/libgnunethello.la \ | 958 | $(top_builddir)/src/hello/libgnunethello.la \ |
961 | $(top_builddir)/src/util/libgnunetutil.la \ | 959 | $(top_builddir)/src/util/libgnunetutil.la \ |
962 | libgnunettransporttesting2.la | 960 | libgnunettransporttesting2.la |
diff --git a/src/transport/gnunet-communicator-tcp.c b/src/transport/gnunet-communicator-tcp.c index ed82dba9f..9dd2797df 100644 --- a/src/transport/gnunet-communicator-tcp.c +++ b/src/transport/gnunet-communicator-tcp.c | |||
@@ -739,7 +739,6 @@ struct Addresses | |||
739 | }; | 739 | }; |
740 | 740 | ||
741 | 741 | ||
742 | |||
743 | /** | 742 | /** |
744 | * Maximum queue length before we stop reading towards the transport service. | 743 | * Maximum queue length before we stop reading towards the transport service. |
745 | */ | 744 | */ |
@@ -878,12 +877,14 @@ queue_destroy (struct Queue *queue) | |||
878 | { | 877 | { |
879 | struct ListenTask *lt = NULL; | 878 | struct ListenTask *lt = NULL; |
880 | struct GNUNET_HashCode h_sock; | 879 | struct GNUNET_HashCode h_sock; |
880 | int sockfd; | ||
881 | 881 | ||
882 | GNUNET_CRYPTO_hash (queue->listen_sock, | 882 | sockfd = GNUNET_NETWORK_get_fd (queue->listen_sock); |
883 | sizeof(queue->listen_sock), | 883 | GNUNET_CRYPTO_hash (&sockfd, |
884 | sizeof(int), | ||
884 | &h_sock); | 885 | &h_sock); |
885 | 886 | ||
886 | lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock); | 887 | lt = GNUNET_CONTAINER_multihashmap_get (lt_map, &h_sock); |
887 | 888 | ||
888 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 889 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
889 | "Disconnecting queue for peer `%s'\n", | 890 | "Disconnecting queue for peer `%s'\n", |
@@ -953,6 +954,9 @@ queue_destroy (struct Queue *queue) | |||
953 | else | 954 | else |
954 | GNUNET_free (queue); | 955 | GNUNET_free (queue); |
955 | 956 | ||
957 | if (NULL == lt) | ||
958 | return; | ||
959 | |||
956 | if ((! shutdown_running) && (NULL == lt->listen_task)) | 960 | if ((! shutdown_running) && (NULL == lt->listen_task)) |
957 | { | 961 | { |
958 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 962 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1193,6 +1197,7 @@ setup_cipher (const struct GNUNET_HashCode *dh, | |||
1193 | 0)); | 1197 | 0)); |
1194 | } | 1198 | } |
1195 | 1199 | ||
1200 | |||
1196 | /** | 1201 | /** |
1197 | * Callback called when peerstore store operation for rekey monotime value is finished. | 1202 | * Callback called when peerstore store operation for rekey monotime value is finished. |
1198 | * @param cls Queue context the store operation was executed. | 1203 | * @param cls Queue context the store operation was executed. |
@@ -1210,6 +1215,7 @@ rekey_monotime_store_cb (void *cls, int success) | |||
1210 | queue->rekey_monotime_sc = NULL; | 1215 | queue->rekey_monotime_sc = NULL; |
1211 | } | 1216 | } |
1212 | 1217 | ||
1218 | |||
1213 | /** | 1219 | /** |
1214 | * Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY | 1220 | * Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY |
1215 | * where found. | 1221 | * where found. |
@@ -1259,13 +1265,15 @@ rekey_monotime_cb (void *cls, | |||
1259 | pid, | 1265 | pid, |
1260 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY, | 1266 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_REKEY, |
1261 | rekey_monotonic_time, | 1267 | rekey_monotonic_time, |
1262 | sizeof(rekey_monotonic_time), | 1268 | sizeof(* |
1269 | rekey_monotonic_time), | ||
1263 | GNUNET_TIME_UNIT_FOREVER_ABS, | 1270 | GNUNET_TIME_UNIT_FOREVER_ABS, |
1264 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 1271 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, |
1265 | &rekey_monotime_store_cb, | 1272 | &rekey_monotime_store_cb, |
1266 | queue); | 1273 | queue); |
1267 | } | 1274 | } |
1268 | 1275 | ||
1276 | |||
1269 | /** | 1277 | /** |
1270 | * Setup cipher of @a queue for decryption. | 1278 | * Setup cipher of @a queue for decryption. |
1271 | * | 1279 | * |
@@ -1344,6 +1352,7 @@ do_rekey (struct Queue *queue, const struct TCPRekey *rekey) | |||
1344 | setup_in_cipher (&rekey->ephemeral, queue); | 1352 | setup_in_cipher (&rekey->ephemeral, queue); |
1345 | } | 1353 | } |
1346 | 1354 | ||
1355 | |||
1347 | /** | 1356 | /** |
1348 | * Callback called when peerstore store operation for handshake ack monotime value is finished. | 1357 | * Callback called when peerstore store operation for handshake ack monotime value is finished. |
1349 | * @param cls Queue context the store operation was executed. | 1358 | * @param cls Queue context the store operation was executed. |
@@ -1362,6 +1371,7 @@ handshake_ack_monotime_store_cb (void *cls, int success) | |||
1362 | queue->handshake_ack_monotime_sc = NULL; | 1371 | queue->handshake_ack_monotime_sc = NULL; |
1363 | } | 1372 | } |
1364 | 1373 | ||
1374 | |||
1365 | /** | 1375 | /** |
1366 | * Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK | 1376 | * Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK |
1367 | * where found. | 1377 | * where found. |
@@ -1406,20 +1416,21 @@ handshake_ack_monotime_cb (void *cls, | |||
1406 | queue_finish (queue); | 1416 | queue_finish (queue); |
1407 | return; | 1417 | return; |
1408 | } | 1418 | } |
1409 | queue->handshake_ack_monotime_sc = GNUNET_PEERSTORE_store (peerstore, | 1419 | queue->handshake_ack_monotime_sc = |
1410 | "transport_tcp_communicator", | 1420 | GNUNET_PEERSTORE_store (peerstore, |
1411 | pid, | 1421 | "transport_tcp_communicator", |
1412 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK, | 1422 | pid, |
1413 | handshake_ack_monotonic_time, | 1423 | GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE_ACK, |
1414 | sizeof( | 1424 | handshake_ack_monotonic_time, |
1415 | handshake_ack_monotonic_time), | 1425 | sizeof(*handshake_ack_monotonic_time), |
1416 | GNUNET_TIME_UNIT_FOREVER_ABS, | 1426 | GNUNET_TIME_UNIT_FOREVER_ABS, |
1417 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, | 1427 | GNUNET_PEERSTORE_STOREOPTION_REPLACE, |
1418 | & | 1428 | & |
1419 | handshake_ack_monotime_store_cb, | 1429 | handshake_ack_monotime_store_cb, |
1420 | queue); | 1430 | queue); |
1421 | } | 1431 | } |
1422 | 1432 | ||
1433 | |||
1423 | /** | 1434 | /** |
1424 | * Sending challenge with TcpConfirmationAck back to sender of ephemeral key. | 1435 | * Sending challenge with TcpConfirmationAck back to sender of ephemeral key. |
1425 | * | 1436 | * |
@@ -1465,6 +1476,7 @@ send_challenge (struct ChallengeNonceP challenge, struct Queue *queue) | |||
1465 | "sending challenge done\n"); | 1476 | "sending challenge done\n"); |
1466 | } | 1477 | } |
1467 | 1478 | ||
1479 | |||
1468 | /** | 1480 | /** |
1469 | * Setup cipher for outgoing data stream based on target and | 1481 | * Setup cipher for outgoing data stream based on target and |
1470 | * our ephemeral private key. | 1482 | * our ephemeral private key. |
@@ -1545,6 +1557,7 @@ inject_rekey (struct Queue *queue) | |||
1545 | setup_out_cipher (queue); | 1557 | setup_out_cipher (queue); |
1546 | } | 1558 | } |
1547 | 1559 | ||
1560 | |||
1548 | /** | 1561 | /** |
1549 | * We have been notified that our socket is ready to write. | 1562 | * We have been notified that our socket is ready to write. |
1550 | * Then reschedule this function to be called again once more is available. | 1563 | * Then reschedule this function to be called again once more is available. |
@@ -1634,6 +1647,7 @@ queue_write (void *cls) | |||
1634 | queue); | 1647 | queue); |
1635 | } | 1648 | } |
1636 | 1649 | ||
1650 | |||
1637 | /** | 1651 | /** |
1638 | * Test if we have received a full message in plaintext. | 1652 | * Test if we have received a full message in plaintext. |
1639 | * If so, handle it. | 1653 | * If so, handle it. |
@@ -1778,7 +1792,7 @@ try_handle_plaintext (struct Queue *queue) | |||
1778 | queue->qh = GNUNET_TRANSPORT_communicator_mq_add (ch, | 1792 | queue->qh = GNUNET_TRANSPORT_communicator_mq_add (ch, |
1779 | &queue->target, | 1793 | &queue->target, |
1780 | foreign_addr, | 1794 | foreign_addr, |
1781 | 0 /* no MTU */, | 1795 | UINT32_MAX, /* no MTU */ |
1782 | GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED, | 1796 | GNUNET_TRANSPORT_QUEUE_LENGTH_UNLIMITED, |
1783 | 0, /* Priority */ | 1797 | 0, /* Priority */ |
1784 | queue->nt, | 1798 | queue->nt, |
@@ -1975,6 +1989,7 @@ queue_read (void *cls) | |||
1975 | queue_finish (queue); | 1989 | queue_finish (queue); |
1976 | } | 1990 | } |
1977 | 1991 | ||
1992 | |||
1978 | /** | 1993 | /** |
1979 | * Convert a `struct sockaddr_in6 to a `struct sockaddr *` | 1994 | * Convert a `struct sockaddr_in6 to a `struct sockaddr *` |
1980 | * | 1995 | * |
@@ -2001,6 +2016,7 @@ tcp_address_to_sockaddr_numeric_v6 (socklen_t *sock_len, struct sockaddr_in6 v6, | |||
2001 | return in; | 2016 | return in; |
2002 | } | 2017 | } |
2003 | 2018 | ||
2019 | |||
2004 | /** | 2020 | /** |
2005 | * Convert a `struct sockaddr_in4 to a `struct sockaddr *` | 2021 | * Convert a `struct sockaddr_in4 to a `struct sockaddr *` |
2006 | * | 2022 | * |
@@ -2024,6 +2040,7 @@ tcp_address_to_sockaddr_numeric_v4 (socklen_t *sock_len, struct sockaddr_in v4, | |||
2024 | return in; | 2040 | return in; |
2025 | } | 2041 | } |
2026 | 2042 | ||
2043 | |||
2027 | /** | 2044 | /** |
2028 | * Convert TCP bind specification to a `struct PortOnlyIpv4Ipv6 *` | 2045 | * Convert TCP bind specification to a `struct PortOnlyIpv4Ipv6 *` |
2029 | * | 2046 | * |
@@ -2083,6 +2100,7 @@ tcp_address_to_sockaddr_port_only (const char *bindto, unsigned int *port) | |||
2083 | return po; | 2100 | return po; |
2084 | } | 2101 | } |
2085 | 2102 | ||
2103 | |||
2086 | /** | 2104 | /** |
2087 | * This Method extracts the address part of the BINDTO string. | 2105 | * This Method extracts the address part of the BINDTO string. |
2088 | * | 2106 | * |
@@ -2117,7 +2135,8 @@ extract_address (const char *bindto) | |||
2117 | start++; /* skip over '['*/ | 2135 | start++; /* skip over '['*/ |
2118 | cp[strlen (cp) - 1] = '\0'; /* eat ']'*/ | 2136 | cp[strlen (cp) - 1] = '\0'; /* eat ']'*/ |
2119 | } | 2137 | } |
2120 | else { | 2138 | else |
2139 | { | ||
2121 | token = strtok_r (cp, "]", &rest); | 2140 | token = strtok_r (cp, "]", &rest); |
2122 | if (strlen (bindto) == strlen (token)) | 2141 | if (strlen (bindto) == strlen (token)) |
2123 | { | 2142 | { |
@@ -2139,6 +2158,7 @@ extract_address (const char *bindto) | |||
2139 | return start; | 2158 | return start; |
2140 | } | 2159 | } |
2141 | 2160 | ||
2161 | |||
2142 | /** | 2162 | /** |
2143 | * This Method extracts the port part of the BINDTO string. | 2163 | * This Method extracts the port part of the BINDTO string. |
2144 | * | 2164 | * |
@@ -2217,6 +2237,7 @@ extract_port (const char *addr_and_port) | |||
2217 | return port; | 2237 | return port; |
2218 | } | 2238 | } |
2219 | 2239 | ||
2240 | |||
2220 | /** | 2241 | /** |
2221 | * Convert TCP bind specification to a `struct sockaddr *` | 2242 | * Convert TCP bind specification to a `struct sockaddr *` |
2222 | * | 2243 | * |
@@ -2245,7 +2266,6 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len) | |||
2245 | bindto); | 2266 | bindto); |
2246 | 2267 | ||
2247 | 2268 | ||
2248 | |||
2249 | if (1 == inet_pton (AF_INET, start, &v4.sin_addr)) | 2269 | if (1 == inet_pton (AF_INET, start, &v4.sin_addr)) |
2250 | { | 2270 | { |
2251 | // colon = strrchr (cp, ':'); | 2271 | // colon = strrchr (cp, ':'); |
@@ -2263,7 +2283,8 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len) | |||
2263 | port = extract_port (bindto); | 2283 | port = extract_port (bindto); |
2264 | in = tcp_address_to_sockaddr_numeric_v6 (sock_len, v6, port); | 2284 | in = tcp_address_to_sockaddr_numeric_v6 (sock_len, v6, port); |
2265 | } | 2285 | } |
2266 | else{ | 2286 | else |
2287 | { | ||
2267 | GNUNET_assert (0); | 2288 | GNUNET_assert (0); |
2268 | } | 2289 | } |
2269 | 2290 | ||
@@ -2272,6 +2293,7 @@ tcp_address_to_sockaddr (const char *bindto, socklen_t *sock_len) | |||
2272 | return in; | 2293 | return in; |
2273 | } | 2294 | } |
2274 | 2295 | ||
2296 | |||
2275 | /** | 2297 | /** |
2276 | * Signature of functions implementing the sending functionality of a | 2298 | * Signature of functions implementing the sending functionality of a |
2277 | * message queue. | 2299 | * message queue. |
@@ -2510,6 +2532,7 @@ start_initial_kx_out (struct Queue *queue) | |||
2510 | transmit_kx (queue, &epub); | 2532 | transmit_kx (queue, &epub); |
2511 | } | 2533 | } |
2512 | 2534 | ||
2535 | |||
2513 | /** | 2536 | /** |
2514 | * Callback called when peerstore store operation for handshake monotime is finished. | 2537 | * Callback called when peerstore store operation for handshake monotime is finished. |
2515 | * @param cls Queue context the store operation was executed. | 2538 | * @param cls Queue context the store operation was executed. |
@@ -2527,6 +2550,7 @@ handshake_monotime_store_cb (void *cls, int success) | |||
2527 | queue->handshake_monotime_sc = NULL; | 2550 | queue->handshake_monotime_sc = NULL; |
2528 | } | 2551 | } |
2529 | 2552 | ||
2553 | |||
2530 | /** | 2554 | /** |
2531 | * Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE | 2555 | * Callback called by peerstore when records for GNUNET_PEERSTORE_TRANSPORT_TCP_COMMUNICATOR_HANDSHAKE |
2532 | * where found. | 2556 | * where found. |
@@ -2585,6 +2609,7 @@ handshake_monotime_cb (void *cls, | |||
2585 | queue); | 2609 | queue); |
2586 | } | 2610 | } |
2587 | 2611 | ||
2612 | |||
2588 | /** | 2613 | /** |
2589 | * We have received the first bytes from the other side on a @a queue. | 2614 | * We have received the first bytes from the other side on a @a queue. |
2590 | * Decrypt the @a tc contained in @a ibuf and check the signature. | 2615 | * Decrypt the @a tc contained in @a ibuf and check the signature. |
@@ -2651,6 +2676,7 @@ free_proto_queue (struct ProtoQueue *pq) | |||
2651 | GNUNET_free (pq); | 2676 | GNUNET_free (pq); |
2652 | } | 2677 | } |
2653 | 2678 | ||
2679 | |||
2654 | /** | 2680 | /** |
2655 | * Read from the socket of the proto queue until we have enough data | 2681 | * Read from the socket of the proto queue until we have enough data |
2656 | * to upgrade to full queue. | 2682 | * to upgrade to full queue. |
@@ -2892,6 +2918,7 @@ queue_read_kx (void *cls) | |||
2892 | queue->read_task = GNUNET_SCHEDULER_add_now (&queue_read, queue); | 2918 | queue->read_task = GNUNET_SCHEDULER_add_now (&queue_read, queue); |
2893 | } | 2919 | } |
2894 | 2920 | ||
2921 | |||
2895 | /** | 2922 | /** |
2896 | * Function called by the transport service to initialize a | 2923 | * Function called by the transport service to initialize a |
2897 | * message queue given address information about another peer. | 2924 | * message queue given address information about another peer. |
@@ -2991,6 +3018,7 @@ mq_init (void *cls, const struct GNUNET_PeerIdentity *peer, const char *address) | |||
2991 | return GNUNET_OK; | 3018 | return GNUNET_OK; |
2992 | } | 3019 | } |
2993 | 3020 | ||
3021 | |||
2994 | /** | 3022 | /** |
2995 | * Iterator over all ListenTasks to clean up. | 3023 | * Iterator over all ListenTasks to clean up. |
2996 | * | 3024 | * |
@@ -3021,6 +3049,7 @@ get_lt_delete_it (void *cls, | |||
3021 | return GNUNET_OK; | 3049 | return GNUNET_OK; |
3022 | } | 3050 | } |
3023 | 3051 | ||
3052 | |||
3024 | /** | 3053 | /** |
3025 | * Iterator over all message queues to clean up. | 3054 | * Iterator over all message queues to clean up. |
3026 | * | 3055 | * |
@@ -3042,6 +3071,7 @@ get_queue_delete_it (void *cls, | |||
3042 | return GNUNET_OK; | 3071 | return GNUNET_OK; |
3043 | } | 3072 | } |
3044 | 3073 | ||
3074 | |||
3045 | /** | 3075 | /** |
3046 | * Shutdown the UNIX communicator. | 3076 | * Shutdown the UNIX communicator. |
3047 | * | 3077 | * |
@@ -3182,6 +3212,7 @@ nat_address_cb (void *cls, | |||
3182 | } | 3212 | } |
3183 | } | 3213 | } |
3184 | 3214 | ||
3215 | |||
3185 | /** | 3216 | /** |
3186 | * This method adds addresses to the DLL, that are later register at the NAT service. | 3217 | * This method adds addresses to the DLL, that are later register at the NAT service. |
3187 | */ | 3218 | */ |
@@ -3211,6 +3242,7 @@ add_addr (struct sockaddr *in, socklen_t in_len) | |||
3211 | addrs_lens++; | 3242 | addrs_lens++; |
3212 | } | 3243 | } |
3213 | 3244 | ||
3245 | |||
3214 | /** | 3246 | /** |
3215 | * This method launch network interactions for each address we like to bind to. | 3247 | * This method launch network interactions for each address we like to bind to. |
3216 | * | 3248 | * |
@@ -3226,6 +3258,7 @@ init_socket (struct sockaddr *addr, | |||
3226 | socklen_t sto_len; | 3258 | socklen_t sto_len; |
3227 | struct GNUNET_NETWORK_Handle *listen_sock; | 3259 | struct GNUNET_NETWORK_Handle *listen_sock; |
3228 | struct ListenTask *lt; | 3260 | struct ListenTask *lt; |
3261 | int sockfd; | ||
3229 | struct GNUNET_HashCode h_sock; | 3262 | struct GNUNET_HashCode h_sock; |
3230 | 3263 | ||
3231 | if (NULL == addr) | 3264 | if (NULL == addr) |
@@ -3314,8 +3347,9 @@ init_socket (struct sockaddr *addr, | |||
3314 | 3347 | ||
3315 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3348 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3316 | "creating hash\n"); | 3349 | "creating hash\n"); |
3317 | GNUNET_CRYPTO_hash (lt->listen_sock, | 3350 | sockfd = GNUNET_NETWORK_get_fd (lt->listen_sock); |
3318 | sizeof(lt->listen_sock), | 3351 | GNUNET_CRYPTO_hash (&sockfd, |
3352 | sizeof(int), | ||
3319 | &h_sock); | 3353 | &h_sock); |
3320 | 3354 | ||
3321 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3355 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -3336,7 +3370,7 @@ init_socket (struct sockaddr *addr, | |||
3336 | if (NULL == queue_map) | 3370 | if (NULL == queue_map) |
3337 | queue_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); | 3371 | queue_map = GNUNET_CONTAINER_multipeermap_create (10, GNUNET_NO); |
3338 | 3372 | ||
3339 | if (NULL == ch ) | 3373 | if (NULL == ch) |
3340 | ch = GNUNET_TRANSPORT_communicator_connect (cfg, | 3374 | ch = GNUNET_TRANSPORT_communicator_connect (cfg, |
3341 | COMMUNICATOR_CONFIG_SECTION, | 3375 | COMMUNICATOR_CONFIG_SECTION, |
3342 | COMMUNICATOR_ADDRESS_PREFIX, | 3376 | COMMUNICATOR_ADDRESS_PREFIX, |
@@ -3360,6 +3394,7 @@ init_socket (struct sockaddr *addr, | |||
3360 | 3394 | ||
3361 | } | 3395 | } |
3362 | 3396 | ||
3397 | |||
3363 | /** | 3398 | /** |
3364 | * This method reads from the DLL addrs_head to register them at the NAT service. | 3399 | * This method reads from the DLL addrs_head to register them at the NAT service. |
3365 | */ | 3400 | */ |
@@ -3421,6 +3456,7 @@ nat_register () | |||
3421 | } | 3456 | } |
3422 | } | 3457 | } |
3423 | 3458 | ||
3459 | |||
3424 | /** | 3460 | /** |
3425 | * This method is the callback called by the resolver API, and wraps method init_socket. | 3461 | * This method is the callback called by the resolver API, and wraps method init_socket. |
3426 | * | 3462 | * |
@@ -3476,6 +3512,7 @@ init_socket_resolv (void *cls, | |||
3476 | } | 3512 | } |
3477 | } | 3513 | } |
3478 | 3514 | ||
3515 | |||
3479 | /** | 3516 | /** |
3480 | * Setup communicator and launch network interactions. | 3517 | * Setup communicator and launch network interactions. |
3481 | * | 3518 | * |
@@ -3532,6 +3569,7 @@ run (void *cls, | |||
3532 | peerstore = GNUNET_PEERSTORE_connect (cfg); | 3569 | peerstore = GNUNET_PEERSTORE_connect (cfg); |
3533 | if (NULL == peerstore) | 3570 | if (NULL == peerstore) |
3534 | { | 3571 | { |
3572 | GNUNET_free (bindto); | ||
3535 | GNUNET_break (0); | 3573 | GNUNET_break (0); |
3536 | GNUNET_SCHEDULER_shutdown (); | 3574 | GNUNET_SCHEDULER_shutdown (); |
3537 | return; | 3575 | return; |
@@ -3564,7 +3602,6 @@ run (void *cls, | |||
3564 | GNUNET_free (po); | 3602 | GNUNET_free (po); |
3565 | nat_register (); | 3603 | nat_register (); |
3566 | GNUNET_free (bindto); | 3604 | GNUNET_free (bindto); |
3567 | |||
3568 | return; | 3605 | return; |
3569 | } | 3606 | } |
3570 | 3607 | ||
@@ -3577,8 +3614,8 @@ run (void *cls, | |||
3577 | in = tcp_address_to_sockaddr_numeric_v4 (&in_len, v4, bind_port); | 3614 | in = tcp_address_to_sockaddr_numeric_v4 (&in_len, v4, bind_port); |
3578 | init_socket (in, in_len); | 3615 | init_socket (in, in_len); |
3579 | nat_register (); | 3616 | nat_register (); |
3617 | GNUNET_free (start); | ||
3580 | GNUNET_free (bindto); | 3618 | GNUNET_free (bindto); |
3581 | |||
3582 | return; | 3619 | return; |
3583 | } | 3620 | } |
3584 | 3621 | ||
@@ -3588,8 +3625,8 @@ run (void *cls, | |||
3588 | in = tcp_address_to_sockaddr_numeric_v6 (&in_len, v6, bind_port); | 3625 | in = tcp_address_to_sockaddr_numeric_v6 (&in_len, v6, bind_port); |
3589 | init_socket (in, in_len); | 3626 | init_socket (in, in_len); |
3590 | nat_register (); | 3627 | nat_register (); |
3628 | GNUNET_free (start); | ||
3591 | GNUNET_free (bindto); | 3629 | GNUNET_free (bindto); |
3592 | |||
3593 | return; | 3630 | return; |
3594 | } | 3631 | } |
3595 | 3632 | ||
@@ -3603,6 +3640,7 @@ run (void *cls, | |||
3603 | &init_socket_resolv, | 3640 | &init_socket_resolv, |
3604 | &port); | 3641 | &port); |
3605 | GNUNET_free (bindto); | 3642 | GNUNET_free (bindto); |
3643 | GNUNET_free (start); | ||
3606 | } | 3644 | } |
3607 | 3645 | ||
3608 | 3646 | ||
diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index 415dc4b48..d75f4ae00 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c | |||
@@ -1492,16 +1492,9 @@ add_acks (struct SharedSecret *ss, int acks_to_add) | |||
1492 | 1492 | ||
1493 | struct ReceiverAddress *receiver = ss->receiver; | 1493 | struct ReceiverAddress *receiver = ss->receiver; |
1494 | 1494 | ||
1495 | if (NULL == ss) | 1495 | GNUNET_assert (NULL != ss); |
1496 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1496 | GNUNET_assert (NULL != receiver); |
1497 | "secret NULL!\n"); | 1497 | GNUNET_assert (NULL != receiver->d_qh); |
1498 | |||
1499 | if (NULL == receiver) | ||
1500 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1501 | "Receiver NULL!\n"); | ||
1502 | if (NULL == receiver->d_qh) | ||
1503 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1504 | "Queue NULL!\n"); | ||
1505 | 1498 | ||
1506 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1499 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1507 | "Tell transport we have %u more acks!\n", | 1500 | "Tell transport we have %u more acks!\n", |
diff --git a/src/transport/gnunet-service-tng.c b/src/transport/gnunet-service-tng.c index 9c37f15e2..cbf795eea 100644 --- a/src/transport/gnunet-service-tng.c +++ b/src/transport/gnunet-service-tng.c | |||
@@ -2693,12 +2693,12 @@ static struct GNUNET_CONTAINER_MultiShortmap *dvlearn_map; | |||
2693 | /** | 2693 | /** |
2694 | * Head of a DLL sorted by launch time. | 2694 | * Head of a DLL sorted by launch time. |
2695 | */ | 2695 | */ |
2696 | static struct LearnLaunchEntry *lle_head; | 2696 | static struct LearnLaunchEntry *lle_head = NULL; |
2697 | 2697 | ||
2698 | /** | 2698 | /** |
2699 | * Tail of a DLL sorted by launch time. | 2699 | * Tail of a DLL sorted by launch time. |
2700 | */ | 2700 | */ |
2701 | static struct LearnLaunchEntry *lle_tail; | 2701 | static struct LearnLaunchEntry *lle_tail = NULL; |
2702 | 2702 | ||
2703 | /** | 2703 | /** |
2704 | * MIN Heap sorted by "next_challenge" to `struct ValidationState` entries | 2704 | * MIN Heap sorted by "next_challenge" to `struct ValidationState` entries |
@@ -2772,6 +2772,11 @@ static unsigned int pa_count; | |||
2772 | */ | 2772 | */ |
2773 | static struct GNUNET_TIME_Absolute hello_mono_time; | 2773 | static struct GNUNET_TIME_Absolute hello_mono_time; |
2774 | 2774 | ||
2775 | /** | ||
2776 | * Indication if we have received a shutdown signal | ||
2777 | * and are in the process of cleaning up. | ||
2778 | */ | ||
2779 | static int in_shutdown; | ||
2775 | 2780 | ||
2776 | /** | 2781 | /** |
2777 | * Get an offset into the transmission history buffer for `struct | 2782 | * Get an offset into the transmission history buffer for `struct |
@@ -2805,6 +2810,7 @@ free_incoming_request (struct IncomingRequest *ir) | |||
2805 | GNUNET_assert (ir_total > 0); | 2810 | GNUNET_assert (ir_total > 0); |
2806 | ir_total--; | 2811 | ir_total--; |
2807 | GNUNET_PEERSTORE_watch_cancel (ir->wc); | 2812 | GNUNET_PEERSTORE_watch_cancel (ir->wc); |
2813 | ir->wc = NULL; | ||
2808 | GNUNET_free (ir); | 2814 | GNUNET_free (ir); |
2809 | } | 2815 | } |
2810 | 2816 | ||
@@ -3333,6 +3339,8 @@ free_neighbour (struct Neighbour *neighbour) | |||
3333 | GNUNET_CONTAINER_multipeermap_remove (neighbours, | 3339 | GNUNET_CONTAINER_multipeermap_remove (neighbours, |
3334 | &neighbour->pid, | 3340 | &neighbour->pid, |
3335 | neighbour)); | 3341 | neighbour)); |
3342 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3343 | "Freeing neighbour\n"); | ||
3336 | if (NULL != neighbour->reassembly_map) | 3344 | if (NULL != neighbour->reassembly_map) |
3337 | { | 3345 | { |
3338 | GNUNET_CONTAINER_multihashmap32_iterate (neighbour->reassembly_map, | 3346 | GNUNET_CONTAINER_multihashmap32_iterate (neighbour->reassembly_map, |
@@ -3451,6 +3459,8 @@ schedule_transmit_on_queue (struct Queue *queue, | |||
3451 | if (queue->tc->details.communicator.total_queue_length >= | 3459 | if (queue->tc->details.communicator.total_queue_length >= |
3452 | COMMUNICATOR_TOTAL_QUEUE_LIMIT) | 3460 | COMMUNICATOR_TOTAL_QUEUE_LIMIT) |
3453 | { | 3461 | { |
3462 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3463 | "Transmission throttled due to communicator queue limit\n"); | ||
3454 | GNUNET_STATISTICS_update ( | 3464 | GNUNET_STATISTICS_update ( |
3455 | GST_stats, | 3465 | GST_stats, |
3456 | "# Transmission throttled due to communicator queue limit", | 3466 | "# Transmission throttled due to communicator queue limit", |
@@ -3461,6 +3471,8 @@ schedule_transmit_on_queue (struct Queue *queue, | |||
3461 | } | 3471 | } |
3462 | if (queue->queue_length >= QUEUE_LENGTH_LIMIT) | 3472 | if (queue->queue_length >= QUEUE_LENGTH_LIMIT) |
3463 | { | 3473 | { |
3474 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3475 | "Transmission throttled due to communicator queue length limit\n"); | ||
3464 | GNUNET_STATISTICS_update (GST_stats, | 3476 | GNUNET_STATISTICS_update (GST_stats, |
3465 | "# Transmission throttled due to queue queue limit", | 3477 | "# Transmission throttled due to queue queue limit", |
3466 | 1, | 3478 | 1, |
@@ -3495,15 +3507,21 @@ check_link_down (void *cls) | |||
3495 | struct GNUNET_TIME_Absolute dvh_timeout; | 3507 | struct GNUNET_TIME_Absolute dvh_timeout; |
3496 | struct GNUNET_TIME_Absolute q_timeout; | 3508 | struct GNUNET_TIME_Absolute q_timeout; |
3497 | 3509 | ||
3510 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3511 | "Checking if link is down\n"); | ||
3498 | vl->visibility_task = NULL; | 3512 | vl->visibility_task = NULL; |
3499 | dvh_timeout = GNUNET_TIME_UNIT_ZERO_ABS; | 3513 | dvh_timeout = GNUNET_TIME_UNIT_ZERO_ABS; |
3500 | for (struct DistanceVectorHop *pos = dv->dv_head; NULL != pos; | 3514 | if (NULL != dv) |
3501 | pos = pos->next_dv) | ||
3502 | dvh_timeout = GNUNET_TIME_absolute_max (dvh_timeout, pos->path_valid_until); | ||
3503 | if (0 == GNUNET_TIME_absolute_get_remaining (dvh_timeout).rel_value_us) | ||
3504 | { | 3515 | { |
3505 | vl->dv->vl = NULL; | 3516 | for (struct DistanceVectorHop *pos = dv->dv_head; NULL != pos; |
3506 | vl->dv = NULL; | 3517 | pos = pos->next_dv) |
3518 | dvh_timeout = GNUNET_TIME_absolute_max (dvh_timeout, | ||
3519 | pos->path_valid_until); | ||
3520 | if (0 == GNUNET_TIME_absolute_get_remaining (dvh_timeout).rel_value_us) | ||
3521 | { | ||
3522 | vl->dv->vl = NULL; | ||
3523 | vl->dv = NULL; | ||
3524 | } | ||
3507 | } | 3525 | } |
3508 | q_timeout = GNUNET_TIME_UNIT_ZERO_ABS; | 3526 | q_timeout = GNUNET_TIME_UNIT_ZERO_ABS; |
3509 | for (struct Queue *q = n->queue_head; NULL != q; q = q->next_neighbour) | 3527 | for (struct Queue *q = n->queue_head; NULL != q; q = q->next_neighbour) |
@@ -3543,6 +3561,8 @@ free_queue (struct Queue *queue) | |||
3543 | struct PendingAcknowledgement *pa; | 3561 | struct PendingAcknowledgement *pa; |
3544 | struct VirtualLink *vl; | 3562 | struct VirtualLink *vl; |
3545 | 3563 | ||
3564 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3565 | "Cleaning up queue %u\n", queue->qid); | ||
3546 | if (NULL != queue->transmit_task) | 3566 | if (NULL != queue->transmit_task) |
3547 | { | 3567 | { |
3548 | GNUNET_SCHEDULER_cancel (queue->transmit_task); | 3568 | GNUNET_SCHEDULER_cancel (queue->transmit_task); |
@@ -3650,6 +3670,7 @@ stop_peer_request (void *cls, | |||
3650 | struct PeerRequest *pr = value; | 3670 | struct PeerRequest *pr = value; |
3651 | 3671 | ||
3652 | GNUNET_PEERSTORE_watch_cancel (pr->wc); | 3672 | GNUNET_PEERSTORE_watch_cancel (pr->wc); |
3673 | pr->wc = NULL; | ||
3653 | GNUNET_assert ( | 3674 | GNUNET_assert ( |
3654 | GNUNET_YES == | 3675 | GNUNET_YES == |
3655 | GNUNET_CONTAINER_multipeermap_remove (tc->details.application.requests, | 3676 | GNUNET_CONTAINER_multipeermap_remove (tc->details.application.requests, |
@@ -3661,6 +3682,9 @@ stop_peer_request (void *cls, | |||
3661 | } | 3682 | } |
3662 | 3683 | ||
3663 | 3684 | ||
3685 | static void | ||
3686 | do_shutdown (void *cls); | ||
3687 | |||
3664 | /** | 3688 | /** |
3665 | * Called whenever a client is disconnected. Frees our | 3689 | * Called whenever a client is disconnected. Frees our |
3666 | * resources associated with that client. | 3690 | * resources associated with that client. |
@@ -3678,16 +3702,20 @@ client_disconnect_cb (void *cls, | |||
3678 | 3702 | ||
3679 | (void) cls; | 3703 | (void) cls; |
3680 | (void) client; | 3704 | (void) client; |
3681 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3682 | "Client %p disconnected, cleaning up.\n", | ||
3683 | tc); | ||
3684 | GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, tc); | 3705 | GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, tc); |
3685 | switch (tc->type) | 3706 | switch (tc->type) |
3686 | { | 3707 | { |
3687 | case CT_NONE: | 3708 | case CT_NONE: |
3709 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3710 | "Unknown Client %p disconnected, cleaning up.\n", | ||
3711 | tc); | ||
3688 | break; | 3712 | break; |
3689 | 3713 | ||
3690 | case CT_CORE: { | 3714 | case CT_CORE: { |
3715 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3716 | "CORE Client %p disconnected, cleaning up.\n", | ||
3717 | tc); | ||
3718 | |||
3691 | struct PendingMessage *pm; | 3719 | struct PendingMessage *pm; |
3692 | 3720 | ||
3693 | while (NULL != (pm = tc->details.core.pending_msg_head)) | 3721 | while (NULL != (pm = tc->details.core.pending_msg_head)) |
@@ -3702,9 +3730,17 @@ client_disconnect_cb (void *cls, | |||
3702 | break; | 3730 | break; |
3703 | 3731 | ||
3704 | case CT_MONITOR: | 3732 | case CT_MONITOR: |
3733 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3734 | "MONITOR Client %p disconnected, cleaning up.\n", | ||
3735 | tc); | ||
3736 | |||
3705 | break; | 3737 | break; |
3706 | 3738 | ||
3707 | case CT_COMMUNICATOR: { | 3739 | case CT_COMMUNICATOR: { |
3740 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3741 | "COMMUNICATOR Client %p disconnected, cleaning up.\n", | ||
3742 | tc); | ||
3743 | |||
3708 | struct Queue *q; | 3744 | struct Queue *q; |
3709 | struct AddressListEntry *ale; | 3745 | struct AddressListEntry *ale; |
3710 | 3746 | ||
@@ -3717,6 +3753,10 @@ client_disconnect_cb (void *cls, | |||
3717 | break; | 3753 | break; |
3718 | 3754 | ||
3719 | case CT_APPLICATION: | 3755 | case CT_APPLICATION: |
3756 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
3757 | "APPLICATION Client %p disconnected, cleaning up.\n", | ||
3758 | tc); | ||
3759 | |||
3720 | GNUNET_CONTAINER_multipeermap_iterate (tc->details.application.requests, | 3760 | GNUNET_CONTAINER_multipeermap_iterate (tc->details.application.requests, |
3721 | &stop_peer_request, | 3761 | &stop_peer_request, |
3722 | tc); | 3762 | tc); |
@@ -3724,6 +3764,12 @@ client_disconnect_cb (void *cls, | |||
3724 | break; | 3764 | break; |
3725 | } | 3765 | } |
3726 | GNUNET_free (tc); | 3766 | GNUNET_free (tc); |
3767 | if ((GNUNET_YES == in_shutdown) && (NULL == clients_head)) | ||
3768 | { | ||
3769 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
3770 | "Our last client disconnected\n"); | ||
3771 | do_shutdown (cls); | ||
3772 | } | ||
3727 | } | 3773 | } |
3728 | 3774 | ||
3729 | 3775 | ||
@@ -4153,7 +4199,6 @@ queue_send_msg (struct Queue *queue, | |||
4153 | struct GNUNET_TRANSPORT_SendMessageTo *smt; | 4199 | struct GNUNET_TRANSPORT_SendMessageTo *smt; |
4154 | struct GNUNET_MQ_Envelope *env; | 4200 | struct GNUNET_MQ_Envelope *env; |
4155 | 4201 | ||
4156 | queue->idle = GNUNET_NO; | ||
4157 | GNUNET_log ( | 4202 | GNUNET_log ( |
4158 | GNUNET_ERROR_TYPE_DEBUG, | 4203 | GNUNET_ERROR_TYPE_DEBUG, |
4159 | "Queueing %u bytes of payload for transmission <%llu> on queue %llu to %s\n", | 4204 | "Queueing %u bytes of payload for transmission <%llu> on queue %llu to %s\n", |
@@ -4226,7 +4271,7 @@ route_via_neighbour (const struct Neighbour *n, | |||
4226 | for (struct Queue *pos = n->queue_head; NULL != pos; | 4271 | for (struct Queue *pos = n->queue_head; NULL != pos; |
4227 | pos = pos->next_neighbour) | 4272 | pos = pos->next_neighbour) |
4228 | { | 4273 | { |
4229 | if ((0 == (options & RMO_UNCONFIRMED_ALLOWED)) || | 4274 | if ((0 != (options & RMO_UNCONFIRMED_ALLOWED)) || |
4230 | (pos->validated_until.abs_value_us > now.abs_value_us)) | 4275 | (pos->validated_until.abs_value_us > now.abs_value_us)) |
4231 | candidates++; | 4276 | candidates++; |
4232 | } | 4277 | } |
@@ -4255,7 +4300,7 @@ route_via_neighbour (const struct Neighbour *n, | |||
4255 | for (struct Queue *pos = n->queue_head; NULL != pos; | 4300 | for (struct Queue *pos = n->queue_head; NULL != pos; |
4256 | pos = pos->next_neighbour) | 4301 | pos = pos->next_neighbour) |
4257 | { | 4302 | { |
4258 | if ((0 == (options & RMO_UNCONFIRMED_ALLOWED)) || | 4303 | if ((0 != (options & RMO_UNCONFIRMED_ALLOWED)) || |
4259 | (pos->validated_until.abs_value_us > now.abs_value_us)) | 4304 | (pos->validated_until.abs_value_us > now.abs_value_us)) |
4260 | { | 4305 | { |
4261 | if ((sel1 == candidates) || (sel2 == candidates)) | 4306 | if ((sel1 == candidates) || (sel2 == candidates)) |
@@ -4702,6 +4747,24 @@ route_control_message_without_fc (const struct GNUNET_PeerIdentity *target, | |||
4702 | } | 4747 | } |
4703 | 4748 | ||
4704 | 4749 | ||
4750 | static void | ||
4751 | consider_sending_fc (void *cls); | ||
4752 | |||
4753 | /** | ||
4754 | * Something changed on the virtual link with respect to flow | ||
4755 | * control. Consider retransmitting the FC window size. | ||
4756 | * | ||
4757 | * @param cls a `struct VirtualLink` to work with | ||
4758 | */ | ||
4759 | static void | ||
4760 | task_consider_sending_fc (void *cls) | ||
4761 | { | ||
4762 | struct VirtualLink *vl = cls; | ||
4763 | vl->fc_retransmit_task = NULL; | ||
4764 | consider_sending_fc (cls); | ||
4765 | } | ||
4766 | |||
4767 | |||
4705 | /** | 4768 | /** |
4706 | * Something changed on the virtual link with respect to flow | 4769 | * Something changed on the virtual link with respect to flow |
4707 | * control. Consider retransmitting the FC window size. | 4770 | * control. Consider retransmitting the FC window size. |
@@ -4759,7 +4822,7 @@ consider_sending_fc (void *cls) | |||
4759 | if (NULL != vl->fc_retransmit_task) | 4822 | if (NULL != vl->fc_retransmit_task) |
4760 | GNUNET_SCHEDULER_cancel (vl->fc_retransmit_task); | 4823 | GNUNET_SCHEDULER_cancel (vl->fc_retransmit_task); |
4761 | vl->fc_retransmit_task = | 4824 | vl->fc_retransmit_task = |
4762 | GNUNET_SCHEDULER_add_delayed (rtt, &consider_sending_fc, vl); | 4825 | GNUNET_SCHEDULER_add_delayed (rtt, &task_consider_sending_fc, vl); |
4763 | } | 4826 | } |
4764 | 4827 | ||
4765 | 4828 | ||
@@ -4812,16 +4875,22 @@ check_vl_transmission (struct VirtualLink *vl) | |||
4812 | } | 4875 | } |
4813 | if (GNUNET_NO == elig) | 4876 | if (GNUNET_NO == elig) |
4814 | return; | 4877 | return; |
4815 | 4878 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | |
4879 | "Not stalled. Scheduling transmission on queue\n"); | ||
4816 | /* Notify queues at direct neighbours that we are interested */ | 4880 | /* Notify queues at direct neighbours that we are interested */ |
4817 | now = GNUNET_TIME_absolute_get (); | 4881 | now = GNUNET_TIME_absolute_get (); |
4818 | if (NULL != n) | 4882 | if (NULL != n) |
4819 | { | 4883 | { |
4820 | for (struct Queue *queue = n->queue_head; NULL != queue; | 4884 | for (struct Queue *queue = n->queue_head; NULL != queue; |
4821 | queue = queue->next_neighbour) | 4885 | queue = queue->next_neighbour) |
4886 | { | ||
4822 | if ((GNUNET_YES == queue->idle) && | 4887 | if ((GNUNET_YES == queue->idle) && |
4823 | (queue->validated_until.abs_value_us > now.abs_value_us)) | 4888 | (queue->validated_until.abs_value_us > now.abs_value_us)) |
4824 | schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT); | 4889 | schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT); |
4890 | else | ||
4891 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4892 | "Queue busy or invalid\n"); | ||
4893 | } | ||
4825 | } | 4894 | } |
4826 | /* Notify queues via DV that we are interested */ | 4895 | /* Notify queues via DV that we are interested */ |
4827 | if (NULL != dv) | 4896 | if (NULL != dv) |
@@ -4869,6 +4938,9 @@ handle_client_send (void *cls, const struct OutboundMessage *obm) | |||
4869 | vl = lookup_virtual_link (&obm->peer); | 4938 | vl = lookup_virtual_link (&obm->peer); |
4870 | if (NULL == vl) | 4939 | if (NULL == vl) |
4871 | { | 4940 | { |
4941 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
4942 | "Don't have %s as a neighbour (anymore).\n", | ||
4943 | GNUNET_i2s (&obm->peer)); | ||
4872 | /* Failure: don't have this peer as a neighbour (anymore). | 4944 | /* Failure: don't have this peer as a neighbour (anymore). |
4873 | Might have gone down asynchronously, so this is NOT | 4945 | Might have gone down asynchronously, so this is NOT |
4874 | a protocol violation by CORE. Still count the event, | 4946 | a protocol violation by CORE. Still count the event, |
@@ -5127,9 +5199,12 @@ handle_del_address (void *cls, | |||
5127 | ale->address); | 5199 | ale->address); |
5128 | free_address_list_entry (ale); | 5200 | free_address_list_entry (ale); |
5129 | GNUNET_SERVICE_client_continue (tc->client); | 5201 | GNUNET_SERVICE_client_continue (tc->client); |
5202 | return; | ||
5130 | } | 5203 | } |
5131 | GNUNET_break (0); | 5204 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
5132 | GNUNET_SERVICE_client_drop (tc->client); | 5205 | "Communicator removed address we did not even have.\n"); |
5206 | GNUNET_SERVICE_client_continue (tc->client); | ||
5207 | // GNUNET_SERVICE_client_drop (tc->client); | ||
5133 | } | 5208 | } |
5134 | 5209 | ||
5135 | 5210 | ||
@@ -5208,7 +5283,8 @@ handle_raw_message (void *cls, const struct GNUNET_MessageHeader *mh) | |||
5208 | we pass this on, CORE would be confused (link down, messages | 5283 | we pass this on, CORE would be confused (link down, messages |
5209 | arrive). We should investigate more if this happens often, | 5284 | arrive). We should investigate more if this happens often, |
5210 | or in a persistent manner, and possibly do "something" about | 5285 | or in a persistent manner, and possibly do "something" about |
5211 | it. Thus logging as error for now. */GNUNET_break_op (0); | 5286 | it. Thus logging as error for now. */ |
5287 | GNUNET_break_op (0); | ||
5212 | GNUNET_STATISTICS_update (GST_stats, | 5288 | GNUNET_STATISTICS_update (GST_stats, |
5213 | "# CORE messages droped (virtual link still down)", | 5289 | "# CORE messages droped (virtual link still down)", |
5214 | 1, | 5290 | 1, |
@@ -6100,6 +6176,7 @@ activate_core_visible_dv_path (struct DistanceVectorHop *hop) | |||
6100 | dv->vl = vl; | 6176 | dv->vl = vl; |
6101 | vl->core_recv_window = RECV_WINDOW_SIZE; | 6177 | vl->core_recv_window = RECV_WINDOW_SIZE; |
6102 | vl->available_fc_window_size = DEFAULT_WINDOW_SIZE; | 6178 | vl->available_fc_window_size = DEFAULT_WINDOW_SIZE; |
6179 | vl->incoming_fc_window_size = DEFAULT_WINDOW_SIZE; | ||
6103 | vl->visibility_task = | 6180 | vl->visibility_task = |
6104 | GNUNET_SCHEDULER_add_at (hop->path_valid_until, &check_link_down, vl); | 6181 | GNUNET_SCHEDULER_add_at (hop->path_valid_until, &check_link_down, vl); |
6105 | GNUNET_break (GNUNET_YES == | 6182 | GNUNET_break (GNUNET_YES == |
@@ -6899,7 +6976,6 @@ handle_dv_learn (void *cls, const struct TransportDVLearnMessage *dvl) | |||
6899 | if (MAX_DV_HOPS_ALLOWED == nhops) | 6976 | if (MAX_DV_HOPS_ALLOWED == nhops) |
6900 | { | 6977 | { |
6901 | /* At limit, we're out of here! */ | 6978 | /* At limit, we're out of here! */ |
6902 | finish_cmc_handling (cmc); | ||
6903 | return; | 6979 | return; |
6904 | } | 6980 | } |
6905 | 6981 | ||
@@ -7637,7 +7713,7 @@ start_address_validation (const struct GNUNET_PeerIdentity *pid, | |||
7637 | validation_map, | 7713 | validation_map, |
7638 | &vs->pid, | 7714 | &vs->pid, |
7639 | vs, | 7715 | vs, |
7640 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 7716 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE)); |
7641 | update_next_challenge_time (vs, now); | 7717 | update_next_challenge_time (vs, now); |
7642 | } | 7718 | } |
7643 | 7719 | ||
@@ -7730,13 +7806,26 @@ handle_validation_challenge ( | |||
7730 | &tvp, | 7806 | &tvp, |
7731 | &tvr.signature); | 7807 | &tvr.signature); |
7732 | } | 7808 | } |
7733 | route_control_message_without_fc (&cmc->im.sender, | ||
7734 | &tvr.header, | ||
7735 | RMO_ANYTHING_GOES | RMO_REDUNDANT); | ||
7736 | sender = cmc->im.sender; | 7809 | sender = cmc->im.sender; |
7737 | finish_cmc_handling (cmc); | ||
7738 | vl = lookup_virtual_link (&sender); | 7810 | vl = lookup_virtual_link (&sender); |
7739 | if (NULL != vl) | 7811 | if (NULL != vl) |
7812 | { | ||
7813 | route_control_message_without_fc (&cmc->im.sender, | ||
7814 | &tvr.header, | ||
7815 | RMO_ANYTHING_GOES | RMO_REDUNDANT); | ||
7816 | } | ||
7817 | else | ||
7818 | { | ||
7819 | /* Use route via neighbour */ | ||
7820 | n = lookup_neighbour (&sender); | ||
7821 | if (NULL != n) | ||
7822 | route_via_neighbour (n, &tvr.header, | ||
7823 | RMO_ANYTHING_GOES | RMO_REDUNDANT | ||
7824 | | RMO_UNCONFIRMED_ALLOWED); | ||
7825 | } | ||
7826 | |||
7827 | finish_cmc_handling (cmc); | ||
7828 | if (NULL != vl) | ||
7740 | return; | 7829 | return; |
7741 | 7830 | ||
7742 | /* For us, the link is still down, but we need bi-directional | 7831 | /* For us, the link is still down, but we need bi-directional |
@@ -8010,8 +8099,10 @@ handle_validation_response ( | |||
8010 | vl->target = n->pid; | 8099 | vl->target = n->pid; |
8011 | vl->n = n; | 8100 | vl->n = n; |
8012 | n->vl = vl; | 8101 | n->vl = vl; |
8102 | q->idle = GNUNET_YES; | ||
8013 | vl->core_recv_window = RECV_WINDOW_SIZE; | 8103 | vl->core_recv_window = RECV_WINDOW_SIZE; |
8014 | vl->available_fc_window_size = DEFAULT_WINDOW_SIZE; | 8104 | vl->available_fc_window_size = DEFAULT_WINDOW_SIZE; |
8105 | vl->incoming_fc_window_size = DEFAULT_WINDOW_SIZE; | ||
8015 | vl->visibility_task = | 8106 | vl->visibility_task = |
8016 | GNUNET_SCHEDULER_add_at (q->validated_until, &check_link_down, vl); | 8107 | GNUNET_SCHEDULER_add_at (q->validated_until, &check_link_down, vl); |
8017 | GNUNET_break (GNUNET_YES == | 8108 | GNUNET_break (GNUNET_YES == |
@@ -8067,11 +8158,15 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc) | |||
8067 | uint64_t os; | 8158 | uint64_t os; |
8068 | uint64_t wnd; | 8159 | uint64_t wnd; |
8069 | 8160 | ||
8161 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
8162 | "Received FC from %s\n", GNUNET_i2s (&cmc->im.sender)); | ||
8070 | vl = lookup_virtual_link (&cmc->im.sender); | 8163 | vl = lookup_virtual_link (&cmc->im.sender); |
8071 | if (NULL == vl) | 8164 | if (NULL == vl) |
8072 | { | 8165 | { |
8166 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
8167 | "FC dropped: VL unknown\n"); | ||
8073 | GNUNET_STATISTICS_update (GST_stats, | 8168 | GNUNET_STATISTICS_update (GST_stats, |
8074 | "# FC dropped: virtual link unknown", | 8169 | "# FC dropped: Virtual link unknown", |
8075 | 1, | 8170 | 1, |
8076 | GNUNET_NO); | 8171 | GNUNET_NO); |
8077 | finish_cmc_handling (cmc); | 8172 | finish_cmc_handling (cmc); |
@@ -8080,6 +8175,8 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc) | |||
8080 | st = GNUNET_TIME_absolute_ntoh (fc->sender_time); | 8175 | st = GNUNET_TIME_absolute_ntoh (fc->sender_time); |
8081 | if (st.abs_value_us < vl->last_fc_timestamp.abs_value_us) | 8176 | if (st.abs_value_us < vl->last_fc_timestamp.abs_value_us) |
8082 | { | 8177 | { |
8178 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
8179 | "FC dropped: Message out of order\n"); | ||
8083 | /* out of order, drop */ | 8180 | /* out of order, drop */ |
8084 | GNUNET_STATISTICS_update (GST_stats, | 8181 | GNUNET_STATISTICS_update (GST_stats, |
8085 | "# FC dropped: message out of order", | 8182 | "# FC dropped: message out of order", |
@@ -8112,8 +8209,10 @@ handle_flow_control (void *cls, const struct TransportFlowControlMessage *fc) | |||
8112 | (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX) | 8209 | (0 == GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX) |
8113 | % FC_NO_CHANGE_REPLY_PROBABILITY)) | 8210 | % FC_NO_CHANGE_REPLY_PROBABILITY)) |
8114 | { | 8211 | { |
8115 | /* Consider re-sending our FC message, as clearly the | 8212 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
8116 | other peer's idea of the window is not up-to-date */ | 8213 | "Consider re-sending our FC message, as clearly the ther peer's idea of the window is not up-to-date (%llu vs %llu)\n", |
8214 | (unsigned long long) wnd, | ||
8215 | (unsigned long long) vl->incoming_fc_window_size); | ||
8117 | consider_sending_fc (vl); | 8216 | consider_sending_fc (vl); |
8118 | } | 8217 | } |
8119 | if ((wnd == vl->incoming_fc_window_size) && | 8218 | if ((wnd == vl->incoming_fc_window_size) && |
@@ -8149,41 +8248,41 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc, | |||
8149 | { GNUNET_MQ_hd_var_size (fragment_box, | 8248 | { GNUNET_MQ_hd_var_size (fragment_box, |
8150 | GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT, | 8249 | GNUNET_MESSAGE_TYPE_TRANSPORT_FRAGMENT, |
8151 | struct TransportFragmentBoxMessage, | 8250 | struct TransportFragmentBoxMessage, |
8152 | &cmc), | 8251 | cmc), |
8153 | GNUNET_MQ_hd_var_size (reliability_box, | 8252 | GNUNET_MQ_hd_var_size (reliability_box, |
8154 | GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX, | 8253 | GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_BOX, |
8155 | struct TransportReliabilityBoxMessage, | 8254 | struct TransportReliabilityBoxMessage, |
8156 | &cmc), | 8255 | cmc), |
8157 | GNUNET_MQ_hd_var_size (reliability_ack, | 8256 | GNUNET_MQ_hd_var_size (reliability_ack, |
8158 | GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK, | 8257 | GNUNET_MESSAGE_TYPE_TRANSPORT_RELIABILITY_ACK, |
8159 | struct TransportReliabilityAckMessage, | 8258 | struct TransportReliabilityAckMessage, |
8160 | &cmc), | 8259 | cmc), |
8161 | GNUNET_MQ_hd_var_size (backchannel_encapsulation, | 8260 | GNUNET_MQ_hd_var_size (backchannel_encapsulation, |
8162 | GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION, | 8261 | GNUNET_MESSAGE_TYPE_TRANSPORT_BACKCHANNEL_ENCAPSULATION, |
8163 | struct TransportBackchannelEncapsulationMessage, | 8262 | struct TransportBackchannelEncapsulationMessage, |
8164 | &cmc), | 8263 | cmc), |
8165 | GNUNET_MQ_hd_var_size (dv_learn, | 8264 | GNUNET_MQ_hd_var_size (dv_learn, |
8166 | GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN, | 8265 | GNUNET_MESSAGE_TYPE_TRANSPORT_DV_LEARN, |
8167 | struct TransportDVLearnMessage, | 8266 | struct TransportDVLearnMessage, |
8168 | &cmc), | 8267 | cmc), |
8169 | GNUNET_MQ_hd_var_size (dv_box, | 8268 | GNUNET_MQ_hd_var_size (dv_box, |
8170 | GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX, | 8269 | GNUNET_MESSAGE_TYPE_TRANSPORT_DV_BOX, |
8171 | struct TransportDVBoxMessage, | 8270 | struct TransportDVBoxMessage, |
8172 | &cmc), | 8271 | cmc), |
8173 | GNUNET_MQ_hd_fixed_size ( | 8272 | GNUNET_MQ_hd_fixed_size ( |
8174 | validation_challenge, | 8273 | validation_challenge, |
8175 | GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE, | 8274 | GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_CHALLENGE, |
8176 | struct TransportValidationChallengeMessage, | 8275 | struct TransportValidationChallengeMessage, |
8177 | &cmc), | 8276 | cmc), |
8178 | GNUNET_MQ_hd_fixed_size (flow_control, | 8277 | GNUNET_MQ_hd_fixed_size (flow_control, |
8179 | GNUNET_MESSAGE_TYPE_TRANSPORT_FLOW_CONTROL, | 8278 | GNUNET_MESSAGE_TYPE_TRANSPORT_FLOW_CONTROL, |
8180 | struct TransportFlowControlMessage, | 8279 | struct TransportFlowControlMessage, |
8181 | &cmc), | 8280 | cmc), |
8182 | GNUNET_MQ_hd_fixed_size ( | 8281 | GNUNET_MQ_hd_fixed_size ( |
8183 | validation_response, | 8282 | validation_response, |
8184 | GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE, | 8283 | GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_VALIDATION_RESPONSE, |
8185 | struct TransportValidationResponseMessage, | 8284 | struct TransportValidationResponseMessage, |
8186 | &cmc), | 8285 | cmc), |
8187 | GNUNET_MQ_handler_end () }; | 8286 | GNUNET_MQ_handler_end () }; |
8188 | int ret; | 8287 | int ret; |
8189 | 8288 | ||
@@ -8202,7 +8301,7 @@ demultiplex_with_cmc (struct CommunicatorMessageContext *cmc, | |||
8202 | if (GNUNET_NO == ret) | 8301 | if (GNUNET_NO == ret) |
8203 | { | 8302 | { |
8204 | /* unencapsulated 'raw' message */ | 8303 | /* unencapsulated 'raw' message */ |
8205 | handle_raw_message (&cmc, msg); | 8304 | handle_raw_message (cmc, msg); |
8206 | } | 8305 | } |
8207 | } | 8306 | } |
8208 | 8307 | ||
@@ -8770,6 +8869,8 @@ transmit_on_queue (void *cls) | |||
8770 | queue->idle = GNUNET_YES; | 8869 | queue->idle = GNUNET_YES; |
8771 | return; | 8870 | return; |
8772 | } | 8871 | } |
8872 | /* There is a message pending, we are certainly not idle */ | ||
8873 | queue->idle = GNUNET_NO; | ||
8773 | 8874 | ||
8774 | /* Given selection in `sc`, do transmission */ | 8875 | /* Given selection in `sc`, do transmission */ |
8775 | pm = sc.best; | 8876 | pm = sc.best; |
@@ -8838,7 +8939,8 @@ transmit_on_queue (void *cls) | |||
8838 | via DV (and thus the ultimate target of the pending message is for | 8939 | via DV (and thus the ultimate target of the pending message is for |
8839 | a different virtual link than the one of the queue), then we need | 8940 | a different virtual link than the one of the queue), then we need |
8840 | to use up not only the window of the direct link but also the | 8941 | to use up not only the window of the direct link but also the |
8841 | flow control window for the DV link! */pm->vl->outbound_fc_window_size_used += pm->bytes_msg; | 8942 | flow control window for the DV link! */ |
8943 | pm->vl->outbound_fc_window_size_used += pm->bytes_msg; | ||
8842 | 8944 | ||
8843 | if (pm->vl != queue->neighbour->vl) | 8945 | if (pm->vl != queue->neighbour->vl) |
8844 | { | 8946 | { |
@@ -8877,7 +8979,8 @@ transmit_on_queue (void *cls) | |||
8877 | 8979 | ||
8878 | OPTIMIZE: Note that in the future this heuristic should likely | 8980 | OPTIMIZE: Note that in the future this heuristic should likely |
8879 | be improved further (measure RTT stability, consider message | 8981 | be improved further (measure RTT stability, consider message |
8880 | urgency and size when delaying ACKs, etc.) */update_pm_next_attempt (pm, | 8982 | urgency and size when delaying ACKs, etc.) */ |
8983 | update_pm_next_attempt (pm, | ||
8881 | GNUNET_TIME_relative_to_absolute ( | 8984 | GNUNET_TIME_relative_to_absolute ( |
8882 | GNUNET_TIME_relative_multiply (queue->pd.aged_rtt, | 8985 | GNUNET_TIME_relative_multiply (queue->pd.aged_rtt, |
8883 | 4))); | 8986 | 4))); |
@@ -8949,20 +9052,30 @@ handle_send_message_ack (void *cls, | |||
8949 | 9052 | ||
8950 | /* find our queue entry matching the ACK */ | 9053 | /* find our queue entry matching the ACK */ |
8951 | qe = NULL; | 9054 | qe = NULL; |
9055 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
9056 | "Looking for queue for PID %s\n", | ||
9057 | GNUNET_i2s (&sma->receiver)); | ||
8952 | for (struct Queue *queue = tc->details.communicator.queue_head; NULL != queue; | 9058 | for (struct Queue *queue = tc->details.communicator.queue_head; NULL != queue; |
8953 | queue = queue->next_client) | 9059 | queue = queue->next_client) |
8954 | { | 9060 | { |
8955 | if (0 != GNUNET_memcmp (&queue->neighbour->pid, &sma->receiver)) | 9061 | if (0 != GNUNET_memcmp (&queue->neighbour->pid, &sma->receiver)) |
8956 | continue; | 9062 | continue; |
9063 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
9064 | "Found PID %s\n", | ||
9065 | GNUNET_i2s (&queue->neighbour->pid)); | ||
9066 | |||
9067 | |||
8957 | for (struct QueueEntry *qep = queue->queue_head; NULL != qep; | 9068 | for (struct QueueEntry *qep = queue->queue_head; NULL != qep; |
8958 | qep = qep->next) | 9069 | qep = qep->next) |
8959 | { | 9070 | { |
9071 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
9072 | "QueueEntry MID: %lu, Ack MID: %lu\n", | ||
9073 | qep->mid, sma->mid); | ||
8960 | if (qep->mid != sma->mid) | 9074 | if (qep->mid != sma->mid) |
8961 | continue; | 9075 | continue; |
8962 | qe = qep; | 9076 | qe = qep; |
8963 | break; | 9077 | break; |
8964 | } | 9078 | } |
8965 | break; | ||
8966 | } | 9079 | } |
8967 | if (NULL == qe) | 9080 | if (NULL == qe) |
8968 | { | 9081 | { |
@@ -8998,7 +9111,9 @@ handle_send_message_ack (void *cls, | |||
8998 | for (struct Queue *queue = tc->details.communicator.queue_head; | 9111 | for (struct Queue *queue = tc->details.communicator.queue_head; |
8999 | NULL != queue; | 9112 | NULL != queue; |
9000 | queue = queue->next_client) | 9113 | queue = queue->next_client) |
9114 | { | ||
9001 | schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT); | 9115 | schedule_transmit_on_queue (queue, GNUNET_SCHEDULER_PRIORITY_DEFAULT); |
9116 | } | ||
9002 | } | 9117 | } |
9003 | else if (QUEUE_LENGTH_LIMIT - 1 == qe->queue->queue_length) | 9118 | else if (QUEUE_LENGTH_LIMIT - 1 == qe->queue->queue_length) |
9004 | { | 9119 | { |
@@ -9211,6 +9326,9 @@ validation_start_cb (void *cls) | |||
9211 | (NULL != vs) && | 9326 | (NULL != vs) && |
9212 | (0 == GNUNET_TIME_absolute_get_remaining (vs->valid_until).rel_value_us)) | 9327 | (0 == GNUNET_TIME_absolute_get_remaining (vs->valid_until).rel_value_us)) |
9213 | { | 9328 | { |
9329 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
9330 | "Validation response %s cleaned up\n", | ||
9331 | GNUNET_sh2s (&vs->challenge.value)); | ||
9214 | free_validation_state (vs); | 9332 | free_validation_state (vs); |
9215 | vs = GNUNET_CONTAINER_heap_peek (validation_heap); | 9333 | vs = GNUNET_CONTAINER_heap_peek (validation_heap); |
9216 | } | 9334 | } |
@@ -9333,6 +9451,7 @@ start_dv_learn (void *cls) | |||
9333 | return; /* lost all connectivity, cannot do learning */ | 9451 | return; /* lost all connectivity, cannot do learning */ |
9334 | qqc.quality_count = 0; | 9452 | qqc.quality_count = 0; |
9335 | qqc.num_queues = 0; | 9453 | qqc.num_queues = 0; |
9454 | qqc.k = GNUNET_CONTAINER_multipeermap_size (neighbours); | ||
9336 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, | 9455 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, |
9337 | &check_connection_quality, | 9456 | &check_connection_quality, |
9338 | &qqc); | 9457 | &qqc); |
@@ -9352,7 +9471,7 @@ start_dv_learn (void *cls) | |||
9352 | return; | 9471 | return; |
9353 | } | 9472 | } |
9354 | /* remove old entries in #dvlearn_map if it has grown too big */ | 9473 | /* remove old entries in #dvlearn_map if it has grown too big */ |
9355 | while (MAX_DV_LEARN_PENDING >= | 9474 | while (MAX_DV_LEARN_PENDING <= |
9356 | GNUNET_CONTAINER_multishortmap_size (dvlearn_map)) | 9475 | GNUNET_CONTAINER_multishortmap_size (dvlearn_map)) |
9357 | { | 9476 | { |
9358 | lle = lle_tail; | 9477 | lle = lle_tail; |
@@ -9505,8 +9624,7 @@ handle_add_queue_message (void *cls, | |||
9505 | const char *addr; | 9624 | const char *addr; |
9506 | uint16_t addr_len; | 9625 | uint16_t addr_len; |
9507 | 9626 | ||
9508 | if ((0 != ntohl (aqm->mtu)) && | 9627 | if (ntohl (aqm->mtu) <= sizeof(struct TransportFragmentBoxMessage)) |
9509 | (ntohl (aqm->mtu) <= sizeof(struct TransportFragmentBoxMessage))) | ||
9510 | { | 9628 | { |
9511 | /* MTU so small as to be useless for transmissions, | 9629 | /* MTU so small as to be useless for transmissions, |
9512 | required for #fragment_message()! */ | 9630 | required for #fragment_message()! */ |
@@ -9514,57 +9632,73 @@ handle_add_queue_message (void *cls, | |||
9514 | GNUNET_SERVICE_client_drop (tc->client); | 9632 | GNUNET_SERVICE_client_drop (tc->client); |
9515 | return; | 9633 | return; |
9516 | } | 9634 | } |
9517 | neighbour = lookup_neighbour (&aqm->receiver); | 9635 | /* This may simply be a queue update */ |
9518 | if (NULL == neighbour) | 9636 | for (queue = tc->details.communicator.queue_head; |
9637 | NULL != queue; | ||
9638 | queue = queue->next_client) | ||
9519 | { | 9639 | { |
9520 | neighbour = GNUNET_new (struct Neighbour); | 9640 | if (queue->qid != aqm->qid) |
9521 | neighbour->pid = aqm->receiver; | 9641 | continue; |
9522 | GNUNET_assert (GNUNET_OK == | 9642 | break; |
9523 | GNUNET_CONTAINER_multipeermap_put ( | 9643 | } |
9524 | neighbours, | 9644 | |
9525 | &neighbour->pid, | 9645 | if (NULL != queue) |
9526 | neighbour, | 9646 | { |
9527 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 9647 | neighbour = queue->neighbour; |
9528 | neighbour->get = | 9648 | } else { |
9529 | GNUNET_PEERSTORE_iterate (peerstore, | 9649 | neighbour = lookup_neighbour (&aqm->receiver); |
9530 | "transport", | 9650 | if (NULL == neighbour) |
9531 | &neighbour->pid, | 9651 | { |
9532 | GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME, | 9652 | neighbour = GNUNET_new (struct Neighbour); |
9533 | &neighbour_dv_monotime_cb, | 9653 | neighbour->pid = aqm->receiver; |
9534 | neighbour); | 9654 | GNUNET_assert (GNUNET_OK == |
9655 | GNUNET_CONTAINER_multipeermap_put ( | ||
9656 | neighbours, | ||
9657 | &neighbour->pid, | ||
9658 | neighbour, | ||
9659 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | ||
9660 | neighbour->get = | ||
9661 | GNUNET_PEERSTORE_iterate (peerstore, | ||
9662 | "transport", | ||
9663 | &neighbour->pid, | ||
9664 | GNUNET_PEERSTORE_TRANSPORT_DVLEARN_MONOTIME, | ||
9665 | &neighbour_dv_monotime_cb, | ||
9666 | neighbour); | ||
9667 | } | ||
9668 | addr_len = ntohs (aqm->header.size) - sizeof(*aqm); | ||
9669 | addr = (const char *) &aqm[1]; | ||
9670 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
9671 | "New queue %s to %s available with QID %llu\n", | ||
9672 | addr, | ||
9673 | GNUNET_i2s (&aqm->receiver), | ||
9674 | (unsigned long long) aqm->qid); | ||
9675 | queue = GNUNET_malloc (sizeof(struct Queue) + addr_len); | ||
9676 | queue->tc = tc; | ||
9677 | queue->address = (const char *) &queue[1]; | ||
9678 | queue->pd.aged_rtt = GNUNET_TIME_UNIT_FOREVER_REL; | ||
9679 | queue->qid = aqm->qid; | ||
9680 | queue->neighbour = neighbour; | ||
9681 | memcpy (&queue[1], addr, addr_len); | ||
9682 | /* notify monitors about new queue */ | ||
9683 | { | ||
9684 | struct MonitorEvent me = { .rtt = queue->pd.aged_rtt, .cs = queue->cs }; | ||
9685 | |||
9686 | notify_monitors (&neighbour->pid, queue->address, queue->nt, &me); | ||
9687 | } | ||
9688 | GNUNET_CONTAINER_MDLL_insert (neighbour, | ||
9689 | neighbour->queue_head, | ||
9690 | neighbour->queue_tail, | ||
9691 | queue); | ||
9692 | GNUNET_CONTAINER_MDLL_insert (client, | ||
9693 | tc->details.communicator.queue_head, | ||
9694 | tc->details.communicator.queue_tail, | ||
9695 | queue); | ||
9696 | |||
9535 | } | 9697 | } |
9536 | addr_len = ntohs (aqm->header.size) - sizeof(*aqm); | ||
9537 | addr = (const char *) &aqm[1]; | ||
9538 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
9539 | "New queue %s to %s available with QID %llu\n", | ||
9540 | addr, | ||
9541 | GNUNET_i2s (&aqm->receiver), | ||
9542 | (unsigned long long) aqm->qid); | ||
9543 | queue = GNUNET_malloc (sizeof(struct Queue) + addr_len); | ||
9544 | queue->tc = tc; | ||
9545 | queue->address = (const char *) &queue[1]; | ||
9546 | queue->pd.aged_rtt = GNUNET_TIME_UNIT_FOREVER_REL; | ||
9547 | queue->qid = aqm->qid; | ||
9548 | queue->mtu = ntohl (aqm->mtu); | 9698 | queue->mtu = ntohl (aqm->mtu); |
9549 | queue->nt = (enum GNUNET_NetworkType) ntohl (aqm->nt); | 9699 | queue->nt = (enum GNUNET_NetworkType) ntohl (aqm->nt); |
9550 | queue->cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (aqm->cs); | 9700 | queue->cs = (enum GNUNET_TRANSPORT_ConnectionStatus) ntohl (aqm->cs); |
9551 | queue->neighbour = neighbour; | ||
9552 | queue->idle = GNUNET_YES; | 9701 | queue->idle = GNUNET_YES; |
9553 | memcpy (&queue[1], addr, addr_len); | ||
9554 | /* notify monitors about new queue */ | ||
9555 | { | ||
9556 | struct MonitorEvent me = { .rtt = queue->pd.aged_rtt, .cs = queue->cs }; | ||
9557 | |||
9558 | notify_monitors (&neighbour->pid, queue->address, queue->nt, &me); | ||
9559 | } | ||
9560 | GNUNET_CONTAINER_MDLL_insert (neighbour, | ||
9561 | neighbour->queue_head, | ||
9562 | neighbour->queue_tail, | ||
9563 | queue); | ||
9564 | GNUNET_CONTAINER_MDLL_insert (client, | ||
9565 | tc->details.communicator.queue_head, | ||
9566 | tc->details.communicator.queue_tail, | ||
9567 | queue); | ||
9568 | /* check if valdiations are waiting for the queue */ | 9702 | /* check if valdiations are waiting for the queue */ |
9569 | (void) | 9703 | (void) |
9570 | GNUNET_CONTAINER_multipeermap_get_multiple (validation_map, | 9704 | GNUNET_CONTAINER_multipeermap_get_multiple (validation_map, |
@@ -9623,7 +9757,6 @@ handle_update_queue_message (void *cls, | |||
9623 | } | 9757 | } |
9624 | 9758 | ||
9625 | 9759 | ||
9626 | |||
9627 | /** | 9760 | /** |
9628 | * Communicator tells us that our request to create a queue "worked", that | 9761 | * Communicator tells us that our request to create a queue "worked", that |
9629 | * is setting up the queue is now in process. | 9762 | * is setting up the queue is now in process. |
@@ -9965,12 +10098,17 @@ do_shutdown (void *cls) | |||
9965 | struct LearnLaunchEntry *lle; | 10098 | struct LearnLaunchEntry *lle; |
9966 | 10099 | ||
9967 | (void) cls; | 10100 | (void) cls; |
9968 | 10101 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, | |
9969 | GNUNET_CONTAINER_multipeermap_iterate (neighbours, &free_neighbour_cb, NULL); | 10102 | &free_neighbour_cb, NULL); |
9970 | if (NULL != peerstore) | 10103 | if (NULL != validation_task) |
9971 | { | 10104 | { |
9972 | GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_NO); | 10105 | GNUNET_SCHEDULER_cancel (validation_task); |
9973 | peerstore = NULL; | 10106 | validation_task = NULL; |
10107 | } | ||
10108 | if (NULL != dvlearn_task) | ||
10109 | { | ||
10110 | GNUNET_SCHEDULER_cancel (dvlearn_task); | ||
10111 | dvlearn_task = NULL; | ||
9974 | } | 10112 | } |
9975 | if (NULL != GST_stats) | 10113 | if (NULL != GST_stats) |
9976 | { | 10114 | { |
@@ -10016,6 +10154,13 @@ do_shutdown (void *cls) | |||
10016 | GNUNET_CONTAINER_DLL_remove (lle_head, lle_tail, lle); | 10154 | GNUNET_CONTAINER_DLL_remove (lle_head, lle_tail, lle); |
10017 | GNUNET_free (lle); | 10155 | GNUNET_free (lle); |
10018 | } | 10156 | } |
10157 | if (NULL != peerstore) | ||
10158 | { | ||
10159 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
10160 | "Disconnecting from PEERSTORE service\n"); | ||
10161 | GNUNET_PEERSTORE_disconnect (peerstore, GNUNET_NO); | ||
10162 | peerstore = NULL; | ||
10163 | } | ||
10019 | GNUNET_CONTAINER_multishortmap_destroy (dvlearn_map); | 10164 | GNUNET_CONTAINER_multishortmap_destroy (dvlearn_map); |
10020 | dvlearn_map = NULL; | 10165 | dvlearn_map = NULL; |
10021 | GNUNET_CONTAINER_heap_destroy (validation_heap); | 10166 | GNUNET_CONTAINER_heap_destroy (validation_heap); |
@@ -10023,6 +10168,16 @@ do_shutdown (void *cls) | |||
10023 | GNUNET_CONTAINER_multipeermap_iterate (dv_routes, &free_dv_routes_cb, NULL); | 10168 | GNUNET_CONTAINER_multipeermap_iterate (dv_routes, &free_dv_routes_cb, NULL); |
10024 | GNUNET_CONTAINER_multipeermap_destroy (dv_routes); | 10169 | GNUNET_CONTAINER_multipeermap_destroy (dv_routes); |
10025 | dv_routes = NULL; | 10170 | dv_routes = NULL; |
10171 | GNUNET_SCHEDULER_shutdown (); | ||
10172 | } | ||
10173 | |||
10174 | |||
10175 | static void | ||
10176 | shutdown_task (void *cls) | ||
10177 | { | ||
10178 | in_shutdown = GNUNET_YES; | ||
10179 | if (NULL == clients_head) | ||
10180 | do_shutdown (cls); | ||
10026 | } | 10181 | } |
10027 | 10182 | ||
10028 | 10183 | ||
@@ -10042,6 +10197,7 @@ run (void *cls, | |||
10042 | (void) service; | 10197 | (void) service; |
10043 | /* setup globals */ | 10198 | /* setup globals */ |
10044 | hello_mono_time = GNUNET_TIME_absolute_get_monotonic (c); | 10199 | hello_mono_time = GNUNET_TIME_absolute_get_monotonic (c); |
10200 | in_shutdown = GNUNET_NO; | ||
10045 | GST_cfg = c; | 10201 | GST_cfg = c; |
10046 | backtalkers = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); | 10202 | backtalkers = GNUNET_CONTAINER_multipeermap_create (16, GNUNET_YES); |
10047 | pending_acks = GNUNET_CONTAINER_multiuuidmap_create (32768, GNUNET_YES); | 10203 | pending_acks = GNUNET_CONTAINER_multiuuidmap_create (32768, GNUNET_YES); |
@@ -10071,7 +10227,7 @@ run (void *cls, | |||
10071 | "My identity is `%s'\n", | 10227 | "My identity is `%s'\n", |
10072 | GNUNET_i2s_full (&GST_my_identity)); | 10228 | GNUNET_i2s_full (&GST_my_identity)); |
10073 | GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg); | 10229 | GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg); |
10074 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | 10230 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL); |
10075 | peerstore = GNUNET_PEERSTORE_connect (GST_cfg); | 10231 | peerstore = GNUNET_PEERSTORE_connect (GST_cfg); |
10076 | if (NULL == peerstore) | 10232 | if (NULL == peerstore) |
10077 | { | 10233 | { |
diff --git a/src/transport/test_transport_api2_tcp_peer1.conf b/src/transport/test_transport_api2_tcp_peer1.conf new file mode 100644 index 000000000..745ed6887 --- /dev/null +++ b/src/transport/test_transport_api2_tcp_peer1.conf | |||
@@ -0,0 +1,23 @@ | |||
1 | @INLINE@ template_cfg_peer1.conf | ||
2 | [PATHS] | ||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p1/ | ||
4 | |||
5 | [transport] | ||
6 | BINARY = gnunet-service-tng | ||
7 | PLUGINS = tcp | ||
8 | #PREFIX = valgrind --log-file=/tmp/vg_peer1-%p | ||
9 | UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p1.sock | ||
10 | |||
11 | [communicator-tcp] | ||
12 | BINARY = gnunet-communicator-tcp | ||
13 | BINDTO = 60002 | ||
14 | DISABLE_V6 = YES | ||
15 | IMMEDIATE_START = YES | ||
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p1.sock | ||
17 | #PREFIX = valgrind --log-file=/tmp/vg_cpeer1-%p | ||
18 | |||
19 | [peerstore] | ||
20 | IMMEDIATE_START = YES | ||
21 | |||
22 | #[transport] | ||
23 | #PREFIX = valgrind | ||
diff --git a/src/transport/test_transport_api2_tcp_peer2.conf b/src/transport/test_transport_api2_tcp_peer2.conf new file mode 100644 index 000000000..022468bcd --- /dev/null +++ b/src/transport/test_transport_api2_tcp_peer2.conf | |||
@@ -0,0 +1,22 @@ | |||
1 | @INLINE@ template_cfg_peer2.conf | ||
2 | [PATHS] | ||
3 | GNUNET_TEST_HOME = $GNUNET_TMP/test-transport/api-tcp-p2/ | ||
4 | |||
5 | [transport] | ||
6 | BINARY = gnunet-service-tng | ||
7 | #PREFIX = valgrind --log-file=/tmp/vg_peer2-%p | ||
8 | UNIXPATH = $GNUNET_RUNTIME_DIR/tng-p2.sock | ||
9 | |||
10 | [communicator-tcp] | ||
11 | BINARY = gnunet-communicator-tcp | ||
12 | BINDTO = 60003 | ||
13 | DISABLE_V6 = YES | ||
14 | IMMEDIATE_START = YES | ||
15 | #PREFIX = valgrind --log-file=/tmp/vg_comm2-%p | ||
16 | UNIXPATH = $GNUNET_RUNTIME_DIR/tcp-comm-p2.sock | ||
17 | |||
18 | [peerstore] | ||
19 | IMMEDIATE_START = YES | ||
20 | |||
21 | #[transport] | ||
22 | #PREFIX = valgrind | ||
diff --git a/src/transport/transport-testing-communicator.c b/src/transport/transport-testing-communicator.c index de356fb9c..040f16d5d 100644 --- a/src/transport/transport-testing-communicator.c +++ b/src/transport/transport-testing-communicator.c | |||
@@ -548,6 +548,11 @@ handle_update_queue_message (void *cls, | |||
548 | tc_queue = tc_queue->next; | 548 | tc_queue = tc_queue->next; |
549 | } | 549 | } |
550 | } | 550 | } |
551 | if (NULL == tc_queue) | ||
552 | { | ||
553 | GNUNET_SERVICE_client_continue (client->client); | ||
554 | return; | ||
555 | } | ||
551 | GNUNET_assert (tc_queue->qid == msg->qid); | 556 | GNUNET_assert (tc_queue->qid == msg->qid); |
552 | GNUNET_assert (0 == GNUNET_memcmp (&tc_queue->peer_id, &msg->receiver)); | 557 | GNUNET_assert (0 == GNUNET_memcmp (&tc_queue->peer_id, &msg->receiver)); |
553 | tc_queue->nt = msg->nt; | 558 | tc_queue->nt = msg->nt; |
diff --git a/src/transport/transport-testing-ng.h b/src/transport/transport-testing-ng.h new file mode 100644 index 000000000..cd5ba65a9 --- /dev/null +++ b/src/transport/transport-testing-ng.h | |||
@@ -0,0 +1,71 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @author t3sserakt | ||
23 | */ | ||
24 | |||
25 | struct TngState | ||
26 | { | ||
27 | /** | ||
28 | * Handle to operation | ||
29 | */ | ||
30 | struct GNUNET_TESTBED_Operation *operation; | ||
31 | |||
32 | /** | ||
33 | * Flag indicating if service is ready. | ||
34 | */ | ||
35 | int service_ready; | ||
36 | |||
37 | /** | ||
38 | * Abort task identifier | ||
39 | */ | ||
40 | struct GNUNET_SCHEDULER_Task *abort_task; | ||
41 | |||
42 | /** | ||
43 | * Label of peer command. | ||
44 | */ | ||
45 | const char *peer_label; | ||
46 | |||
47 | /** | ||
48 | * Name of service to start. | ||
49 | */ | ||
50 | const char *servicename; | ||
51 | |||
52 | /** | ||
53 | * Peer identity of the system. | ||
54 | */ | ||
55 | struct GNUNET_PeerIdentity *peer_identity; | ||
56 | |||
57 | /** | ||
58 | * Message handler for transport service. | ||
59 | */ | ||
60 | const struct GNUNET_MQ_MessageHandler *handlers; | ||
61 | |||
62 | /** | ||
63 | * Notify connect callback | ||
64 | */ | ||
65 | GNUNET_TRANSPORT_NotifyConnect nc; | ||
66 | |||
67 | /** | ||
68 | * Closure for the @a nc callback | ||
69 | */ | ||
70 | void *cb_cls; | ||
71 | }; | ||
diff --git a/src/transport/transport-testing2.c b/src/transport/transport-testing2.c index d9f1d5e56..eaa8a5f15 100644 --- a/src/transport/transport-testing2.c +++ b/src/transport/transport-testing2.c | |||
@@ -328,6 +328,8 @@ notify_disconnect (void *cls, | |||
328 | } | 328 | } |
329 | } | 329 | } |
330 | 330 | ||
331 | static void | ||
332 | retrieve_hello (void *cls); | ||
331 | 333 | ||
332 | static void | 334 | static void |
333 | hello_iter_cb (void *cb_cls, | 335 | hello_iter_cb (void *cb_cls, |
@@ -337,16 +339,19 @@ hello_iter_cb (void *cb_cls, | |||
337 | struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cb_cls; | 339 | struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cb_cls; |
338 | if ((NULL == record) && (NULL == emsg)) | 340 | if ((NULL == record) && (NULL == emsg)) |
339 | { | 341 | { |
340 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Iteration End\n"); | 342 | p->pic = NULL; |
343 | if (NULL != p->start_cb) | ||
344 | p->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, p); | ||
341 | return; | 345 | return; |
342 | } | 346 | } |
343 | //Check record type et al? | 347 | // Check record type et al? |
344 | p->hello_size = record->value_size; | 348 | p->hello_size = record->value_size; |
345 | p->hello = GNUNET_malloc (p->hello_size); | 349 | p->hello = GNUNET_malloc (p->hello_size); |
346 | memcpy (p->hello, record->value, p->hello_size); | 350 | memcpy (p->hello, record->value, p->hello_size); |
347 | p->hello[p->hello_size-1] = '\0'; | 351 | p->hello[p->hello_size - 1] = '\0'; |
348 | 352 | ||
349 | GNUNET_PEERSTORE_iterate_cancel (p->pic); | 353 | GNUNET_PEERSTORE_iterate_cancel (p->pic); |
354 | p->pic = NULL; | ||
350 | if (NULL != p->start_cb) | 355 | if (NULL != p->start_cb) |
351 | { | 356 | { |
352 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 357 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -358,13 +363,12 @@ hello_iter_cb (void *cb_cls, | |||
358 | } | 363 | } |
359 | } | 364 | } |
360 | 365 | ||
366 | |||
361 | static void | 367 | static void |
362 | retrieve_hello(void *cls) | 368 | retrieve_hello (void *cls) |
363 | { | 369 | { |
364 | struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls; | 370 | struct GNUNET_TRANSPORT_TESTING_PeerContext *p = cls; |
365 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 371 | p->rh_task = NULL; |
366 | "Getting hello...\n"); | ||
367 | |||
368 | p->pic = GNUNET_PEERSTORE_iterate (p->ph, | 372 | p->pic = GNUNET_PEERSTORE_iterate (p->ph, |
369 | "transport", | 373 | "transport", |
370 | &p->id, | 374 | &p->id, |
@@ -375,7 +379,6 @@ retrieve_hello(void *cls) | |||
375 | } | 379 | } |
376 | 380 | ||
377 | 381 | ||
378 | |||
379 | /** | 382 | /** |
380 | * Start a peer with the given configuration | 383 | * Start a peer with the given configuration |
381 | * @param tth the testing handle | 384 | * @param tth the testing handle |
@@ -504,15 +507,13 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct | |||
504 | "Peer %u configured with identity `%s'\n", | 507 | "Peer %u configured with identity `%s'\n", |
505 | p->no, | 508 | p->no, |
506 | GNUNET_i2s_full (&p->id)); | 509 | GNUNET_i2s_full (&p->id)); |
507 | p->tmh = GNUNET_TRANSPORT_manipulation_connect (p->cfg); | ||
508 | p->th = GNUNET_TRANSPORT_core_connect (p->cfg, | 510 | p->th = GNUNET_TRANSPORT_core_connect (p->cfg, |
509 | NULL, | 511 | NULL, |
510 | handlers, | 512 | handlers, |
511 | p, | 513 | p, |
512 | ¬ify_connect, | 514 | ¬ify_connect, |
513 | ¬ify_disconnect); | 515 | ¬ify_disconnect); |
514 | if ((NULL == p->th) || | 516 | if (NULL == p->th) |
515 | (NULL == p->tmh)) | ||
516 | { | 517 | { |
517 | LOG (GNUNET_ERROR_TYPE_ERROR, | 518 | LOG (GNUNET_ERROR_TYPE_ERROR, |
518 | "Failed to connect to transport service for peer `%s': `%s'\n", | 519 | "Failed to connect to transport service for peer `%s': `%s'\n", |
@@ -535,11 +536,8 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct | |||
535 | // FIXME Error handling | 536 | // FIXME Error handling |
536 | p->ah = GNUNET_TRANSPORT_application_init (p->cfg); | 537 | p->ah = GNUNET_TRANSPORT_application_init (p->cfg); |
537 | GNUNET_assert (NULL != p->ah); | 538 | GNUNET_assert (NULL != p->ah); |
538 | // FIXME Error handleing | 539 | // FIXME Error handling |
539 | GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 540 | p->rh_task = GNUNET_SCHEDULER_add_now (retrieve_hello, p); |
540 | retrieve_hello, | ||
541 | p); | ||
542 | //GNUNET_assert (NULL != p->pic); | ||
543 | 541 | ||
544 | return p; | 542 | return p; |
545 | } | 543 | } |
@@ -577,11 +575,6 @@ GNUNET_TRANSPORT_TESTING_restart_peer (struct | |||
577 | GNUNET_TRANSPORT_core_disconnect (p->th); | 575 | GNUNET_TRANSPORT_core_disconnect (p->th); |
578 | p->th = NULL; | 576 | p->th = NULL; |
579 | } | 577 | } |
580 | if (NULL != p->tmh) | ||
581 | { | ||
582 | GNUNET_TRANSPORT_manipulation_disconnect (p->tmh); | ||
583 | p->tmh = NULL; | ||
584 | } | ||
585 | for (cc = p->tth->cc_head; NULL != cc; cc = ccn) | 578 | for (cc = p->tth->cc_head; NULL != cc; cc = ccn) |
586 | { | 579 | { |
587 | ccn = cc->next; | 580 | ccn = cc->next; |
@@ -655,6 +648,11 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct | |||
655 | struct GNUNET_TRANSPORT_TESTING_Handle *tth = p->tth; | 648 | struct GNUNET_TRANSPORT_TESTING_Handle *tth = p->tth; |
656 | struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc; | 649 | struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc; |
657 | struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ccn; | 650 | struct GNUNET_TRANSPORT_TESTING_ConnectRequest *ccn; |
651 | /* shutdown */ | ||
652 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
653 | "Stopping peer %u (`%s')\n", | ||
654 | p->no, | ||
655 | GNUNET_i2s (&p->id)); | ||
658 | 656 | ||
659 | for (cc = tth->cc_head; NULL != cc; cc = ccn) | 657 | for (cc = tth->cc_head; NULL != cc; cc = ccn) |
660 | { | 658 | { |
@@ -668,16 +666,29 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct | |||
668 | GNUNET_PEERSTORE_iterate_cancel (p->pic); | 666 | GNUNET_PEERSTORE_iterate_cancel (p->pic); |
669 | p->pic = NULL; | 667 | p->pic = NULL; |
670 | } | 668 | } |
671 | if (NULL != p->tmh) | ||
672 | { | ||
673 | GNUNET_TRANSPORT_manipulation_disconnect (p->tmh); | ||
674 | p->tmh = NULL; | ||
675 | } | ||
676 | if (NULL != p->th) | 669 | if (NULL != p->th) |
677 | { | 670 | { |
678 | GNUNET_TRANSPORT_core_disconnect (p->th); | 671 | GNUNET_TRANSPORT_core_disconnect (p->th); |
679 | p->th = NULL; | 672 | p->th = NULL; |
680 | } | 673 | } |
674 | if (NULL != p->ats) | ||
675 | { | ||
676 | GNUNET_ATS_connectivity_done (p->ats); | ||
677 | p->ats = NULL; | ||
678 | } | ||
679 | if (NULL != p->ah) | ||
680 | { | ||
681 | GNUNET_TRANSPORT_application_done (p->ah); | ||
682 | p->ah = NULL; | ||
683 | } | ||
684 | if (NULL != p->ph) | ||
685 | { | ||
686 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
687 | "Disconnecting from PEERSTORE service\n"); | ||
688 | GNUNET_PEERSTORE_disconnect (p->ph, GNUNET_NO); | ||
689 | p->ph = NULL; | ||
690 | } | ||
691 | |||
681 | if (NULL != p->peer) | 692 | if (NULL != p->peer) |
682 | { | 693 | { |
683 | if (GNUNET_OK != | 694 | if (GNUNET_OK != |
@@ -691,11 +702,6 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct | |||
691 | GNUNET_TESTING_peer_destroy (p->peer); | 702 | GNUNET_TESTING_peer_destroy (p->peer); |
692 | p->peer = NULL; | 703 | p->peer = NULL; |
693 | } | 704 | } |
694 | if (NULL != p->ats) | ||
695 | { | ||
696 | GNUNET_ATS_connectivity_done (p->ats); | ||
697 | p->ats = NULL; | ||
698 | } | ||
699 | if (NULL != p->hello) | 705 | if (NULL != p->hello) |
700 | { | 706 | { |
701 | GNUNET_free (p->hello); | 707 | GNUNET_free (p->hello); |
@@ -718,6 +724,9 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct | |||
718 | "Peer %u (`%s') stopped\n", | 724 | "Peer %u (`%s') stopped\n", |
719 | p->no, | 725 | p->no, |
720 | GNUNET_i2s (&p->id)); | 726 | GNUNET_i2s (&p->id)); |
727 | if (NULL != p->rh_task) | ||
728 | GNUNET_SCHEDULER_cancel (p->rh_task); | ||
729 | p->rh_task = NULL; | ||
721 | GNUNET_free (p); | 730 | GNUNET_free (p); |
722 | } | 731 | } |
723 | 732 | ||
@@ -728,16 +737,16 @@ GNUNET_TRANSPORT_TESTING_stop_peer (struct | |||
728 | * FIXME maybe schedule the application_validate somehow | 737 | * FIXME maybe schedule the application_validate somehow |
729 | */ | 738 | */ |
730 | /* | 739 | /* |
731 | static void | 740 | static void |
732 | hello_offered (void *cls) | 741 | hello_offered (void *cls) |
733 | { | 742 | { |
734 | struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls; | 743 | struct GNUNET_TRANSPORT_TESTING_ConnectRequest *cc = cls; |
735 | 744 | ||
736 | cc->oh = NULL; | 745 | cc->oh = NULL; |
737 | cc->tct = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, | 746 | cc->tct = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, |
738 | &offer_hello, | 747 | &offer_hello, |
739 | cc); | 748 | cc); |
740 | }*/ | 749 | }*/ |
741 | 750 | ||
742 | 751 | ||
743 | /** | 752 | /** |
diff --git a/src/transport/transport-testing2.h b/src/transport/transport-testing2.h index 3554436d8..db8700df9 100644 --- a/src/transport/transport-testing2.h +++ b/src/transport/transport-testing2.h | |||
@@ -85,11 +85,6 @@ struct GNUNET_TRANSPORT_TESTING_PeerContext | |||
85 | struct GNUNET_TRANSPORT_CoreHandle *th; | 85 | struct GNUNET_TRANSPORT_CoreHandle *th; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * Peer's transport service manipulation handle | ||
89 | */ | ||
90 | struct GNUNET_TRANSPORT_ManipulationHandle *tmh; | ||
91 | |||
92 | /** | ||
93 | * Peer's ATS handle. | 88 | * Peer's ATS handle. |
94 | */ | 89 | */ |
95 | struct GNUNET_ATS_ConnectivityHandle *ats; | 90 | struct GNUNET_ATS_ConnectivityHandle *ats; |
@@ -150,6 +145,11 @@ struct GNUNET_TRANSPORT_TESTING_PeerContext | |||
150 | GNUNET_SCHEDULER_TaskCallback start_cb; | 145 | GNUNET_SCHEDULER_TaskCallback start_cb; |
151 | 146 | ||
152 | /** | 147 | /** |
148 | * Hello get task | ||
149 | */ | ||
150 | struct GNUNET_SCHEDULER_Task *rh_task; | ||
151 | |||
152 | /** | ||
153 | * Closure for the @a nc and @a nd callbacks | 153 | * Closure for the @a nc and @a nd callbacks |
154 | */ | 154 | */ |
155 | void *cb_cls; | 155 | void *cb_cls; |
diff --git a/src/transport/transport_api2_communication.c b/src/transport/transport_api2_communication.c index b048ad851..3d9da08e4 100644 --- a/src/transport/transport_api2_communication.c +++ b/src/transport/transport_api2_communication.c | |||
@@ -677,7 +677,7 @@ handle_send_msg (void *cls, const struct GNUNET_TRANSPORT_SendMessageTo *smt) | |||
677 | struct GNUNET_TRANSPORT_QueueHandle *qh; | 677 | struct GNUNET_TRANSPORT_QueueHandle *qh; |
678 | 678 | ||
679 | for (qh = ch->queue_head; NULL != qh; qh = qh->next) | 679 | for (qh = ch->queue_head; NULL != qh; qh = qh->next) |
680 | if ((qh->queue_id == smt->qid) && | 680 | if ((qh->queue_id == ntohl (smt->qid)) && |
681 | (0 == memcmp (&qh->peer, | 681 | (0 == memcmp (&qh->peer, |
682 | &smt->receiver, | 682 | &smt->receiver, |
683 | sizeof(struct GNUNET_PeerIdentity)))) | 683 | sizeof(struct GNUNET_PeerIdentity)))) |
diff --git a/src/util/.gitignore b/src/util/.gitignore index 8556ee7b8..7c7b7045d 100644 --- a/src/util/.gitignore +++ b/src/util/.gitignore | |||
@@ -80,3 +80,4 @@ python27_location | |||
80 | perf_malloc | 80 | perf_malloc |
81 | perf_mq | 81 | perf_mq |
82 | perf_scheduler | 82 | perf_scheduler |
83 | gnunet-base32 | ||
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 33fe26e34..e2614e5e3 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am | |||
@@ -25,6 +25,11 @@ if ENABLE_BENCHMARK | |||
25 | PTHREAD = -lpthread | 25 | PTHREAD = -lpthread |
26 | endif | 26 | endif |
27 | 27 | ||
28 | if HAVE_NOLIBGCRYPT19 | ||
29 | DLOG = crypto_ecc_dlog.c | ||
30 | DLOG_TEST = test_crypto_ecc_dlog | ||
31 | endif | ||
32 | |||
28 | gnunet_config_diff_SOURCES = \ | 33 | gnunet_config_diff_SOURCES = \ |
29 | gnunet-config-diff.c | 34 | gnunet-config-diff.c |
30 | gnunet_config_diff_LDADD = \ | 35 | gnunet_config_diff_LDADD = \ |
@@ -58,7 +63,7 @@ libgnunetutil_la_SOURCES = \ | |||
58 | crypto_symmetric.c \ | 63 | crypto_symmetric.c \ |
59 | crypto_crc.c \ | 64 | crypto_crc.c \ |
60 | crypto_ecc.c \ | 65 | crypto_ecc.c \ |
61 | crypto_ecc_dlog.c \ | 66 | $(DLOG) \ |
62 | crypto_ecc_setup.c \ | 67 | crypto_ecc_setup.c \ |
63 | crypto_hash.c \ | 68 | crypto_hash.c \ |
64 | crypto_hash_file.c \ | 69 | crypto_hash_file.c \ |
@@ -152,9 +157,10 @@ libexec_PROGRAMS = \ | |||
152 | gnunet-timeout | 157 | gnunet-timeout |
153 | 158 | ||
154 | bin_PROGRAMS = \ | 159 | bin_PROGRAMS = \ |
155 | gnunet-resolver \ | 160 | gnunet-base32 \ |
156 | gnunet-config \ | 161 | gnunet-config \ |
157 | gnunet-crypto-tvg \ | 162 | gnunet-crypto-tvg \ |
163 | gnunet-resolver \ | ||
158 | $(GNUNET_ECC) \ | 164 | $(GNUNET_ECC) \ |
159 | $(GNUNET_SCRYPT) \ | 165 | $(GNUNET_SCRYPT) \ |
160 | gnunet-uri | 166 | gnunet-uri |
@@ -203,6 +209,12 @@ gnunet_ecc_LDADD = \ | |||
203 | libgnunetutil.la \ | 209 | libgnunetutil.la \ |
204 | $(GN_LIBINTL) -lgcrypt | 210 | $(GN_LIBINTL) -lgcrypt |
205 | 211 | ||
212 | gnunet_base32_SOURCES = \ | ||
213 | gnunet-base32.c | ||
214 | gnunet_base32_LDADD = \ | ||
215 | libgnunetutil.la \ | ||
216 | $(GN_LIBINTL) | ||
217 | |||
206 | gnunet_scrypt_SOURCES = \ | 218 | gnunet_scrypt_SOURCES = \ |
207 | gnunet-scrypt.c | 219 | gnunet-scrypt.c |
208 | gnunet_scrypt_LDADD = \ | 220 | gnunet_scrypt_LDADD = \ |
@@ -241,7 +253,6 @@ libgnunet_plugin_test_la_LDFLAGS = \ | |||
241 | if HAVE_BENCHMARKS | 253 | if HAVE_BENCHMARKS |
242 | BENCHMARKS = \ | 254 | BENCHMARKS = \ |
243 | perf_crypto_hash \ | 255 | perf_crypto_hash \ |
244 | perf_crypto_ecc_dlog \ | ||
245 | perf_crypto_rsa \ | 256 | perf_crypto_rsa \ |
246 | perf_crypto_paillier \ | 257 | perf_crypto_paillier \ |
247 | perf_crypto_symmetric \ | 258 | perf_crypto_symmetric \ |
@@ -249,6 +260,10 @@ if HAVE_BENCHMARKS | |||
249 | perf_malloc \ | 260 | perf_malloc \ |
250 | perf_mq \ | 261 | perf_mq \ |
251 | perf_scheduler | 262 | perf_scheduler |
263 | |||
264 | if HAVE_NOLIBGCRYPT19 | ||
265 | BENCHMARKS += perf_crypto_ecc_dlog | ||
266 | endif | ||
252 | endif | 267 | endif |
253 | 268 | ||
254 | if HAVE_SSH_KEY | 269 | if HAVE_SSH_KEY |
@@ -280,7 +295,7 @@ check_PROGRAMS = \ | |||
280 | test_crypto_ecdhe \ | 295 | test_crypto_ecdhe \ |
281 | test_crypto_ecdh_eddsa \ | 296 | test_crypto_ecdh_eddsa \ |
282 | test_crypto_ecdh_ecdsa \ | 297 | test_crypto_ecdh_ecdsa \ |
283 | test_crypto_ecc_dlog \ | 298 | $(DLOG_TEST) \ |
284 | test_crypto_hash \ | 299 | test_crypto_hash \ |
285 | test_crypto_hash_context \ | 300 | test_crypto_hash_context \ |
286 | test_crypto_hkdf \ | 301 | test_crypto_hkdf \ |
@@ -441,11 +456,13 @@ test_crypto_eddsa_LDADD = \ | |||
441 | libgnunetutil.la \ | 456 | libgnunetutil.la \ |
442 | $(LIBGCRYPT_LIBS) | 457 | $(LIBGCRYPT_LIBS) |
443 | 458 | ||
459 | if HAVE_NOLIBGCRYPT19 | ||
444 | test_crypto_ecc_dlog_SOURCES = \ | 460 | test_crypto_ecc_dlog_SOURCES = \ |
445 | test_crypto_ecc_dlog.c | 461 | test_crypto_ecc_dlog.c |
446 | test_crypto_ecc_dlog_LDADD = \ | 462 | test_crypto_ecc_dlog_LDADD = \ |
447 | libgnunetutil.la \ | 463 | libgnunetutil.la \ |
448 | $(LIBGCRYPT_LIBS) | 464 | $(LIBGCRYPT_LIBS) |
465 | endif | ||
449 | 466 | ||
450 | test_crypto_ecdhe_SOURCES = \ | 467 | test_crypto_ecdhe_SOURCES = \ |
451 | test_crypto_ecdhe.c | 468 | test_crypto_ecdhe.c |
@@ -588,11 +605,13 @@ perf_crypto_hash_SOURCES = \ | |||
588 | perf_crypto_hash_LDADD = \ | 605 | perf_crypto_hash_LDADD = \ |
589 | libgnunetutil.la | 606 | libgnunetutil.la |
590 | 607 | ||
608 | if HAVE_NOLIBGCRYPT19 | ||
591 | perf_crypto_ecc_dlog_SOURCES = \ | 609 | perf_crypto_ecc_dlog_SOURCES = \ |
592 | perf_crypto_ecc_dlog.c | 610 | perf_crypto_ecc_dlog.c |
593 | perf_crypto_ecc_dlog_LDADD = \ | 611 | perf_crypto_ecc_dlog_LDADD = \ |
594 | libgnunetutil.la \ | 612 | libgnunetutil.la \ |
595 | -lgcrypt | 613 | -lgcrypt |
614 | endif | ||
596 | 615 | ||
597 | perf_crypto_rsa_SOURCES = \ | 616 | perf_crypto_rsa_SOURCES = \ |
598 | perf_crypto_rsa.c | 617 | perf_crypto_rsa.c |
diff --git a/src/util/configuration.c b/src/util/configuration.c index bda643b83..3294d11f4 100644 --- a/src/util/configuration.c +++ b/src/util/configuration.c | |||
@@ -606,6 +606,7 @@ GNUNET_CONFIGURATION_write (struct GNUNET_CONFIGURATION_Handle *cfg, | |||
606 | if (NULL == h) | 606 | if (NULL == h) |
607 | { | 607 | { |
608 | GNUNET_free (fn); | 608 | GNUNET_free (fn); |
609 | GNUNET_free (cfg_buf); | ||
609 | return GNUNET_SYSERR; | 610 | return GNUNET_SYSERR; |
610 | } | 611 | } |
611 | if (((ssize_t) size) != | 612 | if (((ssize_t) size) != |
diff --git a/src/util/container_meta_data.c b/src/util/container_meta_data.c index b66a7b258..efaac1136 100644 --- a/src/util/container_meta_data.c +++ b/src/util/container_meta_data.c | |||
@@ -964,6 +964,9 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData | |||
964 | { | 964 | { |
965 | /* does not fit! */ | 965 | /* does not fit! */ |
966 | GNUNET_free (ent); | 966 | GNUNET_free (ent); |
967 | if (NULL != cdata) | ||
968 | GNUNET_free (cdata); | ||
969 | cdata = NULL; | ||
967 | return GNUNET_SYSERR; | 970 | return GNUNET_SYSERR; |
968 | } | 971 | } |
969 | 972 | ||
@@ -976,9 +979,9 @@ GNUNET_CONTAINER_meta_data_serialize (const struct GNUNET_CONTAINER_MetaData | |||
976 | if (NULL != pos->mime_type) | 979 | if (NULL != pos->mime_type) |
977 | left -= strlen (pos->mime_type) + 1; | 980 | left -= strlen (pos->mime_type) + 1; |
978 | 981 | ||
979 | GNUNET_free (cdata); | 982 | if (NULL != cdata) |
983 | GNUNET_free (cdata); | ||
980 | cdata = NULL; | 984 | cdata = NULL; |
981 | |||
982 | i++; | 985 | i++; |
983 | } | 986 | } |
984 | GNUNET_free (ent); | 987 | GNUNET_free (ent); |
diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index bc58142c2..efbf2ee17 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c | |||
@@ -33,6 +33,22 @@ | |||
33 | 33 | ||
34 | #define EXTRA_CHECKS 0 | 34 | #define EXTRA_CHECKS 0 |
35 | 35 | ||
36 | /** | ||
37 | * IMPLEMENTATION NOTICE: | ||
38 | * | ||
39 | * ECDSA: We use a non-standard curve for ECDSA: Ed25519. | ||
40 | * For performance reasons, we use cryptographic operations from | ||
41 | * libsodium wherever we can get away with it, even though libsodium | ||
42 | * itself does not support ECDSA. | ||
43 | * This is why the sign and verifiy functionality from libgcrypt is | ||
44 | * required and used. | ||
45 | * | ||
46 | * EdDSA: We use a standard EdDSA construction. | ||
47 | * (We still use libgcrypt for hashing and RNG, but not EC) | ||
48 | * | ||
49 | * ECDHE: For both EdDSA and ECDSA keys, we use libsodium for | ||
50 | * ECDHE due to performance benefits over libgcrypt. | ||
51 | */ | ||
36 | 52 | ||
37 | /** | 53 | /** |
38 | * Name of the curve we are using. Note that we have hard-coded | 54 | * Name of the curve we are using. Note that we have hard-coded |
@@ -476,6 +492,10 @@ GNUNET_CRYPTO_ecdsa_key_get_anonymous () | |||
476 | GNUNET_CRYPTO_mpi_print_unsigned (anonymous.d, | 492 | GNUNET_CRYPTO_mpi_print_unsigned (anonymous.d, |
477 | sizeof(anonymous.d), | 493 | sizeof(anonymous.d), |
478 | GCRYMPI_CONST_ONE); | 494 | GCRYMPI_CONST_ONE); |
495 | anonymous.d[0] &= 248; | ||
496 | anonymous.d[31] &= 127; | ||
497 | anonymous.d[31] |= 64; | ||
498 | |||
479 | once = 1; | 499 | once = 1; |
480 | return &anonymous; | 500 | return &anonymous; |
481 | } | 501 | } |
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c index 63232cab6..5e4c4d1e6 100644 --- a/src/util/crypto_rsa.c +++ b/src/util/crypto_rsa.c | |||
@@ -863,6 +863,7 @@ rsa_sign_mpi (const struct GNUNET_CRYPTO_RsaPrivateKey *key, | |||
863 | __FILE__, | 863 | __FILE__, |
864 | __LINE__, | 864 | __LINE__, |
865 | gcry_strerror (rc)); | 865 | gcry_strerror (rc)); |
866 | gcry_sexp_release (data); | ||
866 | GNUNET_break (0); | 867 | GNUNET_break (0); |
867 | return NULL; | 868 | return NULL; |
868 | } | 869 | } |
diff --git a/src/util/gnunet-base32.c b/src/util/gnunet-base32.c new file mode 100644 index 000000000..2c797f56e --- /dev/null +++ b/src/util/gnunet-base32.c | |||
@@ -0,0 +1,152 @@ | |||
1 | /* | ||
2 | This file is part of GNUnet. | ||
3 | Copyright (C) 2021 GNUnet e.V. | ||
4 | |||
5 | GNUnet is free software: you can redistribute it and/or modify it | ||
6 | under the terms of the GNU Affero General Public License as published | ||
7 | by the Free Software Foundation, either version 3 of the License, | ||
8 | or (at your option) any later version. | ||
9 | |||
10 | GNUnet is distributed in the hope that it will be useful, but | ||
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Affero General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Affero General Public License | ||
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | |||
18 | SPDX-License-Identifier: AGPL3.0-or-later | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file util/gnunet-base32.c | ||
23 | * @brief tool to encode/decode from/to the Crockford Base32 encoding GNUnet uses | ||
24 | * @author Christian Grothoff | ||
25 | */ | ||
26 | #include "platform.h" | ||
27 | #include "gnunet_util_lib.h" | ||
28 | |||
29 | |||
30 | /** | ||
31 | * The main function of gnunet-base32 | ||
32 | * | ||
33 | * @param argc number of arguments from the command line | ||
34 | * @param argv command line arguments | ||
35 | * @return 0 ok, 1 on error | ||
36 | */ | ||
37 | int | ||
38 | main (int argc, | ||
39 | char *const *argv) | ||
40 | { | ||
41 | int decode = 0; | ||
42 | const struct GNUNET_GETOPT_CommandLineOption options[] = { | ||
43 | GNUNET_GETOPT_option_flag ('d', | ||
44 | "decode", | ||
45 | gettext_noop ("run decoder modus, otherwise runs as encoder"), | ||
46 | &decode), | ||
47 | GNUNET_GETOPT_option_help ("Crockford base32 encoder/decoder"), | ||
48 | GNUNET_GETOPT_option_version (PACKAGE_VERSION), | ||
49 | GNUNET_GETOPT_OPTION_END | ||
50 | }; | ||
51 | int ret; | ||
52 | char *in; | ||
53 | unsigned int in_size; | ||
54 | ssize_t iret; | ||
55 | char *out; | ||
56 | size_t out_size; | ||
57 | |||
58 | if (GNUNET_OK != | ||
59 | GNUNET_STRINGS_get_utf8_args (argc, argv, | ||
60 | &argc, &argv)) | ||
61 | return 2; | ||
62 | ret = GNUNET_GETOPT_run ("gnunet-base32", | ||
63 | options, | ||
64 | argc, | ||
65 | argv); | ||
66 | if (ret < 0) | ||
67 | return 1; | ||
68 | if (0 == ret) | ||
69 | return 0; | ||
70 | in_size = 0; | ||
71 | in = NULL; | ||
72 | iret = 1; | ||
73 | while (iret > 0) | ||
74 | { | ||
75 | /* read in blocks of 4k */ | ||
76 | char buf[4092]; | ||
77 | |||
78 | iret = read (0, | ||
79 | buf, | ||
80 | sizeof (buf)); | ||
81 | if (iret < 0) | ||
82 | { | ||
83 | GNUNET_free (in); | ||
84 | return 2; | ||
85 | } | ||
86 | if (iret > 0) | ||
87 | { | ||
88 | if (iret + in_size < in_size) | ||
89 | { | ||
90 | GNUNET_break (0); | ||
91 | GNUNET_free (in); | ||
92 | return 1; | ||
93 | } | ||
94 | GNUNET_array_grow (in, | ||
95 | in_size, | ||
96 | in_size + iret); | ||
97 | memcpy (&in[in_size - iret], | ||
98 | buf, | ||
99 | iret); | ||
100 | } | ||
101 | } | ||
102 | if (decode) | ||
103 | { | ||
104 | /* This formula can overestimate by 1 byte, so we try both | ||
105 | out_size and out_size-1 below */ | ||
106 | out_size = in_size * 5 / 8; | ||
107 | out = GNUNET_malloc (out_size); | ||
108 | if (GNUNET_OK != | ||
109 | GNUNET_STRINGS_string_to_data (in, | ||
110 | in_size, | ||
111 | out, | ||
112 | out_size)) | ||
113 | { | ||
114 | out_size--; | ||
115 | if (GNUNET_OK != | ||
116 | GNUNET_STRINGS_string_to_data (in, | ||
117 | in_size, | ||
118 | out, | ||
119 | out_size)) | ||
120 | { | ||
121 | GNUNET_free (out); | ||
122 | GNUNET_free (in); | ||
123 | return 3; | ||
124 | } | ||
125 | } | ||
126 | } | ||
127 | else | ||
128 | { | ||
129 | out = GNUNET_STRINGS_data_to_string_alloc (in, | ||
130 | in_size); | ||
131 | out_size = strlen (out); | ||
132 | } | ||
133 | { | ||
134 | size_t pos = 0; | ||
135 | |||
136 | while (pos < out_size) | ||
137 | { | ||
138 | iret = write (1, | ||
139 | &out[pos], | ||
140 | out_size - pos); | ||
141 | if (iret <= 0) | ||
142 | return 4; | ||
143 | pos += iret; | ||
144 | } | ||
145 | } | ||
146 | GNUNET_free (out); | ||
147 | GNUNET_free_nz ((void *) argv); | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | |||
152 | /* end of gnunet-uri.c */ | ||
diff --git a/src/util/gnunet-crypto-tvg.c b/src/util/gnunet-crypto-tvg.c index 8949f427c..28e44e28b 100644 --- a/src/util/gnunet-crypto-tvg.c +++ b/src/util/gnunet-crypto-tvg.c | |||
@@ -128,6 +128,7 @@ d2j (json_t *vec, | |||
128 | json_object_set_new (vec, label, json); | 128 | json_object_set_new (vec, label, json); |
129 | } | 129 | } |
130 | 130 | ||
131 | |||
131 | /** | 132 | /** |
132 | * Add a number to a test vector. | 133 | * Add a number to a test vector. |
133 | * | 134 | * |
@@ -138,8 +139,8 @@ d2j (json_t *vec, | |||
138 | */ | 139 | */ |
139 | static void | 140 | static void |
140 | uint2j (json_t *vec, | 141 | uint2j (json_t *vec, |
141 | const char *label, | 142 | const char *label, |
142 | unsigned int num) | 143 | unsigned int num) |
143 | { | 144 | { |
144 | json_t *json = json_integer (num); | 145 | json_t *json = json_integer (num); |
145 | 146 | ||
@@ -154,7 +155,7 @@ expect_data_fixed (json_t *vec, | |||
154 | size_t expect_len) | 155 | size_t expect_len) |
155 | { | 156 | { |
156 | const char *s = json_string_value (json_object_get (vec, name)); | 157 | const char *s = json_string_value (json_object_get (vec, name)); |
157 | 158 | ||
158 | if (NULL == s) | 159 | if (NULL == s) |
159 | return GNUNET_NO; | 160 | return GNUNET_NO; |
160 | 161 | ||
@@ -166,6 +167,7 @@ expect_data_fixed (json_t *vec, | |||
166 | return GNUNET_OK; | 167 | return GNUNET_OK; |
167 | } | 168 | } |
168 | 169 | ||
170 | |||
169 | static int | 171 | static int |
170 | expect_data_dynamic (json_t *vec, | 172 | expect_data_dynamic (json_t *vec, |
171 | const char *name, | 173 | const char *name, |
@@ -173,6 +175,7 @@ expect_data_dynamic (json_t *vec, | |||
173 | size_t *ret_len) | 175 | size_t *ret_len) |
174 | { | 176 | { |
175 | const char *s = json_string_value (json_object_get (vec, name)); | 177 | const char *s = json_string_value (json_object_get (vec, name)); |
178 | char *tmp; | ||
176 | size_t len; | 179 | size_t len; |
177 | 180 | ||
178 | if (NULL == s) | 181 | if (NULL == s) |
@@ -181,10 +184,14 @@ expect_data_dynamic (json_t *vec, | |||
181 | len = (strlen (s) * 5) / 8; | 184 | len = (strlen (s) * 5) / 8; |
182 | if (NULL != ret_len) | 185 | if (NULL != ret_len) |
183 | *ret_len = len; | 186 | *ret_len = len; |
184 | *data = GNUNET_malloc (len); | 187 | tmp = GNUNET_malloc (len); |
185 | 188 | ||
186 | if (GNUNET_OK != GNUNET_STRINGS_string_to_data (s, strlen (s), *data, len)) | 189 | if (GNUNET_OK != GNUNET_STRINGS_string_to_data (s, strlen (s), tmp, len)) |
190 | { | ||
191 | GNUNET_free (tmp); | ||
187 | return GNUNET_NO; | 192 | return GNUNET_NO; |
193 | } | ||
194 | *data = tmp; | ||
188 | return GNUNET_OK; | 195 | return GNUNET_OK; |
189 | } | 196 | } |
190 | 197 | ||
@@ -197,7 +204,7 @@ expect_data_dynamic (json_t *vec, | |||
197 | * | 204 | * |
198 | * @returns GNUNET_OK if the vector is okay | 205 | * @returns GNUNET_OK if the vector is okay |
199 | */ | 206 | */ |
200 | static int | 207 | static int |
201 | checkvec (const char *operation, | 208 | checkvec (const char *operation, |
202 | json_t *vec) | 209 | json_t *vec) |
203 | { | 210 | { |
@@ -220,10 +227,11 @@ checkvec (const char *operation, | |||
220 | return GNUNET_SYSERR; | 227 | return GNUNET_SYSERR; |
221 | } | 228 | } |
222 | if (GNUNET_OK != expect_data_fixed (vec, | 229 | if (GNUNET_OK != expect_data_fixed (vec, |
223 | "output", | 230 | "output", |
224 | &hash_out, | 231 | &hash_out, |
225 | sizeof (hash_out))) | 232 | sizeof (hash_out))) |
226 | { | 233 | { |
234 | GNUNET_free (data); | ||
227 | GNUNET_break (0); | 235 | GNUNET_break (0); |
228 | return GNUNET_NO; | 236 | return GNUNET_NO; |
229 | } | 237 | } |
@@ -232,9 +240,11 @@ checkvec (const char *operation, | |||
232 | 240 | ||
233 | if (0 != GNUNET_memcmp (&hc, &hash_out)) | 241 | if (0 != GNUNET_memcmp (&hc, &hash_out)) |
234 | { | 242 | { |
243 | GNUNET_free (data); | ||
235 | GNUNET_break (0); | 244 | GNUNET_break (0); |
236 | return GNUNET_NO; | 245 | return GNUNET_NO; |
237 | } | 246 | } |
247 | GNUNET_free (data); | ||
238 | } | 248 | } |
239 | else if (0 == strcmp (operation, "ecc_ecdh")) | 249 | else if (0 == strcmp (operation, "ecc_ecdh")) |
240 | { | 250 | { |
@@ -245,33 +255,33 @@ checkvec (const char *operation, | |||
245 | struct GNUNET_HashCode skm_comp; | 255 | struct GNUNET_HashCode skm_comp; |
246 | 256 | ||
247 | if (GNUNET_OK != expect_data_fixed (vec, | 257 | if (GNUNET_OK != expect_data_fixed (vec, |
248 | "priv1", | 258 | "priv1", |
249 | &priv1, | 259 | &priv1, |
250 | sizeof (priv1))) | 260 | sizeof (priv1))) |
251 | { | 261 | { |
252 | GNUNET_break (0); | 262 | GNUNET_break (0); |
253 | return GNUNET_NO; | 263 | return GNUNET_NO; |
254 | } | 264 | } |
255 | if (GNUNET_OK != expect_data_fixed (vec, | 265 | if (GNUNET_OK != expect_data_fixed (vec, |
256 | "priv2", | 266 | "priv2", |
257 | &priv2, | 267 | &priv2, |
258 | sizeof (priv2))) | 268 | sizeof (priv2))) |
259 | { | 269 | { |
260 | GNUNET_break (0); | 270 | GNUNET_break (0); |
261 | return GNUNET_NO; | 271 | return GNUNET_NO; |
262 | } | 272 | } |
263 | if (GNUNET_OK != expect_data_fixed (vec, | 273 | if (GNUNET_OK != expect_data_fixed (vec, |
264 | "pub1", | 274 | "pub1", |
265 | &pub1, | 275 | &pub1, |
266 | sizeof (pub1))) | 276 | sizeof (pub1))) |
267 | { | 277 | { |
268 | GNUNET_break (0); | 278 | GNUNET_break (0); |
269 | return GNUNET_NO; | 279 | return GNUNET_NO; |
270 | } | 280 | } |
271 | if (GNUNET_OK != expect_data_fixed (vec, | 281 | if (GNUNET_OK != expect_data_fixed (vec, |
272 | "skm", | 282 | "skm", |
273 | &skm, | 283 | &skm, |
274 | sizeof (skm))) | 284 | sizeof (skm))) |
275 | { | 285 | { |
276 | GNUNET_break (0); | 286 | GNUNET_break (0); |
277 | return GNUNET_NO; | 287 | return GNUNET_NO; |
@@ -407,6 +417,8 @@ checkvec (const char *operation, | |||
407 | &ikm, | 417 | &ikm, |
408 | &ikm_len)) | 418 | &ikm_len)) |
409 | { | 419 | { |
420 | GNUNET_free (out); | ||
421 | GNUNET_free (out_comp); | ||
410 | GNUNET_break (0); | 422 | GNUNET_break (0); |
411 | return GNUNET_SYSERR; | 423 | return GNUNET_SYSERR; |
412 | } | 424 | } |
@@ -416,6 +428,9 @@ checkvec (const char *operation, | |||
416 | &salt, | 428 | &salt, |
417 | &salt_len)) | 429 | &salt_len)) |
418 | { | 430 | { |
431 | GNUNET_free (out); | ||
432 | GNUNET_free (out_comp); | ||
433 | GNUNET_free (ikm); | ||
419 | GNUNET_break (0); | 434 | GNUNET_break (0); |
420 | return GNUNET_SYSERR; | 435 | return GNUNET_SYSERR; |
421 | } | 436 | } |
@@ -425,6 +440,10 @@ checkvec (const char *operation, | |||
425 | &ctx, | 440 | &ctx, |
426 | &ctx_len)) | 441 | &ctx_len)) |
427 | { | 442 | { |
443 | GNUNET_free (out); | ||
444 | GNUNET_free (out_comp); | ||
445 | GNUNET_free (ikm); | ||
446 | GNUNET_free (salt); | ||
428 | GNUNET_break (0); | 447 | GNUNET_break (0); |
429 | return GNUNET_SYSERR; | 448 | return GNUNET_SYSERR; |
430 | } | 449 | } |
@@ -442,10 +461,19 @@ checkvec (const char *operation, | |||
442 | 461 | ||
443 | if (0 != memcmp (out, out_comp, out_len)) | 462 | if (0 != memcmp (out, out_comp, out_len)) |
444 | { | 463 | { |
464 | GNUNET_free (out); | ||
465 | GNUNET_free (out_comp); | ||
466 | GNUNET_free (ikm); | ||
467 | GNUNET_free (salt); | ||
468 | GNUNET_free (ctx); | ||
445 | GNUNET_break (0); | 469 | GNUNET_break (0); |
446 | return GNUNET_NO; | 470 | return GNUNET_NO; |
447 | } | 471 | } |
448 | 472 | GNUNET_free (out); | |
473 | GNUNET_free (out_comp); | ||
474 | GNUNET_free (ikm); | ||
475 | GNUNET_free (salt); | ||
476 | GNUNET_free (ctx); | ||
449 | } | 477 | } |
450 | else if (0 == strcmp (operation, "eddsa_ecdh")) | 478 | else if (0 == strcmp (operation, "eddsa_ecdh")) |
451 | { | 479 | { |
@@ -562,6 +590,7 @@ checkvec (const char *operation, | |||
562 | &public_enc_data, | 590 | &public_enc_data, |
563 | &public_enc_len)) | 591 | &public_enc_len)) |
564 | { | 592 | { |
593 | GNUNET_free (blinded_data); | ||
565 | GNUNET_break (0); | 594 | GNUNET_break (0); |
566 | return GNUNET_SYSERR; | 595 | return GNUNET_SYSERR; |
567 | } | 596 | } |
@@ -571,6 +600,8 @@ checkvec (const char *operation, | |||
571 | &secret_enc_data, | 600 | &secret_enc_data, |
572 | &secret_enc_len)) | 601 | &secret_enc_len)) |
573 | { | 602 | { |
603 | GNUNET_free (blinded_data); | ||
604 | GNUNET_free (public_enc_data); | ||
574 | GNUNET_break (0); | 605 | GNUNET_break (0); |
575 | return GNUNET_SYSERR; | 606 | return GNUNET_SYSERR; |
576 | } | 607 | } |
@@ -580,6 +611,9 @@ checkvec (const char *operation, | |||
580 | &sig_enc_data, | 611 | &sig_enc_data, |
581 | &sig_enc_length)) | 612 | &sig_enc_length)) |
582 | { | 613 | { |
614 | GNUNET_free (blinded_data); | ||
615 | GNUNET_free (public_enc_data); | ||
616 | GNUNET_free (secret_enc_data); | ||
583 | GNUNET_break (0); | 617 | GNUNET_break (0); |
584 | return GNUNET_SYSERR; | 618 | return GNUNET_SYSERR; |
585 | } | 619 | } |
@@ -601,6 +635,11 @@ checkvec (const char *operation, | |||
601 | blinded_data_comp, | 635 | blinded_data_comp, |
602 | blinded_len)) ) | 636 | blinded_len)) ) |
603 | { | 637 | { |
638 | GNUNET_free (blinded_data); | ||
639 | GNUNET_free (public_enc_data); | ||
640 | GNUNET_free (secret_enc_data); | ||
641 | GNUNET_free (sig_enc_data); | ||
642 | GNUNET_free (skey); | ||
604 | GNUNET_break (0); | 643 | GNUNET_break (0); |
605 | return GNUNET_NO; | 644 | return GNUNET_NO; |
606 | } | 645 | } |
@@ -611,14 +650,27 @@ checkvec (const char *operation, | |||
611 | pkey)); | 650 | pkey)); |
612 | public_enc_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, | 651 | public_enc_len = GNUNET_CRYPTO_rsa_public_key_encode (pkey, |
613 | &public_enc_data); | 652 | &public_enc_data); |
614 | sig_enc_length_comp = GNUNET_CRYPTO_rsa_signature_encode (sig, &sig_enc_data_comp); | 653 | sig_enc_length_comp = GNUNET_CRYPTO_rsa_signature_encode (sig, |
654 | &sig_enc_data_comp); | ||
615 | 655 | ||
616 | if ( (sig_enc_length != sig_enc_length_comp) || | 656 | if ( (sig_enc_length != sig_enc_length_comp) || |
617 | (0 != memcmp (sig_enc_data, sig_enc_data_comp, sig_enc_length) )) | 657 | (0 != memcmp (sig_enc_data, sig_enc_data_comp, sig_enc_length) )) |
618 | { | 658 | { |
659 | GNUNET_free (blinded_sig); | ||
660 | GNUNET_free (blinded_data); | ||
661 | GNUNET_free (public_enc_data); | ||
662 | GNUNET_free (secret_enc_data); | ||
663 | GNUNET_free (sig_enc_data); | ||
664 | GNUNET_free (skey); | ||
619 | GNUNET_break (0); | 665 | GNUNET_break (0); |
620 | return GNUNET_NO; | 666 | return GNUNET_NO; |
621 | } | 667 | } |
668 | GNUNET_free (blinded_sig); | ||
669 | GNUNET_free (blinded_data); | ||
670 | GNUNET_free (public_enc_data); | ||
671 | GNUNET_free (secret_enc_data); | ||
672 | GNUNET_free (sig_enc_data); | ||
673 | GNUNET_free (skey); | ||
622 | } | 674 | } |
623 | else | 675 | else |
624 | { | 676 | { |
@@ -629,6 +681,7 @@ checkvec (const char *operation, | |||
629 | return GNUNET_OK; | 681 | return GNUNET_OK; |
630 | } | 682 | } |
631 | 683 | ||
684 | |||
632 | /** | 685 | /** |
633 | * Check test vectors from stdin. | 686 | * Check test vectors from stdin. |
634 | * | 687 | * |
@@ -656,7 +709,7 @@ check_vectors () | |||
656 | return 1; | 709 | return 1; |
657 | } | 710 | } |
658 | vectors = json_object_get (vecfile, "vectors"); | 711 | vectors = json_object_get (vecfile, "vectors"); |
659 | if (!json_is_array (vectors)) | 712 | if (! json_is_array (vectors)) |
660 | { | 713 | { |
661 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "bad vectors\n"); | 714 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "bad vectors\n"); |
662 | json_decref (vecfile); | 715 | json_decref (vecfile); |
@@ -692,6 +745,7 @@ check_vectors () | |||
692 | } | 745 | } |
693 | } | 746 | } |
694 | 747 | ||
748 | |||
695 | /** | 749 | /** |
696 | * Output test vectors. | 750 | * Output test vectors. |
697 | * | 751 | * |
@@ -868,20 +922,20 @@ output_vectors () | |||
868 | GNUNET_CRYPTO_ecdh_eddsa (&priv_ecdhe, &pub_eddsa, &key_material); | 922 | GNUNET_CRYPTO_ecdh_eddsa (&priv_ecdhe, &pub_eddsa, &key_material); |
869 | 923 | ||
870 | d2j (vec, "priv_ecdhe", | 924 | d2j (vec, "priv_ecdhe", |
871 | &priv_ecdhe, | 925 | &priv_ecdhe, |
872 | sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); | 926 | sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); |
873 | d2j (vec, "pub_ecdhe", | 927 | d2j (vec, "pub_ecdhe", |
874 | &pub_ecdhe, | 928 | &pub_ecdhe, |
875 | sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); | 929 | sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)); |
876 | d2j (vec, "priv_eddsa", | 930 | d2j (vec, "priv_eddsa", |
877 | &priv_eddsa, | 931 | &priv_eddsa, |
878 | sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)); | 932 | sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)); |
879 | d2j (vec, "pub_eddsa", | 933 | d2j (vec, "pub_eddsa", |
880 | &pub_eddsa, | 934 | &pub_eddsa, |
881 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); | 935 | sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); |
882 | d2j (vec, "key_material", | 936 | d2j (vec, "key_material", |
883 | &key_material, | 937 | &key_material, |
884 | sizeof (struct GNUNET_HashCode)); | 938 | sizeof (struct GNUNET_HashCode)); |
885 | } | 939 | } |
886 | 940 | ||
887 | { | 941 | { |
@@ -968,6 +1022,7 @@ output_vectors () | |||
968 | GNUNET_free (blinded_data); | 1022 | GNUNET_free (blinded_data); |
969 | GNUNET_free (sig_enc_data); | 1023 | GNUNET_free (sig_enc_data); |
970 | GNUNET_free (blinded_sig_enc_data); | 1024 | GNUNET_free (blinded_sig_enc_data); |
1025 | GNUNET_free (secret_enc_data); | ||
971 | } | 1026 | } |
972 | 1027 | ||
973 | json_dumpf (vecfile, stdout, JSON_INDENT (2)); | 1028 | json_dumpf (vecfile, stdout, JSON_INDENT (2)); |
@@ -977,6 +1032,7 @@ output_vectors () | |||
977 | return 0; | 1032 | return 0; |
978 | } | 1033 | } |
979 | 1034 | ||
1035 | |||
980 | /** | 1036 | /** |
981 | * Main function that will be run. | 1037 | * Main function that will be run. |
982 | * | 1038 | * |
diff --git a/src/util/gnunet-scrypt.c b/src/util/gnunet-scrypt.c index 5c3dfc12e..fe8b6769f 100644 --- a/src/util/gnunet-scrypt.c +++ b/src/util/gnunet-scrypt.c | |||
@@ -290,8 +290,8 @@ run (void *cls, | |||
290 | int | 290 | int |
291 | main (int argc, char *const *argv) | 291 | main (int argc, char *const *argv) |
292 | { | 292 | { |
293 | struct GNUNET_GETOPT_CommandLineOption options[] = | 293 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
294 | { GNUNET_GETOPT_option_ulong ( | 294 | GNUNET_GETOPT_option_ulong ( |
295 | 'b', | 295 | 'b', |
296 | "bits", | 296 | "bits", |
297 | "BITS", | 297 | "BITS", |
@@ -315,7 +315,8 @@ main (int argc, char *const *argv) | |||
315 | gettext_noop ( | 315 | gettext_noop ( |
316 | "time to wait between calculations"), | 316 | "time to wait between calculations"), |
317 | &proof_find_delay), | 317 | &proof_find_delay), |
318 | GNUNET_GETOPT_OPTION_END }; | 318 | GNUNET_GETOPT_OPTION_END |
319 | }; | ||
319 | int ret; | 320 | int ret; |
320 | 321 | ||
321 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) | 322 | if (GNUNET_OK != GNUNET_STRINGS_get_utf8_args (argc, argv, &argc, &argv)) |
diff --git a/src/util/mq.c b/src/util/mq.c index 2342b2c5c..9b59cd338 100644 --- a/src/util/mq.c +++ b/src/util/mq.c | |||
@@ -363,7 +363,7 @@ GNUNET_MQ_send (struct GNUNET_MQ_Handle *mq, | |||
363 | GNUNET_assert (NULL == ev->parent_queue); | 363 | GNUNET_assert (NULL == ev->parent_queue); |
364 | 364 | ||
365 | mq->queue_length++; | 365 | mq->queue_length++; |
366 | if (mq->queue_length >= 10000) | 366 | if (mq->queue_length >= 10000000) |
367 | { | 367 | { |
368 | /* This would seem like a bug... */ | 368 | /* This would seem like a bug... */ |
369 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 369 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/util/os_installation.c b/src/util/os_installation.c index d1e5e0da5..02d4d439d 100644 --- a/src/util/os_installation.c +++ b/src/util/os_installation.c | |||
@@ -736,7 +736,12 @@ GNUNET_OS_get_suid_binary_path (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
736 | "SUID_BINARY_PATH", | 736 | "SUID_BINARY_PATH", |
737 | &path); | 737 | &path); |
738 | if ((NULL == path) || (0 == strlen (path))) | 738 | if ((NULL == path) || (0 == strlen (path))) |
739 | { | ||
740 | if (NULL != path) | ||
741 | GNUNET_free (path); | ||
742 | cache = NULL; | ||
739 | return GNUNET_OS_get_libexec_binary_path (progname); | 743 | return GNUNET_OS_get_libexec_binary_path (progname); |
744 | } | ||
740 | path_len = strlen (path); | 745 | path_len = strlen (path); |
741 | GNUNET_asprintf (&binary, | 746 | GNUNET_asprintf (&binary, |
742 | "%s%s%s", | 747 | "%s%s%s", |
diff --git a/src/util/plugin.c b/src/util/plugin.c index d169bc911..feb661f24 100644 --- a/src/util/plugin.c +++ b/src/util/plugin.c | |||
@@ -388,6 +388,11 @@ find_libraries (void *cls, | |||
388 | * `basename_ANYTHING_init` and `basename_ANYTHING__done`. These will | 388 | * `basename_ANYTHING_init` and `basename_ANYTHING__done`. These will |
389 | * be called when the library is loaded and unloaded respectively. | 389 | * be called when the library is loaded and unloaded respectively. |
390 | * | 390 | * |
391 | * If you are writing a service to which third-party applications can connect, | ||
392 | * like GNUnet's own GNS service for example, you should use | ||
393 | * #GNUNET_PLUGIN_load_all_in_context instead of this function, passing your | ||
394 | * service's project data as context. | ||
395 | * | ||
391 | * @param basename basename of the plugins to load | 396 | * @param basename basename of the plugins to load |
392 | * @param arg argument to the plugin initialization function | 397 | * @param arg argument to the plugin initialization function |
393 | * @param cb function to call for each plugin found | 398 | * @param cb function to call for each plugin found |
@@ -420,4 +425,32 @@ GNUNET_PLUGIN_load_all (const char *basename, | |||
420 | } | 425 | } |
421 | 426 | ||
422 | 427 | ||
428 | /** | ||
429 | * Load all compatible plugins with the given base name while inside the given | ||
430 | * context (i.e. a specific project data structure.) | ||
431 | * | ||
432 | * Note that the library must export symbols called `basename_ANYTHING_init` | ||
433 | * and `basename_ANYTHING__done`. These will be called when the library is | ||
434 | * loaded and unloaded respectively. | ||
435 | * | ||
436 | * @param ctx the context used to find the plugins | ||
437 | * @param basename basename of the plugins to load | ||
438 | * @param arg argument to the plugin initialization function | ||
439 | * @param cb function to call for each plugin found | ||
440 | * @param cb_cls closure for @a cb | ||
441 | */ | ||
442 | void | ||
443 | GNUNET_PLUGIN_load_all_in_context (const struct GNUNET_OS_ProjectData *ctx, | ||
444 | const char *basename, | ||
445 | void *arg, | ||
446 | GNUNET_PLUGIN_LoaderCallback cb, | ||
447 | void *cb_cls) | ||
448 | { | ||
449 | const struct GNUNET_OS_ProjectData *cpd = GNUNET_OS_project_data_get (); | ||
450 | GNUNET_OS_init (ctx); | ||
451 | GNUNET_PLUGIN_load_all (basename, arg, cb, cb_cls); | ||
452 | GNUNET_OS_init (cpd); | ||
453 | } | ||
454 | |||
455 | |||
423 | /* end of plugin.c */ | 456 | /* end of plugin.c */ |
diff --git a/src/util/time.c b/src/util/time.c index 9e41305f1..456ee660b 100644 --- a/src/util/time.c +++ b/src/util/time.c | |||
@@ -44,11 +44,6 @@ | |||
44 | */ | 44 | */ |
45 | static long long timestamp_offset; | 45 | static long long timestamp_offset; |
46 | 46 | ||
47 | /** | ||
48 | * Set the timestamp offset for this instance. | ||
49 | * | ||
50 | * @param offset the offset to skew the locale time by | ||
51 | */ | ||
52 | void | 47 | void |
53 | GNUNET_TIME_set_offset (long long offset) | 48 | GNUNET_TIME_set_offset (long long offset) |
54 | { | 49 | { |
@@ -56,11 +51,6 @@ GNUNET_TIME_set_offset (long long offset) | |||
56 | } | 51 | } |
57 | 52 | ||
58 | 53 | ||
59 | /** | ||
60 | * Get the timestamp offset for this instance. | ||
61 | * | ||
62 | * @return the offset we currently skew the locale time by | ||
63 | */ | ||
64 | long long | 54 | long long |
65 | GNUNET_TIME_get_offset () | 55 | GNUNET_TIME_get_offset () |
66 | { | 56 | { |
@@ -68,14 +58,6 @@ GNUNET_TIME_get_offset () | |||
68 | } | 58 | } |
69 | 59 | ||
70 | 60 | ||
71 | /** | ||
72 | * Round a time value so that it is suitable for transmission | ||
73 | * via JSON encodings. | ||
74 | * | ||
75 | * @param at time to round | ||
76 | * @return #GNUNET_OK if time was already rounded, #GNUNET_NO if | ||
77 | * it was just now rounded | ||
78 | */ | ||
79 | int | 61 | int |
80 | GNUNET_TIME_round_abs (struct GNUNET_TIME_Absolute *at) | 62 | GNUNET_TIME_round_abs (struct GNUNET_TIME_Absolute *at) |
81 | { | 63 | { |
@@ -88,14 +70,6 @@ GNUNET_TIME_round_abs (struct GNUNET_TIME_Absolute *at) | |||
88 | } | 70 | } |
89 | 71 | ||
90 | 72 | ||
91 | /** | ||
92 | * Round a time value so that it is suitable for transmission | ||
93 | * via JSON encodings. | ||
94 | * | ||
95 | * @param rt time to round | ||
96 | * @return #GNUNET_OK if time was already rounded, #GNUNET_NO if | ||
97 | * it was just now rounded | ||
98 | */ | ||
99 | int | 73 | int |
100 | GNUNET_TIME_round_rel (struct GNUNET_TIME_Relative *rt) | 74 | GNUNET_TIME_round_rel (struct GNUNET_TIME_Relative *rt) |
101 | { | 75 | { |
@@ -108,12 +82,6 @@ GNUNET_TIME_round_rel (struct GNUNET_TIME_Relative *rt) | |||
108 | } | 82 | } |
109 | 83 | ||
110 | 84 | ||
111 | /** | ||
112 | * Get the current time (works just as "time", just that we use the | ||
113 | * unit of time that the cron-jobs use (and is 64 bit)). | ||
114 | * | ||
115 | * @return the current time | ||
116 | */ | ||
117 | struct GNUNET_TIME_Absolute | 85 | struct GNUNET_TIME_Absolute |
118 | GNUNET_TIME_absolute_get () | 86 | GNUNET_TIME_absolute_get () |
119 | { | 87 | { |
@@ -128,9 +96,6 @@ GNUNET_TIME_absolute_get () | |||
128 | } | 96 | } |
129 | 97 | ||
130 | 98 | ||
131 | /** | ||
132 | * Return relative time of 0ms. | ||
133 | */ | ||
134 | struct GNUNET_TIME_Relative | 99 | struct GNUNET_TIME_Relative |
135 | GNUNET_TIME_relative_get_zero_ () | 100 | GNUNET_TIME_relative_get_zero_ () |
136 | { | 101 | { |
@@ -140,9 +105,6 @@ GNUNET_TIME_relative_get_zero_ () | |||
140 | } | 105 | } |
141 | 106 | ||
142 | 107 | ||
143 | /** | ||
144 | * Return absolute time of 0ms. | ||
145 | */ | ||
146 | struct GNUNET_TIME_Absolute | 108 | struct GNUNET_TIME_Absolute |
147 | GNUNET_TIME_absolute_get_zero_ () | 109 | GNUNET_TIME_absolute_get_zero_ () |
148 | { | 110 | { |
@@ -152,9 +114,6 @@ GNUNET_TIME_absolute_get_zero_ () | |||
152 | } | 114 | } |
153 | 115 | ||
154 | 116 | ||
155 | /** | ||
156 | * Return relative time of 1us. | ||
157 | */ | ||
158 | struct GNUNET_TIME_Relative | 117 | struct GNUNET_TIME_Relative |
159 | GNUNET_TIME_relative_get_unit_ () | 118 | GNUNET_TIME_relative_get_unit_ () |
160 | { | 119 | { |
@@ -164,9 +123,6 @@ GNUNET_TIME_relative_get_unit_ () | |||
164 | } | 123 | } |
165 | 124 | ||
166 | 125 | ||
167 | /** | ||
168 | * Return relative time of 1ms. | ||
169 | */ | ||
170 | struct GNUNET_TIME_Relative | 126 | struct GNUNET_TIME_Relative |
171 | GNUNET_TIME_relative_get_millisecond_ () | 127 | GNUNET_TIME_relative_get_millisecond_ () |
172 | { | 128 | { |
@@ -176,9 +132,6 @@ GNUNET_TIME_relative_get_millisecond_ () | |||
176 | } | 132 | } |
177 | 133 | ||
178 | 134 | ||
179 | /** | ||
180 | * Return relative time of 1s. | ||
181 | */ | ||
182 | struct GNUNET_TIME_Relative | 135 | struct GNUNET_TIME_Relative |
183 | GNUNET_TIME_relative_get_second_ () | 136 | GNUNET_TIME_relative_get_second_ () |
184 | { | 137 | { |
@@ -188,9 +141,6 @@ GNUNET_TIME_relative_get_second_ () | |||
188 | } | 141 | } |
189 | 142 | ||
190 | 143 | ||
191 | /** | ||
192 | * Return relative time of 1 minute. | ||
193 | */ | ||
194 | struct GNUNET_TIME_Relative | 144 | struct GNUNET_TIME_Relative |
195 | GNUNET_TIME_relative_get_minute_ () | 145 | GNUNET_TIME_relative_get_minute_ () |
196 | { | 146 | { |
@@ -200,9 +150,6 @@ GNUNET_TIME_relative_get_minute_ () | |||
200 | } | 150 | } |
201 | 151 | ||
202 | 152 | ||
203 | /** | ||
204 | * Return relative time of 1 hour. | ||
205 | */ | ||
206 | struct GNUNET_TIME_Relative | 153 | struct GNUNET_TIME_Relative |
207 | GNUNET_TIME_relative_get_hour_ () | 154 | GNUNET_TIME_relative_get_hour_ () |
208 | { | 155 | { |
@@ -212,9 +159,6 @@ GNUNET_TIME_relative_get_hour_ () | |||
212 | } | 159 | } |
213 | 160 | ||
214 | 161 | ||
215 | /** | ||
216 | * Return "forever". | ||
217 | */ | ||
218 | struct GNUNET_TIME_Relative | 162 | struct GNUNET_TIME_Relative |
219 | GNUNET_TIME_relative_get_forever_ () | 163 | GNUNET_TIME_relative_get_forever_ () |
220 | { | 164 | { |
@@ -224,9 +168,6 @@ GNUNET_TIME_relative_get_forever_ () | |||
224 | } | 168 | } |
225 | 169 | ||
226 | 170 | ||
227 | /** | ||
228 | * Return "forever". | ||
229 | */ | ||
230 | struct GNUNET_TIME_Absolute | 171 | struct GNUNET_TIME_Absolute |
231 | GNUNET_TIME_absolute_get_forever_ () | 172 | GNUNET_TIME_absolute_get_forever_ () |
232 | { | 173 | { |
@@ -236,12 +177,6 @@ GNUNET_TIME_absolute_get_forever_ () | |||
236 | } | 177 | } |
237 | 178 | ||
238 | 179 | ||
239 | /** | ||
240 | * Convert relative time to an absolute time in the | ||
241 | * future. | ||
242 | * | ||
243 | * @return timestamp that is "rel" in the future, or FOREVER if rel==FOREVER (or if we would overflow) | ||
244 | */ | ||
245 | struct GNUNET_TIME_Absolute | 180 | struct GNUNET_TIME_Absolute |
246 | GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) | 181 | GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) |
247 | { | 182 | { |
@@ -261,13 +196,6 @@ GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel) | |||
261 | } | 196 | } |
262 | 197 | ||
263 | 198 | ||
264 | /** | ||
265 | * Return the minimum of two relative time values. | ||
266 | * | ||
267 | * @param t1 first timestamp | ||
268 | * @param t2 other timestamp | ||
269 | * @return timestamp that is smaller | ||
270 | */ | ||
271 | struct GNUNET_TIME_Relative | 199 | struct GNUNET_TIME_Relative |
272 | GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, | 200 | GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, |
273 | struct GNUNET_TIME_Relative t2) | 201 | struct GNUNET_TIME_Relative t2) |
@@ -276,13 +204,6 @@ GNUNET_TIME_relative_min (struct GNUNET_TIME_Relative t1, | |||
276 | } | 204 | } |
277 | 205 | ||
278 | 206 | ||
279 | /** | ||
280 | * Return the maximum of two relative time values. | ||
281 | * | ||
282 | * @param t1 first timestamp | ||
283 | * @param t2 other timestamp | ||
284 | * @return timestamp that is larger | ||
285 | */ | ||
286 | struct GNUNET_TIME_Relative | 207 | struct GNUNET_TIME_Relative |
287 | GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, | 208 | GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, |
288 | struct GNUNET_TIME_Relative t2) | 209 | struct GNUNET_TIME_Relative t2) |
@@ -291,13 +212,6 @@ GNUNET_TIME_relative_max (struct GNUNET_TIME_Relative t1, | |||
291 | } | 212 | } |
292 | 213 | ||
293 | 214 | ||
294 | /** | ||
295 | * Return the minimum of two relative time values. | ||
296 | * | ||
297 | * @param t1 first timestamp | ||
298 | * @param t2 other timestamp | ||
299 | * @return timestamp that is smaller | ||
300 | */ | ||
301 | struct GNUNET_TIME_Absolute | 215 | struct GNUNET_TIME_Absolute |
302 | GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, | 216 | GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, |
303 | struct GNUNET_TIME_Absolute t2) | 217 | struct GNUNET_TIME_Absolute t2) |
@@ -306,13 +220,6 @@ GNUNET_TIME_absolute_min (struct GNUNET_TIME_Absolute t1, | |||
306 | } | 220 | } |
307 | 221 | ||
308 | 222 | ||
309 | /** | ||
310 | * Return the maximum of two relative time values. | ||
311 | * | ||
312 | * @param t1 first timestamp | ||
313 | * @param t2 other timestamp | ||
314 | * @return timestamp that is bigger | ||
315 | */ | ||
316 | struct GNUNET_TIME_Absolute | 223 | struct GNUNET_TIME_Absolute |
317 | GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, | 224 | GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, |
318 | struct GNUNET_TIME_Absolute t2) | 225 | struct GNUNET_TIME_Absolute t2) |
@@ -321,12 +228,6 @@ GNUNET_TIME_absolute_max (struct GNUNET_TIME_Absolute t1, | |||
321 | } | 228 | } |
322 | 229 | ||
323 | 230 | ||
324 | /** | ||
325 | * Given a timestamp in the future, how much time | ||
326 | * remains until then? | ||
327 | * | ||
328 | * @return future - now, or 0 if now >= future, or FOREVER if future==FOREVER. | ||
329 | */ | ||
330 | struct GNUNET_TIME_Relative | 231 | struct GNUNET_TIME_Relative |
331 | GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) | 232 | GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) |
332 | { | 233 | { |
@@ -343,13 +244,6 @@ GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future) | |||
343 | } | 244 | } |
344 | 245 | ||
345 | 246 | ||
346 | /** | ||
347 | * Compute the time difference between the given start and end times. | ||
348 | * Use this function instead of actual subtraction to ensure that | ||
349 | * "FOREVER" and overflows are handled correctly. | ||
350 | * | ||
351 | * @return 0 if start >= end; FOREVER if end==FOREVER; otherwise end - start | ||
352 | */ | ||
353 | struct GNUNET_TIME_Relative | 247 | struct GNUNET_TIME_Relative |
354 | GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, | 248 | GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, |
355 | struct GNUNET_TIME_Absolute end) | 249 | struct GNUNET_TIME_Absolute end) |
@@ -365,12 +259,6 @@ GNUNET_TIME_absolute_get_difference (struct GNUNET_TIME_Absolute start, | |||
365 | } | 259 | } |
366 | 260 | ||
367 | 261 | ||
368 | /** | ||
369 | * Get the duration of an operation as the | ||
370 | * difference of the current time and the given start time "whence". | ||
371 | * | ||
372 | * @return 0 if whence > now, otherwise now-whence. | ||
373 | */ | ||
374 | struct GNUNET_TIME_Relative | 262 | struct GNUNET_TIME_Relative |
375 | GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) | 263 | GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) |
376 | { | 264 | { |
@@ -385,12 +273,6 @@ GNUNET_TIME_absolute_get_duration (struct GNUNET_TIME_Absolute whence) | |||
385 | } | 273 | } |
386 | 274 | ||
387 | 275 | ||
388 | /** | ||
389 | * Add a given relative duration to the | ||
390 | * given start time. | ||
391 | * | ||
392 | * @return FOREVER if either argument is FOREVER or on overflow; start+duration otherwise | ||
393 | */ | ||
394 | struct GNUNET_TIME_Absolute | 276 | struct GNUNET_TIME_Absolute |
395 | GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, | 277 | GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, |
396 | struct GNUNET_TIME_Relative duration) | 278 | struct GNUNET_TIME_Relative duration) |
@@ -410,14 +292,6 @@ GNUNET_TIME_absolute_add (struct GNUNET_TIME_Absolute start, | |||
410 | } | 292 | } |
411 | 293 | ||
412 | 294 | ||
413 | /** | ||
414 | * Subtract a given relative duration from the | ||
415 | * given start time. | ||
416 | * | ||
417 | * @param start some absolute time | ||
418 | * @param duration some relative time to subtract | ||
419 | * @return ZERO if start <= duration, or FOREVER if start time is FOREVER; start-duration otherwise | ||
420 | */ | ||
421 | struct GNUNET_TIME_Absolute | 295 | struct GNUNET_TIME_Absolute |
422 | GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, | 296 | GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, |
423 | struct GNUNET_TIME_Relative duration) | 297 | struct GNUNET_TIME_Relative duration) |
@@ -433,11 +307,6 @@ GNUNET_TIME_absolute_subtract (struct GNUNET_TIME_Absolute start, | |||
433 | } | 307 | } |
434 | 308 | ||
435 | 309 | ||
436 | /** | ||
437 | * Multiply relative time by a given factor. | ||
438 | * | ||
439 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor | ||
440 | */ | ||
441 | struct GNUNET_TIME_Relative | 310 | struct GNUNET_TIME_Relative |
442 | GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, | 311 | GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, |
443 | unsigned long long factor) | 312 | unsigned long long factor) |
@@ -458,12 +327,6 @@ GNUNET_TIME_relative_multiply (struct GNUNET_TIME_Relative rel, | |||
458 | } | 327 | } |
459 | 328 | ||
460 | 329 | ||
461 | /** | ||
462 | * Multiply relative time by a given floating-point factor. The factor must be | ||
463 | * positive. | ||
464 | * | ||
465 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor | ||
466 | */ | ||
467 | struct GNUNET_TIME_Relative | 330 | struct GNUNET_TIME_Relative |
468 | relative_multiply_double (struct GNUNET_TIME_Relative rel, double factor) | 331 | relative_multiply_double (struct GNUNET_TIME_Relative rel, double factor) |
469 | { | 332 | { |
@@ -490,13 +353,6 @@ relative_multiply_double (struct GNUNET_TIME_Relative rel, double factor) | |||
490 | } | 353 | } |
491 | 354 | ||
492 | 355 | ||
493 | /** | ||
494 | * Saturating multiply relative time by a given factor. | ||
495 | * | ||
496 | * @param rel some duration | ||
497 | * @param factor integer to multiply with | ||
498 | * @return FOREVER if rel=FOREVER or on overflow; otherwise rel*factor | ||
499 | */ | ||
500 | struct GNUNET_TIME_Relative | 356 | struct GNUNET_TIME_Relative |
501 | GNUNET_TIME_relative_saturating_multiply (struct GNUNET_TIME_Relative rel, | 357 | GNUNET_TIME_relative_saturating_multiply (struct GNUNET_TIME_Relative rel, |
502 | unsigned long long factor) | 358 | unsigned long long factor) |
@@ -516,13 +372,6 @@ GNUNET_TIME_relative_saturating_multiply (struct GNUNET_TIME_Relative rel, | |||
516 | } | 372 | } |
517 | 373 | ||
518 | 374 | ||
519 | /** | ||
520 | * Divide relative time by a given factor. | ||
521 | * | ||
522 | * @param rel some duration | ||
523 | * @param factor integer to divide by | ||
524 | * @return FOREVER if rel=FOREVER or factor==0; otherwise rel/factor | ||
525 | */ | ||
526 | struct GNUNET_TIME_Relative | 375 | struct GNUNET_TIME_Relative |
527 | GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, | 376 | GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, |
528 | unsigned long long factor) | 377 | unsigned long long factor) |
@@ -537,16 +386,6 @@ GNUNET_TIME_relative_divide (struct GNUNET_TIME_Relative rel, | |||
537 | } | 386 | } |
538 | 387 | ||
539 | 388 | ||
540 | /** | ||
541 | * Calculate the estimate time of arrival/completion | ||
542 | * for an operation. | ||
543 | * | ||
544 | * @param start when did the operation start? | ||
545 | * @param finished how much has been done? | ||
546 | * @param total how much must be done overall (same unit as for "finished") | ||
547 | * @return remaining duration for the operation, | ||
548 | * assuming it continues at the same speed | ||
549 | */ | ||
550 | struct GNUNET_TIME_Relative | 389 | struct GNUNET_TIME_Relative |
551 | GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, | 390 | GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, |
552 | uint64_t finished, | 391 | uint64_t finished, |
@@ -568,13 +407,6 @@ GNUNET_TIME_calculate_eta (struct GNUNET_TIME_Absolute start, | |||
568 | } | 407 | } |
569 | 408 | ||
570 | 409 | ||
571 | /** | ||
572 | * Add relative times together. | ||
573 | * | ||
574 | * @param a1 first timestamp | ||
575 | * @param a2 second timestamp | ||
576 | * @return FOREVER if either argument is FOREVER or on overflow; a1+a2 otherwise | ||
577 | */ | ||
578 | struct GNUNET_TIME_Relative | 410 | struct GNUNET_TIME_Relative |
579 | GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, | 411 | GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, |
580 | struct GNUNET_TIME_Relative a2) | 412 | struct GNUNET_TIME_Relative a2) |
@@ -593,13 +425,6 @@ GNUNET_TIME_relative_add (struct GNUNET_TIME_Relative a1, | |||
593 | } | 425 | } |
594 | 426 | ||
595 | 427 | ||
596 | /** | ||
597 | * Subtract relative timestamp from the other. | ||
598 | * | ||
599 | * @param a1 first timestamp | ||
600 | * @param a2 second timestamp | ||
601 | * @return ZERO if a2>=a1 (including both FOREVER), FOREVER if a1 is FOREVER, a1-a2 otherwise | ||
602 | */ | ||
603 | struct GNUNET_TIME_Relative | 428 | struct GNUNET_TIME_Relative |
604 | GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, | 429 | GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, |
605 | struct GNUNET_TIME_Relative a2) | 430 | struct GNUNET_TIME_Relative a2) |
@@ -615,12 +440,6 @@ GNUNET_TIME_relative_subtract (struct GNUNET_TIME_Relative a1, | |||
615 | } | 440 | } |
616 | 441 | ||
617 | 442 | ||
618 | /** | ||
619 | * Convert relative time to network byte order. | ||
620 | * | ||
621 | * @param a time to convert | ||
622 | * @return time in network byte order | ||
623 | */ | ||
624 | struct GNUNET_TIME_RelativeNBO | 443 | struct GNUNET_TIME_RelativeNBO |
625 | GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) | 444 | GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) |
626 | { | 445 | { |
@@ -631,12 +450,6 @@ GNUNET_TIME_relative_hton (struct GNUNET_TIME_Relative a) | |||
631 | } | 450 | } |
632 | 451 | ||
633 | 452 | ||
634 | /** | ||
635 | * Convert relative time from network byte order. | ||
636 | * | ||
637 | * @param a time to convert | ||
638 | * @return time in host byte order | ||
639 | */ | ||
640 | struct GNUNET_TIME_Relative | 453 | struct GNUNET_TIME_Relative |
641 | GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) | 454 | GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) |
642 | { | 455 | { |
@@ -647,12 +460,6 @@ GNUNET_TIME_relative_ntoh (struct GNUNET_TIME_RelativeNBO a) | |||
647 | } | 460 | } |
648 | 461 | ||
649 | 462 | ||
650 | /** | ||
651 | * Convert absolute time to network byte order. | ||
652 | * | ||
653 | * @param a time to convert | ||
654 | * @return time in network byte order | ||
655 | */ | ||
656 | struct GNUNET_TIME_AbsoluteNBO | 463 | struct GNUNET_TIME_AbsoluteNBO |
657 | GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) | 464 | GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) |
658 | { | 465 | { |
@@ -663,12 +470,6 @@ GNUNET_TIME_absolute_hton (struct GNUNET_TIME_Absolute a) | |||
663 | } | 470 | } |
664 | 471 | ||
665 | 472 | ||
666 | /** | ||
667 | * Convert absolute time from network byte order. | ||
668 | * | ||
669 | * @param a time to convert | ||
670 | * @return time in host byte order | ||
671 | */ | ||
672 | struct GNUNET_TIME_Absolute | 473 | struct GNUNET_TIME_Absolute |
673 | GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) | 474 | GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) |
674 | { | 475 | { |
@@ -679,9 +480,6 @@ GNUNET_TIME_absolute_ntoh (struct GNUNET_TIME_AbsoluteNBO a) | |||
679 | } | 480 | } |
680 | 481 | ||
681 | 482 | ||
682 | /** | ||
683 | * Return the current year (i.e. '2011'). | ||
684 | */ | ||
685 | unsigned int | 483 | unsigned int |
686 | GNUNET_TIME_get_current_year () | 484 | GNUNET_TIME_get_current_year () |
687 | { | 485 | { |
@@ -696,12 +494,6 @@ GNUNET_TIME_get_current_year () | |||
696 | } | 494 | } |
697 | 495 | ||
698 | 496 | ||
699 | /** | ||
700 | * Convert an expiration time to the respective year (rounds) | ||
701 | * | ||
702 | * @param at absolute time | ||
703 | * @return year a year (after 1970), 0 on error | ||
704 | */ | ||
705 | unsigned int | 497 | unsigned int |
706 | GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at) | 498 | GNUNET_TIME_time_to_year (struct GNUNET_TIME_Absolute at) |
707 | { | 499 | { |
@@ -742,12 +534,6 @@ my_timegm (struct tm *tm) | |||
742 | #endif | 534 | #endif |
743 | 535 | ||
744 | 536 | ||
745 | /** | ||
746 | * Convert a year to an expiration time of January 1st of that year. | ||
747 | * | ||
748 | * @param year a year (after 1970, please ;-)). | ||
749 | * @return absolute time for January 1st of that year. | ||
750 | */ | ||
751 | struct GNUNET_TIME_Absolute | 537 | struct GNUNET_TIME_Absolute |
752 | GNUNET_TIME_year_to_time (unsigned int year) | 538 | GNUNET_TIME_year_to_time (unsigned int year) |
753 | { | 539 | { |
@@ -777,15 +563,6 @@ GNUNET_TIME_year_to_time (unsigned int year) | |||
777 | } | 563 | } |
778 | 564 | ||
779 | 565 | ||
780 | /** | ||
781 | * Randomized exponential back-off, starting at 1 ms | ||
782 | * and going up by a factor of 2+r, where 0 <= r <= 0.5, up | ||
783 | * to a maximum of the given threshold. | ||
784 | * | ||
785 | * @param r current backoff time, initially zero | ||
786 | * @param threshold maximum value for backoff | ||
787 | * @return the next backoff time | ||
788 | */ | ||
789 | struct GNUNET_TIME_Relative | 566 | struct GNUNET_TIME_Relative |
790 | GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative rt, | 567 | GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative rt, |
791 | struct GNUNET_TIME_Relative threshold) | 568 | struct GNUNET_TIME_Relative threshold) |
@@ -800,39 +577,15 @@ GNUNET_TIME_randomized_backoff (struct GNUNET_TIME_Relative rt, | |||
800 | } | 577 | } |
801 | 578 | ||
802 | 579 | ||
803 | /** | ||
804 | * Return a random time value between 0.5*r and 1.5*r. | ||
805 | * | ||
806 | * @param r input time for scaling | ||
807 | * @return randomized time | ||
808 | */ | ||
809 | struct GNUNET_TIME_Relative | 580 | struct GNUNET_TIME_Relative |
810 | GNUNET_TIME_randomize (struct GNUNET_TIME_Relative r) | 581 | GNUNET_TIME_randomize (struct GNUNET_TIME_Relative r) |
811 | { | 582 | { |
812 | double d = ((rand () % 1001) - 500) / 1000.0; | 583 | double d = ((rand () % 1001) + 500) / 1000.0; |
813 | 584 | ||
814 | return relative_multiply_double (r, d); | 585 | return relative_multiply_double (r, d); |
815 | } | 586 | } |
816 | 587 | ||
817 | 588 | ||
818 | /** | ||
819 | * Obtain the current time and make sure it is monotonically | ||
820 | * increasing. Guards against systems without an RTC or | ||
821 | * clocks running backwards and other nasty surprises. Does | ||
822 | * not guarantee that the returned time is near the current | ||
823 | * time returned by #GNUNET_TIME_absolute_get(). Two | ||
824 | * subsequent calls (within a short time period) may return the | ||
825 | * same value. Persists the last returned time on disk to | ||
826 | * ensure that time never goes backwards. As a result, the | ||
827 | * resulting value can be used to check if a message is the | ||
828 | * "most recent" value and replays of older messages (from | ||
829 | * the same origin) would be discarded. | ||
830 | * | ||
831 | * @param cfg configuration, used to determine where to | ||
832 | * store the time; user can also insist RTC is working | ||
833 | * nicely and disable the feature | ||
834 | * @return monotonically increasing time | ||
835 | */ | ||
836 | struct GNUNET_TIME_Absolute | 589 | struct GNUNET_TIME_Absolute |
837 | GNUNET_TIME_absolute_get_monotonic ( | 590 | GNUNET_TIME_absolute_get_monotonic ( |
838 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 591 | const struct GNUNET_CONFIGURATION_Handle *cfg) |