aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Dockerfile102
-rw-r--r--Makefile.am7
-rw-r--r--README8
-rw-r--r--README.md268
-rw-r--r--configure.ac6
-rw-r--r--contrib/.gitignore1
-rw-r--r--contrib/Makefile.am11
-rw-r--r--contrib/branding/logo/gnunet-logo-dark-text.svg1411
-rw-r--r--contrib/gnunet-arch-full.svg648
-rw-r--r--contrib/packages/guix/notest-guix-env.scm145
-rw-r--r--contrib/services/shepherd/ng0_wip/.gitignore1
-rw-r--r--contrib/services/shepherd/ng0_wip/00001-gnu-services-Add-gnunet-service.patch186
-rw-r--r--contrib/services/shepherd/ng0_wip/0001-gnu-services-Add-gnunet-service.patch225
-rw-r--r--contrib/services/shepherd/ng0_wip/001-gnu-services-Add-gnunet-service.patch204
-rw-r--r--contrib/services/shepherd/ng0_wip/README11
-rw-r--r--contrib/services/shepherd/ng0_wip/gnunet.scm173
-rw-r--r--contrib/services/shepherd/ng0_wip/janneke-os-modified.scm62
-rw-r--r--doc/documentation/Makefile.am5
-rw-r--r--doc/documentation/agpl-3.0.texi698
-rw-r--r--doc/documentation/chapters/contributing.texi25
-rw-r--r--doc/documentation/chapters/developer.texi13
-rw-r--r--doc/documentation/chapters/installation.texi129
-rw-r--r--doc/documentation/chapters/preface.texi67
-rw-r--r--doc/documentation/chapters/user.texi364
-rw-r--r--doc/documentation/gnunet.texi21
-rw-r--r--doc/man/Makefile.am1
-rw-r--r--doc/man/gnunet-gns.12
-rw-r--r--doc/man/gnunet-timeout.120
-rw-r--r--docker/README.md138
-rw-r--r--docker/docker-entrypoint.sh15
-rw-r--r--docker/gnunet.conf21
-rw-r--r--po/POTFILES.in136
-rw-r--r--src/Makefile.am6
-rw-r--r--src/arm/test_exponential_backoff.c3
-rw-r--r--src/cadet/cadet.conf.in2
-rw-r--r--src/cadet/cadet_api.c20
-rw-r--r--src/cadet/gnunet-cadet.c2
-rw-r--r--src/core/test_core_api_reliability.c4
-rw-r--r--src/core/test_core_quota_compliance.c5
-rw-r--r--src/datacache/plugin_datacache_sqlite.c5
-rw-r--r--src/gns/gns_api.c7
-rw-r--r--src/gns/gnunet-dns2gns.c1
-rw-r--r--src/gns/gnunet-gns.c10
-rw-r--r--src/gns/nss/nss_gns.c269
-rw-r--r--src/gns/nss/nss_gns_query.c25
-rw-r--r--src/gns/nss/nss_gns_query.h30
-rw-r--r--src/gns/plugin_rest_gns.c11
-rw-r--r--src/gnsrecord/plugin_gnsrecord_dns.c4
-rw-r--r--src/identity-provider/identity-token.conf2
-rw-r--r--src/identity-provider/jwt.c189
-rw-r--r--src/identity-provider/jwt.h9
-rw-r--r--src/identity-provider/test_idp.conf33
-rwxr-xr-xsrc/identity-provider/test_idp.sh31
-rwxr-xr-xsrc/identity-provider/test_idp_attribute.sh40
-rwxr-xr-xsrc/identity-provider/test_idp_consume.sh43
-rwxr-xr-xsrc/identity-provider/test_idp_issue.sh42
-rwxr-xr-xsrc/identity-provider/test_idp_revoke.sh65
-rw-r--r--src/identity/gnunet-service-identity.c49
-rw-r--r--src/identity/identity_api_lookup.c8
-rw-r--r--src/identity/plugin_rest_identity.c7
-rw-r--r--src/include/Makefile.am2
-rw-r--r--src/include/gnunet_abe_lib.h2
-rw-r--r--src/include/gnunet_common.h4
-rw-r--r--src/include/gnunet_crypto_lib.h26
-rw-r--r--src/include/gnunet_dnsparser_lib.h53
-rw-r--r--src/include/gnunet_gnsrecord_lib.h10
-rw-r--r--src/include/gnunet_protocols.h30
-rw-r--r--src/include/gnunet_reclaim_attribute_lib.h (renamed from src/include/gnunet_identity_attribute_lib.h)64
-rw-r--r--src/include/gnunet_reclaim_attribute_plugin.h (renamed from src/include/gnunet_identity_attribute_plugin.h)24
-rw-r--r--src/include/gnunet_reclaim_plugin.h (renamed from src/include/gnunet_identity_provider_plugin.h)28
-rw-r--r--src/include/gnunet_reclaim_service.h (renamed from src/include/gnunet_identity_provider_service.h)116
-rw-r--r--src/include/gnunet_signatures.h6
-rw-r--r--src/include/gnunet_strings_lib.h8
-rw-r--r--src/multicast/gnunet-service-multicast.c18
-rw-r--r--src/multicast/test_multicast_multipeer.c2
-rw-r--r--src/namestore/gnunet-zoneimport.c15
-rw-r--r--src/namestore/plugin_namestore_flat.c65
-rw-r--r--src/psyc/Makefile.am4
-rw-r--r--src/reclaim-attribute/Makefile.am (renamed from src/identity-attribute/Makefile.am)20
-rw-r--r--src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c (renamed from src/identity-attribute/plugin_identity_attribute_gnuid.c)22
-rw-r--r--src/reclaim-attribute/reclaim_attribute.c (renamed from src/identity-attribute/identity_attribute.c)110
-rw-r--r--src/reclaim-attribute/reclaim_attribute.h (renamed from src/identity-attribute/identity_attribute.h)10
-rw-r--r--src/reclaim/.gitignore (renamed from src/identity-provider/.gitignore)0
-rw-r--r--src/reclaim/Makefile.am (renamed from src/identity-provider/Makefile.am)95
-rw-r--r--src/reclaim/gnunet-reclaim.c (renamed from src/identity-provider/gnunet-idp.c)269
-rw-r--r--src/reclaim/gnunet-service-reclaim.c (renamed from src/identity-provider/gnunet-service-identity-provider.c)206
-rw-r--r--src/reclaim/jwt.c1
-rw-r--r--src/reclaim/oidc_helper.c440
-rw-r--r--src/reclaim/oidc_helper.h109
-rw-r--r--src/reclaim/plugin_gnsrecord_reclaim.c (renamed from src/identity-provider/plugin_gnsrecord_identity_provider.c)12
-rw-r--r--src/reclaim/plugin_reclaim_sqlite.c (renamed from src/identity-provider/plugin_identity_provider_sqlite.c)72
-rw-r--r--src/reclaim/plugin_rest_openid_connect.c (renamed from src/identity-provider/plugin_rest_openid_connect.c)787
-rw-r--r--src/reclaim/plugin_rest_reclaim.c (renamed from src/identity-provider/plugin_rest_identity_provider.c)118
-rw-r--r--src/reclaim/reclaim.conf (renamed from src/identity-provider/identity-provider.conf)15
-rw-r--r--src/reclaim/reclaim.h (renamed from src/identity-provider/identity_provider.h)24
-rw-r--r--src/reclaim/reclaim_api.c (renamed from src/identity-provider/identity_provider_api.c)345
-rwxr-xr-xsrc/reclaim/test_reclaim.sh31
-rwxr-xr-xsrc/reclaim/test_reclaim_attribute.sh40
-rwxr-xr-xsrc/reclaim/test_reclaim_consume.sh43
-rw-r--r--src/reclaim/test_reclaim_defaults.conf (renamed from src/identity-provider/test_idp_defaults.conf)0
-rwxr-xr-xsrc/reclaim/test_reclaim_issue.sh42
-rwxr-xr-xsrc/reclaim/test_reclaim_revoke.sh65
-rw-r--r--src/rest/Makefile.am12
-rw-r--r--src/rest/plugin_rest_copying.c231
-rw-r--r--src/rps/gnunet-rps-profiler.c284
-rw-r--r--src/rps/gnunet-service-rps.c676
-rw-r--r--src/rps/gnunet-service-rps_custommap.c2
-rw-r--r--src/rps/rps-test_util.c80
-rw-r--r--src/set/gnunet-service-set_intersection.c19
-rw-r--r--src/set/gnunet-service-set_union.c39
-rw-r--r--src/transport/test_quota_compliance.c4
-rw-r--r--src/transport/test_transport_api_reliability.c4
-rw-r--r--src/util/.gitignore4
-rw-r--r--src/util/Makefile.am16
-rw-r--r--src/util/client.c13
-rw-r--r--src/util/crypto_hash.c26
-rw-r--r--src/util/dnsparser.c125
-rw-r--r--src/util/gnunet-service-resolver.c1173
-rw-r--r--src/util/gnunet-timeout-w32.c (renamed from contrib/timeout_watchdog_w32.c)6
-rw-r--r--src/util/gnunet-timeout.c (renamed from contrib/timeout_watchdog.c)82
-rw-r--r--src/util/resolver.h4
-rw-r--r--src/util/resolver_api.c26
-rw-r--r--src/util/scheduler.c189
-rw-r--r--src/util/strings.c39
124 files changed, 8230 insertions, 4223 deletions
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 000000000..4fdd91f60
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,102 @@
1FROM ubuntu:18.04
2
3ENV DEBIAN_FRONTEND noninteractive
4
5# Install tools and dependencies
6RUN apt-get update && \
7 apt-get -y install --no-install-recommends \
8 ca-certificates \
9 libsasl2-modules \
10 git \
11 automake \
12 autopoint \
13 autoconf \
14 texinfo \
15 libtool \
16 libltdl-dev \
17 libgpg-error-dev \
18 libidn11-dev \
19 libunistring-dev \
20 libglpk-dev \
21 libbluetooth-dev \
22 libextractor-dev \
23 libmicrohttpd-dev \
24 libgnutls28-dev \
25 libgcrypt20-dev \
26 libpq-dev \
27 libsqlite3-dev && \
28 apt-get clean all && \
29 apt-get -y autoremove && \
30 rm -rf \
31 /var/lib/apt/lists/* \
32 /tmp/*
33
34# Install GNUrl
35ENV GNURL_GIT_URL https://git.taler.net/gnurl.git
36ENV GNURL_GIT_BRANCH gnurl-7.57.0
37
38RUN git clone $GNURL_GIT_URL \
39 --branch $GNURL_GIT_BRANCH \
40 --depth=1 \
41 --quiet && \
42 cd /gnurl && \
43 autoreconf -i && \
44 ./configure \
45 --enable-ipv6 \
46 --with-gnutls \
47 --without-libssh2 \
48 --without-libmetalink \
49 --without-winidn \
50 --without-librtmp \
51 --without-nghttp2 \
52 --without-nss \
53 --without-cyassl \
54 --without-polarssl \
55 --without-ssl \
56 --without-winssl \
57 --without-darwinssl \
58 --disable-sspi \
59 --disable-ntlm-wb \
60 --disable-ldap \
61 --disable-rtsp \
62 --disable-dict \
63 --disable-telnet \
64 --disable-tftp \
65 --disable-pop3 \
66 --disable-imap \
67 --disable-smtp \
68 --disable-gopher \
69 --disable-file \
70 --disable-ftp \
71 --disable-smb && \
72 make install && \
73 cd - && \
74 rm -fr /gnurl
75
76# Install GNUnet
77ENV GNUNET_PREFIX /usr/local/gnunet
78ENV CFLAGS '-g -Wall -O0'
79
80COPY . /gnunet
81
82RUN cd /gnunet && \
83 ./bootstrap && \
84 ./configure \
85 --with-nssdir=/lib \
86 --prefix="$GNUNET_PREFIX" \
87 --enable-logging=verbose && \
88 make -j3 && \
89 make install && \
90 ldconfig && \
91 cd - && \
92 rm -fr /gnunet
93
94# Configure GNUnet
95COPY docker/gnunet.conf /etc/gnunet.conf
96COPY docker/docker-entrypoint.sh /usr/local/bin/docker-entrypoint
97RUN chmod 755 /usr/local/bin/docker-entrypoint
98
99ENV LOCAL_PORT_RANGE='40001 40200'
100ENV PATH "$GNUNET_PREFIX/bin:/usr/local/bin:$PATH"
101
102ENTRYPOINT ["docker-entrypoint"]
diff --git a/Makefile.am b/Makefile.am
index 45a693ac9..ad32cf920 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,8 +3,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/include
3 3
4if DOCUMENTATION_ONLY 4if DOCUMENTATION_ONLY
5 SUBDIRS = doc 5 SUBDIRS = doc
6else 6else
7 SUBDIRS = doc m4 src po pkgconfig 7 SUBDIRS = m4 src po pkgconfig
8if DOCUMENTATION
9 SUBDIRS += doc
10endif
8endif 11endif
9 12
10if !TALER_ONLY 13if !TALER_ONLY
diff --git a/README b/README
index a00c5a0a9..256a6c69c 100644
--- a/README
+++ b/README
@@ -453,12 +453,12 @@ Further Reading
453 453
454* Documentation 454* Documentation
455 455
456 A preliminary rendering of the new GNUnet manual is deployed at 456 A HTML version of the new GNUnet manual is deployed at
457 457
458 https://d.n0.is/pub/doc/gnunet/manual/ 458 https://docs.gnunet.org
459 459
460 we plan to have a complete new gnunet.org up and running in 2019. 460 which currently displays just GNUnet documentation. Until 2019
461 This website output exists as a convenience solution until then. 461 we will add more reading material.
462 462
463* Academia / papers 463* Academia / papers
464 464
diff --git a/README.md b/README.md
new file mode 100644
index 000000000..3f40b3d87
--- /dev/null
+++ b/README.md
@@ -0,0 +1,268 @@
1<p align="center">
2 <a href="https://gnunet.org"><img src="contrib/branding/logo/gnunet-logo-dark-text.svg" alt="GNUnet" width="300px"/></a>
3</p>
4
5> GNUnet is a *new* network protocol stack for building secure, distributed, and privacy-preserving applications.
6
7* [Install](#how-to-install-gnunet)
8 * [From Source](#from-source)
9 * [Using Docker](#docker)
10* [Using GNUnet](#using-gnunet)
11* [License](#license)
12
13How to Install GNUnet
14---------------------
15
16### 1. From Source
17
18**Dependencies**
19
20Install these packages. Some of them may need to be installed from source depending on your OS.
21
22```
23- libmicrohttpd >= 0.9.42 (available from https://www.gnu.org/software/libmicrohttpd/)
24- libgcrypt >= 1.6
25- libgnurl >= 7.35.0 (recommended, available from https://gnunet.org/gnurl)
26- libcurl >= 7.35.0 (alternative to libgnurl)
27- libunistring >= 0.9.2
28- gnutls >= 3.2.12 (highly recommended: a gnutls linked against libunbound)
29- libidn >= 1.0
30- libextractor >= 0.6.1 (highly recommended)
31- openssl >= 1.0 (binary, used to generate X.509 certificate)
32- libltdl >= 2.2 (part of GNU libtool)
33- sqlite >= 3.8 (default database, required)
34- mysql >= 5.1 (alternative to sqlite)
35- postgres >= 9.5 (alternative to sqlite)
36- Texinfo >= 5.2 [*1]
37- which (for the bootstrap script)
38- gettext
39- zlib
40- pkg-config
41```
42
43
44You can also install the dependencies with the [GNU Guix package manager:](https://https://www.gnu.org/software/guix/) by using the provided environment file:
45
46```shell
47guix package -l guix-env.scm
48```
49
50
51**Using GNU Make**
52
53```shell
54./bootstrap # Run this to generate the configure files.
55./configure # See the various flags avalable to you.
56make
57make install
58```
59
60**Using the [GNU Guix package manager:](https://https://www.gnu.org/software/guix/)**
61
62```shell
63# To build, run tests, and install:
64guix package -f guix-env.scm
65
66# To skip the testing phase:
67guix package -f guix-env.scm:notest
68```
69
70
71### 2. Docker
72
73```
74docker build -t gnunet .
75```
76
77
78
79Using GNUnet
80-------------
81
82There are many possible ways to use the subsystems of GNUnet, so we will provide a few examples in this section.
83
84<p align="center">
85 <a href="contrib/gnunet-arch-full.svg"><img src="contrib/gnunet-arch-full.svg" alt="GNUnet Modular Architecture" width="600px" border="1px"/></a>
86</p>
87
88>***GNUnet is composed of over 30 modular subsystems***
89
90
91### Start GNUnet Services
92
93Before we can begin using most of the components we must start them.
94
95```shell
96gnunet-arm --start
97```
98
99Now we can open up another shell and try using some of the modules.
100
101### Cadet
102
103#### Examples
104
105Open a Cadet connection:
106
107```shell
108# Node 1
109gnunet-cadet -o <shared secret>
110```
111
112Conect to peer:
113
114```shell
115# Node 2
116gnunet-cadet <peer-id of Node 1> <shared secret>
117```
118
119#### Sharing Files
120
121With the cli tool, you can also share files:
122
123```shell
124# Node 1
125gnunet-cadet -o <shared secret> > filename
126```
127
128On the Node 2 we're going to send the file to Node 1, and to do this we need to make use of [coprocesses](https://www.gnu.org/software/bash/manual/html_node/Coprocesses.html).
129The syntax for using coprocesses varies per shell. In our example we are assuming Bash. More info for different shells can be found [here](https://unix.stackexchange.com/questions/86270/how-do-you-use-the-command-coproc-in-various-shells)
130
131```shell
132# Node 2
133coproc gnunet-cadet <peer-id of Node 1> <shared secret>
134cat <file> >&"${COPROC[1]}"
135```
136
137Now this enables us to do some fun things, such as streaming video by piping to a media player:
138
139```shell
140# Node 1
141gnunet-cadet -o <shared secret> | vlc -
142```
143
144```shell
145# Node 2
146coproc gnunet-cadet <peer-id of Node 1> <shared secret>
147cat <video-file> >&"${COPROC[1]}"
148```
149
150### Filesharing
151
152You can use GNUnet as a content-addressed storage, much like IPFS: sharing immutable files in a decentralized fashion with added privacy.
153
154For instance, you can get a nice cat picture with
155```sh
156gnunet-download gnunet://fs/loc/CB0ZX5EM1ZNNRT7AX93RVHCN1H49242DWZ4AXBTCJBAG22Z33VHYMR61J71YJXTXHEC22TNE0PRWA6D5X7NFNY2J9BNMG0SFN5DKZ0G.R48JSE2T4Y3W2AMDHZYX2MMDJC4HR0BVTJYNWJT2DGK7EQXR35DT84H9ZRAK3QTCTHDBAE1S6W16P8PCKC4HGEEKNW2T42HXF9RS1J0.1906755.J5Z3BDEG2PW332001GGZ2SSKCCSV8WDM696HNARG49X9TMABC4DG.B6Y7BCJ6B5K40EXCXASX1HQAD8MBJ9WTFWPCE3F15Q3Q4Y2PB8BKVGCS5HA4FG4484858NB74PBEE5V1638MGG7NS40A82K7QKK3G0G.1577833200 --output cat.png
157```
158
159You can also give files to the network, like so:
160
161```sh
162$ echo "I love GNUnet" > ILoveGNUnet.txt
163$ gnunet-publish ILoveGNUnet.txt
164
165Publishing `/tmp/ILoveGNUnet.txt` done.
166URI is `gnunet://fs/chk/SXA4RGZWDHE4PDWD2F4XG778J4SZY3E3SNDZ9AWFRZYYBV52W1T2WQNZCF1NYAT842800SSBQ8F247TG6MX7H4S1RWZZSC8ZXGQ4YPR.AZ3B5WR1XCWCWR6W30S2365KFY7A3R5AMF5SRN3Z11R72SMVQDX3F6GXQSZMWZGM5BSYVDQEJ93CR024QAAE65CKHM52GH8MZK1BM90.14`.
167```
168
169The URI you get is what you can use to retrieve the file with `gnunet-download`.
170
171### GNS
172
173*coming soon*
174
175
176### VPN
177
178#### "Half-hidden" services
179
180You can tunnel IP traffic through GNUnet allowing you to offer web, [rsh](https://linux.die.net/man/1/rsh), messaging or other servers without revealing your IP address.
181
182This is similar to Tor's Hidden (aka Onion) services, but currently does not provide as much privacy as onion routing isn't yet implemented; on the other hand, you can tunnel UDP, unlike Tor.
183
184#### Configuring server
185
186First, set up access from GNUnet to IP with `exit`:
187
188`gnunet.conf`:
189```
190[exit]
191FORCESTART = YES
192EXIT_IPV4 = YES
193EXIT_RANGE_IPV4_POLICY = 169.254.86.1;
194```
195
196Exit, by the way can also be used as a general-purpose IP proxy i.e. exit relay but here we restrict IPs to be accessed to those we'll be serving stuff on only.
197
198Then, start up a server to be shared. For the sake of example,
199
200```sh
201python3 -m http.server 8080
202```
203
204Now to configure the actual "half-hidden service". The config syntax is as follows:
205
206```sh
207[<shared secret>.gnunet.]
208TCP_REDIRECTS = <exposed port>:<local IP>:<local port>
209```
210
211...which for our example would be
212
213```sh
214[myhttptest.gnunet.]
215TCP_REDIRECTS = 80:169.254.86.1:8080
216```
217
218Local IP can be anything (if allowed by other configuration) but a localhost address (in other words, you can't bind a hidden service to the loopback interface and say 127.0.0.1 in `TCP_REDIRECTS`). The packets will appear as coming from the exit TUN interface to whatever address is configured in `TCP_REDIRECTS` (unlike SSH local forwarding, where the packets appear as coming from the loopback interface) and so they will not be forwarded to 127.0.0.1.
219
220You can share access to this service with a peer id, shared secret and IP port numbler: here `gnunet-peerinfo -s`, `myhttptest` and `80` respectively.
221
222#### Connecting
223
224`gnunet-vpn` gives you ephemeral IPs to connect to if you tell it a peer id and a shared secret, like so:
225
226```sh
227$ gnunet-vpn -p N7R25J8ADR553EPW0NFWNCXK9V80RVCP69QJ47XMT82VKAR7Y300 -t -s myhttptest
22810.11.139.20
229
230# And just connect to the given IP
231$ wget 10.11.139.20
232Connecting to 10.11.139.20:80... connected.
233```
234
235(You can try it out with your browser too.)
236
237### Running a Hostlist Server
238
239*coming soon*
240
241GNUnet Configuration
242--------------------------
243### Examples
244
245```yaml
246[transport]
247OPTIONS = -L DEBUG
248PLUGINS = tcp
249#PLUGINS = udp
250
251[transport-tcp]
252OPTIONS = -L DEBUG
253BINDTO = 192.168.0.2
254```
255
256TODO: *explain what this does and add more*
257
258
259Philosophy
260-------------------------
261
262GNUnet is made for an open society: It's a self-organizing network and it's [http://www.gnu.org/philosophy/free-sw.html](free software) as in freedom. GNUnet puts you in control of your data. You determine which data to share with whom, and you're not pressured to accept compromises.
263
264
265Related Projects
266-------------------------
267
268 <a href="https://pep.foundation"><img src="https://pep.foundation/static/media/uploads/peplogo.svg" alt="pep.foundation" width="80px"/></a> <a href="https://secushare.org"><img src="https://secushare.org/img/secushare-0444.png" alt="Secushare" width="80px"/></a>
diff --git a/configure.ac b/configure.ac
index 5d308c658..535ce0ffe 100644
--- a/configure.ac
+++ b/configure.ac
@@ -677,7 +677,7 @@ AC_CHECK_LIB([kstat],[kstat_open])
677# should the build process be building the documentation? 677# should the build process be building the documentation?
678AC_MSG_CHECKING(whether to build documentation) 678AC_MSG_CHECKING(whether to build documentation)
679AC_ARG_ENABLE([documentation], 679AC_ARG_ENABLE([documentation],
680 [AS_HELP_STRING([--enable-documentation], [build the documentation])], 680 [AS_HELP_STRING([--disable-documentation], [do not build the documentation])],
681 [documentation=${enableval}], 681 [documentation=${enableval}],
682 [documentation=yes]) 682 [documentation=yes])
683AC_MSG_RESULT($documentation) 683AC_MSG_RESULT($documentation)
@@ -1759,8 +1759,8 @@ src/zonemaster/Makefile
1759src/zonemaster/zonemaster.conf 1759src/zonemaster/zonemaster.conf
1760src/rest/Makefile 1760src/rest/Makefile
1761src/abe/Makefile 1761src/abe/Makefile
1762src/identity-attribute/Makefile 1762src/reclaim-attribute/Makefile
1763src/identity-provider/Makefile 1763src/reclaim/Makefile
1764pkgconfig/Makefile 1764pkgconfig/Makefile
1765pkgconfig/gnunetarm.pc 1765pkgconfig/gnunetarm.pc
1766pkgconfig/gnunetats.pc 1766pkgconfig/gnunetats.pc
diff --git a/contrib/.gitignore b/contrib/.gitignore
index 304706d7e..d6ef469ba 100644
--- a/contrib/.gitignore
+++ b/contrib/.gitignore
@@ -2,7 +2,6 @@ gnunet_janitor.py
2gnunet_pyexpect.py 2gnunet_pyexpect.py
3pydiffer.py 3pydiffer.py
4terminate.py 4terminate.py
5timeout_watchdog
6gnunet_pyexpect.py 5gnunet_pyexpect.py
7gnunet_pyexpect.pyc 6gnunet_pyexpect.pyc
8pydiffer.pyc 7pydiffer.pyc
diff --git a/contrib/Makefile.am b/contrib/Makefile.am
index 158e43998..eec3300b9 100644
--- a/contrib/Makefile.am
+++ b/contrib/Makefile.am
@@ -5,17 +5,6 @@ tap32dir = $(pkgdatadir)/openvpn-tap32/tapw32/
5 5
6tap64dir = $(pkgdatadir)/openvpn-tap32/tapw64/ 6tap64dir = $(pkgdatadir)/openvpn-tap32/tapw64/
7 7
8noinst_PROGRAMS = \
9 timeout_watchdog
10
11if !MINGW
12timeout_watchdog_SOURCES = \
13 timeout_watchdog.c
14else
15timeout_watchdog_SOURCES = \
16 timeout_watchdog_w32.c
17endif
18
19noinst_SCRIPTS = \ 8noinst_SCRIPTS = \
20 scripts/terminate.py \ 9 scripts/terminate.py \
21 scripts/pydiffer.py \ 10 scripts/pydiffer.py \
diff --git a/contrib/branding/logo/gnunet-logo-dark-text.svg b/contrib/branding/logo/gnunet-logo-dark-text.svg
new file mode 100644
index 000000000..5644e0ae7
--- /dev/null
+++ b/contrib/branding/logo/gnunet-logo-dark-text.svg
@@ -0,0 +1,1411 @@
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:xlink="http://www.w3.org/1999/xlink"
9 version="1.1"
10 id="svg2"
11 height="280"
12 width="320">
13 <title
14 id="title3310">logo for GNUnet</title>
15 <defs
16 id="defs4">
17 <linearGradient
18 id="gnunet">
19 <stop
20 style="stop-color:#ff0000;stop-opacity:0.58431375;"
21 offset="0"
22 id="stop9516" />
23 <stop
24 style="stop-color:#ffcc00;stop-opacity:1;"
25 offset="1"
26 id="stop9518" />
27 </linearGradient>
28 <linearGradient
29 id="linearGradient4094">
30 <stop
31 style="stop-color:#232323;stop-opacity:1;"
32 offset="0"
33 id="stop4096" />
34 <stop
35 style="stop-color:#4d4d4d;stop-opacity:1;"
36 offset="1"
37 id="stop4098" />
38 </linearGradient>
39 <linearGradient
40 id="linearGradient4014">
41 <stop
42 style="stop-color:#a0a0a0;stop-opacity:1;"
43 offset="0"
44 id="stop4016" />
45 <stop
46 style="stop-color:#ffffff;stop-opacity:1;"
47 offset="1"
48 id="stop4018" />
49 </linearGradient>
50 <linearGradient
51 id="linearGradient4678">
52 <stop
53 style="stop-color:#e5e5e5;stop-opacity:1;"
54 offset="0"
55 id="stop4680" />
56 <stop
57 style="stop-color:#d3cdcd;stop-opacity:1;"
58 offset="1"
59 id="stop4682" />
60 </linearGradient>
61 <linearGradient
62 id="linearGradient4341">
63 <stop
64 id="stop4343"
65 offset="0"
66 style="stop-color:#333333;stop-opacity:1;" />
67 <stop
68 id="stop4345"
69 offset="1"
70 style="stop-color:#484848;stop-opacity:1;" />
71 </linearGradient>
72 <linearGradient
73 id="linearGradient4696-5">
74 <stop
75 id="stop4698-6"
76 offset="0"
77 style="stop-color:#ffb638;stop-opacity:1;" />
78 <stop
79 id="stop4700-2"
80 offset="1"
81 style="stop-color:#f0ae26;stop-opacity:1;" />
82 </linearGradient>
83 <linearGradient
84 id="linearGradient4702-3-6">
85 <stop
86 id="stop4704-1"
87 offset="0"
88 style="stop-color:#ff0000;stop-opacity:0.58431375;" />
89 <stop
90 id="stop4706-8"
91 offset="1"
92 style="stop-color:#ffcc00;stop-opacity:1;" />
93 </linearGradient>
94 <color-profile
95 name="Artifex-PS-CMYK-Profile"
96 xlink:href="/usr/share/color/icc/ghostscript/ps_cmyk.icc"
97 id="color-profile27" />
98 <linearGradient
99 y2="69.791016"
100 x2="177.04297"
101 y1="63.65625"
102 x1="142.96875"
103 gradientTransform="matrix(-0.88803314,0,0,0.88803314,595.57001,1106.9291)"
104 gradientUnits="userSpaceOnUse"
105 id="linearGradient3138"
106 xlink:href="#linearGradient4702-3-6" />
107 <linearGradient
108 y2="1043.709"
109 x2="80.655251"
110 y1="1025.709"
111 x1="108.08774"
112 gradientTransform="matrix(-0.49726789,0,0,0.49726789,555.31016,722.70088)"
113 gradientUnits="userSpaceOnUse"
114 id="linearGradient3141"
115 xlink:href="#linearGradient4696-5" />
116 <linearGradient
117 y2="922.07178"
118 x2="78.000107"
119 y1="1004.8033"
120 x1="113.5146"
121 gradientTransform="matrix(0.88803314,0,0,0.88803314,415.18739,350.00262)"
122 gradientUnits="userSpaceOnUse"
123 id="linearGradient3144"
124 xlink:href="#linearGradient4702-3-6" />
125 <linearGradient
126 y2="70.667412"
127 x2="176.60477"
128 y1="63.65625"
129 x1="142.96875"
130 gradientTransform="matrix(0.88803314,0,0,0.88803314,415.2161,1106.9294)"
131 gradientUnits="userSpaceOnUse"
132 id="linearGradient3148"
133 xlink:href="#linearGradient4702-3-6" />
134 <linearGradient
135 y2="70.667412"
136 x2="176.60477"
137 y1="63.65625"
138 x1="142.96875"
139 gradientTransform="matrix(0.88803314,0,0,0.88803314,415.2161,1106.9294)"
140 gradientUnits="userSpaceOnUse"
141 id="linearGradient3780"
142 xlink:href="#linearGradient4702-3-6" />
143 <linearGradient
144 y2="922.07178"
145 x2="78.000107"
146 y1="1004.8033"
147 x1="113.5146"
148 gradientTransform="matrix(0.88803314,0,0,0.88803314,415.18739,350.00262)"
149 gradientUnits="userSpaceOnUse"
150 id="linearGradient3782"
151 xlink:href="#linearGradient4702-3-6" />
152 <linearGradient
153 y2="1043.709"
154 x2="80.655251"
155 y1="1025.709"
156 x1="108.08774"
157 gradientTransform="matrix(-0.49726789,0,0,0.49726789,555.31016,722.70088)"
158 gradientUnits="userSpaceOnUse"
159 id="linearGradient3784"
160 xlink:href="#linearGradient4696-5" />
161 <linearGradient
162 y2="69.791016"
163 x2="177.04297"
164 y1="63.65625"
165 x1="142.96875"
166 gradientTransform="matrix(-0.88803314,0,0,0.88803314,595.57001,1106.9291)"
167 gradientUnits="userSpaceOnUse"
168 id="linearGradient3786"
169 xlink:href="#linearGradient4702-3-6" />
170 <filter
171 id="filter9204"
172 style="color-interpolation-filters:sRGB">
173 <feColorMatrix
174 id="feColorMatrix9194"
175 result="colormatrix"
176 values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 -0.2125 -0.7154 -0.0721 1 0 "
177 in="SourceGraphic" />
178 <feComposite
179 k1="0"
180 id="feComposite9196"
181 result="composite"
182 k4="0"
183 k3="0"
184 k2="1"
185 operator="arithmetic"
186 in2="colormatrix"
187 in="SourceGraphic" />
188 <feGaussianBlur
189 id="feGaussianBlur9198"
190 result="blur1"
191 stdDeviation="5 0.01" />
192 <feGaussianBlur
193 id="feGaussianBlur9200"
194 result="blur2"
195 stdDeviation="0.01 5"
196 in="composite" />
197 <feBlend
198 id="feBlend9202"
199 result="blend"
200 mode="darken"
201 in2="blur1"
202 in="blur2" />
203 </filter>
204 <filter
205 id="filter9330"
206 style="color-interpolation-filters:sRGB">
207 <feGaussianBlur
208 id="feGaussianBlur9328"
209 result="blur"
210 stdDeviation="2 2" />
211 </filter>
212 </defs>
213 <metadata
214 id="metadata7">
215 <rdf:RDF>
216 <cc:Work
217 rdf:about="">
218 <dc:format>image/svg+xml</dc:format>
219 <dc:type
220 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
221 <dc:title>logo for GNUnet</dc:title>
222 <dc:creator>
223 <cc:Agent>
224 <dc:title>Luis Felipe López Acevedo, Amirouche Boubekki, carlo von lynX</dc:title>
225 </cc:Agent>
226 </dc:creator>
227 <dc:rights>
228 <cc:Agent>
229 <dc:title>GNUnet e.V.</dc:title>
230 </cc:Agent>
231 </dc:rights>
232 <cc:license
233 rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
234 <dc:description />
235 </cc:Work>
236 <cc:License
237 rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
238 <cc:permits
239 rdf:resource="http://creativecommons.org/ns#Reproduction" />
240 <cc:permits
241 rdf:resource="http://creativecommons.org/ns#Distribution" />
242 <cc:requires
243 rdf:resource="http://creativecommons.org/ns#Notice" />
244 <cc:requires
245 rdf:resource="http://creativecommons.org/ns#Attribution" />
246 <cc:permits
247 rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
248 <cc:requires
249 rdf:resource="http://creativecommons.org/ns#ShareAlike" />
250 </cc:License>
251 </rdf:RDF>
252 </metadata>
253 <g
254 id="g5346"
255 style="display:none"
256 transform="translate(-387.41463,-609.81931)">
257 <text
258 xml:space="preserve"
259 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:16.53852463px;line-height:125%;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;word-spacing:0px;display:inline;opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.03365779px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
260 x="453.95291"
261 y="869.96057"
262 id="text5344"><tspan
263 id="tspan5342"
264 x="453.95291"
265 y="869.96057"
266 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:49.33333206px;font-family:'Ubuntu Bold';-inkscape-font-specification:'Ubuntu Bold, ';fill:#ffffff;stroke-width:1.03365779px"
267 dx="0 0 0">gnu net</tspan></text>
268 </g>
269 <g
270 transform="translate(-387.41463,-609.81931)"
271 style="display:none"
272 id="g950">
273 <text
274 id="text948"
275 y="869.21057"
276 x="467.77612"
277 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:16.53852463px;line-height:125%;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;word-spacing:0px;display:inline;opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.03365779px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
278 xml:space="preserve"><tspan
279 dx="0 -2.5 -3 0 -19.25 -2.5 -3"
280 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#ffffff;stroke-width:1.03365779px"
281 y="869.21057"
282 x="467.77612"
283 id="tspan946">gnu net</tspan></text>
284 </g>
285 <g
286 id="g941"
287 style="display:none"
288 transform="translate(0,-20)">
289 <ellipse
290 ry="17.690269"
291 rx="17.68549"
292 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#ee0000;stroke-width:1.68696308;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.97635139"
293 id="ellipse937"
294 cx="157.97346"
295 cy="180.65355" />
296 <ellipse
297 ry="17.690269"
298 rx="17.68549"
299 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#ee0000;stroke-width:1.68696308;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.97635139"
300 id="ellipse939"
301 cx="157.97346"
302 cy="111.16864" />
303 </g>
304 <g
305 transform="translate(-387.41463,-609.81931)"
306 style="display:none"
307 id="g935">
308 <g
309 aria-label="gnu net"
310 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:16.53852463px;line-height:125%;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;word-spacing:0px;display:inline;opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.03365779px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;image-rendering:auto"
311 id="g933">
312 <path
313 d="m 423.90503,684.79003 h 22.14128 v 61.61056 q 0,11.55196 4.3855,16.04443 4.38546,4.49242 12.72857,4.49242 12.19374,0 20.00203,-9.94753 7.80828,-9.94753 7.80828,-27.48942 v -44.71046 h 22.14128 v 99.6893 h -22.14128 v -24.92231 q -3.31586,12.83553 -12.30071,20.10899 -8.98489,7.27346 -22.14132,7.27346 -15.29567,0 -23.95963,-9.94753 -8.664,-10.0545 -8.664,-30.59135 z"
314 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#ffffff;stroke-width:4.46906853px"
315 id="path925" />
316 <path
317 d="m 669.48029,784.47933 h -22.14128 v -61.50359 q 0,-11.65892 -4.3855,-16.15139 -4.38546,-4.49243 -12.72857,-4.49243 -12.30071,0 -20.10899,9.94753 -7.70132,9.94754 -7.70132,27.48947 v 44.71041 h -22.14128 v -99.6893 h 22.14128 v 25.02928 q 3.31586,-12.94249 12.30071,-20.10899 8.98489,-7.27346 22.14132,-7.27346 15.29567,0 23.95967,9.94753 8.66396,9.94753 8.66396,30.59135 z"
318 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#ffffff;stroke-width:4.46906853px"
319 id="path927" />
320 </g>
321 </g>
322 <g
323 id="g1296"
324 style="display:none"
325 transform="translate(0,-67.278107)">
326 <path
327 style="fill:none;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
328 d="m 62.698223,85.778107 -39.5,48.000003 v 0 l -1,2"
329 id="path1256" />
330 <path
331 style="fill:none;stroke:#dddddd;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
332 d="m 12.698223,104.77811 10,29 21,-10.5 v 0 0"
333 id="path1258" />
334 <path
335 style="display:inline;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
336 d="m 11.809253,105.24526 63.6227,34.91188 23.31802,-11.09978 -35.03955,28.74946 11.86161,-17.77468 -53.18435,-5.79678 40.95076,23.69646 25.32406,0.49689 24.193047,3.02495 v 48.02104 l 21.04995,-32.14943 -20.559,-15.87161 32.52749,48.02104 -8.06937,31.38386 -24.94907,-31.76198 24.94907,77.51429 22.25436,-36.69889 21.97354,37.07701 -43.59987,-0.37188 41.32877,-28.87448 22.05899,-21.17152 -19.90986,50.171 -3.71591,-29.60613 -8.57843,-31.7682 -9.69437,24.71516 54.37611,-52.19866 -24.96716,8.94671 -18.39175,19.15282 18.27579,-55.07718 25.20812,27.362 20.66591,-41.35238 -46.00204,14.12783 22.94304,-37.07431 23.05297,23.0777 31.8814,-26.48075 40.07874,-25.58708 -15.26372,39.20869 -24.69305,-13.74039 -55.05634,4.03119 79.62738,9.58108 -56.57441,12.73416"
337 id="path1260" />
338 <path
339 style="display:inline;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
340 d="m 98.868943,129.31358 37.045597,48.02106"
341 id="path1262" />
342 <path
343 style="display:inline;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
344 d="m 88.284483,158.4287 10.96248,-29.11512 12.474537,32.51819"
345 id="path1264" />
346 <path
347 style="display:inline;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
348 d="m 212.13974,133.78236 54.69043,-3.64603 -31.75647,27.04795"
349 id="path1266" />
350 <path
351 transform="translate(-387.41463,-542.5412)"
352 style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#dddddd;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
353 d="m 399.11285,648.31931 50.5,-19.5 -14.05,28.1 0.925,-1.725 -5.875,11.75 -0.25,-0.75"
354 id="path1268" />
355 <path
356 transform="translate(-387.41463,-542.5412)"
357 style="display:inline;opacity:1;fill:#729fcf;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
358 d="m 601.57854,741.42859 -2.26809,-64.28015"
359 id="path1270" />
360 <path
361 style="fill:none;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
362 d="m 189.57322,206.52811 -44,2.625 25.375,17.125 v 0"
363 id="path1272" />
364 <path
365 transform="translate(-387.41463,-542.5412)"
366 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
367 d="m 475.69911,700.21367 24.57107,51.42411"
368 id="path1274" />
369 <path
370 transform="translate(-387.41463,-542.5412)"
371 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
372 d="m 534.29164,751.63778 12.85257,40.08057"
373 id="path1276" />
374 <path
375 transform="translate(-387.41463,-542.5412)"
376 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
377 d="m 525.21925,783.02162 0.37803,45.75234"
378 id="path1278" />
379 <path
380 transform="translate(-387.41463,-542.5412)"
381 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
382 d="m 601.95657,742.56293 -12.09653,36.6775"
383 id="path1280" />
384 <path
385 transform="translate(-387.41463,-542.5412)"
386 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
387 d="m 475.69911,700.59178 46.98395,22.0278 10.85256,28.26194"
388 id="path1282" />
389 <path
390 transform="translate(-387.41463,-542.5412)"
391 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
392 d="m 589.104,778.86231 -12.85255,-66.17074 v 36.6775 z"
393 id="path1284" />
394 <path
395 transform="translate(-387.41463,-542.5412)"
396 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
397 d="m 557.35064,768.27501 31.75336,10.5873"
398 id="path1286" />
399 <path
400 transform="translate(-387.41463,-542.5412)"
401 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
402 d="m 500.27018,704.37298 v 48.77728 l 24.57105,30.2495 23.81505,9.45293"
403 id="path1288" />
404 <path
405 transform="translate(-387.41463,-542.5412)"
406 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
407 d="m 524.46323,829.53019 44.98392,-0.37812"
408 id="path1290" />
409 <path
410 transform="translate(-387.41463,-542.5412)"
411 style="display:inline;opacity:1;fill:none;stroke:#dddddd;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
412 d="m 694.61285,647.31931 -40.285,-17.00922 -4.715,-1.99078 29,57.5 v -0.5 0 h 0.5 v 0"
413 id="path1292" />
414 <path
415 transform="translate(-387.41463,-542.5412)"
416 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#dddddd;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
417 d="m 409.92428,677.14844 54.05634,6.0499"
418 id="path1294" />
419 </g>
420 <g
421 transform="translate(0,-67.278107)"
422 style="display:none"
423 id="g1254">
424 <ellipse
425 transform="translate(-387.41463,-542.5412)"
426 ry="4.1593032"
427 rx="4.1581793"
428 cy="829.24042"
429 cx="568.98083"
430 id="ellipse1194"
431 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
432 <ellipse
433 transform="translate(-387.41463,-542.5412)"
434 ry="4.1593032"
435 rx="4.1581793"
436 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
437 id="ellipse1196"
438 cx="588.85413"
439 cy="778.67493" />
440 <ellipse
441 transform="translate(-387.41463,-542.5412)"
442 ry="4.1593032"
443 rx="4.1581793"
444 cy="740.67249"
445 cx="601.57867"
446 id="ellipse1198"
447 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
448 <ellipse
449 transform="translate(-387.41463,-542.5412)"
450 ry="4.1593032"
451 rx="4.1581793"
452 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
453 id="ellipse1200"
454 cx="525.79852"
455 cy="829.24042" />
456 <ellipse
457 transform="translate(-387.41463,-542.5412)"
458 ry="4.1593032"
459 rx="4.1581793"
460 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
461 id="ellipse1202"
462 cx="557.82654"
463 cy="768.71582" />
464 <ellipse
465 transform="translate(-387.41463,-542.5412)"
466 ry="4.1593032"
467 rx="4.1581793"
468 cy="783.02173"
469 cx="525.21936"
470 id="ellipse1204"
471 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
472 <ellipse
473 transform="translate(-387.41463,-542.5412)"
474 ry="4.1593032"
475 rx="4.1581793"
476 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
477 id="ellipse1206"
478 cx="400.09586"
479 cy="647.34271" />
480 <ellipse
481 transform="translate(-387.41463,-542.5412)"
482 ry="4.1593032"
483 rx="4.1581793"
484 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
485 id="ellipse1208"
486 cx="450.11285"
487 cy="628.31934" />
488 <ellipse
489 transform="translate(-387.41463,-542.5412)"
490 ry="4.1593032"
491 rx="4.1581793"
492 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
493 id="ellipse1210"
494 cx="622.36951"
495 cy="699.45752" />
496 <ellipse
497 transform="translate(-387.41463,-542.5412)"
498 ry="4.1593032"
499 rx="4.1581793"
500 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
501 id="ellipse1212"
502 cx="547.21771"
503 cy="792.29773" />
504 <ellipse
505 transform="translate(-387.41463,-542.5412)"
506 ry="4.1593032"
507 rx="4.1581793"
508 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
509 id="ellipse1214"
510 cx="566.20697"
511 cy="800.12549" />
512 <ellipse
513 transform="translate(-387.41463,-542.5412)"
514 ry="4.1593032"
515 rx="4.1581793"
516 cy="751.63794"
517 cx="500.64822"
518 id="ellipse1216"
519 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
520 <ellipse
521 transform="translate(-387.41463,-542.5412)"
522 ry="4.1593032"
523 rx="4.1581793"
524 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
525 id="ellipse1218"
526 cx="533.33447"
527 cy="751.72632" />
528 <ellipse
529 transform="translate(-387.41463,-542.5412)"
530 ry="4.1593032"
531 rx="4.1581793"
532 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
533 id="ellipse1220"
534 cx="450.75012"
535 cy="699.83545" />
536 <ellipse
537 transform="translate(-387.41463,-542.5412)"
538 ry="4.1593032"
539 rx="4.1581793"
540 cy="700.59174"
541 cx="476.07718"
542 id="ellipse1222"
543 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
544 <ellipse
545 transform="translate(-387.41463,-542.5412)"
546 ry="4.1593032"
547 rx="4.1581793"
548 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
549 id="ellipse1224"
550 cx="521.49146"
551 cy="719.65314" />
552 <ellipse
553 transform="translate(-387.41463,-542.5412)"
554 ry="4.1593032"
555 rx="4.1581793"
556 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
557 id="ellipse1226"
558 cx="500.6362"
559 cy="703.87305" />
560 <ellipse
561 ry="4.1593032"
562 rx="4.1581793"
563 cy="134.28851"
564 cx="211.9584"
565 id="ellipse1228"
566 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
567 <ellipse
568 transform="translate(-387.41463,-542.5412)"
569 ry="4.1593032"
570 rx="4.1581793"
571 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
572 id="ellipse1230"
573 cx="576.62964"
574 cy="713.44794" />
575 <ellipse
576 ry="4.1593032"
577 rx="4.1581793"
578 cy="123.16669"
579 cx="43.166531"
580 id="ellipse1232"
581 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
582 <ellipse
583 ry="4.1593032"
584 rx="4.1581793"
585 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
586 id="ellipse1234"
587 cx="98.865997"
588 cy="129.43542" />
589 <ellipse
590 ry="4.1593032"
591 rx="4.1581793"
592 cy="130.05022"
593 cx="267.08618"
594 id="ellipse1236"
595 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
596 <ellipse
597 transform="translate(-387.41463,-542.5412)"
598 ry="4.1593032"
599 rx="4.1581793"
600 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
601 id="ellipse1238"
602 cx="679.07196"
603 cy="686.22339" />
604 <ellipse
605 transform="translate(-387.41463,-542.5412)"
606 ry="4.1593032"
607 rx="4.1581793"
608 cy="748.99109"
609 cx="577.00763"
610 id="ellipse1240"
611 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
612 <ellipse
613 transform="translate(-387.41463,-542.5412)"
614 ry="4.1593032"
615 rx="4.1581793"
616 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
617 id="ellipse1242"
618 cx="577.00763"
619 cy="748.99109" />
620 <ellipse
621 transform="translate(-387.41463,-542.5412)"
622 ry="4.1593032"
623 rx="4.1581793"
624 cy="748.99109"
625 cx="577.07013"
626 id="ellipse1244"
627 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
628 <ellipse
629 transform="translate(0,-3e-6)"
630 ry="4.1593032"
631 rx="4.1581793"
632 cy="133.85095"
633 cx="22.887779"
634 id="ellipse1246"
635 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
636 <ellipse
637 transform="translate(-387.41463,-542.5412)"
638 ry="4.1593032"
639 rx="4.1581793"
640 cy="682.1922"
641 cx="462.47165"
642 id="ellipse1248"
643 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
644 <ellipse
645 transform="translate(-387.41463,-542.5412)"
646 ry="4.1593032"
647 rx="4.1581793"
648 cy="647.3053"
649 cx="694.58264"
650 id="ellipse1250"
651 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" />
652 <ellipse
653 transform="translate(-387.41463,-542.5412)"
654 ry="4.1593032"
655 rx="4.1581793"
656 style="display:inline;opacity:1;fill:#ffffff;fill-opacity:1;stroke:#eeeeee;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
657 id="ellipse1252"
658 cx="649.61285"
659 cy="628.31934" />
660 </g>
661 <g
662 transform="translate(0,-67.278107)"
663 style="display:inline"
664 id="g1533">
665 <path
666 id="path1493"
667 d="m 62.698223,85.778107 -39.5,48.000003 v 0 l -1,2"
668 style="fill:none;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
669 <path
670 id="path1495"
671 d="m 12.698223,104.77811 10,29 21,-10.5 v 0 0"
672 style="fill:none;stroke:#3399cc;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
673 <path
674 id="path1497"
675 d="m 11.809253,105.24526 63.6227,34.91188 23.31802,-11.09978 -35.03955,28.74946 11.86161,-17.77468 -53.18435,-5.79678 40.95076,23.69646 25.32406,0.49689 24.193047,3.02495 v 48.02104 l 21.04995,-32.14943 -20.559,-15.87161 32.52749,48.02104 -8.06937,31.38386 -24.94907,-31.76198 24.94907,77.51429 22.25436,-36.69889 21.97354,37.07701 -43.59987,-0.37188 41.32877,-28.87448 22.05899,-21.17152 -19.90986,50.171 -3.71591,-29.60613 -8.57843,-31.7682 -9.69437,24.71516 54.37611,-52.19866 -24.96716,8.94671 -18.39175,19.15282 18.27579,-55.07718 25.20812,27.362 20.66591,-41.35238 -46.00204,14.12783 22.94304,-37.07431 23.05297,23.0777 31.8814,-26.48075 40.07874,-25.58708 -15.26372,39.20869 -24.69305,-13.74039 -55.05634,4.03119 79.62738,9.58108 -56.57441,12.73416"
676 style="display:inline;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
677 <path
678 id="path1499"
679 d="m 98.868943,129.31358 37.045597,48.02106"
680 style="display:inline;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
681 <path
682 id="path1501"
683 d="m 88.284483,158.4287 10.96248,-29.11512 12.474537,32.51819"
684 style="display:inline;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
685 <path
686 id="path1503"
687 d="m 212.13974,133.78236 54.69043,-3.64603 -31.75647,27.04795"
688 style="display:inline;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
689 <path
690 id="path1505"
691 d="m 399.11285,648.31931 50.5,-19.5 -14.05,28.1 0.925,-1.725 -5.875,11.75 -0.25,-0.75"
692 style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#3399cc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
693 transform="translate(-387.41463,-542.5412)" />
694 <path
695 id="path1507"
696 d="m 601.57854,741.42859 -2.26809,-64.28015"
697 style="display:inline;opacity:1;fill:#729fcf;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
698 transform="translate(-387.41463,-542.5412)" />
699 <path
700 id="path1509"
701 d="m 189.57322,206.52811 -44,2.625 25.375,17.125 v 0"
702 style="fill:none;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
703 <path
704 id="path1511"
705 d="m 475.69911,700.21367 24.57107,51.42411"
706 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
707 transform="translate(-387.41463,-542.5412)" />
708 <path
709 id="path1513"
710 d="m 534.29164,751.63778 12.85257,40.08057"
711 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
712 transform="translate(-387.41463,-542.5412)" />
713 <path
714 id="path1515"
715 d="m 525.21925,783.02162 0.37803,45.75234"
716 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
717 transform="translate(-387.41463,-542.5412)" />
718 <path
719 id="path1517"
720 d="m 601.95657,742.56293 -12.09653,36.6775"
721 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
722 transform="translate(-387.41463,-542.5412)" />
723 <path
724 id="path1519"
725 d="m 475.69911,700.59178 46.98395,22.0278 10.85256,28.26194"
726 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
727 transform="translate(-387.41463,-542.5412)" />
728 <path
729 id="path1521"
730 d="m 589.104,778.86231 -12.85255,-66.17074 v 36.6775 z"
731 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
732 transform="translate(-387.41463,-542.5412)" />
733 <path
734 id="path1523"
735 d="m 557.35064,768.27501 31.75336,10.5873"
736 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
737 transform="translate(-387.41463,-542.5412)" />
738 <path
739 id="path1525"
740 d="m 500.27018,704.37298 v 48.77728 l 24.57105,30.2495 23.81505,9.45293"
741 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
742 transform="translate(-387.41463,-542.5412)" />
743 <path
744 id="path1527"
745 d="m 524.46323,829.53019 44.98392,-0.37812"
746 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
747 transform="translate(-387.41463,-542.5412)" />
748 <path
749 id="path1529"
750 d="m 694.61285,647.31931 -40.285,-17.00922 -4.715,-1.99078 29,57.5 v -0.5 0 h 0.5 v 0"
751 style="display:inline;opacity:1;fill:none;stroke:#3399cc;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
752 transform="translate(-387.41463,-542.5412)" />
753 <path
754 id="path1531"
755 d="m 409.92428,677.14844 54.05634,6.0499"
756 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#3399cc;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
757 transform="translate(-387.41463,-542.5412)" />
758 </g>
759 <g
760 id="g1491"
761 style="display:inline"
762 transform="translate(0,-67.278107)">
763 <ellipse
764 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
765 id="ellipse1431"
766 cx="568.98083"
767 cy="829.24042"
768 rx="4.1581793"
769 ry="4.1593032"
770 transform="translate(-387.41463,-542.5412)" />
771 <ellipse
772 cy="778.67493"
773 cx="588.85413"
774 id="ellipse1433"
775 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
776 rx="4.1581793"
777 ry="4.1593032"
778 transform="translate(-387.41463,-542.5412)" />
779 <ellipse
780 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
781 id="ellipse1435"
782 cx="601.57867"
783 cy="740.67249"
784 rx="4.1581793"
785 ry="4.1593032"
786 transform="translate(-387.41463,-542.5412)" />
787 <ellipse
788 cy="829.24042"
789 cx="525.79852"
790 id="ellipse1437"
791 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
792 rx="4.1581793"
793 ry="4.1593032"
794 transform="translate(-387.41463,-542.5412)" />
795 <ellipse
796 cy="768.71582"
797 cx="557.82654"
798 id="ellipse1439"
799 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
800 rx="4.1581793"
801 ry="4.1593032"
802 transform="translate(-387.41463,-542.5412)" />
803 <ellipse
804 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
805 id="ellipse1441"
806 cx="525.21936"
807 cy="783.02173"
808 rx="4.1581793"
809 ry="4.1593032"
810 transform="translate(-387.41463,-542.5412)" />
811 <ellipse
812 cy="647.34271"
813 cx="400.09586"
814 id="ellipse1443"
815 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
816 rx="4.1581793"
817 ry="4.1593032"
818 transform="translate(-387.41463,-542.5412)" />
819 <ellipse
820 cy="628.31934"
821 cx="450.11285"
822 id="ellipse1445"
823 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
824 rx="4.1581793"
825 ry="4.1593032"
826 transform="translate(-387.41463,-542.5412)" />
827 <ellipse
828 cy="699.45752"
829 cx="622.36951"
830 id="ellipse1447"
831 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
832 rx="4.1581793"
833 ry="4.1593032"
834 transform="translate(-387.41463,-542.5412)" />
835 <ellipse
836 cy="792.29773"
837 cx="547.21771"
838 id="ellipse1449"
839 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
840 rx="4.1581793"
841 ry="4.1593032"
842 transform="translate(-387.41463,-542.5412)" />
843 <ellipse
844 cy="800.12549"
845 cx="566.20697"
846 id="ellipse1451"
847 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
848 rx="4.1581793"
849 ry="4.1593032"
850 transform="translate(-387.41463,-542.5412)" />
851 <ellipse
852 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
853 id="ellipse1453"
854 cx="500.64822"
855 cy="751.63794"
856 rx="4.1581793"
857 ry="4.1593032"
858 transform="translate(-387.41463,-542.5412)" />
859 <ellipse
860 cy="751.72632"
861 cx="533.33447"
862 id="ellipse1455"
863 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
864 rx="4.1581793"
865 ry="4.1593032"
866 transform="translate(-387.41463,-542.5412)" />
867 <ellipse
868 cy="699.83545"
869 cx="450.75012"
870 id="ellipse1457"
871 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
872 rx="4.1581793"
873 ry="4.1593032"
874 transform="translate(-387.41463,-542.5412)" />
875 <ellipse
876 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
877 id="ellipse1459"
878 cx="476.07718"
879 cy="700.59174"
880 rx="4.1581793"
881 ry="4.1593032"
882 transform="translate(-387.41463,-542.5412)" />
883 <ellipse
884 cy="719.65314"
885 cx="521.49146"
886 id="ellipse1461"
887 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
888 rx="4.1581793"
889 ry="4.1593032"
890 transform="translate(-387.41463,-542.5412)" />
891 <ellipse
892 cy="703.87305"
893 cx="500.6362"
894 id="ellipse1463"
895 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
896 rx="4.1581793"
897 ry="4.1593032"
898 transform="translate(-387.41463,-542.5412)" />
899 <ellipse
900 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
901 id="ellipse1465"
902 cx="211.9584"
903 cy="134.28851"
904 rx="4.1581793"
905 ry="4.1593032" />
906 <ellipse
907 cy="713.44794"
908 cx="576.62964"
909 id="ellipse1467"
910 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
911 rx="4.1581793"
912 ry="4.1593032"
913 transform="translate(-387.41463,-542.5412)" />
914 <ellipse
915 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
916 id="ellipse1469"
917 cx="43.166531"
918 cy="123.16669"
919 rx="4.1581793"
920 ry="4.1593032" />
921 <ellipse
922 cy="129.43542"
923 cx="98.865997"
924 id="ellipse1471"
925 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
926 rx="4.1581793"
927 ry="4.1593032" />
928 <ellipse
929 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
930 id="ellipse1473"
931 cx="267.08618"
932 cy="130.05022"
933 rx="4.1581793"
934 ry="4.1593032" />
935 <ellipse
936 cy="686.22339"
937 cx="679.07196"
938 id="ellipse1475"
939 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
940 rx="4.1581793"
941 ry="4.1593032"
942 transform="translate(-387.41463,-542.5412)" />
943 <ellipse
944 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
945 id="ellipse1477"
946 cx="577.00763"
947 cy="748.99109"
948 rx="4.1581793"
949 ry="4.1593032"
950 transform="translate(-387.41463,-542.5412)" />
951 <ellipse
952 cy="748.99109"
953 cx="577.00763"
954 id="ellipse1479"
955 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
956 rx="4.1581793"
957 ry="4.1593032"
958 transform="translate(-387.41463,-542.5412)" />
959 <ellipse
960 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
961 id="ellipse1481"
962 cx="577.07013"
963 cy="748.99109"
964 rx="4.1581793"
965 ry="4.1593032"
966 transform="translate(-387.41463,-542.5412)" />
967 <ellipse
968 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
969 id="ellipse1483"
970 cx="22.887779"
971 cy="133.85095"
972 rx="4.1581793"
973 ry="4.1593032"
974 transform="translate(0,-3e-6)" />
975 <ellipse
976 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
977 id="ellipse1485"
978 cx="462.47165"
979 cy="682.1922"
980 rx="4.1581793"
981 ry="4.1593032"
982 transform="translate(-387.41463,-542.5412)" />
983 <ellipse
984 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
985 id="ellipse1487"
986 cx="694.58264"
987 cy="647.3053"
988 rx="4.1581793"
989 ry="4.1593032"
990 transform="translate(-387.41463,-542.5412)" />
991 <ellipse
992 cy="628.31934"
993 cx="649.61285"
994 id="ellipse1489"
995 style="display:inline;opacity:1;fill:#419edb;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
996 rx="4.1581793"
997 ry="4.1593032"
998 transform="translate(-387.41463,-542.5412)" />
999 </g>
1000 <g
1001 id="g1539"
1002 style="display:inline"
1003 transform="translate(0,-20)">
1004 <ellipse
1005 ry="4.1593032"
1006 rx="4.1581793"
1007 style="display:inline;opacity:1;fill:#3399cc;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1008 id="ellipse1535"
1009 cx="159.80099"
1010 cy="276.32968" />
1011 <ellipse
1012 ry="4.1593032"
1013 rx="4.1581793"
1014 style="display:inline;opacity:1;fill:#3399cc;fill-opacity:1;stroke:#3399cc;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1015 id="ellipse1537"
1016 cx="159.80099"
1017 cy="259.99252" />
1018 </g>
1019 <g
1020 transform="translate(0,-67.278107)"
1021 style="display:none"
1022 id="layer3">
1023 <path
1024 id="path5313"
1025 d="m 62.698223,85.778107 -39.5,48.000003 v 0 l -1,2"
1026 style="fill:none;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" />
1027 <path
1028 id="path5311"
1029 d="m 12.698223,104.77811 10,29 21,-10.5 v 0 0"
1030 style="fill:none;stroke:#cc0000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" />
1031 <path
1032 id="path9316"
1033 d="m 11.809253,105.24526 63.6227,34.91188 23.31802,-11.09978 -35.03955,28.74946 11.86161,-17.77468 -53.18435,-5.79678 40.95076,23.69646 25.32406,0.49689 24.193047,3.02495 v 48.02104 l 21.04995,-32.14943 -20.559,-15.87161 32.52749,48.02104 -8.06937,31.38386 -24.94907,-31.76198 24.94907,77.51429 22.25436,-36.69889 21.97354,37.07701 -43.59987,-0.37188 41.32877,-28.87448 22.05899,-21.17152 -19.90986,50.171 -3.71591,-29.60613 -8.57843,-31.7682 -9.69437,24.71516 54.37611,-52.19866 -24.96716,8.94671 -18.39175,19.15282 18.27579,-55.07718 25.20812,27.362 20.66591,-41.35238 -46.00204,14.12783 22.94304,-37.07431 23.05297,23.0777 31.8814,-26.48075 40.07874,-25.58708 -15.26372,39.20869 -24.69305,-13.74039 -55.05634,4.03119 79.62738,9.58108 -56.57441,12.73416"
1034 style="display:inline;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" />
1035 <path
1036 id="path9318"
1037 d="m 98.868943,129.31358 37.045597,48.02106"
1038 style="display:inline;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" />
1039 <path
1040 id="path12058"
1041 d="m 88.284483,158.4287 10.96248,-29.11512 12.474537,32.51819"
1042 style="display:inline;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" />
1043 <path
1044 id="path12250"
1045 d="m 212.13974,133.78236 54.69043,-3.64603 -31.75647,27.04795"
1046 style="display:inline;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" />
1047 <path
1048 id="path5161"
1049 d="m 399.11285,648.31931 50.5,-19.5 -14.05,28.1 0.925,-1.725 -5.875,11.75 -0.25,-0.75"
1050 style="display:inline;opacity:1;fill:none;fill-opacity:1;stroke:#cc0000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1051 transform="translate(-387.41463,-542.5412)" />
1052 <path
1053 id="path12206"
1054 d="m 601.57854,741.42859 -2.26809,-64.28015"
1055 style="display:inline;opacity:1;fill:#729fcf;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1056 transform="translate(-387.41463,-542.5412)" />
1057 <path
1058 id="path5331"
1059 d="m 189.57322,206.52811 -44,2.625 25.375,17.125 v 0"
1060 style="fill:none;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843" />
1061 <path
1062 id="path9320"
1063 d="m 475.69911,700.21367 24.57107,51.42411"
1064 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1065 transform="translate(-387.41463,-542.5412)" />
1066 <path
1067 id="path9322"
1068 d="m 534.29164,751.63778 12.85257,40.08057"
1069 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1070 transform="translate(-387.41463,-542.5412)" />
1071 <path
1072 id="path9324"
1073 d="m 525.21925,783.02162 0.37803,45.75234"
1074 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1075 transform="translate(-387.41463,-542.5412)" />
1076 <path
1077 id="path9326"
1078 d="m 601.95657,742.56293 -12.09653,36.6775"
1079 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1080 transform="translate(-387.41463,-542.5412)" />
1081 <path
1082 id="path12060"
1083 d="m 475.69911,700.59178 46.98395,22.0278 10.85256,28.26194"
1084 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1085 transform="translate(-387.41463,-542.5412)" />
1086 <path
1087 id="path12208"
1088 d="m 589.104,778.86231 -12.85255,-66.17074 v 36.6775 z"
1089 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.99607843"
1090 transform="translate(-387.41463,-542.5412)" />
1091 <path
1092 id="path12210"
1093 d="m 557.35064,768.27501 31.75336,10.5873"
1094 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.99607843"
1095 transform="translate(-387.41463,-542.5412)" />
1096 <path
1097 id="path12212"
1098 d="m 500.27018,704.37298 v 48.77728 l 24.57105,30.2495 23.81505,9.45293"
1099 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.99607843"
1100 transform="translate(-387.41463,-542.5412)" />
1101 <path
1102 id="path12216"
1103 d="m 524.46323,829.53019 44.98392,-0.37812"
1104 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1105 transform="translate(-387.41463,-542.5412)" />
1106 <path
1107 id="path5163"
1108 d="m 694.61285,647.31931 -40.285,-17.00922 -4.715,-1.99078 29,57.5 v -0.5 0 h 0.5 v 0"
1109 style="display:inline;opacity:1;fill:none;stroke:#cc0000;stroke-width:2.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.99607843"
1110 transform="translate(-387.41463,-542.5412)" />
1111 <path
1112 id="path12214"
1113 d="m 409.92428,677.14844 54.05634,6.0499"
1114 style="display:inline;opacity:1;fill:none;fill-rule:evenodd;stroke:#cc0000;stroke-width:1.58654225px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:0.99607843"
1115 transform="translate(-387.41463,-542.5412)" />
1116 </g>
1117 <g
1118 id="g325"
1119 style="display:none"
1120 transform="translate(0,-67.278107)">
1121 <ellipse
1122 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1123 id="ellipse12254"
1124 cx="568.98083"
1125 cy="829.24042"
1126 rx="4.1581793"
1127 ry="4.1593032"
1128 transform="translate(-387.41463,-542.5412)" />
1129 <ellipse
1130 cy="778.67493"
1131 cx="588.85413"
1132 id="ellipse12290"
1133 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1134 rx="4.1581793"
1135 ry="4.1593032"
1136 transform="translate(-387.41463,-542.5412)" />
1137 <ellipse
1138 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1139 id="ellipse12284"
1140 cx="601.57867"
1141 cy="740.67249"
1142 rx="4.1581793"
1143 ry="4.1593032"
1144 transform="translate(-387.41463,-542.5412)" />
1145 <ellipse
1146 cy="829.24042"
1147 cx="525.79852"
1148 id="ellipse12256"
1149 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1150 rx="4.1581793"
1151 ry="4.1593032"
1152 transform="translate(-387.41463,-542.5412)" />
1153 <ellipse
1154 cy="768.71582"
1155 cx="557.82654"
1156 id="ellipse12306"
1157 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1158 rx="4.1581793"
1159 ry="4.1593032"
1160 transform="translate(-387.41463,-542.5412)" />
1161 <ellipse
1162 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1163 id="ellipse12280"
1164 cx="525.21936"
1165 cy="783.02173"
1166 rx="4.1581793"
1167 ry="4.1593032"
1168 transform="translate(-387.41463,-542.5412)" />
1169 <ellipse
1170 cy="647.34271"
1171 cx="400.09586"
1172 id="ellipse12258"
1173 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1174 rx="4.1581793"
1175 ry="4.1593032"
1176 transform="translate(-387.41463,-542.5412)" />
1177 <ellipse
1178 cy="628.31934"
1179 cx="450.11285"
1180 id="ellipse12258-3"
1181 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1182 rx="4.1581793"
1183 ry="4.1593032"
1184 transform="translate(-387.41463,-542.5412)" />
1185 <ellipse
1186 cy="699.45752"
1187 cx="622.36951"
1188 id="ellipse12294"
1189 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1190 rx="4.1581793"
1191 ry="4.1593032"
1192 transform="translate(-387.41463,-542.5412)" />
1193 <ellipse
1194 cy="792.29773"
1195 cx="547.21771"
1196 id="ellipse12252"
1197 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1198 rx="4.1581793"
1199 ry="4.1593032"
1200 transform="translate(-387.41463,-542.5412)" />
1201 <ellipse
1202 cy="800.12549"
1203 cx="566.20697"
1204 id="ellipse12282"
1205 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1206 rx="4.1581793"
1207 ry="4.1593032"
1208 transform="translate(-387.41463,-542.5412)" />
1209 <ellipse
1210 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1211 id="ellipse12276"
1212 cx="500.64822"
1213 cy="751.63794"
1214 rx="4.1581793"
1215 ry="4.1593032"
1216 transform="translate(-387.41463,-542.5412)" />
1217 <ellipse
1218 cy="751.72632"
1219 cx="533.33447"
1220 id="ellipse12278"
1221 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1222 rx="4.1581793"
1223 ry="4.1593032"
1224 transform="translate(-387.41463,-542.5412)" />
1225 <ellipse
1226 cy="699.83545"
1227 cx="450.75012"
1228 id="ellipse12262"
1229 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1230 rx="4.1581793"
1231 ry="4.1593032"
1232 transform="translate(-387.41463,-542.5412)" />
1233 <ellipse
1234 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1235 id="ellipse12268"
1236 cx="476.07718"
1237 cy="700.59174"
1238 rx="4.1581793"
1239 ry="4.1593032"
1240 transform="translate(-387.41463,-542.5412)" />
1241 <ellipse
1242 cy="719.65314"
1243 cx="521.49146"
1244 id="ellipse12270"
1245 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1246 rx="4.1581793"
1247 ry="4.1593032"
1248 transform="translate(-387.41463,-542.5412)" />
1249 <ellipse
1250 cy="703.87305"
1251 cx="500.6362"
1252 id="ellipse12274"
1253 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1254 rx="4.1581793"
1255 ry="4.1593032"
1256 transform="translate(-387.41463,-542.5412)" />
1257 <ellipse
1258 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1259 id="ellipse12292"
1260 cx="211.9584"
1261 cy="134.28851"
1262 rx="4.1581793"
1263 ry="4.1593032" />
1264 <ellipse
1265 cy="713.44794"
1266 cx="576.62964"
1267 id="ellipse12286"
1268 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1269 rx="4.1581793"
1270 ry="4.1593032"
1271 transform="translate(-387.41463,-542.5412)" />
1272 <ellipse
1273 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1274 id="ellipse12260"
1275 cx="43.166531"
1276 cy="123.16669"
1277 rx="4.1581793"
1278 ry="4.1593032" />
1279 <ellipse
1280 cy="129.43542"
1281 cx="98.865997"
1282 id="ellipse12266"
1283 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1284 rx="4.1581793"
1285 ry="4.1593032" />
1286 <ellipse
1287 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1288 id="ellipse12296"
1289 cx="267.08618"
1290 cy="130.05022"
1291 rx="4.1581793"
1292 ry="4.1593032" />
1293 <ellipse
1294 cy="686.22339"
1295 cx="679.07196"
1296 id="ellipse12298"
1297 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1298 rx="4.1581793"
1299 ry="4.1593032"
1300 transform="translate(-387.41463,-542.5412)" />
1301 <ellipse
1302 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1303 id="ellipse12288"
1304 cx="577.00763"
1305 cy="748.99109"
1306 rx="4.1581793"
1307 ry="4.1593032"
1308 transform="translate(-387.41463,-542.5412)" />
1309 <ellipse
1310 cy="748.99109"
1311 cx="577.00763"
1312 id="ellipse12302"
1313 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1314 rx="4.1581793"
1315 ry="4.1593032"
1316 transform="translate(-387.41463,-542.5412)" />
1317 <ellipse
1318 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1319 id="ellipse12304"
1320 cx="577.07013"
1321 cy="748.99109"
1322 rx="4.1581793"
1323 ry="4.1593032"
1324 transform="translate(-387.41463,-542.5412)" />
1325 <ellipse
1326 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1327 id="ellipse12264"
1328 cx="22.887779"
1329 cy="133.85095"
1330 rx="4.1581793"
1331 ry="4.1593032"
1332 transform="translate(0,-3e-6)" />
1333 <ellipse
1334 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1335 id="ellipse12272"
1336 cx="462.47165"
1337 cy="682.1922"
1338 rx="4.1581793"
1339 ry="4.1593032"
1340 transform="translate(-387.41463,-542.5412)" />
1341 <ellipse
1342 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1343 id="ellipse12300"
1344 cx="694.58264"
1345 cy="647.3053"
1346 rx="4.1581793"
1347 ry="4.1593032"
1348 transform="translate(-387.41463,-542.5412)" />
1349 <ellipse
1350 cy="628.31934"
1351 cx="649.61285"
1352 id="ellipse12258-3-0"
1353 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#cc0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
1354 rx="4.1581793"
1355 ry="4.1593032"
1356 transform="translate(-387.41463,-542.5412)" />
1357 </g>
1358 <g
1359 transform="translate(0,-20)"
1360 style="display:none"
1361 id="layer6">
1362 <ellipse
1363 cy="276.32968"
1364 cx="159.80099"
1365 id="ellipse12282-8-9-0"
1366 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#ee0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.97635139"
1367 rx="4.1581793"
1368 ry="4.1593032" />
1369 <ellipse
1370 cy="259.99252"
1371 cx="159.80099"
1372 id="ellipse12282-8-9"
1373 style="display:inline;opacity:1;fill:#ee0000;fill-opacity:1;stroke:#ee0000;stroke-width:0.39663559;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:0.97635139"
1374 rx="4.1581793"
1375 ry="4.1593032" />
1376 </g>
1377 <g
1378 id="g975"
1379 style="display:inline"
1380 transform="translate(-387.41463,-609.81931)">
1381 <g
1382 id="text973"
1383 style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:16.53852463px;line-height:125%;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;word-spacing:0px;display:inline;opacity:1;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1.03365779px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;image-rendering:auto"
1384 aria-label="gnu net">
1385 <path
1386 id="path977"
1387 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#292929;stroke-width:1.03365779px;fill-opacity:1"
1388 d="m 489.62118,868.96318 q 0,2.375 -0.81641,4.23046 -0.81641,1.85547 -2.30078,3.14193 -1.45964,1.28646 -3.46354,1.95443 -1.97917,0.69271 -4.42839,0.69271 -6.01172,0 -10.26693,-3.63672 l 2.42448,-3.95834 q 3.53776,3.04297 7.84245,3.04297 2.64714,0 4.25521,-1.31119 1.63281,-1.28646 1.63281,-4.0573 v -2.47395 q -1.58333,1.36067 -3.04297,2.02864 -1.45963,0.64323 -3.38932,0.64323 -2.22656,0 -4.13151,-0.9401 -1.90495,-0.94011 -3.29037,-2.54818 -1.36067,-1.63281 -2.15234,-3.78516 -0.76693,-2.15234 -0.76693,-4.57682 0,-2.42448 0.76693,-4.57682 0.79167,-2.17709 2.15234,-3.76042 1.38542,-1.60807 3.29037,-2.52344 1.90495,-0.9401 4.13151,-0.9401 1.92969,0 3.4388,0.66797 1.50912,0.64323 2.99349,1.95442 v -2.07812 h 5.1211 z m -5.1211,-16.67448 q -0.91536,-1.01433 -2.375,-1.53386 -1.43489,-0.54427 -2.79557,-0.54427 -2.89453,0 -4.70052,2.02865 -1.78125,2.02864 -1.78125,5.17057 0,1.55859 0.47005,2.89453 0.49479,1.3112 1.33594,2.27604 0.86588,0.96485 2.05338,1.53386 1.21224,0.54427 2.6224,0.54427 1.36068,0 2.79557,-0.54427 1.45964,-0.56901 2.375,-1.58334 z" />
1389 <path
1390 id="path979"
1391 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#292929;stroke-width:1.03365779px;fill-opacity:1"
1392 d="m 514.82951,869.21057 h -5.12109 v -14.22526 q 0,-2.69661 -1.01433,-3.73568 -1.01432,-1.03906 -2.94401,-1.03906 -2.84505,0 -4.65104,2.30078 -1.78125,2.30078 -1.78125,6.35808 v 10.34114 h -5.12109 v -23.05729 h 5.12109 v 5.78906 q 0.76693,-2.99349 2.84505,-4.65104 2.07813,-1.68229 5.1211,-1.68229 3.53776,0 5.54166,2.30078 2.00391,2.30078 2.00391,7.07552 z" />
1393 <path
1394 id="path981"
1395 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#292929;stroke-width:1.03365779px;fill-opacity:1"
1396 d="m 518.90503,846.15328 h 5.12109 v 14.25 q 0,2.67187 1.01433,3.71094 1.01432,1.03906 2.94401,1.03906 2.82031,0 4.6263,-2.30078 1.80599,-2.30078 1.80599,-6.35807 v -10.34115 h 5.12109 v 23.05729 h -5.12109 v -5.76432 q -0.76693,2.96875 -2.84505,4.65104 -2.07813,1.68229 -5.1211,1.68229 -3.53776,0 -5.54166,-2.30078 -2.00391,-2.32552 -2.00391,-7.07552 z" />
1397 <path
1398 id="path983"
1399 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#292929;stroke-width:1.03365779px;fill-opacity:1"
1400 d="m 575.70451,869.21057 h -5.12109 v -14.22526 q 0,-2.69661 -1.01433,-3.73568 -1.01432,-1.03906 -2.94401,-1.03906 -2.84505,0 -4.65104,2.30078 -1.78125,2.30078 -1.78125,6.35808 v 10.34114 h -5.12109 v -23.05729 h 5.12109 v 5.78906 q 0.76693,-2.99349 2.84505,-4.65104 2.07813,-1.68229 5.1211,-1.68229 3.53776,0 5.54167,2.30078 2.0039,2.30078 2.0039,7.07552 z" />
1401 <path
1402 id="path985"
1403 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#292929;stroke-width:1.03365779px;fill-opacity:1"
1404 d="m 583.76832,859.63635 q 0.37109,2.375 2.2513,3.95834 1.90495,1.55859 5.09635,1.55859 2.4987,0 4.32943,-0.76693 1.85547,-0.79166 3.19141,-2.07812 l 2.62239,3.61198 q -2.22656,2.22656 -4.72526,3.04297 -2.47396,0.8164 -5.41797,0.8164 -2.67187,0 -4.97265,-0.89062 -2.30079,-0.89063 -3.98308,-2.47396 -1.68229,-1.60807 -2.64713,-3.8099 -0.94011,-2.20182 -0.94011,-4.89844 0,-2.62239 0.86589,-4.82421 0.89062,-2.22657 2.47396,-3.83464 1.60807,-1.63281 3.83463,-2.52344 2.22657,-0.91536 4.92318,-0.91536 2.79557,0 5.07161,0.96484 2.27605,0.94011 3.88412,2.7461 1.63281,1.80599 2.54818,4.42838 0.91536,2.59766 0.91536,5.88802 z m 13.53255,-4.5026 q -0.39584,-2.22656 -2.30078,-3.5625 -1.90495,-1.36068 -4.32943,-1.36068 -2.42448,0 -4.35417,1.36068 -1.92968,1.33594 -2.32552,3.5625 z" />
1405 <path
1406 id="path987"
1407 style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:50.66666794px;font-family:'Anonymous Pro';-inkscape-font-specification:'Anonymous Pro Bold';fill:#292929;stroke-width:1.03365779px;fill-opacity:1"
1408 d="m 627.08081,861.86291 q -0.39583,3.63672 -2.86979,5.78907 -2.44922,2.1276 -6.13542,2.1276 -2.02864,0 -3.71094,-0.66797 -1.68229,-0.66797 -2.86979,-1.85547 -1.1875,-1.1875 -1.85547,-2.84505 -0.64322,-1.68229 -0.64322,-3.66146 v -9.97005 h -5.22006 v -4.6263 h 5.22006 v -9.22787 h 5.12109 v 9.22787 h 9.67318 v 4.6263 h -9.67318 v 9.97005 q 0,2.22657 1.08854,3.31511 1.08854,1.08854 2.86979,1.08854 2.17709,0 3.24089,-1.26172 1.0638,-1.26172 1.26172,-3.04297 z" />
1409 </g>
1410 </g>
1411</svg>
diff --git a/contrib/gnunet-arch-full.svg b/contrib/gnunet-arch-full.svg
new file mode 100644
index 000000000..766f2b855
--- /dev/null
+++ b/contrib/gnunet-arch-full.svg
@@ -0,0 +1,648 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3 "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4<!-- Generated by graphviz version 2.38.0 (20140413.2041)
5 -->
6<!-- Title: dependencies Pages: 1 -->
7<svg width="1277pt" height="836pt"
8 viewBox="0.00 0.00 1276.81 836.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 832)">
10<title>dependencies</title>
11<polygon fill="white" stroke="none" points="-4,4 -4,-832 1272.81,-832 1272.81,4 -4,4"/>
12<!-- voting -->
13<g id="node1" class="node"><title>voting</title>
14<polygon fill="none" stroke="black" points="120.944,-743.562 80,-756 39.0559,-743.562 39.0942,-723.438 120.906,-723.438 120.944,-743.562"/>
15<text text-anchor="middle" x="80" y="-734.3" font-family="Times,serif" font-size="14.00">voting</text>
16</g>
17<!-- consensus -->
18<g id="node2" class="node"><title>consensus</title>
19<ellipse fill="none" stroke="black" cx="112" cy="-594" rx="46.2923" ry="18"/>
20<text text-anchor="middle" x="112" y="-590.3" font-family="Times,serif" font-size="14.00">consensus</text>
21</g>
22<!-- voting&#45;&gt;consensus -->
23<g id="edge1" class="edge"><title>voting&#45;&gt;consensus</title>
24<path fill="none" stroke="black" d="M121.028,-728.482C145.315,-721.103 174.155,-707.724 189,-684 197.487,-670.436 196.445,-662.162 189,-648 180.933,-632.654 166.19,-620.887 151.748,-612.383"/>
25<polygon fill="black" stroke="black" points="153.308,-609.247 142.857,-607.508 149.942,-615.385 153.308,-609.247"/>
26</g>
27<!-- identity -->
28<g id="node3" class="node"><title>identity</title>
29<ellipse fill="none" stroke="black" cx="282" cy="-450" rx="37.8943" ry="18"/>
30<text text-anchor="middle" x="282" y="-446.3" font-family="Times,serif" font-size="14.00">identity</text>
31</g>
32<!-- voting&#45;&gt;identity -->
33<g id="edge2" class="edge"><title>voting&#45;&gt;identity</title>
34<path fill="none" stroke="black" d="M58.5145,-723.377C45.8789,-714.02 31.0387,-700.353 24,-684 5.02284,-639.911 -2.50901,-616.016 24,-576 46.6577,-541.798 71.8444,-557.396 109,-540 158.351,-516.894 214.207,-487.564 248.77,-469.032"/>
35<polygon fill="black" stroke="black" points="250.781,-471.924 257.931,-464.105 247.466,-465.759 250.781,-471.924"/>
36</g>
37<!-- cadet -->
38<g id="node4" class="node"><title>cadet</title>
39<ellipse fill="none" stroke="black" cx="538" cy="-450" rx="29.4969" ry="18"/>
40<text text-anchor="middle" x="538" y="-446.3" font-family="Times,serif" font-size="14.00">cadet</text>
41</g>
42<!-- voting&#45;&gt;cadet -->
43<g id="edge3" class="edge"><title>voting&#45;&gt;cadet</title>
44<path fill="none" stroke="black" d="M72.0051,-723.243C55.682,-693.149 22.8306,-620.604 57,-576 70.8829,-557.877 390.653,-484.265 500.977,-459.316"/>
45<polygon fill="black" stroke="black" points="501.999,-462.673 510.983,-457.057 500.458,-455.845 501.999,-462.673"/>
46</g>
47<!-- secretsharing -->
48<g id="node5" class="node"><title>secretsharing</title>
49<ellipse fill="none" stroke="black" cx="123" cy="-666" rx="57.3905" ry="18"/>
50<text text-anchor="middle" x="123" y="-662.3" font-family="Times,serif" font-size="14.00">secretsharing</text>
51</g>
52<!-- voting&#45;&gt;secretsharing -->
53<g id="edge4" class="edge"><title>voting&#45;&gt;secretsharing</title>
54<path fill="none" stroke="black" d="M88.4954,-723.17C93.8716,-714.418 100.986,-702.837 107.357,-692.466"/>
55<polygon fill="black" stroke="black" points="110.45,-694.117 112.702,-683.764 104.486,-690.453 110.45,-694.117"/>
56</g>
57<!-- consensus&#45;&gt;cadet -->
58<g id="edge72" class="edge"><title>consensus&#45;&gt;cadet</title>
59<path fill="none" stroke="black" d="M146.507,-581.905C153.275,-579.85 160.34,-577.79 167,-576 236.135,-557.417 256.193,-562.96 324,-540 360.547,-527.625 367.474,-519.056 403,-504 437.068,-489.562 476.509,-474.236 503.927,-463.798"/>
60<polygon fill="black" stroke="black" points="505.344,-467.004 513.453,-460.185 502.862,-460.459 505.344,-467.004"/>
61</g>
62<!-- set -->
63<g id="node24" class="node"><title>set</title>
64<ellipse fill="none" stroke="black" cx="517" cy="-522" rx="27" ry="18"/>
65<text text-anchor="middle" x="517" y="-518.3" font-family="Times,serif" font-size="14.00">set</text>
66</g>
67<!-- consensus&#45;&gt;set -->
68<g id="edge71" class="edge"><title>consensus&#45;&gt;set</title>
69<path fill="none" stroke="black" d="M145.818,-581.678C152.772,-579.596 160.083,-577.583 167,-576 182.24,-572.511 394.44,-541.075 480.815,-528.33"/>
70<polygon fill="black" stroke="black" points="481.561,-531.758 490.943,-526.837 480.539,-524.833 481.561,-531.758"/>
71</g>
72<!-- dht -->
73<g id="node7" class="node"><title>dht</title>
74<ellipse fill="none" stroke="black" cx="756" cy="-378" rx="27" ry="18"/>
75<text text-anchor="middle" x="756" y="-374.3" font-family="Times,serif" font-size="14.00">dht</text>
76</g>
77<!-- cadet&#45;&gt;dht -->
78<g id="edge51" class="edge"><title>cadet&#45;&gt;dht</title>
79<path fill="none" stroke="black" d="M563.434,-440.833C602.822,-428.186 678.592,-403.856 722.428,-389.78"/>
80<polygon fill="black" stroke="black" points="723.607,-393.078 732.058,-386.688 721.467,-386.413 723.607,-393.078"/>
81</g>
82<!-- core -->
83<g id="node8" class="node"><title>core</title>
84<ellipse fill="none" stroke="black" cx="555" cy="-234" rx="27" ry="18"/>
85<text text-anchor="middle" x="555" y="-230.3" font-family="Times,serif" font-size="14.00">core</text>
86</g>
87<!-- cadet&#45;&gt;core -->
88<g id="edge50" class="edge"><title>cadet&#45;&gt;core</title>
89<path fill="none" stroke="black" d="M539.362,-431.849C542.303,-394.832 549.266,-307.181 552.824,-262.386"/>
90<polygon fill="black" stroke="black" points="556.328,-262.478 553.631,-252.232 549.35,-261.924 556.328,-262.478"/>
91</g>
92<!-- block -->
93<g id="node11" class="node"><title>block</title>
94<polygon fill="none" stroke="black" points="429,-324 385.598,-306 429,-288 472.402,-306 429,-324"/>
95<text text-anchor="middle" x="429" y="-302.3" font-family="Times,serif" font-size="14.00">block</text>
96</g>
97<!-- cadet&#45;&gt;block -->
98<g id="edge52" class="edge"><title>cadet&#45;&gt;block</title>
99<path fill="none" stroke="blue" stroke-dasharray="1,5" d="M522.106,-434.467C511.33,-424.227 497.085,-409.913 486,-396 469.058,-374.736 452.633,-348.272 441.802,-329.75"/>
100<polygon fill="blue" stroke="blue" points="444.702,-327.773 436.674,-320.859 438.638,-331.27 444.702,-327.773"/>
101</g>
102<!-- secretsharing&#45;&gt;consensus -->
103<g id="edge5" class="edge"><title>secretsharing&#45;&gt;consensus</title>
104<path fill="none" stroke="black" d="M120.281,-647.697C119.069,-639.983 117.612,-630.712 116.261,-622.112"/>
105<polygon fill="black" stroke="black" points="119.698,-621.44 114.688,-612.104 112.783,-622.526 119.698,-621.44"/>
106</g>
107<!-- fs -->
108<g id="node6" class="node"><title>fs</title>
109<polygon fill="none" stroke="black" points="100,-527.562 73,-540 46,-527.562 46.0252,-507.438 99.9748,-507.438 100,-527.562"/>
110<text text-anchor="middle" x="73" y="-518.3" font-family="Times,serif" font-size="14.00">fs</text>
111</g>
112<!-- fs&#45;&gt;identity -->
113<g id="edge12" class="edge"><title>fs&#45;&gt;identity</title>
114<path fill="none" stroke="black" d="M100.21,-509.307C104.786,-507.46 109.507,-505.625 114,-504 164.764,-485.643 178.566,-484.387 230,-468 233.971,-466.735 238.108,-465.404 242.237,-464.067"/>
115<polygon fill="black" stroke="black" points="243.351,-467.386 251.778,-460.965 241.186,-460.729 243.351,-467.386"/>
116</g>
117<!-- fs&#45;&gt;cadet -->
118<g id="edge9" class="edge"><title>fs&#45;&gt;cadet</title>
119<path fill="none" stroke="black" d="M100.01,-516.934C178.772,-505.077 408.387,-470.512 499.803,-456.75"/>
120<polygon fill="black" stroke="black" points="500.372,-460.204 509.74,-455.254 499.33,-453.282 500.372,-460.204"/>
121</g>
122<!-- fs&#45;&gt;dht -->
123<g id="edge6" class="edge"><title>fs&#45;&gt;dht</title>
124<path fill="none" stroke="black" d="M100.081,-509.411C132.571,-495.433 183.726,-473.164 192,-468 213.144,-454.802 212.035,-441.688 235,-432 322.67,-395.017 615.27,-383.079 719.081,-379.955"/>
125<polygon fill="black" stroke="black" points="719.199,-383.453 729.093,-379.664 718.996,-376.456 719.199,-383.453"/>
126</g>
127<!-- fs&#45;&gt;core -->
128<g id="edge7" class="edge"><title>fs&#45;&gt;core</title>
129<path fill="none" stroke="black" d="M65.0877,-507.277C55.5997,-488.827 42.6595,-455.618 57,-432 93.0072,-372.699 269.007,-312.27 334,-288 397.135,-264.424 474.404,-248.714 518.841,-240.869"/>
130<polygon fill="black" stroke="black" points="519.614,-244.287 528.871,-239.134 518.42,-237.39 519.614,-244.287"/>
131</g>
132<!-- datastore -->
133<g id="node9" class="node"><title>datastore</title>
134<ellipse fill="none" stroke="black" cx="108" cy="-450" rx="42.4939" ry="18"/>
135<text text-anchor="middle" x="108" y="-446.3" font-family="Times,serif" font-size="14.00">datastore</text>
136</g>
137<!-- fs&#45;&gt;datastore -->
138<g id="edge8" class="edge"><title>fs&#45;&gt;datastore</title>
139<path fill="none" stroke="black" d="M79.9149,-507.17C84.2467,-498.507 89.9645,-487.071 95.1098,-476.78"/>
140<polygon fill="black" stroke="black" points="98.2763,-478.274 99.618,-467.764 92.0153,-475.143 98.2763,-478.274"/>
141</g>
142<!-- ats -->
143<g id="node10" class="node"><title>ats</title>
144<ellipse fill="none" stroke="black" cx="385" cy="-90" rx="27" ry="18"/>
145<text text-anchor="middle" x="385" y="-86.3" font-family="Times,serif" font-size="14.00">ats</text>
146</g>
147<!-- fs&#45;&gt;ats -->
148<g id="edge10" class="edge"><title>fs&#45;&gt;ats</title>
149<path fill="none" stroke="black" d="M60.2844,-507.296C39.3694,-483.267 0,-431.113 0,-379 0,-379 0,-379 0,-233 0,-159.097 252.872,-111.714 348.742,-96.4063"/>
150<polygon fill="black" stroke="black" points="349.504,-99.8296 358.84,-94.8203 348.418,-92.9144 349.504,-99.8296"/>
151</g>
152<!-- fs&#45;&gt;block -->
153<g id="edge11" class="edge"><title>fs&#45;&gt;block</title>
154<path fill="none" stroke="blue" stroke-dasharray="1,5" d="M99.0792,-507.426C116.81,-497.613 140.343,-483.417 159,-468 175.732,-454.174 174.815,-445.258 192,-432 259.224,-380.139 351.062,-338.689 398.245,-319.166"/>
155<polygon fill="blue" stroke="blue" points="399.679,-322.361 407.611,-315.337 397.03,-315.881 399.679,-322.361"/>
156</g>
157<!-- dht&#45;&gt;core -->
158<g id="edge42" class="edge"><title>dht&#45;&gt;core</title>
159<path fill="none" stroke="black" d="M780.722,-370.233C802.496,-362.816 832.877,-348.569 847,-324 854.974,-310.128 857.48,-300.09 847,-288 810.092,-245.421 650.341,-266.908 596,-252 592.628,-251.075 589.164,-249.944 585.745,-248.709"/>
160<polygon fill="black" stroke="black" points="586.936,-245.416 576.348,-245.037 584.388,-251.936 586.936,-245.416"/>
161</g>
162<!-- dht&#45;&gt;block -->
163<g id="edge44" class="edge"><title>dht&#45;&gt;block</title>
164<path fill="none" stroke="black" d="M730.132,-372.774C681.84,-364.697 574.817,-345.908 486,-324 478.104,-322.052 469.673,-319.694 461.782,-317.363"/>
165<polygon fill="black" stroke="black" points="462.742,-313.997 452.157,-314.456 460.718,-320.698 462.742,-313.997"/>
166</g>
167<!-- nse -->
168<g id="node27" class="node"><title>nse</title>
169<ellipse fill="none" stroke="black" cx="811" cy="-306" rx="27" ry="18"/>
170<text text-anchor="middle" x="811" y="-302.3" font-family="Times,serif" font-size="14.00">nse</text>
171</g>
172<!-- dht&#45;&gt;nse -->
173<g id="edge43" class="edge"><title>dht&#45;&gt;nse</title>
174<path fill="none" stroke="black" d="M767.934,-361.811C775.214,-352.546 784.663,-340.52 792.854,-330.094"/>
175<polygon fill="black" stroke="black" points="795.663,-332.185 799.089,-322.159 790.159,-327.86 795.663,-332.185"/>
176</g>
177<!-- datacache -->
178<g id="node28" class="node"><title>datacache</title>
179<polygon fill="none" stroke="black" points="702,-324 637.818,-306 702,-288 766.182,-306 702,-324"/>
180<text text-anchor="middle" x="702" y="-302.3" font-family="Times,serif" font-size="14.00">datacache</text>
181</g>
182<!-- dht&#45;&gt;datacache -->
183<g id="edge45" class="edge"><title>dht&#45;&gt;datacache</title>
184<path fill="none" stroke="black" d="M744.016,-361.465C736.66,-351.93 727.125,-339.57 718.998,-329.034"/>
185<polygon fill="black" stroke="black" points="721.73,-326.846 712.851,-321.066 716.187,-331.121 721.73,-326.846"/>
186</g>
187<!-- peerinfo -->
188<g id="node29" class="node"><title>peerinfo</title>
189<ellipse fill="none" stroke="black" cx="518" cy="-90" rx="40.0939" ry="18"/>
190<text text-anchor="middle" x="518" y="-86.3" font-family="Times,serif" font-size="14.00">peerinfo</text>
191</g>
192<!-- dht&#45;&gt;peerinfo -->
193<g id="edge46" class="edge"><title>dht&#45;&gt;peerinfo</title>
194<path fill="none" stroke="black" d="M728.828,-376.457C687.438,-374.282 608.033,-364.658 557,-324 495.436,-274.952 504.26,-168.494 512.535,-118.27"/>
195<polygon fill="black" stroke="black" points="516.027,-118.624 514.32,-108.168 509.133,-117.406 516.027,-118.624"/>
196</g>
197<!-- hello -->
198<g id="node30" class="node"><title>hello</title>
199<polygon fill="none" stroke="black" points="854,-36 813.614,-18 854,-3.55271e-15 894.386,-18 854,-36"/>
200<text text-anchor="middle" x="854" y="-14.3" font-family="Times,serif" font-size="14.00">hello</text>
201</g>
202<!-- dht&#45;&gt;hello -->
203<g id="edge47" class="edge"><title>dht&#45;&gt;hello</title>
204<path fill="none" stroke="black" d="M782.364,-373.864C833.24,-367.278 942.225,-350.399 968,-324 996.322,-294.992 988,-275.542 988,-235 988,-235 988,-235 988,-161 988,-99.7534 921.245,-54.2239 881.968,-32.736"/>
205<polygon fill="black" stroke="black" points="883.108,-29.3792 872.632,-27.796 879.834,-35.5665 883.108,-29.3792"/>
206</g>
207<!-- transport -->
208<g id="node33" class="node"><title>transport</title>
209<ellipse fill="none" stroke="black" cx="680" cy="-162" rx="42.4939" ry="18"/>
210<text text-anchor="middle" x="680" y="-158.3" font-family="Times,serif" font-size="14.00">transport</text>
211</g>
212<!-- core&#45;&gt;transport -->
213<g id="edge58" class="edge"><title>core&#45;&gt;transport</title>
214<path fill="none" stroke="black" d="M575.083,-221.753C594.251,-211.02 623.495,-194.643 646.244,-181.903"/>
215<polygon fill="black" stroke="black" points="648.219,-184.809 655.234,-176.869 644.799,-178.701 648.219,-184.809"/>
216</g>
217<!-- exit -->
218<g id="node12" class="node"><title>exit</title>
219<polygon fill="none" stroke="black" points="952,-540 898,-540 898,-504 952,-504 952,-540"/>
220<text text-anchor="middle" x="925" y="-518.3" font-family="Times,serif" font-size="14.00">exit</text>
221</g>
222<!-- exit&#45;&gt;cadet -->
223<g id="edge13" class="edge"><title>exit&#45;&gt;cadet</title>
224<path fill="none" stroke="black" d="M897.67,-514.323C883.742,-511.021 866.513,-507.093 851,-504 752.337,-484.331 635.236,-465.765 576.155,-456.729"/>
225<polygon fill="black" stroke="black" points="576.571,-453.252 566.158,-455.206 575.517,-460.172 576.571,-453.252"/>
226</g>
227<!-- tun -->
228<g id="node13" class="node"><title>tun</title>
229<polygon fill="none" stroke="black" points="929,-468 897.995,-450 929,-432 960.005,-450 929,-468"/>
230<text text-anchor="middle" x="929" y="-446.3" font-family="Times,serif" font-size="14.00">tun</text>
231</g>
232<!-- exit&#45;&gt;tun -->
233<g id="edge14" class="edge"><title>exit&#45;&gt;tun</title>
234<path fill="none" stroke="black" d="M925.989,-503.697C926.436,-495.868 926.975,-486.435 927.473,-477.728"/>
235<polygon fill="black" stroke="black" points="930.974,-477.806 928.05,-467.622 923.985,-477.406 930.974,-477.806"/>
236</g>
237<!-- dnsstub -->
238<g id="node14" class="node"><title>dnsstub</title>
239<polygon fill="none" stroke="black" points="1032,-468 978.877,-450 1032,-432 1085.12,-450 1032,-468"/>
240<text text-anchor="middle" x="1032" y="-446.3" font-family="Times,serif" font-size="14.00">dnsstub</text>
241</g>
242<!-- exit&#45;&gt;dnsstub -->
243<g id="edge15" class="edge"><title>exit&#45;&gt;dnsstub</title>
244<path fill="none" stroke="black" d="M951.175,-503.876C967.88,-492.948 989.443,-478.841 1006.1,-467.947"/>
245<polygon fill="black" stroke="black" points="1008.33,-470.67 1014.78,-462.266 1004.49,-464.812 1008.33,-470.67"/>
246</g>
247<!-- vpn -->
248<g id="node15" class="node"><title>vpn</title>
249<ellipse fill="none" stroke="black" cx="815" cy="-522" rx="27" ry="18"/>
250<text text-anchor="middle" x="815" y="-518.3" font-family="Times,serif" font-size="14.00">vpn</text>
251</g>
252<!-- vpn&#45;&gt;cadet -->
253<g id="edge16" class="edge"><title>vpn&#45;&gt;cadet</title>
254<path fill="none" stroke="black" d="M793.129,-511.116C787.017,-508.578 780.317,-506.003 774,-504 705.524,-482.293 623.185,-465.931 576.085,-457.463"/>
255<polygon fill="black" stroke="black" points="576.482,-453.979 566.025,-455.678 575.26,-460.871 576.482,-453.979"/>
256</g>
257<!-- vpn&#45;&gt;tun -->
258<g id="edge18" class="edge"><title>vpn&#45;&gt;tun</title>
259<path fill="none" stroke="black" d="M834.339,-509.125C854.149,-496.961 884.945,-478.051 905.995,-465.126"/>
260<polygon fill="black" stroke="black" points="907.942,-468.038 914.632,-459.822 904.279,-462.072 907.942,-468.038"/>
261</g>
262<!-- regex -->
263<g id="node16" class="node"><title>regex</title>
264<ellipse fill="none" stroke="black" cx="756" cy="-450" rx="30.5947" ry="18"/>
265<text text-anchor="middle" x="756" y="-446.3" font-family="Times,serif" font-size="14.00">regex</text>
266</g>
267<!-- vpn&#45;&gt;regex -->
268<g id="edge17" class="edge"><title>vpn&#45;&gt;regex</title>
269<path fill="none" stroke="black" d="M802.198,-505.811C794.496,-496.673 784.53,-484.849 775.827,-474.524"/>
270<polygon fill="black" stroke="black" points="778.307,-472.035 769.186,-466.644 772.954,-476.546 778.307,-472.035"/>
271</g>
272<!-- regex&#45;&gt;dht -->
273<g id="edge57" class="edge"><title>regex&#45;&gt;dht</title>
274<path fill="none" stroke="black" d="M756,-431.697C756,-423.983 756,-414.712 756,-406.112"/>
275<polygon fill="black" stroke="black" points="759.5,-406.104 756,-396.104 752.5,-406.104 759.5,-406.104"/>
276</g>
277<!-- regex&#45;&gt;block -->
278<g id="edge49" class="edge"><title>regex&#45;&gt;block</title>
279<path fill="none" stroke="blue" stroke-dasharray="1,5" d="M732.22,-438.673C673.767,-413.29 523.157,-347.888 458.838,-319.957"/>
280<polygon fill="blue" stroke="blue" points="459.85,-316.581 449.283,-315.808 457.061,-323.002 459.85,-316.581"/>
281</g>
282<!-- pt -->
283<g id="node17" class="node"><title>pt</title>
284<polygon fill="none" stroke="black" points="986,-599.562 959,-612 932,-599.562 932.025,-579.438 985.975,-579.438 986,-599.562"/>
285<text text-anchor="middle" x="959" y="-590.3" font-family="Times,serif" font-size="14.00">pt</text>
286</g>
287<!-- pt&#45;&gt;cadet -->
288<g id="edge19" class="edge"><title>pt&#45;&gt;cadet</title>
289<path fill="none" stroke="black" d="M931.717,-579.439C928.807,-578.197 925.864,-577.023 923,-576 860.875,-553.809 836.841,-571.725 779,-540 758.602,-528.812 761.339,-515.294 741,-504 688.34,-474.76 619.008,-461.18 576.516,-455.23"/>
290<polygon fill="black" stroke="black" points="576.951,-451.758 566.577,-453.91 576.029,-458.697 576.951,-451.758"/>
291</g>
292<!-- pt&#45;&gt;vpn -->
293<g id="edge20" class="edge"><title>pt&#45;&gt;vpn</title>
294<path fill="none" stroke="black" d="M931.915,-579.834C907.352,-567.894 871.179,-550.309 845.585,-537.868"/>
295<polygon fill="black" stroke="black" points="846.864,-534.598 836.34,-533.373 843.803,-540.893 846.864,-534.598"/>
296</g>
297<!-- dns -->
298<g id="node18" class="node"><title>dns</title>
299<ellipse fill="none" stroke="black" cx="997" cy="-522" rx="27" ry="18"/>
300<text text-anchor="middle" x="997" y="-518.3" font-family="Times,serif" font-size="14.00">dns</text>
301</g>
302<!-- pt&#45;&gt;dns -->
303<g id="edge21" class="edge"><title>pt&#45;&gt;dns</title>
304<path fill="none" stroke="black" d="M966.508,-579.17C971.277,-570.385 977.594,-558.748 983.241,-548.346"/>
305<polygon fill="black" stroke="black" points="986.48,-549.716 988.175,-539.257 980.328,-546.376 986.48,-549.716"/>
306</g>
307<!-- dnsparser -->
308<g id="node19" class="node"><title>dnsparser</title>
309<polygon fill="none" stroke="black" points="1143,-540 1080.49,-522 1143,-504 1205.51,-522 1143,-540"/>
310<text text-anchor="middle" x="1143" y="-518.3" font-family="Times,serif" font-size="14.00">dnsparser</text>
311</g>
312<!-- pt&#45;&gt;dnsparser -->
313<g id="edge22" class="edge"><title>pt&#45;&gt;dnsparser</title>
314<path fill="none" stroke="black" d="M986.15,-582.671C1018.5,-570.365 1072.61,-549.781 1108.05,-536.296"/>
315<polygon fill="black" stroke="black" points="1109.42,-539.521 1117.52,-532.694 1106.93,-532.979 1109.42,-539.521"/>
316</g>
317<!-- dns&#45;&gt;tun -->
318<g id="edge23" class="edge"><title>dns&#45;&gt;tun</title>
319<path fill="none" stroke="black" d="M982.91,-506.496C972.543,-495.824 958.362,-481.226 947.147,-469.681"/>
320<polygon fill="black" stroke="black" points="949.418,-466.995 939.94,-462.261 944.397,-471.873 949.418,-466.995"/>
321</g>
322<!-- dns&#45;&gt;dnsstub -->
323<g id="edge24" class="edge"><title>dns&#45;&gt;dnsstub</title>
324<path fill="none" stroke="black" d="M1005.12,-504.765C1009.59,-495.828 1015.21,-484.573 1020.16,-474.673"/>
325<polygon fill="black" stroke="black" points="1023.3,-476.227 1024.64,-465.717 1017.04,-473.096 1023.3,-476.227"/>
326</g>
327<!-- gnsrecord -->
328<g id="node25" class="node"><title>gnsrecord</title>
329<ellipse fill="none" stroke="black" cx="1192" cy="-450" rx="45.4919" ry="18"/>
330<text text-anchor="middle" x="1192" y="-446.3" font-family="Times,serif" font-size="14.00">gnsrecord</text>
331</g>
332<!-- dnsparser&#45;&gt;gnsrecord -->
333<g id="edge39" class="edge"><title>dnsparser&#45;&gt;gnsrecord</title>
334<path fill="none" stroke="blue" stroke-dasharray="1,5" d="M1152.92,-506.834C1159.12,-497.971 1167.29,-486.304 1174.55,-475.928"/>
335<polygon fill="blue" stroke="blue" points="1177.51,-477.805 1180.38,-467.606 1171.77,-473.791 1177.51,-477.805"/>
336</g>
337<!-- zonemaster -->
338<g id="node20" class="node"><title>zonemaster</title>
339<polygon fill="none" stroke="black" points="914.433,-599.562 851,-612 787.567,-599.562 787.626,-579.438 914.374,-579.438 914.433,-599.562"/>
340<text text-anchor="middle" x="851" y="-590.3" font-family="Times,serif" font-size="14.00">zonemaster</text>
341</g>
342<!-- zonemaster&#45;&gt;dht -->
343<g id="edge26" class="edge"><title>zonemaster&#45;&gt;dht</title>
344<path fill="none" stroke="black" d="M853.642,-579.298C856.499,-561.438 859.583,-529.479 851,-504 836.849,-461.994 802.343,-422.916 779.052,-399.996"/>
345<polygon fill="black" stroke="black" points="781.264,-397.267 771.628,-392.861 776.413,-402.314 781.264,-397.267"/>
346</g>
347<!-- namestore -->
348<g id="node21" class="node"><title>namestore</title>
349<ellipse fill="none" stroke="black" cx="685" cy="-522" rx="47.3916" ry="18"/>
350<text text-anchor="middle" x="685" y="-518.3" font-family="Times,serif" font-size="14.00">namestore</text>
351</g>
352<!-- zonemaster&#45;&gt;namestore -->
353<g id="edge25" class="edge"><title>zonemaster&#45;&gt;namestore</title>
354<path fill="none" stroke="black" d="M818.599,-579.337C791.812,-568.041 753.653,-551.95 724.971,-539.855"/>
355<polygon fill="black" stroke="black" points="726.212,-536.58 715.637,-535.919 723.492,-543.03 726.212,-536.58"/>
356</g>
357<!-- namestore&#45;&gt;identity -->
358<g id="edge37" class="edge"><title>namestore&#45;&gt;identity</title>
359<path fill="none" stroke="black" d="M642.634,-513.641C566.046,-500.338 405.247,-472.408 326.867,-458.793"/>
360<polygon fill="black" stroke="black" points="327.275,-455.312 316.823,-457.049 326.077,-462.208 327.275,-455.312"/>
361</g>
362<!-- namestore&#45;&gt;gnsrecord -->
363<g id="edge38" class="edge"><title>namestore&#45;&gt;gnsrecord</title>
364<path fill="none" stroke="black" d="M726.085,-512.971C742.503,-509.919 761.609,-506.564 779,-504 918.405,-483.451 954.522,-488.05 1094,-468 1109.42,-465.784 1126.13,-463.019 1141.32,-460.368"/>
365<polygon fill="black" stroke="black" points="1142.32,-463.746 1151.56,-458.558 1141.1,-456.853 1142.32,-463.746"/>
366</g>
367<!-- gns -->
368<g id="node22" class="node"><title>gns</title>
369<ellipse fill="none" stroke="black" cx="850" cy="-666" rx="27" ry="18"/>
370<text text-anchor="middle" x="850" y="-662.3" font-family="Times,serif" font-size="14.00">gns</text>
371</g>
372<!-- gns&#45;&gt;identity -->
373<g id="edge34" class="edge"><title>gns&#45;&gt;identity</title>
374<path fill="none" stroke="black" d="M823.048,-663.899C740.091,-660.169 489.801,-646.281 417,-612 395.952,-602.089 396.543,-591.28 379,-576 359.686,-559.178 350.742,-559.383 334,-540 317.464,-520.856 303.335,-495.717 293.996,-477.041"/>
375<polygon fill="black" stroke="black" points="297.085,-475.39 289.562,-467.93 290.791,-478.453 297.085,-475.39"/>
376</g>
377<!-- gns&#45;&gt;dht -->
378<g id="edge28" class="edge"><title>gns&#45;&gt;dht</title>
379<path fill="none" stroke="black" d="M870.511,-653.985C875.467,-651.699 880.829,-649.525 886,-648 1002.11,-613.746 1046.93,-664.524 1156,-612 1236.59,-573.194 1305.75,-498.559 1246,-432 1215.85,-398.416 902.601,-384.19 793.343,-380.225"/>
380<polygon fill="black" stroke="black" points="793.243,-376.719 783.125,-379.863 792.995,-383.715 793.243,-376.719"/>
381</g>
382<!-- gns&#45;&gt;block -->
383<g id="edge29" class="edge"><title>gns&#45;&gt;block</title>
384<path fill="none" stroke="blue" stroke-dasharray="1,5" d="M822.824,-664.872C770.707,-663.582 654.321,-655.598 569,-612 548.284,-601.414 548.925,-590.83 531,-576 509.902,-558.544 496.079,-562.857 481,-540 438.212,-475.142 430.206,-380.324 428.985,-334.208"/>
385<polygon fill="blue" stroke="blue" points="432.483,-334.033 428.808,-324.096 425.484,-334.156 432.483,-334.033"/>
386</g>
387<!-- gns&#45;&gt;dnsstub -->
388<g id="edge33" class="edge"><title>gns&#45;&gt;dnsstub</title>
389<path fill="none" stroke="black" d="M871.065,-654.325C875.905,-652.077 881.078,-649.834 886,-648 941.778,-627.217 973.486,-654.658 1015,-612 1049.82,-576.222 1044.5,-512.583 1037.99,-476.971"/>
390<polygon fill="black" stroke="black" points="1041.36,-476 1035.97,-466.88 1034.5,-477.373 1041.36,-476"/>
391</g>
392<!-- gns&#45;&gt;vpn -->
393<g id="edge31" class="edge"><title>gns&#45;&gt;vpn</title>
394<path fill="none" stroke="black" d="M827.858,-655.35C811.041,-646.688 789.135,-632.213 779,-612 768.086,-590.233 781.353,-564.325 794.756,-546.091"/>
395<polygon fill="black" stroke="black" points="797.832,-547.84 801.242,-537.808 792.321,-543.524 797.832,-547.84"/>
396</g>
397<!-- gns&#45;&gt;dns -->
398<g id="edge27" class="edge"><title>gns&#45;&gt;dns</title>
399<path fill="none" stroke="black" d="M871.13,-654.496C875.967,-652.239 881.122,-649.949 886,-648 933.377,-629.072 964.65,-653.009 995,-612 1008.03,-594.39 1007.25,-568.995 1003.95,-549.835"/>
400<polygon fill="black" stroke="black" points="1007.35,-549.022 1001.93,-539.921 1000.49,-550.418 1007.35,-549.022"/>
401</g>
402<!-- gns&#45;&gt;dnsparser -->
403<g id="edge32" class="edge"><title>gns&#45;&gt;dnsparser</title>
404<path fill="none" stroke="black" d="M870.586,-654.227C875.54,-651.931 880.881,-649.692 886,-648 963.461,-622.391 995.505,-653.066 1066,-612 1093.37,-596.054 1115.84,-566.774 1129.29,-546.163"/>
405<polygon fill="black" stroke="black" points="1132.29,-547.978 1134.66,-537.654 1126.37,-544.243 1132.29,-547.978"/>
406</g>
407<!-- revocation -->
408<g id="node23" class="node"><title>revocation</title>
409<ellipse fill="none" stroke="black" cx="474" cy="-594" rx="48.1917" ry="18"/>
410<text text-anchor="middle" x="474" y="-590.3" font-family="Times,serif" font-size="14.00">revocation</text>
411</g>
412<!-- gns&#45;&gt;revocation -->
413<g id="edge30" class="edge"><title>gns&#45;&gt;revocation</title>
414<path fill="none" stroke="black" d="M823.776,-661.482C769.658,-654.024 641.808,-635.374 536,-612 531.019,-610.9 525.841,-609.65 520.694,-608.34"/>
415<polygon fill="black" stroke="black" points="521.456,-604.922 510.895,-605.77 519.68,-611.693 521.456,-604.922"/>
416</g>
417<!-- gns&#45;&gt;gnsrecord -->
418<g id="edge41" class="edge"><title>gns&#45;&gt;gnsrecord</title>
419<path fill="none" stroke="black" d="M870.549,-654.113C875.504,-651.822 880.856,-649.613 886,-648 978.027,-619.137 1009.84,-646.249 1100,-612 1156.37,-590.587 1185.79,-592.754 1215,-540 1225.98,-520.174 1217.7,-494.957 1208.15,-476.431"/>
420<polygon fill="black" stroke="black" points="1211.2,-474.717 1203.29,-467.672 1205.08,-478.114 1211.2,-474.717"/>
421</g>
422<!-- revocation&#45;&gt;core -->
423<g id="edge35" class="edge"><title>revocation&#45;&gt;core</title>
424<path fill="none" stroke="black" d="M447.586,-578.755C410.639,-556.683 348,-510.49 348,-451 348,-451 348,-451 348,-377 348,-335.398 347.208,-317.038 377,-288 415.046,-250.916 477.859,-239.613 517.794,-236.267"/>
425<polygon fill="black" stroke="black" points="518.191,-239.747 527.918,-235.547 517.695,-232.765 518.191,-239.747"/>
426</g>
427<!-- revocation&#45;&gt;set -->
428<g id="edge36" class="edge"><title>revocation&#45;&gt;set</title>
429<path fill="none" stroke="black" d="M484.409,-576.055C489.683,-567.469 496.183,-556.888 501.987,-547.439"/>
430<polygon fill="black" stroke="black" points="505.024,-549.182 507.276,-538.829 499.06,-545.518 505.024,-549.182"/>
431</g>
432<!-- set&#45;&gt;cadet -->
433<g id="edge75" class="edge"><title>set&#45;&gt;cadet</title>
434<path fill="none" stroke="black" d="M522.084,-504.055C524.482,-496.059 527.401,-486.331 530.08,-477.4"/>
435<polygon fill="black" stroke="black" points="533.442,-478.373 532.963,-467.789 526.737,-476.362 533.442,-478.373"/>
436</g>
437<!-- conversation -->
438<g id="node26" class="node"><title>conversation</title>
439<polygon fill="none" stroke="black" points="1017.18,-743.562 948,-756 878.82,-743.562 878.884,-723.438 1017.12,-723.438 1017.18,-743.562"/>
440<text text-anchor="middle" x="948" y="-734.3" font-family="Times,serif" font-size="14.00">conversation</text>
441</g>
442<!-- conversation&#45;&gt;cadet -->
443<g id="edge53" class="edge"><title>conversation&#45;&gt;cadet</title>
444<path fill="none" stroke="black" d="M900.537,-723.335C873.864,-714.435 840.677,-701.257 814,-684 756.206,-646.615 759.329,-615.558 703,-576 673.069,-554.981 658.318,-561.866 629,-540 611.601,-527.024 611.36,-519.336 596,-504 585.077,-493.094 572.479,-481.475 561.82,-471.903"/>
445<polygon fill="black" stroke="black" points="563.901,-469.069 554.107,-465.028 559.243,-474.295 563.901,-469.069"/>
446</g>
447<!-- conversation&#45;&gt;gns -->
448<g id="edge54" class="edge"><title>conversation&#45;&gt;gns</title>
449<path fill="none" stroke="black" d="M928.638,-723.17C913.533,-712.381 892.408,-697.291 875.857,-685.469"/>
450<polygon fill="black" stroke="black" points="877.846,-682.589 867.674,-679.625 873.777,-688.285 877.846,-682.589"/>
451</g>
452<!-- conversation&#45;&gt;gnsrecord -->
453<g id="edge40" class="edge"><title>conversation&#45;&gt;gnsrecord</title>
454<path fill="none" stroke="blue" stroke-dasharray="1,5" d="M1017.21,-728.51C1076.25,-719.968 1155.24,-705.041 1179,-684 1241.33,-628.786 1256.97,-583.117 1231,-504 1227.58,-493.58 1221.24,-483.522 1214.65,-475.019"/>
455<polygon fill="blue" stroke="blue" points="1217.15,-472.551 1208.08,-467.08 1211.76,-477.015 1217.15,-472.551"/>
456</g>
457<!-- speaker -->
458<g id="node31" class="node"><title>speaker</title>
459<polygon fill="none" stroke="black" points="948,-684 894.877,-666 948,-648 1001.12,-666 948,-684"/>
460<text text-anchor="middle" x="948" y="-662.3" font-family="Times,serif" font-size="14.00">speaker</text>
461</g>
462<!-- conversation&#45;&gt;speaker -->
463<g id="edge55" class="edge"><title>conversation&#45;&gt;speaker</title>
464<path fill="none" stroke="black" d="M948,-723.17C948,-714.919 948,-704.153 948,-694.256"/>
465<polygon fill="black" stroke="black" points="951.5,-694.019 948,-684.019 944.5,-694.019 951.5,-694.019"/>
466</g>
467<!-- microphone -->
468<g id="node32" class="node"><title>microphone</title>
469<polygon fill="none" stroke="black" points="1095,-684 1019.76,-666 1095,-648 1170.24,-666 1095,-684"/>
470<text text-anchor="middle" x="1095" y="-662.3" font-family="Times,serif" font-size="14.00">microphone</text>
471</g>
472<!-- conversation&#45;&gt;microphone -->
473<g id="edge56" class="edge"><title>conversation&#45;&gt;microphone</title>
474<path fill="none" stroke="black" d="M976.692,-723.337C1001.14,-711.695 1036.29,-694.958 1061.92,-682.753"/>
475<polygon fill="black" stroke="black" points="1063.71,-685.777 1071.23,-678.318 1060.7,-679.457 1063.71,-685.777"/>
476</g>
477<!-- nse&#45;&gt;core -->
478<g id="edge48" class="edge"><title>nse&#45;&gt;core</title>
479<path fill="none" stroke="black" d="M790.412,-294.231C785.459,-291.935 780.118,-289.695 775,-288 697.966,-262.487 673.625,-275.652 596,-252 592.83,-251.034 589.569,-249.913 586.336,-248.716"/>
480<polygon fill="black" stroke="black" points="587.428,-245.385 576.841,-244.978 584.864,-251.899 587.428,-245.385"/>
481</g>
482<!-- peerinfo&#45;&gt;hello -->
483<g id="edge76" class="edge"><title>peerinfo&#45;&gt;hello</title>
484<path fill="none" stroke="black" d="M548.194,-77.9517C554.676,-75.8006 561.524,-73.6914 568,-72 654.752,-49.3407 758.747,-32.6176 814.333,-24.4966"/>
485<polygon fill="black" stroke="black" points="815.063,-27.9277 824.46,-23.0344 814.062,-20.9995 815.063,-27.9277"/>
486</g>
487<!-- transport&#45;&gt;ats -->
488<g id="edge66" class="edge"><title>transport&#45;&gt;ats</title>
489<path fill="none" stroke="black" d="M644.122,-152.487C587.168,-138.972 476.742,-112.769 420.21,-99.3548"/>
490<polygon fill="black" stroke="black" points="420.844,-95.9082 410.306,-97.0048 419.228,-102.719 420.844,-95.9082"/>
491</g>
492<!-- transport&#45;&gt;peerinfo -->
493<g id="edge68" class="edge"><title>transport&#45;&gt;peerinfo</title>
494<path fill="none" stroke="black" d="M651.411,-148.647C624.725,-137.116 584.738,-119.837 555.501,-107.204"/>
495<polygon fill="black" stroke="black" points="556.601,-103.867 546.033,-103.113 553.824,-110.292 556.601,-103.867"/>
496</g>
497<!-- transport&#45;&gt;hello -->
498<g id="edge67" class="edge"><title>transport&#45;&gt;hello</title>
499<path fill="none" stroke="black" d="M721.405,-157.922C756.719,-153.037 806.213,-140.439 835,-108 850.042,-91.0495 854.193,-65.1533 854.935,-45.6573"/>
500<polygon fill="black" stroke="black" points="858.435,-45.6195 855.044,-35.5822 851.436,-45.5437 858.435,-45.6195"/>
501</g>
502<!-- nat -->
503<g id="node36" class="node"><title>nat</title>
504<polygon fill="none" stroke="black" points="796,-108 765.835,-90 796,-72 826.165,-90 796,-108"/>
505<text text-anchor="middle" x="796" y="-86.3" font-family="Times,serif" font-size="14.00">nat</text>
506</g>
507<!-- transport&#45;&gt;nat -->
508<g id="edge69" class="edge"><title>transport&#45;&gt;nat</title>
509<path fill="none" stroke="black" d="M703.474,-146.834C723.706,-134.626 752.749,-117.1 772.878,-104.953"/>
510<polygon fill="black" stroke="black" points="774.946,-107.793 781.7,-99.6294 771.33,-101.799 774.946,-107.793"/>
511</g>
512<!-- fragmentation -->
513<g id="node37" class="node"><title>fragmentation</title>
514<polygon fill="none" stroke="black" points="662,-108 576.537,-90 662,-72 747.463,-90 662,-108"/>
515<text text-anchor="middle" x="662" y="-86.3" font-family="Times,serif" font-size="14.00">fragmentation</text>
516</g>
517<!-- transport&#45;&gt;fragmentation -->
518<g id="edge70" class="edge"><title>transport&#45;&gt;fragmentation</title>
519<path fill="none" stroke="black" d="M675.643,-144.055C673.556,-135.941 671.011,-126.044 668.687,-117.006"/>
520<polygon fill="black" stroke="black" points="672.073,-116.12 666.193,-107.307 665.294,-117.864 672.073,-116.12"/>
521</g>
522<!-- topology -->
523<g id="node34" class="node"><title>topology</title>
524<polygon fill="none" stroke="black" points="959.5,-324 894.5,-324 894.5,-288 959.5,-288 959.5,-324"/>
525<text text-anchor="middle" x="927" y="-302.3" font-family="Times,serif" font-size="14.00">topology</text>
526</g>
527<!-- topology&#45;&gt;core -->
528<g id="edge61" class="edge"><title>topology&#45;&gt;core</title>
529<path fill="none" stroke="black" d="M894.413,-292.17C889.63,-290.593 884.724,-289.139 880,-288 756.312,-258.18 718.97,-284.656 596,-252 592.621,-251.103 589.151,-249.989 585.73,-248.765"/>
530<polygon fill="black" stroke="black" points="586.918,-245.471 576.329,-245.106 584.379,-251.995 586.918,-245.471"/>
531</g>
532<!-- topology&#45;&gt;peerinfo -->
533<g id="edge59" class="edge"><title>topology&#45;&gt;peerinfo</title>
534<path fill="none" stroke="black" d="M894.233,-295.354C862.315,-285.612 812.655,-269.532 771,-252 705.781,-224.55 688.475,-218.336 629,-180 597.704,-159.827 564.778,-132.553 542.992,-113.534"/>
535<polygon fill="black" stroke="black" points="545.032,-110.666 535.215,-106.682 540.404,-115.919 545.032,-110.666"/>
536</g>
537<!-- topology&#45;&gt;hello -->
538<g id="edge62" class="edge"><title>topology&#45;&gt;hello</title>
539<path fill="none" stroke="black" d="M922.652,-287.966C910.314,-239.626 875.032,-101.398 860.438,-44.2243"/>
540<polygon fill="black" stroke="black" points="863.829,-43.3557 857.964,-34.532 857.046,-45.087 863.829,-43.3557"/>
541</g>
542<!-- topology&#45;&gt;transport -->
543<g id="edge60" class="edge"><title>topology&#45;&gt;transport</title>
544<path fill="none" stroke="black" d="M897.206,-287.871C850.798,-261.191 761.564,-209.891 713.17,-182.069"/>
545<polygon fill="black" stroke="black" points="714.758,-178.945 704.344,-176.995 711.269,-185.014 714.758,-178.945"/>
546</g>
547<!-- hostlist -->
548<g id="node35" class="node"><title>hostlist</title>
549<polygon fill="none" stroke="black" points="214,-324 158,-324 158,-288 214,-288 214,-324"/>
550<text text-anchor="middle" x="186" y="-302.3" font-family="Times,serif" font-size="14.00">hostlist</text>
551</g>
552<!-- hostlist&#45;&gt;core -->
553<g id="edge63" class="edge"><title>hostlist&#45;&gt;core</title>
554<path fill="none" stroke="black" d="M214.167,-292.599C218.733,-290.88 223.455,-289.271 228,-288 330.933,-259.219 456.746,-244.294 517.975,-238.275"/>
555<polygon fill="black" stroke="black" points="518.666,-241.725 528.286,-237.286 517.998,-234.757 518.666,-241.725"/>
556</g>
557<!-- hostlist&#45;&gt;peerinfo -->
558<g id="edge64" class="edge"><title>hostlist&#45;&gt;peerinfo</title>
559<path fill="none" stroke="black" d="M212.608,-287.849C273.449,-248.632 422.455,-152.586 487.166,-110.875"/>
560<polygon fill="black" stroke="black" points="489.21,-113.721 495.719,-105.362 485.418,-107.838 489.21,-113.721"/>
561</g>
562<!-- hostlist&#45;&gt;hello -->
563<g id="edge65" class="edge"><title>hostlist&#45;&gt;hello</title>
564<path fill="none" stroke="black" d="M192.198,-287.715C209.228,-243.039 261.382,-123.627 349,-72 425.521,-26.9118 694.449,-19.9666 805.486,-19.053"/>
565<polygon fill="black" stroke="black" points="805.751,-22.5513 815.727,-18.9823 805.703,-15.5515 805.751,-22.5513"/>
566</g>
567<!-- scalarproduct -->
568<g id="node38" class="node"><title>scalarproduct</title>
569<ellipse fill="none" stroke="black" cx="636" cy="-594" rx="57.6901" ry="18"/>
570<text text-anchor="middle" x="636" y="-590.3" font-family="Times,serif" font-size="14.00">scalarproduct</text>
571</g>
572<!-- scalarproduct&#45;&gt;cadet -->
573<g id="edge74" class="edge"><title>scalarproduct&#45;&gt;cadet</title>
574<path fill="none" stroke="black" d="M622.726,-576.035C614.79,-565.742 604.61,-552.266 596,-540 581.021,-518.662 564.9,-493.752 553.465,-475.721"/>
575<polygon fill="black" stroke="black" points="556.241,-473.562 547.943,-466.975 550.322,-477.299 556.241,-473.562"/>
576</g>
577<!-- scalarproduct&#45;&gt;set -->
578<g id="edge73" class="edge"><title>scalarproduct&#45;&gt;set</title>
579<path fill="none" stroke="black" d="M610.179,-577.811C591.059,-566.564 565.021,-551.248 545.33,-539.665"/>
580<polygon fill="black" stroke="black" points="546.899,-536.527 536.505,-534.473 543.349,-542.56 546.899,-536.527"/>
581</g>
582<!-- secushare -->
583<g id="node39" class="node"><title>secushare</title>
584<polygon fill="none" stroke="black" points="633.366,-815.562 578,-828 522.634,-815.562 522.686,-795.438 633.314,-795.438 633.366,-815.562"/>
585<text text-anchor="middle" x="578" y="-806.3" font-family="Times,serif" font-size="14.00">secushare</text>
586</g>
587<!-- social -->
588<g id="node42" class="node"><title>social</title>
589<ellipse fill="none" stroke="black" cx="578" cy="-738" rx="31.3957" ry="18"/>
590<text text-anchor="middle" x="578" y="-734.3" font-family="Times,serif" font-size="14.00">social</text>
591</g>
592<!-- secushare&#45;&gt;social -->
593<g id="edge80" class="edge"><title>secushare&#45;&gt;social</title>
594<path fill="none" stroke="black" d="M578,-795.17C578,-786.919 578,-776.153 578,-766.256"/>
595<polygon fill="black" stroke="black" points="581.5,-766.019 578,-756.019 574.5,-766.019 581.5,-766.019"/>
596</g>
597<!-- multicast -->
598<g id="node40" class="node"><title>multicast</title>
599<ellipse fill="none" stroke="black" cx="326" cy="-594" rx="43.5923" ry="18"/>
600<text text-anchor="middle" x="326" y="-590.3" font-family="Times,serif" font-size="14.00">multicast</text>
601</g>
602<!-- multicast&#45;&gt;cadet -->
603<g id="edge82" class="edge"><title>multicast&#45;&gt;cadet</title>
604<path fill="none" stroke="black" d="M347.889,-578.338C386.803,-552.273 467.927,-497.935 510.526,-469.402"/>
605<polygon fill="black" stroke="black" points="512.642,-472.198 519.003,-463.725 508.747,-466.382 512.642,-472.198"/>
606</g>
607<!-- psyc -->
608<g id="node41" class="node"><title>psyc</title>
609<ellipse fill="none" stroke="black" cx="326" cy="-666" rx="27" ry="18"/>
610<text text-anchor="middle" x="326" y="-662.3" font-family="Times,serif" font-size="14.00">psyc</text>
611</g>
612<!-- psyc&#45;&gt;multicast -->
613<g id="edge81" class="edge"><title>psyc&#45;&gt;multicast</title>
614<path fill="none" stroke="black" d="M326,-647.697C326,-639.983 326,-630.712 326,-622.112"/>
615<polygon fill="black" stroke="black" points="329.5,-622.104 326,-612.104 322.5,-622.104 329.5,-622.104"/>
616</g>
617<!-- psycstore -->
618<g id="node43" class="node"><title>psycstore</title>
619<ellipse fill="none" stroke="black" cx="220" cy="-594" rx="44.393" ry="18"/>
620<text text-anchor="middle" x="220" y="-590.3" font-family="Times,serif" font-size="14.00">psycstore</text>
621</g>
622<!-- psyc&#45;&gt;psycstore -->
623<g id="edge79" class="edge"><title>psyc&#45;&gt;psycstore</title>
624<path fill="none" stroke="black" d="M307.536,-652.807C291.938,-642.506 269.271,-627.537 250.911,-615.413"/>
625<polygon fill="black" stroke="black" points="252.567,-612.312 242.294,-609.722 248.71,-618.154 252.567,-612.312"/>
626</g>
627<!-- social&#45;&gt;gns -->
628<g id="edge78" class="edge"><title>social&#45;&gt;gns</title>
629<path fill="none" stroke="black" d="M605.831,-729.838C655.82,-716.973 760.68,-689.987 815.282,-675.935"/>
630<polygon fill="black" stroke="black" points="816.373,-679.268 825.185,-673.386 814.628,-672.489 816.373,-679.268"/>
631</g>
632<!-- social&#45;&gt;psyc -->
633<g id="edge77" class="edge"><title>social&#45;&gt;psyc</title>
634<path fill="none" stroke="black" d="M550.552,-729.376C504.247,-716.513 410.731,-690.537 360.222,-676.506"/>
635<polygon fill="black" stroke="black" points="360.996,-673.089 350.424,-673.784 359.122,-679.833 360.996,-673.089"/>
636</g>
637<!-- rps -->
638<g id="node44" class="node"><title>rps</title>
639<ellipse fill="none" stroke="black" cx="593" cy="-306" rx="27" ry="18"/>
640<text text-anchor="middle" x="593" y="-302.3" font-family="Times,serif" font-size="14.00">rps</text>
641</g>
642<!-- rps&#45;&gt;core -->
643<g id="edge83" class="edge"><title>rps&#45;&gt;core</title>
644<path fill="none" stroke="black" d="M584.187,-288.765C579.582,-280.283 573.845,-269.714 568.679,-260.197"/>
645<polygon fill="black" stroke="black" points="571.613,-258.266 563.766,-251.147 565.461,-261.606 571.613,-258.266"/>
646</g>
647</g>
648</svg>
diff --git a/contrib/packages/guix/notest-guix-env.scm b/contrib/packages/guix/notest-guix-env.scm
new file mode 100644
index 000000000..ffb0ec889
--- /dev/null
+++ b/contrib/packages/guix/notest-guix-env.scm
@@ -0,0 +1,145 @@
1;;; This file is part of GNUnet.
2;;; Copyright (C) 2016, 2017, 2018 GNUnet e.V.
3;;;
4;;; GNUnet is free software: you can redistribute it and/or modify it
5;;; under the terms of the GNU Affero General Public License as published
6;;; by the Free Software Foundation, either version 3 of the License,
7;;; or (at your option) any later version.
8;;;
9;;; GNUnet is distributed in the hope that it will be useful, but
10;;; WITHOUT ANY WARRANTY; without even the implied warranty of
11;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12;;; Affero General Public License for more details.
13;;;
14;;; You should have received a copy of the GNU Affero General Public License
15;;; along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17(use-modules
18 (ice-9 popen)
19 (ice-9 match)
20 (ice-9 rdelim)
21 (guix packages)
22 (guix build-system gnu)
23 (guix gexp)
24 ((guix build utils) #:select (with-directory-excursion))
25 (guix git-download)
26 (guix utils) ; current-source-directory
27 (gnu packages)
28 (gnu packages aidc)
29 (gnu packages autotools)
30 (gnu packages backup)
31 (gnu packages base)
32 (gnu packages compression)
33 (gnu packages curl)
34 (gnu packages databases)
35 (gnu packages file)
36 (gnu packages gettext)
37 (gnu packages glib)
38 (gnu packages gnome)
39 (gnu packages gnunet)
40 (gnu packages gnupg)
41 (gnu packages gnuzilla)
42 (gnu packages groff)
43 (gnu packages gstreamer)
44 (gnu packages gtk)
45 (gnu packages guile)
46 (gnu packages image)
47 (gnu packages image-viewers)
48 (gnu packages libidn)
49 (gnu packages libunistring)
50 (gnu packages linux)
51 (gnu packages maths)
52 (gnu packages multiprecision)
53 (gnu packages perl)
54 (gnu packages pkg-config)
55 (gnu packages pulseaudio)
56 (gnu packages python)
57 (gnu packages tex)
58 (gnu packages texinfo)
59 (gnu packages tex)
60 (gnu packages tls)
61 (gnu packages upnp)
62 (gnu packages video)
63 (gnu packages web)
64 (gnu packages xiph)
65 ((guix licenses) #:prefix license:))
66
67(define %source-dir (current-source-directory))
68
69(define gnunet-dev-env
70 (let* ((revision "1")
71 (select? (delay (or (git-predicate
72 (current-source-directory))
73 source-file?))))
74 (package
75 (inherit gnunet)
76 (name "gnunet")
77 (version (string-append "git" revision))
78 (source
79 (local-file
80 (string-append (getcwd))
81 #:recursive? #t))
82 (inputs
83 `(("glpk" ,glpk)
84 ("gnurl" ,gnurl)
85 ("gstreamer" ,gstreamer)
86 ("gst-plugins-base" ,gst-plugins-base)
87 ("gnutls/dane" ,gnutls/dane)
88 ("libextractor" ,libextractor)
89 ("libgcrypt" ,libgcrypt)
90 ("libidn" ,libidn)
91 ("libmicrohttpd" ,libmicrohttpd)
92 ("libltdl" ,libltdl)
93 ("libunistring" ,libunistring)
94 ("openssl" ,openssl)
95 ("opus" ,opus)
96 ("pulseaudio" ,pulseaudio)
97 ("sqlite" ,sqlite)
98 ("postgresql" ,postgresql)
99 ("mysql" ,mariadb)
100 ("zlib" ,zlib)
101 ("perl" ,perl)
102 ("python-2" ,python-2) ; tests and gnunet-qr
103 ("python2-future" ,python2-future)
104 ("jansson" ,jansson)
105 ("nss" ,nss)
106 ("glib" ,glib "bin")
107 ("gmp" ,gmp)
108 ("bluez" ,bluez) ; for optional bluetooth feature
109 ("glib" ,glib)
110 ;; ("texlive" ,texlive) ;FIXME: minimize.
111 ("texlive-tiny" ,texlive-tiny) ;; Seems to be enough for _just_ info output.
112 ("miniupnpc" ,miniupnpc)
113 ("libogg" ,libogg)))
114 (native-inputs
115 `(("pkg-config" ,pkg-config)
116 ("autoconf" ,autoconf)
117 ("automake" ,automake)
118 ("gnu-gettext" ,gnu-gettext)
119 ("which" ,which)
120 ("texinfo" ,texinfo-5) ; Debian stable: 5.2
121 ("libtool" ,libtool)))
122 (outputs '("out" "debug"))
123 (arguments
124 `(#:configure-flags
125 (list (string-append "--with-nssdir=" %output "/lib")
126 "--enable-experimental")
127 #:phases
128 ;; swap check and install phases and set paths to installed bin
129 (modify-phases %standard-phases
130 (add-after 'unpack 'patch-bin-sh
131 (lambda _
132 (for-each (lambda (f) (chmod f #o755))
133 (find-files "po" ""))
134 #t))
135 (add-after 'patch-bin-sh 'bootstrap
136 (lambda _
137 (invoke "sh" "bootstrap")))
138 ;;(add-before 'build 'chdir
139 ;; (lambda _
140 ;; (chdir "doc/documentation")))
141 (delete 'check)
142 ;; XXX: https://gnunet.org/bugs/view.php?id=4619
143 ))))))
144
145gnunet-dev-env
diff --git a/contrib/services/shepherd/ng0_wip/.gitignore b/contrib/services/shepherd/ng0_wip/.gitignore
deleted file mode 100644
index 9b974979a..000000000
--- a/contrib/services/shepherd/ng0_wip/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
1!*.patch \ No newline at end of file
diff --git a/contrib/services/shepherd/ng0_wip/00001-gnu-services-Add-gnunet-service.patch b/contrib/services/shepherd/ng0_wip/00001-gnu-services-Add-gnunet-service.patch
deleted file mode 100644
index 609a0a5ef..000000000
--- a/contrib/services/shepherd/ng0_wip/00001-gnu-services-Add-gnunet-service.patch
+++ /dev/null
@@ -1,186 +0,0 @@
1From 60a4c0f7c60ef705db17561fd3e930bbe11730c9 Mon Sep 17 00:00:00 2001
2From: ng0 <ng0@we.make.ritual.n0.is>
3Date: Mon, 12 Sep 2016 12:26:52 +0000
4Subject: [PATCH] gnu: services: Add gnunet-service.
5
6* gnu/services/networking.scm (gnunet): New service.
7
8Signed-off-by: Nils Gillmann <ng0@n0.is>
9---
10 doc/guix.texi | 36 ++++++++++++++
11 gnu/services/networking.scm | 93 ++++++++++++++++++++++++++++++++++++-
12 2 files changed, 128 insertions(+), 1 deletion(-)
13
14diff --git a/doc/guix.texi b/doc/guix.texi
15index d925b4eda..eb7b409d7 100644
16--- a/doc/guix.texi
17+++ b/doc/guix.texi
18@@ -11016,6 +11016,42 @@ Package object of the Open vSwitch.
19 @end table
20 @end deftp
21
22+@cindex GNUnet
23+@cindex gnunet
24+@subsubheading GNUnet Service
25+
26+@deffn {Scheme Variable} gnunet-service-type
27+This is the type of the @uref{https://gnunet.org, GNUnet}
28+service, whose value should be an @code{gnunet-configuration} object
29+as in this example:
30+
31+@example
32+(service gnunet-service-type
33+ (gnunet-configuration
34+ (config-file (local-file "./gnunet.conf"))))
35+@end example
36+@end deffn
37+
38+@deftp {Data Type} gnunet-configuration
39+Data type representing the configuration of GNUnet.
40+
41+@table @asis
42+@item @code{package} (default: @var{gnunet})
43+Package object of the GNUnet service.
44+
45+@item @code{config-file} (default: @var{%default-gnunet-file})
46+File-like object of the GNUnet configuration file to use. For NAT is
47+assumes by default that you are behind a NAT (@var{BEHIND_NAT = YES})
48+and enables UPNP (@var{ENABLE_UPNP = YES}).
49+The hostlist is configured with the options @var{-b} (bootstrap using
50+configured hostlist servers) and @var{-e} (enable learning advertised hostlists).
51+Read the configuration files in @var{"~/.guix-profile/share/gnunet/config.d/"}
52+for more information. These files also set the defaults when you don't set
53+any explicit values to override them.
54+
55+@end table
56+@end deftp
57+
58 @node X Window
59 @subsubsection X Window
60
61diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
62index b0c23aafc..0ff20e707 100644
63--- a/gnu/services/networking.scm
64+++ b/gnu/services/networking.scm
65@@ -5,6 +5,7 @@
66 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
67 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
68 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
69+;;; Copyright © 2017 ng0 <contact.ng0@cryptolab.net>
70 ;;;
71 ;;; This file is part of GNU Guix.
72 ;;;
73@@ -29,6 +30,7 @@
74 #:use-module (gnu system pam)
75 #:use-module (gnu packages admin)
76 #:use-module (gnu packages connman)
77+ #:use-module (gnu packages gnunet)
78 #:use-module (gnu packages linux)
79 #:use-module (gnu packages tor)
80 #:use-module (gnu packages messaging)
81@@ -92,7 +94,12 @@
82 wpa-supplicant-service-type
83
84 openvswitch-service-type
85- openvswitch-configuration))
86+ openvswitch-configuration
87+
88+ gnunet-configuration
89+ gnunet-configuration?
90+ gnunet-service
91+ gnunet-service-type))
92
93 ;;; Commentary:
94 ;;;
95@@ -1125,4 +1132,88 @@ a network connection manager."))))
96 switch designed to enable massive network automation through programmatic
97 extension.")))
98
99+;;;
100+;;; GNUnet
101+;;;
102+
103+(define-record-type* <gnunet-configuration>
104+ gnunet-configuration make-gnunet-configuration
105+ gnunet-configuration?
106+ (package gnunet-configuration-package
107+ (default gnunet))
108+ (config-file gnunet-configuration-config-file
109+ (default %default-gnunet-config-file)))
110+
111+(define %default-gnunet-config-file
112+ (plain-file "gnunet.conf" "
113+[PATHS]
114+SERVICEHOME = /var/lib/gnunet
115+GNUNET_CONFIG_HOME = /var/lib/gnunet
116+
117+[arm]
118+SYSTEM_ONLY = YES
119+USER_ONLY = NO
120+
121+[nat]
122+BEHIND_NAT = YES
123+ENABLE_UPNP = YES
124+
125+[hostlist]
126+OPTIONS = -b -e
127+"))
128+
129+(define gnunet-shepherd-service
130+ (match-lambda
131+ (($ <gnunet-configuration> package config-file)
132+ (list (shepherd-service
133+ (provision '(gnunet))
134+ (requirement '(loopback))
135+ (documentation "Run the GNUnet service.")
136+ (start
137+ (let ((gnunet
138+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
139+ #~(make-forkexec-constructor
140+ (list #$gnunet "-c" #$config-file)
141+ #:log-file "/var/log/gnunet.log"
142+ #:pid-file "/var/run/gnunet.pid")))
143+ (stop
144+ #~(make-kill-destructor)))))))
145+
146+(define %gnunet-accounts
147+ (list (user-group
148+ (name "gnunetdns")
149+ (system? #t))
150+ (user-group
151+ (name "gnunet")
152+ (system? #t))
153+ (user-account
154+ (name "gnunet")
155+ (group "gnunet")
156+ (system? #t)
157+ (comment "GNUnet system user")
158+ (home-directory "/var/lib/gnunet")
159+ (shell #~(string-append #$shadow "/sbin/nologin")))))
160+
161+(define gnunet-activation
162+ (match-lambda
163+ (($ <gnunet-configuration> package config-file)
164+ (let ((gnunet
165+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
166+ #~(begin
167+ ;; Create the .config + .cache for gnunet user
168+ (mkdir-p "/var/lib/gnunet/.config/gnunet")
169+ (mkdir-p "/var/lib/gnunet/.cache/gnunet"))))))
170+
171+(define gnunet-service-type
172+ (service-type
173+ (name 'gnunet)
174+ (extensions (list (service-extension account-service-type
175+ (const %gnunet-accounts))
176+ (service-extension activation-service-type
177+ gnunet-activation)
178+ (service-extension profile-service-type
179+ (compose list gnunet-configuration-package))
180+ (service-extension shepherd-root-service-type
181+ gnunet-shepherd-service)))))
182+
183 ;;; networking.scm ends here
184--
1852.17.0
186
diff --git a/contrib/services/shepherd/ng0_wip/0001-gnu-services-Add-gnunet-service.patch b/contrib/services/shepherd/ng0_wip/0001-gnu-services-Add-gnunet-service.patch
deleted file mode 100644
index a494434e0..000000000
--- a/contrib/services/shepherd/ng0_wip/0001-gnu-services-Add-gnunet-service.patch
+++ /dev/null
@@ -1,225 +0,0 @@
1From 434b05bc1a11b4865c0bd634281acd91dfce972c Mon Sep 17 00:00:00 2001
2From: ng0 <ng0@we.make.ritual.n0.is>
3Date: Mon, 12 Sep 2016 12:26:52 +0000
4Subject: [PATCH] gnu: services: Add gnunet-service.
5
6Signed-off-by: Nils Gillmann <ng0@n0.is>
7---
8 doc/guix.texi | 36 ++++++++++
9 gnu/services/networking.scm | 134 +++++++++++++++++++++++++++++++++++-
10 2 files changed, 169 insertions(+), 1 deletion(-)
11
12diff --git a/doc/guix.texi b/doc/guix.texi
13index 00bf24d3f..73589c88b 100644
14--- a/doc/guix.texi
15+++ b/doc/guix.texi
16@@ -10138,6 +10138,42 @@ Package object of the Open vSwitch.
17 @end table
18 @end deftp
19
20+@cindex GNUnet
21+@cindex gnunet
22+@subsubheading GNUnet Service
23+
24+@deffn {Scheme Variable} gnunet-service-type
25+This is the type of the @uref{https://gnunet.org, GNUnet}
26+service, whose value should be an @code{gnunet-configuration} object
27+as in this example:
28+
29+@example
30+(service gnunet-service-type
31+ (gnunet-configuration
32+ (config-file (local-file "./gnunet.conf"))))
33+@end example
34+@end deffn
35+
36+@deftp {Data Type} gnunet-configuration
37+Data type representing the configuration of GNUnet.
38+
39+@table @asis
40+@item @code{package} (default: @var{gnunet})
41+Package object of the GNUnet service.
42+
43+@item @code{config-file} (default: @var{%default-gnunet-file})
44+File-like object of the GNUnet configuration file to use. For NAT is
45+assumes by default that you are behind a NAT (@var{BEHIND_NAT = YES})
46+and enables UPNP (@var{ENABLE_UPNP = YES}).
47+The hostlist is configured with the options @var{-b} (bootstrap using
48+configured hostlist servers) and @var{-e} (enable learning advertised hostlists).
49+Read the configuration files in @var{"~/.guix-profile/share/gnunet/config.d/"}
50+for more information. These files also set the defaults when you don't set
51+any explicit values to override them.
52+
53+@end table
54+@end deftp
55+
56 @node X Window
57 @subsubsection X Window
58
59diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
60index 99a3d493c..fe682b267 100644
61--- a/gnu/services/networking.scm
62+++ b/gnu/services/networking.scm
63@@ -5,6 +5,7 @@
64 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
65 ;;; Copyright © 2017 Clément Lassieur <clement@lassieur.org>
66 ;;; Copyright © 2017 Thomas Danckaert <post@thomasdanckaert.be>
67+;;; Copyright © 2017 ng0 <ng0@no-reply.pragmatique.xyt>
68 ;;;
69 ;;; This file is part of GNU Guix.
70 ;;;
71@@ -29,6 +30,7 @@
72 #:use-module (gnu system pam)
73 #:use-module (gnu packages admin)
74 #:use-module (gnu packages connman)
75+ #:use-module (gnu packages gnunet)
76 #:use-module (gnu packages linux)
77 #:use-module (gnu packages tor)
78 #:use-module (gnu packages messaging)
79@@ -92,7 +94,12 @@
80 wpa-supplicant-service-type
81
82 openvswitch-service-type
83- openvswitch-configuration))
84+ openvswitch-configuration
85+
86+ gnunet-configuration
87+ gnunet-configuration?
88+ gnunet-service-type
89+ %default-gnunet-config-file))
90
91 ;;; Commentary:
92 ;;;
93@@ -1069,4 +1076,129 @@ dns=" dns "
94 (service-extension shepherd-root-service-type
95 openvswitch-shepherd-service)))))
96
97+;;;
98+;;; GNUnet
99+;;;
100+
101+;; steps:
102+;; 0. The service works!!!
103+;; 1. We want a completely adjustable config.
104+;; 2. We want to extend this service with functions like
105+;; vpn, comparable to tor-service
106+;; Because of (1) we can't have a default. We can have
107+;; default values which can be adjusted. A config is
108+;; generated from these.
109+
110+(define-record-type* <gnunet-configuration>
111+ gnunet-configuration make-gnunet-configuration
112+ gnunet-configuration?
113+ (gnunet gnunet-configuration-package
114+ (default gnunet))
115+ (config-file gnunet-configuration-config-file
116+ (default (plain-file "empty" ""))))
117+
118+(define %default-gnunet-config-file
119+ (plain-file "gnunet.conf" "
120+[PATHS]
121+SERVICEHOME = /var/lib/gnunet
122+GNUNET_CONFIG_HOME = /var/lib/gnunet
123+
124+[arm]
125+SYSTEM_ONLY = NO
126+USER_ONLY = NO
127+
128+[nat]
129+BEHIND_NAT = YES
130+ENABLE_UPNP = YES
131+
132+[hostlist]
133+OPTIONS = -b -e
134+"))
135+
136+(define gnunet-shepherd-service
137+ (match-lambda
138+ (($ <gnunet-configuration> package config-file)
139+ (list (shepherd-service
140+ (provision '(gnunet))
141+ (requirement '(user-processes loopback networking))
142+ (documentation "Run the GNUnet service.")
143+ (start
144+ (let ((gnunet
145+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
146+ #~(make-forkexec-constructor
147+ (list #$gnunet "-c" #$config-file "-d")
148+ #:pid-file "/var/run/gnunet/arm-service.pid"
149+ #:user "gnunet"
150+ #:group "gnunet"
151+ ;;#:log-file "/var/lib/gnunet/gnunet.log")))
152+ #:log-file "/var/log/gnunet.log")))
153+ (stop #~(make-kill-destructor)))))))
154+
155+(define %gnunet-accounts
156+ (list (user-group (name "gnunetdns") (system? #t))
157+ (user-group (name "gnunet") (system? #t))
158+ (user-account
159+ (name "gnunet")
160+ (group "gnunet")
161+ (system? #t)
162+ (comment "GNUnet system user")
163+ (home-directory "/var/empty")
164+ (shell (file-append shadow "/sbin/nologin")))))
165+
166+;; ${GNUNET_HOME}/.local/share/gnunet/gnunet.conf -> chmod 600
167+;; mkdir -p ${GNUNET_HOME}/.cache/gnunet
168+
169+(define gnunet-activation
170+ (match-lambda
171+ (($ <gnunet-configuration> package config-file)
172+ (let ((gnunet
173+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
174+ #~(begin
175+ (use-modules (guix build utils))
176+ (define %user (getpw "gnunet"))
177+ (mkdir-p "/var/lib/gnunet/")
178+ (chown "/var/lib/gnunet" (passwd:uid %user) (passwd:gid %user))
179+ ;;(chmod "/var/lib/gnunet/" #o755)
180+ (mkdir-p "/var/lib/gnunet/.local/share/gnunet")
181+ (mkdir-p "/var/lib/gnunet/.cache/gnunet")
182+ (mkdir-p "/var/lib/gnunet/hostlist")
183+ (mkdir-p "/var/lib/gnunet/.config/gnunet")
184+ (chown "/var/lib/gnunet/.local/share/gnunet" (passwd:uid %user) (passwd:gid %user))
185+ (chown "/var/lib/gnunet/.cache/gnunet" (passwd:uid %user) (passwd:gid %user))
186+ (chown "/var/lib/gnunet/hostlist" (passwd:uid %user) (passwd:gid %user))
187+ ;;(chown "/var/lib/gnunet/gnunet.conf" (passwd:uid %user) (passwd:gid %user))
188+ (chown "/var/lib/gnunet/.config/gnunet" (passwd:uid %user) (passwd:gid %user)))))))
189+ ;;(chmod "/var/lib/gnunet/.config/gnunet" #o755)
190+ ;;(chmod "/var/lib/gnunet/.cache/gnunet" #o755)
191+ ;;(chmod "/var/lib/gnunet/.local/share/gnunet" #o755))))))
192+
193+;; SUID_ROOT_HELPERS="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
194+;; set chmod u+s for those above.
195+;; chmodown_execbin ${libexec}/gnunet-helper-dns 4750 root:gnunetdns
196+;; chmodown_execbin ${libexec}/gnunet-service-dns 2750 gnunet:gnunetdns
197+(define gnunet-setuid-programs
198+ (match-lambda
199+ (($ <gnunet-configuration> package)
200+ (list (file-append package "/lib/gnunet/libexec/gnunet-helper-exit")
201+ (file-append package "/lib/gnunet/libexec/gnunet-helper-nat-server")
202+ (file-append package "/lib/gnunet/libexec/gnunet-helper-nat-client")
203+ (file-append package "/lib/gnunet/libexec/gnunet-helper-transport-bluetooth")
204+ (file-append package "/lib/gnunet/libexec/gnunet-helper-transport-wlan")
205+ (file-append package "/lib/gnunet/libexec/gnunet-helper-vpn")))))
206+
207+(define gnunet-service-type
208+ (service-type
209+ (name 'gnunet)
210+ (extensions (list (service-extension account-service-type
211+ (const %gnunet-accounts))
212+ (service-extension activation-service-type
213+ gnunet-activation)
214+ (service-extension profile-service-type
215+ (compose list gnunet-configuration-package))
216+ (service-extension setuid-program-service-type
217+ gnunet-setuid-programs)
218+ (service-extension shepherd-root-service-type
219+ gnunet-shepherd-service)))))
220+;;; --- here starts the rewrite.
221+
222 ;;; networking.scm ends here
223--
2242.17.0
225
diff --git a/contrib/services/shepherd/ng0_wip/001-gnu-services-Add-gnunet-service.patch b/contrib/services/shepherd/ng0_wip/001-gnu-services-Add-gnunet-service.patch
deleted file mode 100644
index 0017ec8cf..000000000
--- a/contrib/services/shepherd/ng0_wip/001-gnu-services-Add-gnunet-service.patch
+++ /dev/null
@@ -1,204 +0,0 @@
1From 91241bacb6533745535ff28d20f087ecd571e7be Mon Sep 17 00:00:00 2001
2From: ng0 <ng0@we.make.ritual.n0.is>
3Date: Mon, 12 Sep 2016 12:26:52 +0000
4Subject: [PATCH] gnu: services: Add gnunet-service.
5
6---
7 doc/guix.texi | 36 ++++++++++++++
8 gnu/services/networking.scm | 114 +++++++++++++++++++++++++++++++++++++++++++-
9 2 files changed, 149 insertions(+), 1 deletion(-)
10
11diff --git a/doc/guix.texi b/doc/guix.texi
12index 99bde4aca..6c683393e 100644
13--- a/doc/guix.texi
14+++ b/doc/guix.texi
15@@ -8903,6 +8903,42 @@ Boolean values @var{ipv4?} and @var{ipv6?} determine whether to use IPv4/IPv6
16 sockets.
17 @end deffn
18
19+@cindex GNUnet
20+@cindex gnunet
21+@subsubheading GNUnet Service
22+
23+@deffn {Scheme Variable} gnunet-service-type
24+This is the type of the @uref{https://gnunet.org, GNUnet}
25+service, whose value should be an @code{gnunet-configuration} object
26+as in this example:
27+
28+@example
29+(service gnunet-service-type
30+ (gnunet-configuration
31+ (config-file (local-file "./gnunet.conf"))))
32+@end example
33+@end deffn
34+
35+@deftp {Data Type} gnunet-configuration
36+Data type representing the configuration of GNUnet.
37+
38+@table @asis
39+@item @code{package} (default: @var{gnunet})
40+Package object of the GNUnet service.
41+
42+@item @code{config-file} (default: @var{%default-gnunet-file})
43+File-like object of the GNUnet configuration file to use. For NAT is
44+assumes by default that you are behind a NAT (@var{BEHIND_NAT = YES})
45+and enables UPNP (@var{ENABLE_UPNP = YES}).
46+The hostlist is configured with the options @var{-b} (bootstrap using
47+configured hostlist servers) and @var{-e} (enable learning advertised hostlists).
48+Read the configuration files in @var{"~/.guix-profile/share/gnunet/config.d/"}
49+for more information. These files also set the defaults when you don't set
50+any explicit values to override them.
51+
52+@end table
53+@end deftp
54+
55
56 @node X Window
57 @subsubsection X Window
58diff --git a/gnu/services/networking.scm b/gnu/services/networking.scm
59index d672ecf68..ff3615ea2 100644
60--- a/gnu/services/networking.scm
61+++ b/gnu/services/networking.scm
62@@ -3,6 +3,7 @@
63 ;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
64 ;;; Copyright © 2016 Efraim Flashner <efraim@flashner.co.il>
65 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
66+;;; Copyright © 2016 ng0 <ng0@libertad.pw>
67 ;;;
68 ;;; This file is part of GNU Guix.
69 ;;;
70@@ -27,6 +28,7 @@
71 #:use-module (gnu system pam)
72 #:use-module (gnu packages admin)
73 #:use-module (gnu packages connman)
74+ #:use-module (gnu packages gnunet)
75 #:use-module (gnu packages linux)
76 #:use-module (gnu packages tor)
77 #:use-module (gnu packages messaging)
78@@ -66,7 +68,12 @@
79 wicd-service
80 network-manager-service
81 connman-service
82- wpa-supplicant-service-type))
83+ wpa-supplicant-service-type
84+
85+ gnunet-configuration
86+ gnunet-configuration?
87+ gnunet-service-type
88+ %default-gnunet-config-file))
89
90 ;;; Commentary:
91 ;;;
92@@ -781,4 +788,109 @@ configure networking."
93 (service-extension dbus-root-service-type list)
94 (service-extension profile-service-type list)))))
95
96+
97+;;; GNUnet
98+;;;
99+;;;
100+
101+(define-record-type* <gnunet-configuration>
102+ gnunet-configuration make-gnunet-configuration
103+ gnunet-configuration?
104+ (package gnunet-configuration-package
105+ (default gnunet))
106+ (config-file gnunet-configuration-config-file
107+ (default %default-gnunet-config-file)))
108+
109+(define %default-gnunet-config-file
110+ (plain-file "gnunet.conf" "
111+[PATHS]
112+SERVICEHOME = /var/lib/gnunet
113+GNUNET_CONFIG_HOME = /var/lib/gnunet
114+
115+[arm]
116+SYSTEM_ONLY = YES
117+USER_ONLY = NO
118+
119+[nat]
120+BEHIND_NAT = YES
121+ENABLE_UPNP = YES
122+
123+[hostlist]
124+OPTIONS = -b -e
125+"))
126+
127+(define gnunet-shepherd-service
128+ (match-lambda
129+ (($ <gnunet-configuration> package config-file)
130+ (list (shepherd-service
131+ (provision '(gnunet))
132+ (requirement '(user-processes loopback))
133+ (documentation "Run the GNUnet service.")
134+ (start
135+ (let ((gnunet
136+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
137+ #~(make-forkexec-constructor
138+ (list #$gnunet "-c" #$config-file)
139+ #:pid-file "/var/run/gnunet.pid")))
140+ (stop
141+ #~(make-kill-destructor
142+ (list #$gnunet "-e"))))))))
143+
144+(define %gnunet-accounts
145+ (list (user-group
146+ (name "gnunetdns")
147+ (system? #t))
148+ (user-group
149+ (name "gnunet")
150+ (system? #t))
151+ (user-account
152+ (name "gnunet")
153+ (group "gnunet")
154+ (system? #t)
155+ (comment "GNUnet system user")
156+ (home-directory "/var/empty")
157+ (shell #~(string-append #$shadow "/sbin/nologin")))))
158+
159+(define gnunet-activation
160+ (match-lambda
161+ (($ <gnunet-configuration> package config-file)
162+ (let ((gnunet
163+ (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
164+ #~(begin
165+ (use-modules (guix build utils))
166+ (define %user (getpw "gnunet"))
167+ (mkdir-p "/var/lib/gnunet/")
168+ (chown "/var/lib/gnunet" (passwd:uid %user) (passwd:gid %user))
169+ (chmod "/var/lib/gnunet/" #o600)
170+ (mkdir-p "/var/lib/gnunet/.local/share/gnunet")
171+ (mkdir-p "/var/lib/gnunet/.cache/gnunet")
172+ (mkdir-p "/var/lib/gnunet/.config/gnunet")
173+ (chmod "/var/lib/gnunet/.config/gnunet" #o600)
174+ (chmod "/var/lib/gnunet/.cache/gnunet" #o600)
175+ (chmod "/var/lib/gnunet/.local/share/gnunet" #o600))))))
176+
177+(define gnunet-setuid-programs
178+ (match-lambda
179+ (($ <gnunet-configuration> package)
180+ (list (file-append package "/lib/gnunet/libexec/gnunet-helper-exit")
181+ (file-append package "/lib/gnunet/libexec/gnunet-helper-nat-server")
182+ (file-append package "/lib/gnunet/libexec/gnunet-helper-nat-client")
183+ (file-append package "/lib/gnunet/libexec/gnunet-helper-transport-bluetooth")
184+ (file-append package "/lib/gnunet/libexec/gnunet-helper-transport-wlan")
185+ (file-append package "/lib/gnunet/libexec/gnunet-helper-vpn")))))
186+
187+(define gnunet-service-type
188+ (service-type
189+ (name 'gnunet)
190+ (extensions (list (service-extension account-service-type
191+ (const %gnunet-accounts))
192+ (service-extension activation-service-type
193+ gnunet-activation)
194+ (service-extension profile-service-type
195+ (compose list gnunet-configuration-package))
196+ (service-extension setuid-program-service-type
197+ gnunet-setuid-programs)
198+ (service-extension shepherd-root-service-type
199+ gnunet-shepherd-service)))))
200+
201 ;;; networking.scm ends here
202--
2032.11.0
204
diff --git a/contrib/services/shepherd/ng0_wip/README b/contrib/services/shepherd/ng0_wip/README
deleted file mode 100644
index c36c10959..000000000
--- a/contrib/services/shepherd/ng0_wip/README
+++ /dev/null
@@ -1,11 +0,0 @@
1short notes:
2
3* you are not expected to be able to run this as-is.
4* you must keep it GPL3 licensed and NOT license it to GNUnet e.V.,
5 for changes add your line to the header.
6* does not apply to a guix checkout, you have to search and replace
7 the imported modules. in my development of plant, infotropique
8 services is equivalent to gnu services (same for packages) and plant
9 XYZ is guix XYZ.
10* Understanding is optional.
11* Patches come as context reading material. \ No newline at end of file
diff --git a/contrib/services/shepherd/ng0_wip/gnunet.scm b/contrib/services/shepherd/ng0_wip/gnunet.scm
deleted file mode 100644
index 80b807e74..000000000
--- a/contrib/services/shepherd/ng0_wip/gnunet.scm
+++ /dev/null
@@ -1,173 +0,0 @@
1;;; plant ---
2;;; Copyright (C) 2016, 2017, 2018 Nils Gillmann <gillmann@infotropique.org>
3;;;
4;;; This file is part of plant.
5;;;
6;;; plant is free software; you can redistribute it and/or modify it
7;;; under the terms of the GNU General Public License as published by
8;;; the Free Software Foundation; either version 3 of the License, or (at
9;;; your option) any later version.
10;;;
11;;; plant is distributed in the hope that it will be useful, but
12;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14;;; GNU General Public License for more details.
15;;;
16;;; You should have received a copy of thye GNU General Public License
17;;; along with plant. If not, see <http://www.gnu.org/licenses/>.
18
19(define-module (infotropique services networking)
20 #:use-module (infotropique services)
21 #:use-module (infotropique services shepherd)
22 #:use-module (infotropique services dbus)
23 #:use-module (infotropique system shadow)
24 #:use-module (infotropique system pam)
25 #:use-module (infotropique packages admin)
26 #:use-module (infotropique packages connman)
27 #:use-module (infotropique packages linux)
28 #:use-module (infotropique packages tor)
29 #:use-module (infotropique packages messaging)
30 #:use-module (infotropique packages networking)
31 #:use-module (infotropique packages ntp)
32 #:use-module (infotropique packages wicd)
33 #:use-module (infotropique packages gnome)
34 #:use-module (infotropique packages gnunet)
35 #:use-module (plant gexp)
36 #:use-module (plant records)
37 #:use-module (plant modules)
38 #:use-module (srfi srfi-1)
39 #:use-module (srfi srfi-9)
40 #:use-module (srfi srfi-26)
41 #:use-module (ice-9 match)
42 #:export (gnunet-configuration
43 gnunet-configuration?
44 gnunet-service
45 gnunet-service-type))
46
47;;;
48;;; Commentary:
49;;; gnunet (GNUnet) related services, mainly gnunet itself.
50;;;
51
52;; GENTOO OpenRC:
53DONE: depends on "net".
54DONE: PIDFILE=/run/gnunet/arm-service.pid
55SUID_ROOT_HELPERS=exit, nat-server, nat-client, transport-bluetooth, transport-wlan, vpn
56
57/var/lib/gnunet/.local/share/gnunet/gnunet.conf must be chmod 600 and chown gnunet:gnunet
58/var/lib/gnunet/.cache/gnunet must exist.
59/usr/lib/gnunet/libexec/gnunet-helper-SUID_ROOT_HELPERS must be s+u (--> suid)
60
61/usr/lib/gnunet/libexec/gnunet-helper-dns must be: chown root:gnunetdns and chmod 4750
62/usr/lib/gnunet/libexec/gnunet-service-dns must be: chown gnunet:gnunetdns and chmod 2750
63
64directory with PID file must then be chowned by gnunet:gnunet
65
66user gnunet startet dann /usr/lib/gnunet/libexec/gnunet-service-arm -d
67
68stop process hat:
69start-stop-daemon --stop --signal QUIT --pidfile ${PIDFILE}
70sleep 1
71killall -u gnunet
72sleep 1
73rm -rf /tmp/gnunet-gnunet-runtime >/dev/null 2>&1
74rm -rf /tmp/gnunet-system-runtime >/dev/null 2>&1
75
76/etc/nsswitch.conf kriegt den eintrag:
77hosts: files gns [NOTFOUND=return] dns
78
79und die dateien die in der source rumliegen bzgl nss müssen noch kopiert werden
80UND nss muss sie finden.
81
82
83
84(define-record-type* <gnunet-configuration>
85 gnunet-configuration make-gnunet-configuration
86 gnunet-configuration?
87 (package gnunet-configuration-package
88 (default gnunet))
89 (config-file gnunet-configuration-config-file
90 (default %default-gnunet-config-file)))
91
92;; TODO: [PATHS] DEFAULTCONFIG = ?
93(define %default-gnunet-config-file
94 (plain-file "gnunet.conf" "
95[PATHS]
96SERVICEHOME = /var/lib/gnunet
97GNUNET_CONFIG_HOME = /var/lib/gnunet
98
99[arm]
100SYSTEM_ONLY = YES
101USER_ONLY = NO
102
103[nat]
104BEHIND_NAT = YES
105ENABLE_UPNP = NO
106USE_LOCALADDR = NO
107DISABLEV6 = YES
108
109[hostlist]
110OPTIONS = -b -e
111"))
112
113(define gnunet-shepherd-service
114 (match-lambda
115 (($ <gnunet-configuration> package config-file)
116 (list (shepherd-service
117 (provision '(gnunet))
118 ;; do we require networking? arm will try to reconnect until a connection
119 ;; exists (again), but we might also set up vpn and not succeed at service
120 ;; boot time as well as the general certificate issue we have especially on
121 ;; Guix-on-GuixSD systems.
122 (requirement '(loopback))
123 (documentation "Run the GNUnet service.")
124 (start
125 (let ((gnunet
126 (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
127 #~(make-forkexec-constructor
128 (list #$gnunet "-c" #$config-file)
129 #:log-file "/var/log/gnunet.log"
130 #:pid-file "/var/run/gnunet/arm-service.pid")))
131 (stop
132 #~(make-kill-destructor)))))))
133
134(define %gnunet-accounts
135 (list (user-group
136 (name "gnunetdns")
137 (system? #t))
138 (user-group
139 (name "gnunet")
140 (system? #t))
141 (user-account
142 (name "gnunet")
143 (group "gnunet")
144 (system? #t)
145 (comment "GNUnet system user")
146 (home-directory "/var/lib/gnunet")
147 (shell #~(string-append #$shadow "/sbin/nologin")))))
148
149;; TODO: setuids.
150;; TODO: certificate issues -- gnunet should honor CURL_CA_BUNDLE!
151(define gnunet-activation
152 (match-lambda
153 (($ <gnunet-configuration> package config-file)
154 (let ((gnunet
155 (file-append package "/lib/gnunet/libexec/gnunet-service-arm")))
156 #~(begin
157 ;; Create the .config + .cache for gnunet user
158 (mkdir-p "/var/lib/gnunet/.config/gnunet")
159 (mkdir-p "/var/lib/gnunet/.cache/gnunet"))))))
160
161(define gnunet-service-type
162 (service-type
163 (name 'gnunet)
164 (extensions (list (service-extension account-service-type
165 (const %gnunet-accounts))
166 (service-extension activation-service-type
167 gnunet-activation)
168 (service-extension profile-service-type
169 (compose list gnunet-configuration-package))
170 (service-extension shepherd-root-service-type
171 gnunet-shepherd-service)))))
172
173;;; gnunet.scm ends here
diff --git a/contrib/services/shepherd/ng0_wip/janneke-os-modified.scm b/contrib/services/shepherd/ng0_wip/janneke-os-modified.scm
deleted file mode 100644
index d75d14598..000000000
--- a/contrib/services/shepherd/ng0_wip/janneke-os-modified.scm
+++ /dev/null
@@ -1,62 +0,0 @@
1(use-modules (gnu))
2(use-service-modules
3;; admin
4 base
5 mcron
6 networking
7 ssh)
8
9(use-package-modules
10 admin
11 ssh
12 version-control
13 gnunet)
14
15(define %user (getenv "USER"))
16
17(define os
18 (operating-system
19 (host-name "os")
20 (timezone "Europe/Amsterdam")
21 (locale "en_US.UTF-8")
22
23 (bootloader
24 (grub-configuration
25 (device "/dev/sda")))
26
27 (file-systems
28 (cons* (file-system (mount-point "/")
29 (device "/dev/sda1")
30 (type "ext4"))
31 %base-file-systems))
32
33 (groups
34 (cons* (user-group (name %user))
35 %base-groups))
36
37 (users
38 (cons* (user-account (name %user)
39 (group %user)
40 (password (crypt "" "xx"))
41 (uid 1000)
42 (supplementary-groups '("wheel" "gnunet"))
43 (home-directory (string-append "/home/" %user)))
44 %base-user-accounts))
45
46 (packages
47 (cons*
48 git
49 openssh
50 gnunet
51 %base-packages))
52
53 (services
54 (cons*
55 (dhcp-client-service)
56 (lsh-service #:port-number 2222
57 #:allow-empty-passwords? #t
58 #:root-login? #t)
59 (gnunet-service)
60 %base-services
61 ))))
62os
diff --git a/doc/documentation/Makefile.am b/doc/documentation/Makefile.am
index 0ee81304e..b6c666c4d 100644
--- a/doc/documentation/Makefile.am
+++ b/doc/documentation/Makefile.am
@@ -144,6 +144,7 @@ DISTCLEANFILES = \
144 chapters/terminology.cps \ 144 chapters/terminology.cps \
145 chapters/vocabulary.cps \ 145 chapters/vocabulary.cps \
146 fdl-1.3.cps \ 146 fdl-1.3.cps \
147 agpl-3.0.cps \
147 gpl-3.0.cps 148 gpl-3.0.cps
148 149
149# if HAVE_EXTENDED_DOCUMENTATION_BUILDING 150# if HAVE_EXTENDED_DOCUMENTATION_BUILDING
@@ -166,8 +167,8 @@ lego_stack.png: images/lego_stack.svg
166# echo "@set EDITION $(PACKAGE_VERSION)" >> $@ 167# echo "@set EDITION $(PACKAGE_VERSION)" >> $@
167# echo "@set VERSION $(PACKAGE_VERSION)" >> $@ 168# echo "@set VERSION $(PACKAGE_VERSION)" >> $@
168 169
169# Workaround for makeinfo error. Whcih in turn introduces more 170# Workaround for makeinfo error. Which in turn introduces more
170# date-related 'warnings'. Well. 171# date-related 'warnings' for GNUism. Well.
171version2.texi: 172version2.texi:
172 echo "@set UPDATED $(date +'%d %B %Y')" > $@ 173 echo "@set UPDATED $(date +'%d %B %Y')" > $@
173 echo "@set UPDATED-MONTH $(date +'%B %Y')" >> $@ 174 echo "@set UPDATED-MONTH $(date +'%B %Y')" >> $@
diff --git a/doc/documentation/agpl-3.0.texi b/doc/documentation/agpl-3.0.texi
new file mode 100644
index 000000000..eabb0c6df
--- /dev/null
+++ b/doc/documentation/agpl-3.0.texi
@@ -0,0 +1,698 @@
1@c The GNU Affero General Public License.
2@center Version 3, 19 November 2007
3
4@c This file is intended to be included within another document,
5@c hence no sectioning command or @node.
6
7@display
8Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{https://fsf.org/}
9
10Everyone is permitted to copy and distribute verbatim copies of this
11license document, but changing it is not allowed.
12@end display
13
14@heading Preamble
15
16The GNU Affero General Public License is a free, copyleft license
17for software and other kinds of works, specifically designed to ensure
18cooperation with the community in the case of network server software.
19
20The licenses for most software and other practical works are
21designed to take away your freedom to share and change the works. By
22contrast, our General Public Licenses are intended to guarantee your
23freedom to share and change all versions of a program--to make sure it
24remains free software for all its users.
25
26When we speak of free software, we are referring to freedom, not
27price. Our General Public Licenses are designed to make sure that you
28have the freedom to distribute copies of free software (and charge for
29them if you wish), that you receive source code or can get it if you
30want it, that you can change the software or use pieces of it in new
31free programs, and that you know you can do these things.
32
33Developers that use our General Public Licenses protect your rights
34with two steps: (1) assert copyright on the software, and (2) offer
35you this License which gives you legal permission to copy, distribute
36and/or modify the software.
37
38A secondary benefit of defending all users' freedom is that
39improvements made in alternate versions of the program, if they
40receive widespread use, become available for other developers to
41incorporate. Many developers of free software are heartened and
42encouraged by the resulting cooperation. However, in the case of
43software used on network servers, this result may fail to come about.
44The GNU General Public License permits making a modified version and
45letting the public access it on a server without ever releasing its
46source code to the public.
47
48The GNU Affero General Public License is designed specifically to
49ensure that, in such cases, the modified source code becomes available
50to the community. It requires the operator of a network server to
51provide the source code of the modified version running there to the
52users of that server. Therefore, public use of a modified version, on
53a publicly accessible server, gives the public access to the source
54code of the modified version.
55
56An older license, called the Affero General Public License and
57published by Affero, was designed to accomplish similar goals. This is
58a different license, not a version of the Affero GPL, but Affero has
59released a new version of the Affero GPL which permits relicensing under
60this license.
61
62The precise terms and conditions for copying, distribution and
63modification follow.
64
65@heading TERMS AND CONDITIONS
66
67@enumerate 0
68@item Definitions.
69
70``This License'' refers to version 3 of the GNU Affero General Public License.
71
72``Copyright'' also means copyright-like laws that apply to other kinds
73of works, such as semiconductor masks.
74
75``The Program'' refers to any copyrightable work licensed under this
76License. Each licensee is addressed as ``you''. ``Licensees'' and
77``recipients'' may be individuals or organizations.
78
79To ``modify'' a work means to copy from or adapt all or part of the work
80in a fashion requiring copyright permission, other than the making of
81an exact copy. The resulting work is called a ``modified version'' of
82the earlier work or a work ``based on'' the earlier work.
83
84A ``covered work'' means either the unmodified Program or a work based
85on the Program.
86
87To ``propagate'' a work means to do anything with it that, without
88permission, would make you directly or secondarily liable for
89infringement under applicable copyright law, except executing it on a
90computer or modifying a private copy. Propagation includes copying,
91distribution (with or without modification), making available to the
92public, and in some countries other activities as well.
93
94To ``convey'' a work means any kind of propagation that enables other
95parties to make or receive copies. Mere interaction with a user
96through a computer network, with no transfer of a copy, is not
97conveying.
98
99An interactive user interface displays ``Appropriate Legal Notices'' to
100the extent that it includes a convenient and prominently visible
101feature that (1) displays an appropriate copyright notice, and (2)
102tells the user that there is no warranty for the work (except to the
103extent that warranties are provided), that licensees may convey the
104work under this License, and how to view a copy of this License. If
105the interface presents a list of user commands or options, such as a
106menu, a prominent item in the list meets this criterion.
107
108@item Source Code.
109
110The ``source code'' for a work means the preferred form of the work for
111making modifications to it. ``Object code'' means any non-source form
112of a work.
113
114A ``Standard Interface'' means an interface that either is an official
115standard defined by a recognized standards body, or, in the case of
116interfaces specified for a particular programming language, one that
117is widely used among developers working in that language.
118
119The ``System Libraries'' of an executable work include anything, other
120than the work as a whole, that (a) is included in the normal form of
121packaging a Major Component, but which is not part of that Major
122Component, and (b) serves only to enable use of the work with that
123Major Component, or to implement a Standard Interface for which an
124implementation is available to the public in source code form. A
125``Major Component'', in this context, means a major essential component
126(kernel, window system, and so on) of the specific operating system
127(if any) on which the executable work runs, or a compiler used to
128produce the work, or an object code interpreter used to run it.
129
130The ``Corresponding Source'' for a work in object code form means all
131the source code needed to generate, install, and (for an executable
132work) run the object code and to modify the work, including scripts to
133control those activities. However, it does not include the work's
134System Libraries, or general-purpose tools or generally available free
135programs which are used unmodified in performing those activities but
136which are not part of the work. For example, Corresponding Source
137includes interface definition files associated with source files for
138the work, and the source code for shared libraries and dynamically
139linked subprograms that the work is specifically designed to require,
140such as by intimate data communication or control flow between those
141subprograms and other parts of the work.
142
143The Corresponding Source need not include anything that users can
144regenerate automatically from other parts of the Corresponding Source.
145
146The Corresponding Source for a work in source code form is that same
147work.
148
149@item Basic Permissions.
150
151All rights granted under this License are granted for the term of
152copyright on the Program, and are irrevocable provided the stated
153conditions are met. This License explicitly affirms your unlimited
154permission to run the unmodified Program. The output from running a
155covered work is covered by this License only if the output, given its
156content, constitutes a covered work. This License acknowledges your
157rights of fair use or other equivalent, as provided by copyright law.
158
159You may make, run and propagate covered works that you do not convey,
160without conditions so long as your license otherwise remains in force.
161You may convey covered works to others for the sole purpose of having
162them make modifications exclusively for you, or provide you with
163facilities for running those works, provided that you comply with the
164terms of this License in conveying all material for which you do not
165control copyright. Those thus making or running the covered works for
166you must do so exclusively on your behalf, under your direction and
167control, on terms that prohibit them from making any copies of your
168copyrighted material outside their relationship with you.
169
170Conveying under any other circumstances is permitted solely under the
171conditions stated below. Sublicensing is not allowed; section 10
172makes it unnecessary.
173
174@item Protecting Users' Legal Rights From Anti-Circumvention Law.
175
176No covered work shall be deemed part of an effective technological
177measure under any applicable law fulfilling obligations under article
17811 of the WIPO copyright treaty adopted on 20 December 1996, or
179similar laws prohibiting or restricting circumvention of such
180measures.
181
182When you convey a covered work, you waive any legal power to forbid
183circumvention of technological measures to the extent such
184circumvention is effected by exercising rights under this License with
185respect to the covered work, and you disclaim any intention to limit
186operation or modification of the work as a means of enforcing, against
187the work's users, your or third parties' legal rights to forbid
188circumvention of technological measures.
189
190@item Conveying Verbatim Copies.
191
192You may convey verbatim copies of the Program's source code as you
193receive it, in any medium, provided that you conspicuously and
194appropriately publish on each copy an appropriate copyright notice;
195keep intact all notices stating that this License and any
196non-permissive terms added in accord with section 7 apply to the code;
197keep intact all notices of the absence of any warranty; and give all
198recipients a copy of this License along with the Program.
199
200You may charge any price or no price for each copy that you convey,
201and you may offer support or warranty protection for a fee.
202
203@item Conveying Modified Source Versions.
204
205You may convey a work based on the Program, or the modifications to
206produce it from the Program, in the form of source code under the
207terms of section 4, provided that you also meet all of these
208conditions:
209
210@enumerate a
211@item
212The work must carry prominent notices stating that you modified it,
213and giving a relevant date.
214
215@item
216The work must carry prominent notices stating that it is released
217under this License and any conditions added under section 7. This
218requirement modifies the requirement in section 4 to ``keep intact all
219notices''.
220
221@item
222You must license the entire work, as a whole, under this License to
223anyone who comes into possession of a copy. This License will
224therefore apply, along with any applicable section 7 additional terms,
225to the whole of the work, and all its parts, regardless of how they
226are packaged. This License gives no permission to license the work in
227any other way, but it does not invalidate such permission if you have
228separately received it.
229
230@item
231If the work has interactive user interfaces, each must display
232Appropriate Legal Notices; however, if the Program has interactive
233interfaces that do not display Appropriate Legal Notices, your work
234need not make them do so.
235@end enumerate
236
237A compilation of a covered work with other separate and independent
238works, which are not by their nature extensions of the covered work,
239and which are not combined with it such as to form a larger program,
240in or on a volume of a storage or distribution medium, is called an
241``aggregate'' if the compilation and its resulting copyright are not
242used to limit the access or legal rights of the compilation's users
243beyond what the individual works permit. Inclusion of a covered work
244in an aggregate does not cause this License to apply to the other
245parts of the aggregate.
246
247@item Conveying Non-Source Forms.
248
249You may convey a covered work in object code form under the terms of
250sections 4 and 5, provided that you also convey the machine-readable
251Corresponding Source under the terms of this License, in one of these
252ways:
253
254@enumerate a
255@item
256Convey the object code in, or embodied in, a physical product
257(including a physical distribution medium), accompanied by the
258Corresponding Source fixed on a durable physical medium customarily
259used for software interchange.
260
261@item
262Convey the object code in, or embodied in, a physical product
263(including a physical distribution medium), accompanied by a written
264offer, valid for at least three years and valid for as long as you
265offer spare parts or customer support for that product model, to give
266anyone who possesses the object code either (1) a copy of the
267Corresponding Source for all the software in the product that is
268covered by this License, on a durable physical medium customarily used
269for software interchange, for a price no more than your reasonable
270cost of physically performing this conveying of source, or (2) access
271to copy the Corresponding Source from a network server at no charge.
272
273@item
274Convey individual copies of the object code with a copy of the written
275offer to provide the Corresponding Source. This alternative is
276allowed only occasionally and noncommercially, and only if you
277received the object code with such an offer, in accord with subsection
2786b.
279
280@item
281Convey the object code by offering access from a designated place
282(gratis or for a charge), and offer equivalent access to the
283Corresponding Source in the same way through the same place at no
284further charge. You need not require recipients to copy the
285Corresponding Source along with the object code. If the place to copy
286the object code is a network server, the Corresponding Source may be
287on a different server (operated by you or a third party) that supports
288equivalent copying facilities, provided you maintain clear directions
289next to the object code saying where to find the Corresponding Source.
290Regardless of what server hosts the Corresponding Source, you remain
291obligated to ensure that it is available for as long as needed to
292satisfy these requirements.
293
294@item
295Convey the object code using peer-to-peer transmission, provided you
296inform other peers where the object code and Corresponding Source of
297the work are being offered to the general public at no charge under
298subsection 6d.
299
300@end enumerate
301
302A separable portion of the object code, whose source code is excluded
303from the Corresponding Source as a System Library, need not be
304included in conveying the object code work.
305
306A ``User Product'' is either (1) a ``consumer product'', which means any
307tangible personal property which is normally used for personal,
308family, or household purposes, or (2) anything designed or sold for
309incorporation into a dwelling. In determining whether a product is a
310consumer product, doubtful cases shall be resolved in favor of
311coverage. For a particular product received by a particular user,
312``normally used'' refers to a typical or common use of that class of
313product, regardless of the status of the particular user or of the way
314in which the particular user actually uses, or expects or is expected
315to use, the product. A product is a consumer product regardless of
316whether the product has substantial commercial, industrial or
317non-consumer uses, unless such uses represent the only significant
318mode of use of the product.
319
320``Installation Information'' for a User Product means any methods,
321procedures, authorization keys, or other information required to
322install and execute modified versions of a covered work in that User
323Product from a modified version of its Corresponding Source. The
324information must suffice to ensure that the continued functioning of
325the modified object code is in no case prevented or interfered with
326solely because modification has been made.
327
328If you convey an object code work under this section in, or with, or
329specifically for use in, a User Product, and the conveying occurs as
330part of a transaction in which the right of possession and use of the
331User Product is transferred to the recipient in perpetuity or for a
332fixed term (regardless of how the transaction is characterized), the
333Corresponding Source conveyed under this section must be accompanied
334by the Installation Information. But this requirement does not apply
335if neither you nor any third party retains the ability to install
336modified object code on the User Product (for example, the work has
337been installed in ROM).
338
339The requirement to provide Installation Information does not include a
340requirement to continue to provide support service, warranty, or
341updates for a work that has been modified or installed by the
342recipient, or for the User Product in which it has been modified or
343installed. Access to a network may be denied when the modification
344itself materially and adversely affects the operation of the network
345or violates the rules and protocols for communication across the
346network.
347
348Corresponding Source conveyed, and Installation Information provided,
349in accord with this section must be in a format that is publicly
350documented (and with an implementation available to the public in
351source code form), and must require no special password or key for
352unpacking, reading or copying.
353
354@item Additional Terms.
355
356``Additional permissions'' are terms that supplement the terms of this
357License by making exceptions from one or more of its conditions.
358Additional permissions that are applicable to the entire Program shall
359be treated as though they were included in this License, to the extent
360that they are valid under applicable law. If additional permissions
361apply only to part of the Program, that part may be used separately
362under those permissions, but the entire Program remains governed by
363this License without regard to the additional permissions.
364
365When you convey a copy of a covered work, you may at your option
366remove any additional permissions from that copy, or from any part of
367it. (Additional permissions may be written to require their own
368removal in certain cases when you modify the work.) You may place
369additional permissions on material, added by you to a covered work,
370for which you have or can give appropriate copyright permission.
371
372Notwithstanding any other provision of this License, for material you
373add to a covered work, you may (if authorized by the copyright holders
374of that material) supplement the terms of this License with terms:
375
376@enumerate a
377@item
378Disclaiming warranty or limiting liability differently from the terms
379of sections 15 and 16 of this License; or
380
381@item
382Requiring preservation of specified reasonable legal notices or author
383attributions in that material or in the Appropriate Legal Notices
384displayed by works containing it; or
385
386@item
387Prohibiting misrepresentation of the origin of that material, or
388requiring that modified versions of such material be marked in
389reasonable ways as different from the original version; or
390
391@item
392Limiting the use for publicity purposes of names of licensors or
393authors of the material; or
394
395@item
396Declining to grant rights under trademark law for use of some trade
397names, trademarks, or service marks; or
398
399@item
400Requiring indemnification of licensors and authors of that material by
401anyone who conveys the material (or modified versions of it) with
402contractual assumptions of liability to the recipient, for any
403liability that these contractual assumptions directly impose on those
404licensors and authors.
405@end enumerate
406
407All other non-permissive additional terms are considered ``further
408restrictions'' within the meaning of section 10. If the Program as you
409received it, or any part of it, contains a notice stating that it is
410governed by this License along with a term that is a further
411restriction, you may remove that term. If a license document contains
412a further restriction but permits relicensing or conveying under this
413License, you may add to a covered work material governed by the terms
414of that license document, provided that the further restriction does
415not survive such relicensing or conveying.
416
417If you add terms to a covered work in accord with this section, you
418must place, in the relevant source files, a statement of the
419additional terms that apply to those files, or a notice indicating
420where to find the applicable terms.
421
422Additional terms, permissive or non-permissive, may be stated in the
423form of a separately written license, or stated as exceptions; the
424above requirements apply either way.
425
426@item Termination.
427
428You may not propagate or modify a covered work except as expressly
429provided under this License. Any attempt otherwise to propagate or
430modify it is void, and will automatically terminate your rights under
431this License (including any patent licenses granted under the third
432paragraph of section 11).
433
434However, if you cease all violation of this License, then your license
435from a particular copyright holder is reinstated (a) provisionally,
436unless and until the copyright holder explicitly and finally
437terminates your license, and (b) permanently, if the copyright holder
438fails to notify you of the violation by some reasonable means prior to
43960 days after the cessation.
440
441Moreover, your license from a particular copyright holder is
442reinstated permanently if the copyright holder notifies you of the
443violation by some reasonable means, this is the first time you have
444received notice of violation of this License (for any work) from that
445copyright holder, and you cure the violation prior to 30 days after
446your receipt of the notice.
447
448Termination of your rights under this section does not terminate the
449licenses of parties who have received copies or rights from you under
450this License. If your rights have been terminated and not permanently
451reinstated, you do not qualify to receive new licenses for the same
452material under section 10.
453
454@item Acceptance Not Required for Having Copies.
455
456You are not required to accept this License in order to receive or run
457a copy of the Program. Ancillary propagation of a covered work
458occurring solely as a consequence of using peer-to-peer transmission
459to receive a copy likewise does not require acceptance. However,
460nothing other than this License grants you permission to propagate or
461modify any covered work. These actions infringe copyright if you do
462not accept this License. Therefore, by modifying or propagating a
463covered work, you indicate your acceptance of this License to do so.
464
465@item Automatic Licensing of Downstream Recipients.
466
467Each time you convey a covered work, the recipient automatically
468receives a license from the original licensors, to run, modify and
469propagate that work, subject to this License. You are not responsible
470for enforcing compliance by third parties with this License.
471
472An ``entity transaction'' is a transaction transferring control of an
473organization, or substantially all assets of one, or subdividing an
474organization, or merging organizations. If propagation of a covered
475work results from an entity transaction, each party to that
476transaction who receives a copy of the work also receives whatever
477licenses to the work the party's predecessor in interest had or could
478give under the previous paragraph, plus a right to possession of the
479Corresponding Source of the work from the predecessor in interest, if
480the predecessor has it or can get it with reasonable efforts.
481
482You may not impose any further restrictions on the exercise of the
483rights granted or affirmed under this License. For example, you may
484not impose a license fee, royalty, or other charge for exercise of
485rights granted under this License, and you may not initiate litigation
486(including a cross-claim or counterclaim in a lawsuit) alleging that
487any patent claim is infringed by making, using, selling, offering for
488sale, or importing the Program or any portion of it.
489
490@item Patents.
491
492A ``contributor'' is a copyright holder who authorizes use under this
493License of the Program or a work on which the Program is based. The
494work thus licensed is called the contributor's ``contributor version''.
495
496A contributor's ``essential patent claims'' are all patent claims owned
497or controlled by the contributor, whether already acquired or
498hereafter acquired, that would be infringed by some manner, permitted
499by this License, of making, using, or selling its contributor version,
500but do not include claims that would be infringed only as a
501consequence of further modification of the contributor version. For
502purposes of this definition, ``control'' includes the right to grant
503patent sublicenses in a manner consistent with the requirements of
504this License.
505
506Each contributor grants you a non-exclusive, worldwide, royalty-free
507patent license under the contributor's essential patent claims, to
508make, use, sell, offer for sale, import and otherwise run, modify and
509propagate the contents of its contributor version.
510
511In the following three paragraphs, a ``patent license'' is any express
512agreement or commitment, however denominated, not to enforce a patent
513(such as an express permission to practice a patent or covenant not to
514sue for patent infringement). To ``grant'' such a patent license to a
515party means to make such an agreement or commitment not to enforce a
516patent against the party.
517
518If you convey a covered work, knowingly relying on a patent license,
519and the Corresponding Source of the work is not available for anyone
520to copy, free of charge and under the terms of this License, through a
521publicly available network server or other readily accessible means,
522then you must either (1) cause the Corresponding Source to be so
523available, or (2) arrange to deprive yourself of the benefit of the
524patent license for this particular work, or (3) arrange, in a manner
525consistent with the requirements of this License, to extend the patent
526license to downstream recipients. ``Knowingly relying'' means you have
527actual knowledge that, but for the patent license, your conveying the
528covered work in a country, or your recipient's use of the covered work
529in a country, would infringe one or more identifiable patents in that
530country that you have reason to believe are valid.
531
532If, pursuant to or in connection with a single transaction or
533arrangement, you convey, or propagate by procuring conveyance of, a
534covered work, and grant a patent license to some of the parties
535receiving the covered work authorizing them to use, propagate, modify
536or convey a specific copy of the covered work, then the patent license
537you grant is automatically extended to all recipients of the covered
538work and works based on it.
539
540A patent license is ``discriminatory'' if it does not include within the
541scope of its coverage, prohibits the exercise of, or is conditioned on
542the non-exercise of one or more of the rights that are specifically
543granted under this License. You may not convey a covered work if you
544are a party to an arrangement with a third party that is in the
545business of distributing software, under which you make payment to the
546third party based on the extent of your activity of conveying the
547work, and under which the third party grants, to any of the parties
548who would receive the covered work from you, a discriminatory patent
549license (a) in connection with copies of the covered work conveyed by
550you (or copies made from those copies), or (b) primarily for and in
551connection with specific products or compilations that contain the
552covered work, unless you entered into that arrangement, or that patent
553license was granted, prior to 28 March 2007.
554
555Nothing in this License shall be construed as excluding or limiting
556any implied license or other defenses to infringement that may
557otherwise be available to you under applicable patent law.
558
559@item No Surrender of Others' Freedom.
560
561If conditions are imposed on you (whether by court order, agreement or
562otherwise) that contradict the conditions of this License, they do not
563excuse you from the conditions of this License. If you cannot convey
564a covered work so as to satisfy simultaneously your obligations under
565this License and any other pertinent obligations, then as a
566consequence you may not convey it at all. For example, if you agree
567to terms that obligate you to collect a royalty for further conveying
568from those to whom you convey the Program, the only way you could
569satisfy both those terms and this License would be to refrain entirely
570from conveying the Program.
571
572@item Remote Network Interaction; Use with the GNU General Public License.
573
574Notwithstanding any other provision of this License, if you modify the
575Program, your modified version must prominently offer all users interacting
576with it remotely through a computer network (if your version supports such
577interaction) an opportunity to receive the Corresponding Source of your
578version by providing access to the Corresponding Source from a network
579server at no charge, through some standard or customary means of
580facilitating copying of software. This Corresponding Source shall include
581the Corresponding Source for any work covered by version 3 of the GNU
582General Public License that is incorporated pursuant to the following
583paragraph.
584
585Notwithstanding any other provision of this License, you have permission to
586link or combine any covered work with a work licensed under version 3 of
587the GNU General Public License into a single combined work, and to convey
588the resulting work. The terms of this License will continue to apply to
589the part which is the covered work, but the work with which it is combined
590will remain governed by version 3 of the GNU General Public License.
591
592@item Revised Versions of this License.
593
594The Free Software Foundation may publish revised and/or new versions
595of the GNU Affero General Public License from time to time. Such new
596versions will be similar in spirit to the present version, but may
597differ in detail to address new problems or concerns.
598
599Each version is given a distinguishing version number. If the Program
600specifies that a certain numbered version of the GNU Affero General Public
601License ``or any later version'' applies to it, you have the option of
602following the terms and conditions either of that numbered version or
603of any later version published by the Free Software Foundation. If
604the Program does not specify a version number of the GNU Affero General
605Public License, you may choose any version ever published by the Free
606Software Foundation.
607
608If the Program specifies that a proxy can decide which future versions
609of the GNU Affero General Public License can be used, that proxy's public
610statement of acceptance of a version permanently authorizes you to
611choose that version for the Program.
612
613Later license versions may give you additional or different
614permissions. However, no additional obligations are imposed on any
615author or copyright holder as a result of your choosing to follow a
616later version.
617
618@item Disclaimer of Warranty.
619
620THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
621APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
622HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT
623WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
624LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
625A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND
626PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
627DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
628CORRECTION.
629
630@item Limitation of Liability.
631
632IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
633WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
634CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
635INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
636ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
637NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
638LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
639TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
640PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
641
642@item Interpretation of Sections 15 and 16.
643
644If the disclaimer of warranty and limitation of liability provided
645above cannot be given local legal effect according to their terms,
646reviewing courts shall apply local law that most closely approximates
647an absolute waiver of all civil liability in connection with the
648Program, unless a warranty or assumption of liability accompanies a
649copy of the Program in return for a fee.
650
651@end enumerate
652
653@heading END OF TERMS AND CONDITIONS
654
655@heading How to Apply These Terms to Your New Programs
656
657If you develop a new program, and you want it to be of the greatest
658possible use to the public, the best way to achieve this is to make it
659free software which everyone can redistribute and change under these
660terms.
661
662To do so, attach the following notices to the program. It is safest
663to attach them to the start of each source file to most effectively
664state the exclusion of warranty; and each file should have at least
665the ``copyright'' line and a pointer to where the full notice is found.
666
667@smallexample
668@var{one line to give the program's name and a brief idea of what it does.}
669Copyright (C) @var{year} @var{name of author}
670
671This program is free software: you can redistribute it and/or modify
672it under the terms of the GNU Affero General Public License as published by
673the Free Software Foundation, either version 3 of the License, or (at
674your option) any later version.
675
676This program is distributed in the hope that it will be useful, but
677WITHOUT ANY WARRANTY; without even the implied warranty of
678MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
679Affero General Public License for more details.
680
681You should have received a copy of the GNU Affero General Public License
682along with this program. If not, see @url{https://www.gnu.org/licenses/}.
683@end smallexample
684
685Also add information on how to contact you by electronic and paper mail.
686
687If your software can interact with users remotely through a computer
688network, you should also make sure that it provides a way for users to
689get its source. For example, if your program is a web application, its
690interface could display a ``Source'' link that leads users to an archive
691of the code. There are many ways you could offer source, and different
692solutions will be better for different programs; see section 13 for the
693specific requirements.
694
695You should also get your employer (if you work as a programmer) or school,
696if any, to sign a ``copyright disclaimer'' for the program, if necessary.
697For more information on this, and how to apply and follow the GNU AGPL, see
698@url{https://www.gnu.org/licenses/}.
diff --git a/doc/documentation/chapters/contributing.texi b/doc/documentation/chapters/contributing.texi
index 745acca77..a92df45c3 100644
--- a/doc/documentation/chapters/contributing.texi
+++ b/doc/documentation/chapters/contributing.texi
@@ -6,17 +6,20 @@
6* Licenses of contributions:: 6* Licenses of contributions::
7* Copyright Assignment:: 7* Copyright Assignment::
8* Contributing to the Reference Manual:: 8* Contributing to the Reference Manual::
9* Contributing testcases::
9@end menu 10@end menu
10 11
11@node Contributing to GNUnet 12@node Contributing to GNUnet
12@section Contributing to GNUnet 13@section Contributing to GNUnet
13 14
15@cindex licenses
16@cindex licenses of contributions
14@node Licenses of contributions 17@node Licenses of contributions
15@section Licenses of contributions 18@section Licenses of contributions
16 19
17GNUnet is a @uref{https://www.gnu.org/, GNU} package. 20GNUnet is a @uref{https://www.gnu.org/, GNU} package.
18All code contributions must thus be put under the 21All code contributions must thus be put under the
19@uref{https://www.gnu.org/copyleft/gpl.html, GNU Public License (GPL)}. 22@uref{https://www.gnu.org/licenses/agpl.html, GNU Affero Public License (AGPL)}.
20All documentation should be put under FSF approved licenses 23All documentation should be put under FSF approved licenses
21(see @uref{https://www.gnu.org/copyleft/fdl.html, fdl}). 24(see @uref{https://www.gnu.org/copyleft/fdl.html, fdl}).
22 25
@@ -40,7 +43,7 @@ rights, and in particular is allowed to dual-license the code. You
40retain non-exclusive rights to your contributions, so you can also 43retain non-exclusive rights to your contributions, so you can also
41share your contributions freely with other projects. 44share your contributions freely with other projects.
42 45
43GNUnet e.V. will publish all accepted contributions under the GPLv3 46GNUnet e.V. will publish all accepted contributions under the AGPLv3
44or any later version. The association may decide to publish 47or any later version. The association may decide to publish
45contributions under additional licenses (dual-licensing). 48contributions under additional licenses (dual-licensing).
46 49
@@ -88,3 +91,21 @@ In a 200+ pages handbook it's better to have footnotes accessible
88without having to skip over to the end. 91without having to skip over to the end.
89 92
90@end itemize 93@end itemize
94
95@node Contributing testcases
96@section Contributing testcases
97
98In the core of gnunet, we restrict new testcases to a small subset
99of languages, in order of preference:
100@enumerate
101@item C
102@item Bash (preferable portable without too much specifics to Bash)
103@item Python (@geq{}3.6)
104@end enumerate
105
106We welcome efforts to remove our existing python-2.7 scripts to
107replace them either with Bash or, at your choice, python-3.6+.
108
109If you contribute new python based testcases, we advise you to
110not repeat our past misfortunes and write the tests in a standard
111test framework like for example pytest.
diff --git a/doc/documentation/chapters/developer.texi b/doc/documentation/chapters/developer.texi
index 1f74a8163..e82e32b59 100644
--- a/doc/documentation/chapters/developer.texi
+++ b/doc/documentation/chapters/developer.texi
@@ -214,9 +214,7 @@ Installation and update tool
214Template for starting 'external' GNUnet projects 214Template for starting 'external' GNUnet projects
215@item @command{gnunet-java} 215@item @command{gnunet-java}
216Java APIs for writing GNUnet services and applications 216Java APIs for writing GNUnet services and applications
217@c ** FIXME: Point to new website repository once we have it: 217@item @command{gnunet-java-ext}
218@c ** @item svn/gnunet-www/ Code and media helping drive the GNUnet
219@c website
220@item @command{eclectic} 218@item @command{eclectic}
221Code to run GNUnet nodes on testbeds for research, development, 219Code to run GNUnet nodes on testbeds for research, development,
222testing and evaluation 220testing and evaluation
@@ -227,6 +225,8 @@ Qt-based GNUnet GUI (is it deprecated?)
227cocoa-based GNUnet GUI (is it deprecated?) 225cocoa-based GNUnet GUI (is it deprecated?)
228@item @command{gnunet-guile} 226@item @command{gnunet-guile}
229Guile bindings for GNUnet 227Guile bindings for GNUnet
228@item @command{gnunet-python}
229Python bindings for GNUnet
230 230
231@end table 231@end table
232 232
@@ -246,6 +246,13 @@ Tool for automated debugging of distributed systems
246Library for accessing satellite connection quality reports 246Library for accessing satellite connection quality reports
247@item @command{libgnurl} 247@item @command{libgnurl}
248gnURL (feature-restricted variant of cURL/libcurl) 248gnURL (feature-restricted variant of cURL/libcurl)
249@item @command{www}
250work in progress of the new gnunet.org website (Jinja2 framework based to
251replace our current Drupal website)
252@item @command{bibliography}
253Our collected bibliography, papers, references, and so forth
254@item @command{gnunet-videos-}
255Videos about and around gnunet activities
249@end table 256@end table
250 257
251Finally, there are various external projects (see links for a list of 258Finally, there are various external projects (see links for a list of
diff --git a/doc/documentation/chapters/installation.texi b/doc/documentation/chapters/installation.texi
index f5e38fd3d..559a97f96 100644
--- a/doc/documentation/chapters/installation.texi
+++ b/doc/documentation/chapters/installation.texi
@@ -1,22 +1,40 @@
1@node Installing GNUnet 1@node Installing GNUnet
2@chapter Installing GNUnet 2@chapter Installing GNUnet
3 3
4This guide is intended for those who want to install Gnunet from source. For instructions on how to install GNUnet as a binary package please refer to the official documentation of your operating system or package manager. 4This guide is intended for those who want to install Gnunet from
5source. For instructions on how to install GNUnet as a binary package
6please refer to the official documentation of your operating system or
7package manager.
5 8
6@node Getting the Source Code 9@menu
10* Installing dependencies::
11* Getting the Source Code::
12* Create @code{gnunet} user and group::
13* Preparing and Compiling the Source Code::
14* Installation::
15* MOVED FROM USER Checking the Installation::
16* MOVED FROM USER The graphical configuration interface::
17* MOVED FROM USER Config Leftovers::
18@end menu
19
20@c -----------------------------------------------------------------------
21@node Installing dependencies
7@section Installing dependencies 22@section Installing dependencies
8GNUnet needs few libraries and applications for being able to run and another few optional ones for using certain features. Preferably they should be installed with a package manager. Just in case we include a link to the project websites. 23GNUnet needs few libraries and applications for being able to run and
24another few optional ones for using certain features. Preferably they
25should be installed with a package manager. Just in case we include a
26link to the project websites.
9 27
10The mandatory libraries and applications are 28The mandatory libraries and applications are
11@itemize @bullet 29@itemize @bullet
12@item libtool 30@item libtool
13@item autoconf >= version 2.59 31@item autoconf @geq{}2.59
14@item automake >= version 1.11.1 32@item automake @geq{}1.11.1
15@item pkg-config 33@item pkg-config
16@item libgcrypt >= version 1.6 34@item libgcrypt @geq{}1.6
17@item libextractor 35@item libextractor
18@item libidn 36@item libidn
19@item libmicrohttpd >= version 0.9.52 37@item libmicrohttpd @geq{}0.9.52
20@item libnss 38@item libnss
21@item libunistring 39@item libunistring
22@item gettext 40@item gettext
@@ -43,30 +61,43 @@ These are the dependencies only required for certain features
43@item libpulse (for running the GNUnet conversation telephony application) 61@item libpulse (for running the GNUnet conversation telephony application)
44@item libogg (for running the GNUnet conversation telephony application) 62@item libogg (for running the GNUnet conversation telephony application)
45@item bluez (for bluetooth support) 63@item bluez (for bluetooth support)
46@item libpbc (for attribute-based encryption and the identity provider subsystem) 64@item libpbc
47@item libgabe (for attribute-based encryption and the identity provider subsystem) 65(for attribute-based encryption and the identity provider subsystem)
66@item libgabe
67(for attribute-based encryption and the identity provider subsystem)
48@end itemize 68@end itemize
49 69
50 70@c -----------------------------------------------------------------------
71@node Getting the Source Code
51@section Getting the Source Code 72@section Getting the Source Code
52You can either download the source code using git (you obviously need git installed) or as an archive. 73You can either download the source code using git (you obviously need
74git installed) or as an archive.
53 75
54Using git type 76Using git type
55@example 77@example
56git clone https://gnunet.org/git/gnunet.git 78git clone https://gnunet.org/git/gnunet.git
57@end example 79@end example
58 80
59The archive can be found at @uref{https://gnunet.org/downloads}. Extract it using a graphical archive tool or @code{tar}: 81The archive can be found at
82@uref{https://gnunet.org/downloads}. Extract it using a graphical
83archive tool or @code{tar}:
60@example 84@example
61tar xzvf gnunet-0.11.0pre66.tar.gz 85tar xzvf gnunet-0.11.0pre66.tar.gz
62@end example 86@end example
63 87
64In the next chapter we will assume that the source code is available in the home directory at @code{~/gnunet}. 88In the next chapter we will assume that the source code is available
89in the home directory at @code{~/gnunet}.
65 90
91@c -----------------------------------------------------------------------
92@node Create @code{gnunet} user and group
66@section Create @code{gnunet} user and group 93@section Create @code{gnunet} user and group
67The GNUnet services should be run as a dedicated user called @code{gnunet}. For using them a user should be in the same group as this system user. 94The GNUnet services should be run as a dedicated user called
95@code{gnunet}. For using them a user should be in the same group as
96this system user.
68 97
69Create user @code{gnunet} who is member of the group @code{gnunet} and specify a home directory where the GNUnet services will store persistant data such as information about peers. 98Create user @code{gnunet} who is member of the group @code{gnunet} and
99specify a home directory where the GNUnet services will store
100persistant data such as information about peers.
70@example 101@example
71$ sudo useradd --system --groups gnunet --home-dir /var/lib/gnunet 102$ sudo useradd --system --groups gnunet --home-dir /var/lib/gnunet
72@end example 103@end example
@@ -76,8 +107,13 @@ Now add your own user to the @code{gnunet} group.
76$ sudo adduser alice gnunet 107$ sudo adduser alice gnunet
77@end example 108@end example
78 109
110@c -----------------------------------------------------------------------
111@node Preparing and Compiling the Source Code
79@section Preparing and Compiling the Source Code 112@section Preparing and Compiling the Source Code
80For preparing the source code for compilation a bootstrap script and @code{configure} has to be run from the source code directory. When running @code{configure} the following options can be specified to customize the compilation and installation process: 113For preparing the source code for compilation a bootstrap script and
114@code{configure} has to be run from the source code directory. When
115running @code{configure} the following options can be specified to
116customize the compilation and installation process:
81 117
82@itemize @bullet 118@itemize @bullet
83@item @code{--disable-documentation} - don't build the configuration documents 119@item @code{--disable-documentation} - don't build the configuration documents
@@ -91,27 +127,39 @@ For preparing the source code for compilation a bootstrap script and @code{confi
91@item @code{--with-sudo=[PATH]} - path to the sudo binary (no need to run @code{make install} as root if specified) 127@item @code{--with-sudo=[PATH]} - path to the sudo binary (no need to run @code{make install} as root if specified)
92@end itemize 128@end itemize
93 129
94The following example configures the installation prefix @code{/usr/lib} and disables building the documentation 130The following example configures the installation prefix
131@code{/usr/lib} and disables building the documentation
95@example 132@example
96$ cd ~/gnunet 133$ cd ~/gnunet
97$ ./bootstrap 134$ ./bootstrap
98$ configure --prefix=/usr/lib --disable-configuration 135$ configure --prefix=/usr/lib --disable-configuration
99@end example 136@end example
100 137
101After running the bootstrap script and @code{configure} successfully the source code can be compiled with make. Here @code{-j5} specifies that 5 threads should be used. 138After running the bootstrap script and @code{configure} successfully
139the source code can be compiled with make. Here @code{-j5} specifies
140that 5 threads should be used.
102@example 141@example
103$ make -j5 142$ make -j5
104@end example 143@end example
105 144
106 145@c -----------------------------------------------------------------------
146@node Installation
107@section Installation 147@section Installation
108The compiled binaries can be installed using @code{make install}. It needs to be run as root (or with sudo) because some binaries need the @code{suid} bit set. Without that some GNUnet subsystems (such as VPN) will not work. 148The compiled binaries can be installed using @code{make install}. It
149needs to be run as root (or with sudo) because some binaries need the
150@code{suid} bit set. Without that some GNUnet subsystems (such as VPN)
151will not work.
109 152
110@example 153@example
111$ sudo make install 154$ sudo make install
112@end example 155@end example
113 156
114One important library is the GNS plugin for NSS (the name services switch) which allows using GNS (the GNU name system) in the normal DNS resolution process. Unfortunately NSS expects it in a specific location (probably @code{/lib}) which may differ from the installation prefix (see @code{--prefix} option in the previous section). This is why the pugin has to be installed manually. 157One important library is the GNS plugin for NSS (the name services
158switch) which allows using GNS (the GNU name system) in the normal DNS
159resolution process. Unfortunately NSS expects it in a specific
160location (probably @code{/lib}) which may differ from the installation
161prefix (see @code{--prefix} option in the previous section). This is
162why the pugin has to be installed manually.
115 163
116Find the directory where nss plugins are installed on your system, e.g. 164Find the directory where nss plugins are installed on your system, e.g.
117 165
@@ -129,24 +177,30 @@ Copy the GNS NSS plugin to that directory:
129cp ~/gnunet/src/gns/nss/libnss_gns.so.2 /lib 177cp ~/gnunet/src/gns/nss/libnss_gns.so.2 /lib
130@end example 178@end example
131 179
132Now, to activate the plugin, you need to edit your @code{/etc/nsswitch.conf} where you should find a line like this: 180Now, to activate the plugin, you need to edit your
181@code{/etc/nsswitch.conf} where you should find a line like this:
133 182
134@example 183@example
135hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 184hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
136@end example 185@end example
137 186
138The exact details may differ a bit, which is fine. Add the text @code{"gns [NOTFOUND=return]"} after @code{"files"}. 187The exact details may differ a bit, which is fine. Add the text
188@code{"gns [NOTFOUND=return]"} after @code{"files"}.
139 189
140@example 190@example
141hosts: files gns [NOTFOUND=return] mdns4_minimal [NOTFOUND=return] dns mdns4 191hosts: files gns [NOTFOUND=return] mdns4_minimal [NOTFOUND=return] dns mdns4
142@end example 192@end example
143 193
144Optionally, if GNS shall be used with a browser, execute the GNS CA-setup script. It will isetup the GNS Certificate Authority with the user's browser. 194Optionally, if GNS shall be used with a browser, execute the GNS
195CA-setup script. It will isetup the GNS Certificate Authority with the
196user's browser.
145@example 197@example
146$ gnunet-gns-proxy-setup-ca 198$ gnunet-gns-proxy-setup-ca
147@end example 199@end example
148 200
149Finally install a configuration file in @code{~/.gnunet/gnunet.conf}. Below you find an example config which allows you to start GNUnet. 201Finally install a configuration file in
202@code{~/.gnunet/gnunet.conf}. Below you find an example config which
203allows you to start GNUnet.
150 204
151@example 205@example
152[arm] 206[arm]
@@ -170,7 +224,8 @@ This section describes a quick, casual way to check if your GNUnet
170installation works. However, if it does not, we do not cover 224installation works. However, if it does not, we do not cover
171steps for recovery --- for this, please study the instructions 225steps for recovery --- for this, please study the instructions
172provided in the developer handbook as well as the system-specific 226provided in the developer handbook as well as the system-specific
173instruction in the source code repository@footnote{The system specific instructions are not provided as part of this handbook!}. 227instruction in the source code repository@footnote{The system specific
228instructions are not provided as part of this handbook!}.
174 229
175 230
176@menu 231@menu
@@ -203,21 +258,25 @@ Currently these interfaces cover:
203@subsection Statistics 258@subsection Statistics
204@c %**end of header 259@c %**end of header
205 260
206First, you should launch GNUnet gtk@footnote{Obviously you should also start gnunet, via gnunet-arm or the system provided method}. 261First, you should launch GNUnet gtk@footnote{Obviously you should also
262start gnunet, via gnunet-arm or the system provided method}.
207You can do this from the command-line by typing 263You can do this from the command-line by typing
208 264
209@example 265@example
210gnunet-statistics-gtk 266gnunet-statistics-gtk
211@end example 267@end example
212 268
213If your peer@footnote{The term ``peer'' is a common word used in federated and distributed networks to describe a participating device which is connected to the network. Thus, your Personal Computer or whatever it is you are looking at the Gtk+ interface describes a ``Peer'' or a ``Node''.} 269If your peer@footnote{The term ``peer'' is a common word used in
214is running correctly, you should see a bunch of lines, 270federated and distributed networks to describe a participating device
215all of which should be ``significantly'' above zero (at least if your 271which is connected to the network. Thus, your Personal Computer or
216peer has been running for more than a few seconds). The lines indicate 272whatever it is you are looking at the Gtk+ interface describes a
217how many other peers your peer is connected to (via different 273``Peer'' or a ``Node''.} is running correctly, you should see a bunch
218mechanisms) and how large the entire overlay network is currently 274of lines, all of which should be ``significantly'' above zero (at
219estimated to be. The X-axis represents time (in seconds since the 275least if your peer has been running for more than a few seconds). The
220start of @command{gnunet-gtk}). 276lines indicate how many other peers your peer is connected to (via
277different mechanisms) and how large the entire overlay network is
278currently estimated to be. The X-axis represents time (in seconds
279since the start of @command{gnunet-gtk}).
221 280
222You can click on "Traffic" to see information about the amount of 281You can click on "Traffic" to see information about the amount of
223bandwidth your peer has consumed, and on "Storage" to check the amount 282bandwidth your peer has consumed, and on "Storage" to check the amount
diff --git a/doc/documentation/chapters/preface.texi b/doc/documentation/chapters/preface.texi
index 00e6290f0..29cf924a2 100644
--- a/doc/documentation/chapters/preface.texi
+++ b/doc/documentation/chapters/preface.texi
@@ -12,9 +12,9 @@ all kinds of basic applications for the foundation of a new Internet.
12 12
13@menu 13@menu
14* About this book:: 14* About this book::
15* Contributing to this book::
15* Introduction:: 16* Introduction::
16* Project governance:: 17* Project governance::
17* General Terminology::
18* Typography:: 18* Typography::
19@end menu 19@end menu
20 20
@@ -37,6 +37,26 @@ The first chapter (``Preface'') as well as the the second
37chapter (``Philosophy'') give an introduction to GNUnet as a project, 37chapter (``Philosophy'') give an introduction to GNUnet as a project,
38what GNUnet tries to achieve. 38what GNUnet tries to achieve.
39 39
40@node Contributing to this book
41@section Contributing to this book
42
43The GNUnet Reference Manual is a collective work produced by various
44people throughout the years. The version you are reading is derived
45from many individual efforts hosted on our website. This was a failed
46experiment, and with the conversion to Texinfo we hope to address this
47in the longterm. Texinfo is the documentation language of the GNU project.
48While it can be intimidating at first and look scary or complicated,
49it is just another way to express text format instructions. We encourage
50you to take this opportunity and learn about Texinfo, learn about GNUnet,
51and one word at a time we will arrive at a book which explains GNUnet in
52the least complicated way to you. Even when you don't want or can't learn
53Texinfo, you can contribute. Send us an Email or join our IRC chat room
54on freenode and talk with us about the documentation (the prefered way
55to reach out is the mailinglist, since you can communicate with us
56without waiting on someone in the chatroom). One way or another you
57can help shape the understanding of GNUnet without the ability to read
58and understand its sourcecode.
59
40@node Introduction 60@node Introduction
41@section Introduction 61@section Introduction
42 62
@@ -66,25 +86,31 @@ immediately. A few months after the first release we contacted the
66GNU project, happily agreed to their governance model and became an 86GNU project, happily agreed to their governance model and became an
67official GNU package. 87official GNU package.
68 88
69Within the first year, we created GNU libextractor, a helper library 89Within the first year, we created
90@uref{https://gnu.org/s/libextractor, GNU libextractor}, a helper library
70for meta data extraction which has been used by a few other projects 91for meta data extraction which has been used by a few other projects
71as well. 2003 saw the emergence of pluggable transports, the ability 92as well. 2003 saw the emergence of pluggable transports, the ability
72for GNUnet to use different mechanisms for communication, starting 93for GNUnet to use different mechanisms for communication, starting
73with TCP, UDP and SMTP (support for the latter was later dropped due 94with TCP, UDP and SMTP (support for the latter was later dropped due
74to a lack of maintenance). In 2005, the project first started to 95to a lack of maintenance). In 2005, the project first started to
75evolve beyond the original file-sharing application with a first 96evolve beyond the original file-sharing application with a first
76simple P2P chat. In 2007, we created GNU libmicrohttpd 97simple P2P chat. In 2007, we created
98@uref{https://gnu.org/s/libmicrohttpd, GNU libmicrohttpd}
77to support a pluggable transport based on HTTP. In 2009, the 99to support a pluggable transport based on HTTP. In 2009, the
78architecture was radically modularized into the multi-process system 100architecture was radically modularized into the multi-process system
79that exists today. Coincidentally, the first version of the ARM 101that exists today. Coincidentally, the first version of the ARM@footnote{ARM: Automatic Restart Manager}
80service was implemented a day before systemd was announced. From 2009 102service was implemented a day before systemd was announced. From 2009
81to 2014 work progressed rapidly thanks to a significant research grant 103to 2014 work progressed rapidly thanks to a significant research grant
82from the Deutsche Forschungsgesellschaft. This resulted in particular 104from the Deutsche Forschungsgesellschaft. This resulted in particular
83in the creation of the R5N DHT, CADET, ATS and the GNU Name System. 105in the creation of the R5N DHT, CADET, ATS and the GNU Name System.
84In 2010, GNUnet was selected as the basis for the SecuShare online 106In 2010, GNUnet was selected as the basis for the
85social network, resutling in a significant growth of the core team. 107@uref{https://secushare.org, secushare} online
86In 2013, we launched GNU Taler to address the challenge of convenient 108social network, resulting in a significant growth of the core team.
87and privacy-preserving online payments. In 2015, the pEp project 109In 2013, we launched @uref{https://taler.net, GNU Taler} to address
110the challenge of convenient
111and privacy-preserving online payments. In 2015, the
112@c TODO: Maybe even markup for the E if it renders in most outputs.
113@uref{https://pep.foundation/, pEp}@footnote{pretty easy privacy} project
88announced that they will use GNUnet as the technology for their 114announced that they will use GNUnet as the technology for their
89meta-data protection layer, ultimately resulting in GNUnet e.V. 115meta-data protection layer, ultimately resulting in GNUnet e.V.
90entering into a formal long-term collaboration with the pEp 116entering into a formal long-term collaboration with the pEp
@@ -99,9 +125,9 @@ computing has been the core driver of the GNU project. With GNUnet we
99are focusing on informational self-determination for collaborative 125are focusing on informational self-determination for collaborative
100computing and communication over networks. 126computing and communication over networks.
101 127
102The Internet is shaped as much by code and protocols as by its 128The Internet is shaped as much by code and protocols as it is by its
103associated political processes (IETF, ICANN, IEEE, etc.), and its 129associated political processes (IETF, ICANN, IEEE, etc.).
104flaws are similarly not limited to the protocol design. Thus, 130Similarly its flaws are not limited to the protocol design. Thus,
105technical excellence by itself will not suffice to create a better 131technical excellence by itself will not suffice to create a better
106network. We also need to build a community that is wise, humble and 132network. We also need to build a community that is wise, humble and
107has a sense of humor to achieve our goal to create a technical 133has a sense of humor to achieve our goal to create a technical
@@ -116,23 +142,22 @@ follows the governance model of a benevolent dictator. This means
116that ultimately, the GNU project appoints the GNU maintainer and can 142that ultimately, the GNU project appoints the GNU maintainer and can
117overrule decisions made by the GNUnet maintainer. Similarly, the 143overrule decisions made by the GNUnet maintainer. Similarly, the
118GNUnet maintainer can overrule any decisions made by individual 144GNUnet maintainer can overrule any decisions made by individual
145@c TODO: Should we mention if this is just about GNUnet? Other projects
146@c TODO: in GNU seem to have rare issues (GCC, the 2018 documentation
147@c TODO: discussion.
119developers. Still, in practice neither has happened in the last 20 148developers. Still, in practice neither has happened in the last 20
120years, and we hope to keep it that way. 149years, and we hope to keep it that way.
121 150
151@c TODO: Actually we are a Swiss association, or just a German association
152@c TODO: with Swiss bylaws/Satzung?
153@c TODO: Rewrite one of the 'GNUnet eV may also' sentences.
122The GNUnet project is supported by GNUnet e.V., a German association 154The GNUnet project is supported by GNUnet e.V., a German association
123where any developer can become a member. GNUnet e.V. servers as a 155where any developer can become a member. GNUnet e.V. serves as a
124legal entity to hold the copyrights to GNUnet. GNUnet e.V. may also 156legal entity to hold the copyrights to GNUnet. GNUnet e.V. may also
125choose to pay for project resources, and can collect donations. 157choose to pay for project resources, and can collect donations.
126GNUnet e.V. may also choose to adjust the license of the 158GNUnet e.V. may also choose to adjust the license of the
127software (with the constraint that it has to remain free software). 159software (with the constraint that it has to remain free software)@footnote{For example in 2018 we switched from GPL3 to AGPL3. In practice these changes do not happen very often.}
128
129
130@node General Terminology
131@section General Terminology
132 160
133In the following manual we may use words that can not be found in the
134Appendix. Since we want to keep the manual selfcontained, we will
135explain words here.
136 161
137@node Typography 162@node Typography
138@section Typography 163@section Typography
@@ -142,3 +167,5 @@ command should/can be issued as root, or if "normal" user privileges are
142sufficient. We use a @code{#} for root's shell prompt, a 167sufficient. We use a @code{#} for root's shell prompt, a
143@code{%} for users' shell prompt, assuming they use the C-shell or tcsh 168@code{%} for users' shell prompt, assuming they use the C-shell or tcsh
144and a @code{$} for bourne shell and derivatives. 169and a @code{$} for bourne shell and derivatives.
170@c TODO: Really? Why the different prompts? Do we already have c-shell
171@c TODO: examples?
diff --git a/doc/documentation/chapters/user.texi b/doc/documentation/chapters/user.texi
index fe47abb86..50b795197 100644
--- a/doc/documentation/chapters/user.texi
+++ b/doc/documentation/chapters/user.texi
@@ -26,6 +26,7 @@ always welcome.
26* First steps - Using the GNUnet VPN:: 26* First steps - Using the GNUnet VPN::
27* File-sharing:: 27* File-sharing::
28* The GNU Name System:: 28* The GNU Name System::
29* re@:claim Identity Provider::
29* Using the Virtual Public Network:: 30* Using the Virtual Public Network::
30@end menu 31@end menu
31 32
@@ -43,6 +44,7 @@ To stop GNUnet:
43@example 44@example
44$ gnunet-arm -e 45$ gnunet-arm -e
45@end example 46@end example
47
46@node First steps - Using the GNU Name System 48@node First steps - Using the GNU Name System
47@section First steps - Using the GNU Name System 49@section First steps - Using the GNU Name System
48@c %**end of header 50@c %**end of header
@@ -246,7 +248,7 @@ more an experimental feature and not really our primary goal at this
246time. Still, it is a possible use-case and we welcome help with testing 248time. Still, it is a possible use-case and we welcome help with testing
247and development. 249and development.
248 250
249 251@pindex gnunet-bcd
250@node Creating a Business Card 252@node Creating a Business Card
251@subsection Creating a Business Card 253@subsection Creating a Business Card
252@c FIXME: Which parts of texlive are needed? Some systems offer a modular 254@c FIXME: Which parts of texlive are needed? Some systems offer a modular
@@ -257,7 +259,9 @@ Note that this requires having @command{LaTeX} installed on your system.
257If you are using a Debian GNU/Linux based operating system, the 259If you are using a Debian GNU/Linux based operating system, the
258following command should install the required components. 260following command should install the required components.
259Keep in mind that this @b{requires 3GB} of downloaded data and possibly 261Keep in mind that this @b{requires 3GB} of downloaded data and possibly
260@b{even more} when unpacked. 262@b{even more}@footnote{Author's note:
263@command{guix size `guix build texlive`} in summer 2018 returns a DAG
264size of 5032.4 MiB} when unpacked.
261@b{We welcome any help in identifying the required components of the 265@b{We welcome any help in identifying the required components of the
262TexLive Distribution. This way we could just state the required components 266TexLive Distribution. This way we could just state the required components
263without pulling in the full distribution of TexLive.} 267without pulling in the full distribution of TexLive.}
@@ -312,12 +316,14 @@ you might need a trip to the store together.
312Before we get started, we need to tell @code{gnunet-qr} which zone 316Before we get started, we need to tell @code{gnunet-qr} which zone
313it should import new records into. For this, run: 317it should import new records into. For this, run:
314 318
319@pindex gnunet-identity
315@example 320@example
316$ gnunet-identity -s namestore -e NAME 321$ gnunet-identity -s namestore -e NAME
317@end example 322@end example
318where NAME is the name of the zone you want to import records 323where NAME is the name of the zone you want to import records
319into. In our running example, this would be ``gnu''. 324into. In our running example, this would be ``gnu''.
320 325
326@pindex gnunet-qr
321Henceforth, for every business card you collect, simply run: 327Henceforth, for every business card you collect, simply run:
322@example 328@example
323$ gnunet-qr 329$ gnunet-qr
@@ -335,6 +341,7 @@ GNUnet network at this time, you should thus be able to
335resolve your friends names. Suppose your friend's nickname 341resolve your friends names. Suppose your friend's nickname
336is "Bob". Then, type 342is "Bob". Then, type
337 343
344@pindex gnunet-gns
338@example 345@example
339$ gnunet-gns -u test.bob.gnu 346$ gnunet-gns -u test.bob.gnu
340@end example 347@end example
@@ -381,6 +388,7 @@ a revocation certificate corresponding to your ego. This certificate,
381when published on the P2P network, flags your private key as invalid, 388when published on the P2P network, flags your private key as invalid,
382and all further resolutions or other checks involving the key will fail. 389and all further resolutions or other checks involving the key will fail.
383 390
391@pindex gnunet-revocation
384A revocation certificate is thus a useful tool when things go out of 392A revocation certificate is thus a useful tool when things go out of
385control, but at the same time it should be stored securely. 393control, but at the same time it should be stored securely.
386Generation of the revocation certificate for a zone can be done through 394Generation of the revocation certificate for a zone can be done through
@@ -433,6 +441,7 @@ private conversation with your friend. Finally, help us
433with the next GNUnet release for even more applications 441with the next GNUnet release for even more applications
434using this new public key infrastructure. 442using this new public key infrastructure.
435 443
444@pindex gnunet-conservation-gtk
436@node First steps - Using GNUnet Conversation 445@node First steps - Using GNUnet Conversation
437@section First steps - Using GNUnet Conversation 446@section First steps - Using GNUnet Conversation
438@c %**end of header 447@c %**end of header
@@ -485,6 +494,7 @@ that will show up when you call somebody else, as well as the
485GNS zone that will be used to resolve names of users that you 494GNS zone that will be used to resolve names of users that you
486are calling. Run 495are calling. Run
487 496
497@pindex gnunet-conversation
488@example 498@example
489gnunet-conversation -e zone-name 499gnunet-conversation -e zone-name
490@end example 500@end example
@@ -564,7 +574,7 @@ Either of you can end the call using @command{/cancel}. You can exit
564 574
565@menu 575@menu
566* VPN Preliminaries:: 576* VPN Preliminaries::
567* Exit configuration:: 577* GNUnet-Exit configuration::
568* GNS configuration:: 578* GNS configuration::
569* Accessing the service:: 579* Accessing the service::
570* Using a Browser:: 580* Using a Browser::
@@ -595,6 +605,9 @@ The exact details may differ a bit, which is fine. Add the text
595hosts: files gns [NOTFOUND=return] mdns4_minimal [NOTFOUND=return] dns mdns4 605hosts: files gns [NOTFOUND=return] mdns4_minimal [NOTFOUND=return] dns mdns4
596@end example 606@end example
597 607
608@c TODO: outdated section, we no longer install this as part of the
609@c TODO: standard installation procedure and should point out the manual
610@c TODO: steps required to make it useful.
598@noindent 611@noindent
599You might want to make sure that @code{/lib/libnss_gns.so.2} exists on 612You might want to make sure that @code{/lib/libnss_gns.so.2} exists on
600your system, it should have been created during the installation. 613your system, it should have been created during the installation.
@@ -608,8 +621,8 @@ $ cd src/gns/nss; sudo make install
608@noindent 621@noindent
609to install the NSS plugins in the proper location. 622to install the NSS plugins in the proper location.
610 623
611@node Exit configuration 624@node GNUnet-Exit configuration
612@subsection Exit configuration 625@subsection GNUnet-Exit configuration
613@c %**end of header 626@c %**end of header
614 627
615Stop your peer (as user @code{gnunet}, run @command{gnunet-arm -e}) and 628Stop your peer (as user @code{gnunet}, run @command{gnunet-arm -e}) and
@@ -696,9 +709,10 @@ the searcher/downloader specify "no anonymity", non-anonymous
696file-sharing is used. If either user specifies some desired degree 709file-sharing is used. If either user specifies some desired degree
697of anonymity, anonymous file-sharing will be used. 710of anonymity, anonymous file-sharing will be used.
698 711
699After a short introduction, we will first look at the various concepts in 712After a short introduction, we will first look at the various concepts
700GNUnet's file-sharing implementation. Then, we will discuss specifics as to how 713in GNUnet's file-sharing implementation. Then, we will discuss
701they impact users that publish, search or download files. 714specifics as to how they impact users that publish, search or download
715files.
702 716
703 717
704@menu 718@menu
@@ -706,7 +720,6 @@ they impact users that publish, search or download files.
706* fs-Downloading:: 720* fs-Downloading::
707* fs-Publishing:: 721* fs-Publishing::
708* fs-Concepts:: 722* fs-Concepts::
709* fs-Directories::
710* Namespace Management:: 723* Namespace Management::
711* File-Sharing URIs:: 724* File-Sharing URIs::
712* GTK User Interface:: 725* GTK User Interface::
@@ -724,10 +737,11 @@ $ gnunet-search [-t TIMEOUT] KEYWORD
724@end example 737@end example
725 738
726@noindent 739@noindent
727The -t option specifies that the query should timeout after 740The @command{-t} option specifies that the query should timeout after
728approximately TIMEOUT seconds. A value of zero is interpreted 741approximately TIMEOUT seconds. A value of zero (``0'') is interpreted
729as @emph{no timeout}, which is also the default. In this case, 742as @emph{no timeout}, which is the default. In this case,
730gnunet-search will never terminate (unless you press CTRL-C). 743@command{gnunet-search} will never terminate (unless you press
744@command{CTRL-C}).
731 745
732If multiple words are passed as keywords, they will all be 746If multiple words are passed as keywords, they will all be
733considered optional. Prefix keywords with a "+" to make them mandatory. 747considered optional. Prefix keywords with a "+" to make them mandatory.
@@ -750,10 +764,11 @@ as the first will match files shared under the keywords
750"Das" or "Kapital" whereas the second will match files 764"Das" or "Kapital" whereas the second will match files
751shared under the keyword "Das Kapital". 765shared under the keyword "Das Kapital".
752 766
753Search results are printed by gnunet-search like this: 767Search results are printed by @command{gnunet-search} like this:
754 768
755@c it will be better the avoid the ellipsis altogether because I don't 769@c it will be better the avoid the ellipsis altogether because I don't
756@c understand the explanation below that 770@c understand the explanation below that
771@c ng0: who is ``I'' and what was the complete sentence?
757@example 772@example
758#15: 773#15:
759gnunet-download -o "COPYING" gnunet://fs/chk/PGK8M...3EK130.75446 774gnunet-download -o "COPYING" gnunet://fs/chk/PGK8M...3EK130.75446
@@ -762,10 +777,11 @@ gnunet-download -o "COPYING" gnunet://fs/chk/PGK8M...3EK130.75446
762 777
763@noindent 778@noindent
764The whole line is the command you would have to enter to download 779The whole line is the command you would have to enter to download
765the file. The argument passed to @code{-o} is the suggested 780the file. The first argument passed to @code{-o} is the suggested
766filename (you may change it to whatever you like). 781filename (you may change it to whatever you like).
767It is followed by the key for decrypting the file, the query for searching the 782It is followed by the key for decrypting the file, the query for
768file, a checksum (in hexadecimal) finally the size of the file in bytes. 783searching the file, a checksum (in hexadecimal) finally the size of
784the file in bytes.
769 785
770@node fs-Downloading 786@node fs-Downloading
771@subsection Downloading 787@subsection Downloading
@@ -802,9 +818,9 @@ already present.
802GNUnet's file-encoding mechanism will ensure file integrity, even if the 818GNUnet's file-encoding mechanism will ensure file integrity, even if the
803existing file was not downloaded from GNUnet in the first place. 819existing file was not downloaded from GNUnet in the first place.
804 820
805You may want to use the @command{-V} switch to turn on verbose reporting. In 821You may want to use the @command{-V} switch to turn on verbose
806this case, @command{gnunet-download} will print the current number of bytes 822reporting. In this case, @command{gnunet-download} will print the
807downloaded whenever new data was received. 823current number of bytes downloaded whenever new data was received.
808 824
809@node fs-Publishing 825@node fs-Publishing
810@subsection Publishing 826@subsection Publishing
@@ -834,7 +850,7 @@ $ gnunet-publish -m "description:GNU License" -k gpl -k test -m "mimetype:text/p
834The option @code{-k} is used to specify keywords for the file that 850The option @code{-k} is used to specify keywords for the file that
835should be inserted. You can supply any number of keywords, 851should be inserted. You can supply any number of keywords,
836and each of the keywords will be sufficient to locate and 852and each of the keywords will be sufficient to locate and
837retrieve the file. Please note that you must use the @code{-k} option 853retrieve the file. Please note that you must use the @code{-k} option
838more than once -- one for each expression you use as a keyword for 854more than once -- one for each expression you use as a keyword for
839the filename. 855the filename.
840 856
@@ -845,10 +861,14 @@ list by running @command{extract -L}. Use quotes around the entire
845meta-data argument if the value contains spaces. The meta-data 861meta-data argument if the value contains spaces. The meta-data
846is displayed to other users when they select which files to 862is displayed to other users when they select which files to
847download. The meta-data and the keywords are optional and 863download. The meta-data and the keywords are optional and
848maybe inferred using @code{GNU libextractor}. 864may be inferred using @code{GNU libextractor}.
865
866@command{gnunet-publish} has a few additional options to handle
867namespaces and directories. Refer to the man-page for details:
849 868
850gnunet-publish has a few additional options to handle namespaces and 869@example
851directories. See the man-page for details. 870man gnunet-publish
871@end example
852 872
853@node Indexing vs. Inserting 873@node Indexing vs. Inserting
854@subsubsection Indexing vs Inserting 874@subsubsection Indexing vs Inserting
@@ -890,18 +910,17 @@ able to crack the encryption (e.g. by guessing the keyword.
890@subsection Concepts 910@subsection Concepts
891@c %**end of header 911@c %**end of header
892 912
893Sharing files in GNUnet is not quite as simple as in traditional 913For better results with filesharing it is useful to understand the
894file sharing systems. For example, it is not sufficient to just 914following concepts.
895place files into a specific directory to share them. In addition 915In addition to anonymous routing GNUnet attempts to give users a better
896to anonymous routing GNUnet attempts to give users a better experience 916experience in searching for content. GNUnet uses cryptography to safely
897in searching for content. GNUnet uses cryptography to safely break 917break content into smaller pieces that can be obtained from different
898content into smaller pieces that can be obtained from different 918sources without allowing participants to corrupt files. GNUnet makes it
899sources without allowing participants to corrupt files. GNUnet 919difficult for an adversary to send back bogus search results. GNUnet
900makes it difficult for an adversary to send back bogus search 920enables content providers to group related content and to establish a
901results. GNUnet enables content providers to group related content 921reputation. Furthermore, GNUnet allows updates to certain content to be
902and to establish a reputation. Furthermore, GNUnet allows updates 922made available. This section is supposed to introduce users to the
903to certain content to be made available. This section is supposed 923concepts that are used to achieve these goals.
904to introduce users to the concepts that are used to achieve these goals.
905 924
906 925
907@menu 926@menu
@@ -921,10 +940,10 @@ to introduce users to the concepts that are used to achieve these goals.
921@c %**end of header 940@c %**end of header
922 941
923A file in GNUnet is just a sequence of bytes. Any file-format is allowed 942A file in GNUnet is just a sequence of bytes. Any file-format is allowed
924and the maximum file size is theoretically 264 bytes, except that it 943and the maximum file size is theoretically @math{2^64 - 1} bytes, except
925would take an impractical amount of time to share such a file. 944that it would take an impractical amount of time to share such a file.
926GNUnet itself never interprets the contents of shared files, except 945GNUnet itself never interprets the contents of shared files, except when
927when using GNU libextractor to obtain keywords. 946using GNU libextractor to obtain keywords.
928 947
929@node Keywords 948@node Keywords
930@subsubsection Keywords 949@subsubsection Keywords
@@ -954,10 +973,26 @@ it cannot be changed since it is treated just like an ordinary file
954by the network. Small files (of a few kilobytes) can be inlined in 973by the network. Small files (of a few kilobytes) can be inlined in
955the directory, so that a separate download becomes unnecessary. 974the directory, so that a separate download becomes unnecessary.
956 975
976Directories are shared just like ordinary files. If you download a
977directory with @command{gnunet-download}, you can use
978@command{gnunet-directory} to list its contents. The canonical
979extension for GNUnet directories when stored as files in your
980local file-system is ".gnd". The contents of a directory are URIs and
981meta data.
982The URIs contain all the information required by
983@command{gnunet-download} to retrieve the file. The meta data
984typically includes the mime-type, description, a filename and
985other meta information, and possibly even the full original file
986(if it was small).
987
957@node Pseudonyms 988@node Pseudonyms
958@subsubsection Pseudonyms 989@subsubsection Pseudonyms
959@c %**end of header 990@c %**end of header
960 991
992@b{Please note that the text in this subsection is outdated and needs}
993@b{to be rewritten for version 0.10!}
994@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
995
961Pseudonyms in GNUnet are essentially public-private (RSA) key pairs 996Pseudonyms in GNUnet are essentially public-private (RSA) key pairs
962that allow a GNUnet user to maintain an identity (which may or may not 997that allow a GNUnet user to maintain an identity (which may or may not
963be detached from their real-life identity). GNUnet's pseudonyms are not 998be detached from their real-life identity). GNUnet's pseudonyms are not
@@ -973,6 +1008,10 @@ to copy around).
973@subsubsection Namespaces 1008@subsubsection Namespaces
974@c %**end of header 1009@c %**end of header
975 1010
1011@b{Please note that the text in this subsection is outdated and needs}
1012@b{to be rewritten for version 0.10!}
1013@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1014
976A namespace is a set of files that were signed by the same pseudonym. 1015A namespace is a set of files that were signed by the same pseudonym.
977Files (or directories) that have been signed and placed into a namespace 1016Files (or directories) that have been signed and placed into a namespace
978can be updated. Updates are identified as authentic if the same secret 1017can be updated. Updates are identified as authentic if the same secret
@@ -984,11 +1023,15 @@ same entity (which does not have to be the same person).
984@subsubsection Advertisements 1023@subsubsection Advertisements
985@c %**end of header 1024@c %**end of header
986 1025
1026@b{Please note that the text in this subsection is outdated and needs}
1027@b{to be rewritten for version 0.10!}
1028@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1029
987Advertisements are used to notify other users about the existence of a 1030Advertisements are used to notify other users about the existence of a
988namespace. Advertisements are propagated using the normal keyword search. 1031namespace. Advertisements are propagated using the normal keyword search.
989When an advertisement is received (in response to a search), the namespace 1032When an advertisement is received (in response to a search), the namespace
990is added to the list of namespaces available in the namespace-search 1033is added to the list of namespaces available in the namespace-search
991dialogs of gnunet-fs-gtk and printed by gnunet-pseudonym. Whenever a 1034dialogs of gnunet-fs-gtk and printed by @code{gnunet-identity}. Whenever a
992namespace is created, an appropriate advertisement can be generated. 1035namespace is created, an appropriate advertisement can be generated.
993The default keyword for the advertising of namespaces is "namespace". 1036The default keyword for the advertising of namespaces is "namespace".
994 1037
@@ -996,7 +1039,7 @@ Note that GNUnet differentiates between your pseudonyms (the identities
996that you control) and namespaces. If you create a pseudonym, you will 1039that you control) and namespaces. If you create a pseudonym, you will
997not automatically see the respective namespace. You first have to create 1040not automatically see the respective namespace. You first have to create
998an advertisement for the namespace and find it using keyword 1041an advertisement for the namespace and find it using keyword
999search --- even for your own namespaces. The @command{gnunet-pseudonym} 1042search --- even for your own namespaces. The @command{gnunet-identity}
1000tool is currently responsible for both managing pseudonyms and namespaces. 1043tool is currently responsible for both managing pseudonyms and namespaces.
1001This will likely change in the future to reduce the potential for 1044This will likely change in the future to reduce the potential for
1002confusion. 1045confusion.
@@ -1044,22 +1087,6 @@ level by one. If all blocks reach replication level zero, the
1044selection is simply random. 1087selection is simply random.
1045 1088
1046 1089
1047@node fs-Directories
1048@subsection Directories
1049@c %**end of header
1050
1051Directories are shared just like ordinary files. If you download a
1052directory with @command{gnunet-download}, you can use
1053@command{gnunet-directory} to list its contents. The canonical
1054extension for GNUnet directories when stored as files in your
1055local file-system is ".gnd". The contents of a directory are URIs and
1056meta data.
1057The URIs contain all the information required by
1058@command{gnunet-download} to retrieve the file. The meta data
1059typically includes the mime-type, description, a filename and
1060other meta information, and possibly even the full original file
1061(if it was small).
1062
1063@node Namespace Management 1090@node Namespace Management
1064@subsection Namespace Management 1091@subsection Namespace Management
1065@c %**end of header 1092@c %**end of header
@@ -1067,8 +1094,8 @@ other meta information, and possibly even the full original file
1067@b{Please note that the text in this subsection is outdated and needs} 1094@b{Please note that the text in this subsection is outdated and needs}
1068@b{to be rewritten for version 0.10!} 1095@b{to be rewritten for version 0.10!}
1069 1096
1070The gnunet-pseudonym tool can be used to create pseudonyms and 1097The @code{gnunet-identity} tool can be used to create pseudonyms and
1071to advertise namespaces. By default, gnunet-pseudonym simply 1098to advertise namespaces. By default, @code{gnunet-identity -D} simply
1072lists all locally available pseudonyms. 1099lists all locally available pseudonyms.
1073 1100
1074 1101
@@ -1084,6 +1111,10 @@ lists all locally available pseudonyms.
1084@subsubsection Creating Pseudonyms 1111@subsubsection Creating Pseudonyms
1085@c %**end of header 1112@c %**end of header
1086 1113
1114@b{Please note that the text in this subsection is outdated and needs}
1115@b{to be rewritten for version 0.10!}
1116@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1117
1087With the @command{-C NICK} option it can also be used to 1118With the @command{-C NICK} option it can also be used to
1088create a new pseudonym. A pseudonym is the virtual identity 1119create a new pseudonym. A pseudonym is the virtual identity
1089of the entity in control of a namespace. Anyone can create 1120of the entity in control of a namespace. Anyone can create
@@ -1095,6 +1126,10 @@ used.
1095@subsubsection Deleting Pseudonyms 1126@subsubsection Deleting Pseudonyms
1096@c %**end of header 1127@c %**end of header
1097 1128
1129@b{Please note that the text in this subsection is outdated and needs}
1130@b{to be rewritten for version 0.10!}
1131@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1132
1098With the @command{-D NICK} option pseudonyms can be deleted. 1133With the @command{-D NICK} option pseudonyms can be deleted.
1099Once the pseudonym has been deleted it is impossible to add 1134Once the pseudonym has been deleted it is impossible to add
1100content to the corresponding namespace. Deleting the 1135content to the corresponding namespace. Deleting the
@@ -1105,6 +1140,10 @@ unavailable.
1105@subsubsection Advertising namespaces 1140@subsubsection Advertising namespaces
1106@c %**end of header 1141@c %**end of header
1107 1142
1143@b{Please note that the text in this subsection is outdated and needs}
1144@b{to be rewritten for version 0.10!}
1145@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1146
1108Each namespace is associated with meta-data that describes 1147Each namespace is associated with meta-data that describes
1109the namespace. This meta-data is provided by the user at 1148the namespace. This meta-data is provided by the user at
1110the time that the namespace is advertised. Advertisements 1149the time that the namespace is advertised. Advertisements
@@ -1121,6 +1160,10 @@ the quality of the content found in it.
1121@subsubsection Namespace names 1160@subsubsection Namespace names
1122@c %**end of header 1161@c %**end of header
1123 1162
1163@b{Please note that the text in this subsection is outdated and needs}
1164@b{to be rewritten for version 0.10!}
1165@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1166
1124While the namespace is uniquely identified by its ID, another way 1167While the namespace is uniquely identified by its ID, another way
1125to refer to the namespace is to use the NICKNAME. 1168to refer to the namespace is to use the NICKNAME.
1126The NICKNAME can be freely chosen by the creator of the namespace and 1169The NICKNAME can be freely chosen by the creator of the namespace and
@@ -1132,6 +1175,10 @@ to the NICKNAME to get a unique identifier.
1132@subsubsection Namespace root 1175@subsubsection Namespace root
1133@c %**end of header 1176@c %**end of header
1134 1177
1178@b{Please note that the text in this subsection is outdated and needs}
1179@b{to be rewritten for version 0.10!}
1180@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1181
1135An item of particular interest in the namespace advertisement is 1182An item of particular interest in the namespace advertisement is
1136the ROOT. The ROOT is the identifier of a designated entry in the 1183the ROOT. The ROOT is the identifier of a designated entry in the
1137namespace. The idea is that the ROOT can be used to advertise an 1184namespace. The idea is that the ROOT can be used to advertise an
@@ -1219,6 +1266,10 @@ Furthermore they must not contain '++'.
1219@subsubsection Namespace content (sks) 1266@subsubsection Namespace content (sks)
1220@c %**end of header 1267@c %**end of header
1221 1268
1269@b{Please note that the text in this subsection is outdated and needs}
1270@b{to be rewritten for version 0.10!}
1271@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1272
1222Namespaces are sets of files that have been approved by some (usually 1273Namespaces are sets of files that have been approved by some (usually
1223pseudonymous) user --- typically by that user publishing all of the 1274pseudonymous) user --- typically by that user publishing all of the
1224files together. A file can be in many namespaces. A file is in a 1275files together. A file can be in many namespaces. A file is in a
@@ -1419,8 +1470,8 @@ $ gnunet-identity -C "myzone"
1419 1470
1420Henceforth, on your system you control the TLD ``myzone''. 1471Henceforth, on your system you control the TLD ``myzone''.
1421 1472
1422All of your zones can be listed using the @command{gnunet-identity} 1473All of your zones can be listed (displayed) using the
1423command line tool as well: 1474@command{gnunet-identity} command line tool as well:
1424 1475
1425@example 1476@example
1426$ gnunet-identity -d 1477$ gnunet-identity -d
@@ -1528,11 +1579,11 @@ record you want to access).
1528@subsection Using Public Keys as Top Level Domains 1579@subsection Using Public Keys as Top Level Domains
1529 1580
1530 1581
1531GNS also assumes responsibility for any name that uses in a well-formed 1582GNS also assumes responsibility for any name that uses in a
1532public key for the TLD. Names ending this way are then resolved by querying 1583well-formed public key for the TLD. Names ending this way are then
1533the respective zone. Such public key TLDs are expected to be used under rare 1584resolved by querying the respective zone. Such public key TLDs are
1534circumstances where globally unique names are required, and for 1585expected to be used under rare circumstances where globally unique
1535integration with legacy systems. 1586names are required, and for integration with legacy systems.
1536 1587
1537@node Resource Records in GNS 1588@node Resource Records in GNS
1538@subsection Resource Records in GNS 1589@subsection Resource Records in GNS
@@ -1569,18 +1620,31 @@ GNS currently supports the following record types:
1569* CNAME:: 1620* CNAME::
1570* GNS2DNS:: 1621* GNS2DNS::
1571* SOA SRV PTR and MX:: 1622* SOA SRV PTR and MX::
1623* PLACE::
1624* PHONE::
1625* ID ATTR::
1626* ID TOKEN::
1627* ID TOKEN METADATA::
1628* CREDENTIAL::
1629* POLICY::
1630* ATTRIBUTE::
1631* ABE KEY::
1632* ABE MASTER::
1633* RECLAIM OIDC CLIENT::
1634* RECLAIM OIDC REDIRECT::
1572@end menu 1635@end menu
1573 1636
1574@node NICK 1637@node NICK
1575@subsubsection NICK 1638@subsubsection NICK
1576 1639
1577A NICK record is used to give a zone a name. With a NICK record, you can 1640A NICK record is used to give a zone a name. With a NICK record, you
1578essentially specify how you would like to be called. GNS expects this 1641can essentially specify how you would like to be called. GNS expects
1579record under the empty label ``@@'' in the zone's database (NAMESTORE); however, 1642this record under the empty label ``@@'' in the zone's database
1580it will then automatically be copied into each record set, so that 1643(NAMESTORE); however, it will then automatically be copied into each
1581clients never need to do a separate lookup to discover the NICK record. 1644record set, so that clients never need to do a separate lookup to
1582Also, users do not usually have to worry about setting the NICK record: 1645discover the NICK record. Also, users do not usually have to worry
1583it is automatically set to the local name of the TLD. 1646about setting the NICK record: it is automatically set to the local
1647name of the TLD.
1584 1648
1585@b{Example}@ 1649@b{Example}@
1586 1650
@@ -1739,6 +1803,66 @@ should use the ZKEY zone as the destination hostname and
1739GNS-enabled mail servers should be configured to accept 1803GNS-enabled mail servers should be configured to accept
1740e-mails to the ZKEY-zones of all local users. 1804e-mails to the ZKEY-zones of all local users.
1741 1805
1806@node PLACE
1807@subsubsection PLACE
1808
1809Record type for a social place.
1810
1811@node PHONE
1812@subsubsection PHONE
1813
1814Record type for a phone (of CONVERSATION).
1815
1816@node ID ATTR
1817@subsubsection ID ATTR
1818
1819Record type for identity attributes (of IDENTITY).
1820
1821@node ID TOKEN
1822@subsubsection ID TOKEN
1823
1824Record type for an identity token (of IDENTITY-TOKEN).
1825
1826@node ID TOKEN METADATA
1827@subsubsection ID TOKEN METADATA
1828
1829Record type for the private metadata of an identity token (of IDENTITY-TOKEN).
1830
1831@node CREDENTIAL
1832@subsubsection CREDENTIAL
1833
1834Record type for credential.
1835
1836@node POLICY
1837@subsubsection POLICY
1838
1839Record type for policies.
1840
1841@node ATTRIBUTE
1842@subsubsection ATTRIBUTE
1843
1844Record type for reverse lookups.
1845
1846@node ABE KEY
1847@subsubsection ABE KEY
1848
1849Record type for ABE records.
1850
1851@node ABE MASTER
1852@subsubsection ABE MASTER
1853
1854Record type for ABE master keys.
1855
1856@node RECLAIM OIDC CLIENT
1857@subsubsection RECLAIM OIDC CLIENT
1858
1859Record type for reclaim OIDC clients.
1860
1861@node RECLAIM OIDC REDIRECT
1862@subsubsection RECLAIM OIDC REDIRECT
1863
1864Record type for reclaim OIDC redirect URIs.
1865
1742@node Synchronizing with legacy DNS 1866@node Synchronizing with legacy DNS
1743@subsection Synchronizing with legacy DNS 1867@subsection Synchronizing with legacy DNS
1744 1868
@@ -1769,6 +1893,98 @@ is thus advisable to disable the namecache by setting the
1769option ``DISABLE'' to ``YES'' in section ``[namecache]''. 1893option ``DISABLE'' to ``YES'' in section ``[namecache]''.
1770 1894
1771 1895
1896@node re@:claim Identity Provider
1897@section re@:claim Identity Provider
1898
1899The re:claim Identity Provider (IdP) is a decentralized IdP service.
1900It allows its users to manage and authorize third parties to access their identity attributes such as email or shipping addresses.
1901
1902It basically mimics the concepts of centralized IdPs, such as those offered by Google or Facebook.
1903Like other IdPs, re:claim features an (optional) OpenID-Connect 1.0-compliant protocol layer that can be used for websites to integrate re:claim as an Identity Provider with little effort.
1904
1905@menu
1906* Managing Attributes::
1907* Sharing Attributes with Third Parties::
1908* Revoking Authorizations of Third Parties::
1909* Using the OpenID-Connect IdP::
1910@end menu
1911
1912@node Managing Attributes
1913@subsection Managing Attributes
1914
1915Before adding attributes to an identity, you must first create an ego:
1916
1917@example
1918$ gnunet-identity -C "username"
1919@end example
1920
1921Henceforth, you can manage a new user profile of the user ``username''.
1922
1923To add an email address to your user profile, simply use the @command{gnunet-reclaim} command line tool::
1924
1925@example
1926$ gnunet-reclaim -e "username" -a "email" -V "username@@example.gnunet"
1927@end example
1928
1929All of your attributes can be listed using the @command{gnunet-reclaim}
1930command line tool as well:
1931
1932@example
1933$ gnunet-reclaim -e "username" -D
1934@end example
1935
1936Currently, and by default, attribute values are interpreted as plain text.
1937In the future there might be more value types such as X.509 certificate credentials.
1938
1939@node Sharing Attributes with Third Parties
1940@subsection Sharing Attributes with Third Parties
1941
1942If you want to allow a third party such as a website or friend to access to your attributes (or a subset thereof) execute:
1943
1944@example
1945$ gnunet-reclaim -e "username" -r "PKEY" -i "attribute1,attribute2,..."
1946@end example
1947
1948Where "PKEY" is the public key of the third party and "attribute1,attribute2,..." is a comma-separated list of attribute names, such as "email", that you want to share.
1949
1950The command will return a "ticket" string.
1951You must give this "ticket" to the requesting third party.
1952
1953The third party can then retrieve your shared identity attributes using:
1954
1955@example
1956$ gnunet-reclaim -e "friend" -C "ticket"
1957@end example
1958
1959This will retrieve and list the shared identity attributes.
1960The above command will also work if the user "username" is currently offline since the attributes are retrieved from GNS.
1961Further, the "ticket" can be re-used later to retrieve up-to-date attributes in case "username" has changed the value(s). For instance, becasue his email address changed.
1962
1963To list all given authorizations (tickets) you can execute:
1964@example
1965$ gnunet-reclaim -e "friend" -T (TODO there is only a REST API for this ATM)
1966@end example
1967
1968
1969@node Revoking Authorizations of Third Parties
1970@subsection Revoking Authorizations of Third Parties
1971
1972If you want to revoke the access of a third party to your attributes you can execute:
1973
1974@example
1975$ gnunet-idp -e "username" -R "ticket"
1976@end example
1977
1978This will prevent the third party from accessing the attribute in the future.
1979Please note that if the third party has previously accessed the attribute, there is not way in which the system could have prevented the thiry party from storing the data.
1980As such, only access to updated data in the future can be revoked.
1981This behaviour is _exactly the same_ as with other IdPs.
1982
1983@node Using the OpenID-Connect IdP
1984@subsection Using the OpenID-Connect IdP
1985
1986TODO: Document setup and REST endpoints
1987
1772@node Using the Virtual Public Network 1988@node Using the Virtual Public Network
1773@section Using the Virtual Public Network 1989@section Using the Virtual Public Network
1774 1990
diff --git a/doc/documentation/gnunet.texi b/doc/documentation/gnunet.texi
index 2ef5a2b59..50630d4fe 100644
--- a/doc/documentation/gnunet.texi
+++ b/doc/documentation/gnunet.texi
@@ -90,7 +90,8 @@ This document is the Reference Manual for GNUnet version @value{VERSION}.
90* GNUnet Contributors Handbook:: Contributing to GNUnet 90* GNUnet Contributors Handbook:: Contributing to GNUnet
91* GNUnet Developer Handbook:: Developing GNUnet 91* GNUnet Developer Handbook:: Developing GNUnet
92* GNU Free Documentation License:: The license of this manual 92* GNU Free Documentation License:: The license of this manual
93* GNU General Public License:: The license of this manual 93* GNU General Public License::
94* GNU Affero General Public License::
94* Concept Index:: Concepts 95* Concept Index:: Concepts
95* Programming Index:: Data types, functions, and variables 96* Programming Index:: Data types, functions, and variables
96 97
@@ -100,8 +101,8 @@ This document is the Reference Manual for GNUnet version @value{VERSION}.
100Preface 101Preface
101 102
102* About this book 103* About this book
104* Contributing to this book
103* Introduction 105* Introduction
104* General Terminology::
105* Typography:: 106* Typography::
106 107
107Philosophy 108Philosophy
@@ -124,6 +125,14 @@ Key Concepts
124* Revocation:: 125* Revocation::
125 126
126Installing GNUnet 127Installing GNUnet
128* Installing dependencies::
129* Getting the Source Code::
130* Create @code{gnunet} user and group::
131* Preparing and Compiling the Source Code::
132* Installation::
133* MOVED FROM USER Checking the Installation::
134* MOVED FROM USER The graphical configuration interface::
135* MOVED FROM USER Config Leftovers::
127 136
128Using GNUnet 137Using GNUnet
129 138
@@ -141,6 +150,7 @@ GNUnet Contributors Handbook
141* Licenses of contributions:: 150* Licenses of contributions::
142* Copyright Assignment:: 151* Copyright Assignment::
143* Contributing to the Reference Manual:: 152* Contributing to the Reference Manual::
153* Contributing testcases::
144 154
145GNUnet Developer Handbook 155GNUnet Developer Handbook
146 156
@@ -227,6 +237,12 @@ GNUnet Developer Handbook
227@include gpl-3.0.texi 237@include gpl-3.0.texi
228 238
229@c ********************************************************************* 239@c *********************************************************************
240@node GNU Affero General Public License
241@appendix GNU Affero General Public License
242@cindex license, GNU Affero General Public License
243@include agpl-3.0.texi
244
245@c *********************************************************************
230@node Concept Index 246@node Concept Index
231@unnumbered Concept Index 247@unnumbered Concept Index
232@printindex cp 248@printindex cp
@@ -235,6 +251,7 @@ GNUnet Developer Handbook
235@unnumbered Programming Index 251@unnumbered Programming Index
236@syncodeindex tp fn 252@syncodeindex tp fn
237@syncodeindex vr fn 253@syncodeindex vr fn
254@syncodeindex pg fn
238@printindex fn 255@printindex fn
239 256
240@bye 257@bye
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index a6a116dca..37f881d60 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -37,6 +37,7 @@ man_MANS = \
37 gnunet-statistics.1 \ 37 gnunet-statistics.1 \
38 gnunet-testbed-profiler.1 \ 38 gnunet-testbed-profiler.1 \
39 gnunet-testing-run-service.1 \ 39 gnunet-testing-run-service.1 \
40 gnunet-timeout.1 \
40 gnunet-transport.1 \ 41 gnunet-transport.1 \
41 gnunet-transport-certificate-creation.1 \ 42 gnunet-transport-certificate-creation.1 \
42 gnunet-unindex.1 \ 43 gnunet-unindex.1 \
diff --git a/doc/man/gnunet-gns.1 b/doc/man/gnunet-gns.1
index 9466dae03..9e4482653 100644
--- a/doc/man/gnunet-gns.1
+++ b/doc/man/gnunet-gns.1
@@ -46,7 +46,7 @@ Print GNUnet version number.
46.SH RETURN VALUE 46.SH RETURN VALUE
47 47
48gnunet\-gns will return 0 on success, 1 on internal failures, 2 on 48gnunet\-gns will return 0 on success, 1 on internal failures, 2 on
49launch failures, 3 if the given name is not configured to use GNS. 49launch failures, 4 if the given name is not configured to use GNS.
50 50
51 51
52.SH BUGS 52.SH BUGS
diff --git a/doc/man/gnunet-timeout.1 b/doc/man/gnunet-timeout.1
new file mode 100644
index 000000000..e413254f4
--- /dev/null
+++ b/doc/man/gnunet-timeout.1
@@ -0,0 +1,20 @@
1.TH GNUNET\-TIMOUET 1 "Jun 5, 2018" "GNUnet"
2
3.SH NAME
4gnunet\-timeout \- run process with timeout
5
6.SH SYNOPSIS
7.B gnunet\-timeout
8.RI TIMEOUT PROGRAM ARGS
9.br
10
11.SH DESCRIPTION
12\fBgnunet\-timeout\fP can be used to run another process with a
13timeout. Provided as the standard "timout" utility may not be
14available on all platforms.
15
16.SH BUGS
17Report bugs by using Mantis <https://gnunet.org/bugs/> or by sending electronic mail to <gnunet\-developers@gnu.org>
18
19.SH SEE
20timeout(1)
diff --git a/docker/README.md b/docker/README.md
new file mode 100644
index 000000000..ce05012fc
--- /dev/null
+++ b/docker/README.md
@@ -0,0 +1,138 @@
1# gnunet-docker
2A Dockerfile (and maybe later docker-compose.yml) for getting a running GNUnet docker container.
3
4> This README and parts of the Dockerfile were adapted from https://github.com/compiaffe/gnunet-docker
5
6
7## Build it
8This will take quite a while and will consume a bit of data.
9
10First you need to go to the root of this repo.
11
12```bash
13cd ..
14```
15
16Now you can build the image.
17
18```bash
19docker build -t gnunet .
20```
21
22## Start it from the newly created gnunet image
23Start a container from `gnunet` image, which can access /dev/net/tun, has access to the host network. We are going to name it `gnunet1`.
24
25Note the `--rm` that will delete the container as soon as you stop it and `-ti` gives you an interactive terminal.
26
27#### Linux Users
28```bash
29docker run \
30 --rm \
31 -ti \
32 --privileged \
33 --name gnunet1 \
34 --net=host \
35 -v /dev/net/tun:/dev/net/tun \
36 gnunet
37```
38
39#### Mac Users
40```bash
41docker run \
42 --rm \
43 -it \
44 --privileged \
45 --name gnunet1 \
46 -e LOCAL_PORT_RANGE='40001 40200' \
47 -e GNUNET_PORT=2086 \
48 -p 2086:2086 \
49 -p 2086:2086/udp \
50 -p40001-40200:40001-40200 \
51 -p40001-40200:40001-40200/udp \
52 gnunet
53```
54
55This terminal will keep on printing to screen at the moment. So go on in a new terminal please.
56
57Don't worry about warnings too much...
58
59## Check if you are connected
60Open a new terminal and connect to the container we just started:
61
62```bash
63docker exec -it gnunet1 gnunet-peerinfo -i
64```
65
66If you get a list of peers, all is good.
67
68## Multiple containers on the same host
69### Running
70#### Run Container 1
71```bash
72export GPORT=2086 LPORT='40001-40200' GNAME=gnunet1
73docker run \
74 --rm \
75 -it \
76 --privileged \
77 -e GNUNET_PORT=$GPORT \
78 -e LOCAL_PORT_RANGE="${LPORT/-/ }" \
79 -p $GPORT:$GPORT \
80 -p $GPORT:$GPORT/udp \
81 -p$LPORT:$LPORT \
82 -p$LPORT:$LPORT/udp \
83 --name $GNAME \
84 gnunet
85```
86
87#### Run Container 2
88```bash
89export GPORT=2087 LPORT='40201-40400' GNAME=gnunet2
90docker run \
91 --rm \
92 -it \
93 --privileged \
94 -e GNUNET_PORT=$GPORT \
95 -e LOCAL_PORT_RANGE="${LPORT/-/ }" \
96 -p $GPORT:$GPORT \
97 -p $GPORT:$GPORT/udp \
98 -p$LPORT:$LPORT \
99 -p$LPORT:$LPORT/udp \
100 --name $GNAME \
101 gnunet
102```
103
104### Testing cadet example
105#### Container 1
106```bash
107$ docker exec -it gnunet1 bash
108$ gnunet-peerinfo -s
109I am peer `VWPN1NZA6YMM866EJ5J2NY47XG692MQ6H6WASVECF0M18A9SCMZ0'.
110$ gnunet-cadet -o asdasd
111```
112
113#### Container 2
114```bash
115$ docker exec -it gnunet2 bash
116$ gnunet-cadet VWPN1NZA6YMM866EJ5J2NY47XG692MQ6H6WASVECF0M18A9SCMZ0 asdasd
117```
118
119### Testing file sharing example
120#### Container 1
121```bash
122$ docker exec -it gnunet1 bash
123$ echo 'test' > test.txt
124$ gnunet-publish test.txt
125Publishing `/test.txt' done.
126URI is `gnunet://fs/chk/1RZ7A8TAQHMF8DWAGTSZ9CSA365T60C4BC6DDS810VM78D2Q0366CRX8DGFA29EWBT9BW5Y9HYD0Z1EAKNFNJQDJ04QQSGTQ352W28R.7MYB03GYXT17Z93ZRZRVV64AH9KPWFSVDEZGVE84YHD63XZFJ36B86M48KHTZVF87SZ05HBVB44PCXE8CVWAH72VN1SKYPRK1QN2C98.5'.
127```
128
129#### Container 2
130```bash
131$ docker exec -it gnunet2 bash
132$ gnunet-download -o out.file "gnunet://fs/chk/1RZ7A8TAQHMF8DWAGTSZ9CSA365T60C4BC6DDS810VM78D2Q0366CRX8DGFA29EWBT9BW5Y9HYD0Z1EAKNFNJQDJ04QQSGTQ352W28R.7MYB03GYXT17Z93ZRZRVV64AH9KPWFSVDEZGVE84YHD63XZFJ36B86M48KHTZVF87SZ05HBVB44PCXE8CVWAH72VN1SKYPRK1QN2C98.5"
133100% [============================================================]
134Downloading `out.file' done (0 b/s).
135$ cat out.file
136test
137```
138
diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh
new file mode 100644
index 000000000..7f98ef68b
--- /dev/null
+++ b/docker/docker-entrypoint.sh
@@ -0,0 +1,15 @@
1#!/bin/bash -e
2
3echo "${LOCAL_PORT_RANGE:-49152 65535}" > /proc/sys/net/ipv4/ip_local_port_range
4sed -i 's/$GNUNET_PORT/'${GNUNET_PORT:-2086}'/g' /etc/gnunet.conf
5
6if [[ $# -eq 0 ]]; then
7 exec gnunet-arm \
8 --config=/etc/gnunet.conf \
9 --start \
10 --monitor
11elif [[ -z $1 ]] || [[ ${1:0:1} == '-' ]]; then
12 exec gnunet-arm "$@"
13else
14 exec "$@"
15fi
diff --git a/docker/gnunet.conf b/docker/gnunet.conf
new file mode 100644
index 000000000..c8299ef46
--- /dev/null
+++ b/docker/gnunet.conf
@@ -0,0 +1,21 @@
1[arm]
2SYSTEM_ONLY = NO
3USER_ONLY = NO
4
5[fs]
6FORCESTART = NO
7
8[nat]
9ENABLE_UPNP = NO
10BEHIND_NAT = YES
11
12[transport-tcp]
13PORT = $GNUNET_PORT
14ADVERTISED_PORT = $GNUNET_PORT
15
16[transport-udp]
17PORT = $GNUNET_PORT
18BROADCAST = YES
19
20[cadet]
21TESTING_IGNORE_KEYS = ACCEPT_FROM;
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 38fa52508..86235f860 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -4,13 +4,21 @@ src/arm/arm_monitor_api.c
4src/arm/gnunet-arm.c 4src/arm/gnunet-arm.c
5src/arm/gnunet-service-arm.c 5src/arm/gnunet-service-arm.c
6src/arm/mockup-service.c 6src/arm/mockup-service.c
7src/ats-tests/ats-testing-experiment.c
8src/ats-tests/ats-testing-log.c
9src/ats-tests/ats-testing-preferences.c
10src/ats-tests/ats-testing-traffic.c
11src/ats-tests/ats-testing.c
12src/ats-tests/gnunet-ats-sim.c
13src/ats-tests/gnunet-solver-eval.c
14src/ats-tool/gnunet-ats.c
7src/ats/ats_api_connectivity.c 15src/ats/ats_api_connectivity.c
8src/ats/ats_api_performance.c 16src/ats/ats_api_performance.c
9src/ats/ats_api_scanner.c 17src/ats/ats_api_scanner.c
10src/ats/ats_api_scheduling.c 18src/ats/ats_api_scheduling.c
11src/ats/gnunet-ats-solver-eval.c 19src/ats/gnunet-ats-solver-eval.c
12src/ats/gnunet-service-ats_addresses.c
13src/ats/gnunet-service-ats.c 20src/ats/gnunet-service-ats.c
21src/ats/gnunet-service-ats_addresses.c
14src/ats/gnunet-service-ats_connectivity.c 22src/ats/gnunet-service-ats_connectivity.c
15src/ats/gnunet-service-ats_normalization.c 23src/ats/gnunet-service-ats_normalization.c
16src/ats/gnunet-service-ats_performance.c 24src/ats/gnunet-service-ats_performance.c
@@ -21,14 +29,6 @@ src/ats/gnunet-service-ats_scheduling.c
21src/ats/plugin_ats_mlp.c 29src/ats/plugin_ats_mlp.c
22src/ats/plugin_ats_proportional.c 30src/ats/plugin_ats_proportional.c
23src/ats/plugin_ats_ril.c 31src/ats/plugin_ats_ril.c
24src/ats-tests/ats-testing.c
25src/ats-tests/ats-testing-experiment.c
26src/ats-tests/ats-testing-log.c
27src/ats-tests/ats-testing-preferences.c
28src/ats-tests/ats-testing-traffic.c
29src/ats-tests/gnunet-ats-sim.c
30src/ats-tests/gnunet-solver-eval.c
31src/ats-tool/gnunet-ats.c
32src/auction/gnunet-auction-create.c 32src/auction/gnunet-auction-create.c
33src/auction/gnunet-auction-info.c 33src/auction/gnunet-auction-info.c
34src/auction/gnunet-auction-join.c 34src/auction/gnunet-auction-join.c
@@ -40,8 +40,8 @@ src/block/plugin_block_test.c
40src/cadet/cadet_api.c 40src/cadet/cadet_api.c
41src/cadet/cadet_test_lib.c 41src/cadet/cadet_test_lib.c
42src/cadet/desirability_table.c 42src/cadet/desirability_table.c
43src/cadet/gnunet-cadet.c
44src/cadet/gnunet-cadet-profiler.c 43src/cadet/gnunet-cadet-profiler.c
44src/cadet/gnunet-cadet.c
45src/cadet/gnunet-service-cadet.c 45src/cadet/gnunet-service-cadet.c
46src/cadet/gnunet-service-cadet_channel.c 46src/cadet/gnunet-service-cadet_channel.c
47src/cadet/gnunet-service-cadet_connection.c 47src/cadet/gnunet-service-cadet_connection.c
@@ -57,15 +57,15 @@ src/consensus/gnunet-service-consensus.c
57src/consensus/plugin_block_consensus.c 57src/consensus/plugin_block_consensus.c
58src/conversation/conversation_api.c 58src/conversation/conversation_api.c
59src/conversation/conversation_api_call.c 59src/conversation/conversation_api_call.c
60src/conversation/gnunet-conversation.c
61src/conversation/gnunet-conversation-test.c 60src/conversation/gnunet-conversation-test.c
62src/conversation/gnunet_gst.c 61src/conversation/gnunet-conversation.c
63src/conversation/gnunet_gst_test.c
64src/conversation/gnunet-helper-audio-playback.c
65src/conversation/gnunet-helper-audio-playback-gst.c 62src/conversation/gnunet-helper-audio-playback-gst.c
66src/conversation/gnunet-helper-audio-record.c 63src/conversation/gnunet-helper-audio-playback.c
67src/conversation/gnunet-helper-audio-record-gst.c 64src/conversation/gnunet-helper-audio-record-gst.c
65src/conversation/gnunet-helper-audio-record.c
68src/conversation/gnunet-service-conversation.c 66src/conversation/gnunet-service-conversation.c
67src/conversation/gnunet_gst.c
68src/conversation/gnunet_gst_test.c
69src/conversation/microphone.c 69src/conversation/microphone.c
70src/conversation/plugin_gnsrecord_conversation.c 70src/conversation/plugin_gnsrecord_conversation.c
71src/conversation/speaker.c 71src/conversation/speaker.c
@@ -102,7 +102,6 @@ src/dht/dht_api.c
102src/dht/dht_test_lib.c 102src/dht/dht_test_lib.c
103src/dht/gnunet-dht-get.c 103src/dht/gnunet-dht-get.c
104src/dht/gnunet-dht-monitor.c 104src/dht/gnunet-dht-monitor.c
105src/dht/gnunet_dht_profiler.c
106src/dht/gnunet-dht-put.c 105src/dht/gnunet-dht-put.c
107src/dht/gnunet-service-dht.c 106src/dht/gnunet-service-dht.c
108src/dht/gnunet-service-dht_clients.c 107src/dht/gnunet-service-dht_clients.c
@@ -111,6 +110,7 @@ src/dht/gnunet-service-dht_hello.c
111src/dht/gnunet-service-dht_neighbours.c 110src/dht/gnunet-service-dht_neighbours.c
112src/dht/gnunet-service-dht_nse.c 111src/dht/gnunet-service-dht_nse.c
113src/dht/gnunet-service-dht_routing.c 112src/dht/gnunet-service-dht_routing.c
113src/dht/gnunet_dht_profiler.c
114src/dht/plugin_block_dht.c 114src/dht/plugin_block_dht.c
115src/dns/dns_api.c 115src/dns/dns_api.c
116src/dns/gnunet-dns-monitor.c 116src/dns/gnunet-dns-monitor.c
@@ -124,8 +124,8 @@ src/dv/gnunet-dv.c
124src/dv/gnunet-service-dv.c 124src/dv/gnunet-service-dv.c
125src/dv/plugin_transport_dv.c 125src/dv/plugin_transport_dv.c
126src/exit/gnunet-daemon-exit.c 126src/exit/gnunet-daemon-exit.c
127src/exit/gnunet-helper-exit.c
128src/exit/gnunet-helper-exit-windows.c 127src/exit/gnunet-helper-exit-windows.c
128src/exit/gnunet-helper-exit.c
129src/fragmentation/defragmentation.c 129src/fragmentation/defragmentation.c
130src/fragmentation/fragmentation.c 130src/fragmentation/fragmentation.c
131src/fs/fs_api.c 131src/fs/fs_api.c
@@ -150,8 +150,8 @@ src/fs/gnunet-auto-share.c
150src/fs/gnunet-daemon-fsprofiler.c 150src/fs/gnunet-daemon-fsprofiler.c
151src/fs/gnunet-directory.c 151src/fs/gnunet-directory.c
152src/fs/gnunet-download.c 152src/fs/gnunet-download.c
153src/fs/gnunet-fs.c
154src/fs/gnunet-fs-profiler.c 153src/fs/gnunet-fs-profiler.c
154src/fs/gnunet-fs.c
155src/fs/gnunet-helper-fs-publish.c 155src/fs/gnunet-helper-fs-publish.c
156src/fs/gnunet-publish.c 156src/fs/gnunet-publish.c
157src/fs/gnunet-search.c 157src/fs/gnunet-search.c
@@ -171,10 +171,10 @@ src/gns/gns_tld_api.c
171src/gns/gnunet-bcd.c 171src/gns/gnunet-bcd.c
172src/gns/gnunet-dns2gns.c 172src/gns/gnunet-dns2gns.c
173src/gns/gnunet-gns-benchmark.c 173src/gns/gnunet-gns-benchmark.c
174src/gns/gnunet-gns.c
175src/gns/gnunet-gns-helper-service-w32.c 174src/gns/gnunet-gns-helper-service-w32.c
176src/gns/gnunet-gns-import.c 175src/gns/gnunet-gns-import.c
177src/gns/gnunet-gns-proxy.c 176src/gns/gnunet-gns-proxy.c
177src/gns/gnunet-gns.c
178src/gns/gnunet-service-gns.c 178src/gns/gnunet-service-gns.c
179src/gns/gnunet-service-gns_interceptor.c 179src/gns/gnunet-service-gns_interceptor.c
180src/gns/gnunet-service-gns_resolver.c 180src/gns/gnunet-service-gns_resolver.c
@@ -183,45 +183,35 @@ src/gns/nss/nss_gns_query.c
183src/gns/plugin_block_gns.c 183src/gns/plugin_block_gns.c
184src/gns/plugin_gnsrecord_gns.c 184src/gns/plugin_gnsrecord_gns.c
185src/gns/plugin_rest_gns.c 185src/gns/plugin_rest_gns.c
186src/gns/w32nsp-install.c
187src/gns/w32nsp-resolve.c
188src/gns/w32nsp-uninstall.c
189src/gns/w32nsp.c
186src/gnsrecord/gnsrecord.c 190src/gnsrecord/gnsrecord.c
187src/gnsrecord/gnsrecord_crypto.c 191src/gnsrecord/gnsrecord_crypto.c
188src/gnsrecord/gnsrecord_misc.c 192src/gnsrecord/gnsrecord_misc.c
189src/gnsrecord/gnsrecord_serialization.c 193src/gnsrecord/gnsrecord_serialization.c
190src/gnsrecord/plugin_gnsrecord_dns.c 194src/gnsrecord/plugin_gnsrecord_dns.c
191src/gns/w32nsp.c
192src/gns/w32nsp-install.c
193src/gns/w32nsp-resolve.c
194src/gns/w32nsp-uninstall.c
195src/hello/address.c 195src/hello/address.c
196src/hello/gnunet-hello.c 196src/hello/gnunet-hello.c
197src/hello/hello.c 197src/hello/hello.c
198src/hostlist/gnunet-daemon-hostlist.c 198src/hostlist/gnunet-daemon-hostlist.c
199src/hostlist/gnunet-daemon-hostlist_client.c 199src/hostlist/gnunet-daemon-hostlist_client.c
200src/hostlist/gnunet-daemon-hostlist_server.c 200src/hostlist/gnunet-daemon-hostlist_server.c
201src/identity-attribute/identity_attribute.c
202src/identity-attribute/plugin_identity_attribute_gnuid.c
203src/identity/gnunet-identity.c 201src/identity/gnunet-identity.c
204src/identity/gnunet-service-identity.c 202src/identity/gnunet-service-identity.c
205src/identity/identity_api.c 203src/identity/identity_api.c
206src/identity/identity_api_lookup.c 204src/identity/identity_api_lookup.c
207src/identity/plugin_rest_identity.c 205src/identity/plugin_rest_identity.c
208src/identity-provider/gnunet-idp.c 206src/json/json.c
209src/identity-provider/gnunet-service-identity-provider.c 207src/json/json_generator.c
210src/identity-provider/identity_provider_api.c 208src/json/json_helper.c
211src/identity-provider/jwt.c 209src/json/json_mhd.c
212src/identity-provider/plugin_gnsrecord_identity_provider.c
213src/identity-provider/plugin_identity_provider_sqlite.c
214src/identity-provider/plugin_rest_identity_provider.c
215src/identity-provider/plugin_rest_openid_connect.c
216src/jsonapi/jsonapi.c 210src/jsonapi/jsonapi.c
217src/jsonapi/jsonapi_document.c 211src/jsonapi/jsonapi_document.c
218src/jsonapi/jsonapi_error.c 212src/jsonapi/jsonapi_error.c
219src/jsonapi/jsonapi_relationship.c 213src/jsonapi/jsonapi_relationship.c
220src/jsonapi/jsonapi_resource.c 214src/jsonapi/jsonapi_resource.c
221src/json/json.c
222src/json/json_generator.c
223src/json/json_helper.c
224src/json/json_mhd.c
225src/multicast/gnunet-multicast.c 215src/multicast/gnunet-multicast.c
226src/multicast/gnunet-service-multicast.c 216src/multicast/gnunet-service-multicast.c
227src/multicast/multicast_api.c 217src/multicast/multicast_api.c
@@ -235,8 +225,8 @@ src/namecache/namecache_api.c
235src/namecache/plugin_namecache_flat.c 225src/namecache/plugin_namecache_flat.c
236src/namecache/plugin_namecache_postgres.c 226src/namecache/plugin_namecache_postgres.c
237src/namecache/plugin_namecache_sqlite.c 227src/namecache/plugin_namecache_sqlite.c
238src/namestore/gnunet-namestore.c
239src/namestore/gnunet-namestore-fcfsd.c 228src/namestore/gnunet-namestore-fcfsd.c
229src/namestore/gnunet-namestore.c
240src/namestore/gnunet-service-namestore.c 230src/namestore/gnunet-service-namestore.c
241src/namestore/gnunet-zoneimport.c 231src/namestore/gnunet-zoneimport.c
242src/namestore/namestore_api.c 232src/namestore/namestore_api.c
@@ -252,10 +242,10 @@ src/nat-auto/gnunet-service-nat-auto.c
252src/nat-auto/gnunet-service-nat-auto_legacy.c 242src/nat-auto/gnunet-service-nat-auto_legacy.c
253src/nat-auto/nat_auto_api.c 243src/nat-auto/nat_auto_api.c
254src/nat-auto/nat_auto_api_test.c 244src/nat-auto/nat_auto_api_test.c
255src/nat/gnunet-helper-nat-client.c
256src/nat/gnunet-helper-nat-client-windows.c 245src/nat/gnunet-helper-nat-client-windows.c
257src/nat/gnunet-helper-nat-server.c 246src/nat/gnunet-helper-nat-client.c
258src/nat/gnunet-helper-nat-server-windows.c 247src/nat/gnunet-helper-nat-server-windows.c
248src/nat/gnunet-helper-nat-server.c
259src/nat/gnunet-nat.c 249src/nat/gnunet-nat.c
260src/nat/gnunet-service-nat.c 250src/nat/gnunet-service-nat.c
261src/nat/gnunet-service-nat_externalip.c 251src/nat/gnunet-service-nat_externalip.c
@@ -264,15 +254,15 @@ src/nat/gnunet-service-nat_mini.c
264src/nat/gnunet-service-nat_stun.c 254src/nat/gnunet-service-nat_stun.c
265src/nat/nat_api.c 255src/nat/nat_api.c
266src/nat/nat_api_stun.c 256src/nat/nat_api_stun.c
267src/nse/gnunet-nse.c
268src/nse/gnunet-nse-profiler.c 257src/nse/gnunet-nse-profiler.c
258src/nse/gnunet-nse.c
269src/nse/gnunet-service-nse.c 259src/nse/gnunet-service-nse.c
270src/nse/nse_api.c 260src/nse/nse_api.c
261src/peerinfo-tool/gnunet-peerinfo.c
262src/peerinfo-tool/gnunet-peerinfo_plugins.c
271src/peerinfo/gnunet-service-peerinfo.c 263src/peerinfo/gnunet-service-peerinfo.c
272src/peerinfo/peerinfo_api.c 264src/peerinfo/peerinfo_api.c
273src/peerinfo/peerinfo_api_notify.c 265src/peerinfo/peerinfo_api_notify.c
274src/peerinfo-tool/gnunet-peerinfo.c
275src/peerinfo-tool/gnunet-peerinfo_plugins.c
276src/peerstore/gnunet-peerstore.c 266src/peerstore/gnunet-peerstore.c
277src/peerstore/gnunet-service-peerstore.c 267src/peerstore/gnunet-service-peerstore.c
278src/peerstore/peerstore_api.c 268src/peerstore/peerstore_api.c
@@ -297,6 +287,16 @@ src/psycutil/psyc_env.c
297src/psycutil/psyc_message.c 287src/psycutil/psyc_message.c
298src/psycutil/psyc_slicer.c 288src/psycutil/psyc_slicer.c
299src/pt/gnunet-daemon-pt.c 289src/pt/gnunet-daemon-pt.c
290src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
291src/reclaim-attribute/reclaim_attribute.c
292src/reclaim/gnunet-reclaim.c
293src/reclaim/gnunet-service-reclaim.c
294src/reclaim/jwt.c
295src/reclaim/plugin_gnsrecord_reclaim.c
296src/reclaim/plugin_reclaim_sqlite.c
297src/reclaim/plugin_rest_openid_connect.c
298src/reclaim/plugin_rest_reclaim.c
299src/reclaim/reclaim_api.c
300src/regex/gnunet-daemon-regexprofiler.c 300src/regex/gnunet-daemon-regexprofiler.c
301src/regex/gnunet-regex-profiler.c 301src/regex/gnunet-regex-profiler.c
302src/regex/gnunet-regex-simulation-profiler.c 302src/regex/gnunet-regex-simulation-profiler.c
@@ -317,20 +317,20 @@ src/revocation/gnunet-revocation.c
317src/revocation/gnunet-service-revocation.c 317src/revocation/gnunet-service-revocation.c
318src/revocation/plugin_block_revocation.c 318src/revocation/plugin_block_revocation.c
319src/revocation/revocation_api.c 319src/revocation/revocation_api.c
320src/rps/gnunet-rps.c
321src/rps/gnunet-rps-profiler.c 320src/rps/gnunet-rps-profiler.c
321src/rps/gnunet-rps.c
322src/rps/gnunet-service-rps.c 322src/rps/gnunet-service-rps.c
323src/rps/gnunet-service-rps_custommap.c 323src/rps/gnunet-service-rps_custommap.c
324src/rps/gnunet-service-rps_sampler.c 324src/rps/gnunet-service-rps_sampler.c
325src/rps/gnunet-service-rps_sampler_elem.c 325src/rps/gnunet-service-rps_sampler_elem.c
326src/rps/gnunet-service-rps_view.c 326src/rps/gnunet-service-rps_view.c
327src/rps/rps_api.c
328src/rps/rps-test_util.c 327src/rps/rps-test_util.c
328src/rps/rps_api.c
329src/scalarproduct/gnunet-scalarproduct.c 329src/scalarproduct/gnunet-scalarproduct.c
330src/scalarproduct/gnunet-service-scalarproduct_alice.c
331src/scalarproduct/gnunet-service-scalarproduct_bob.c
332src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c 330src/scalarproduct/gnunet-service-scalarproduct-ecc_alice.c
333src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c 331src/scalarproduct/gnunet-service-scalarproduct-ecc_bob.c
332src/scalarproduct/gnunet-service-scalarproduct_alice.c
333src/scalarproduct/gnunet-service-scalarproduct_bob.c
334src/scalarproduct/scalarproduct_api.c 334src/scalarproduct/scalarproduct_api.c
335src/secretsharing/gnunet-secretsharing-profiler.c 335src/secretsharing/gnunet-secretsharing-profiler.c
336src/secretsharing/gnunet-service-secretsharing.c 336src/secretsharing/gnunet-service-secretsharing.c
@@ -359,15 +359,16 @@ src/statistics/gnunet-statistics.c
359src/statistics/statistics_api.c 359src/statistics/statistics_api.c
360src/template/gnunet-service-template.c 360src/template/gnunet-service-template.c
361src/template/gnunet-template.c 361src/template/gnunet-template.c
362src/testbed-logger/gnunet-service-testbed-logger.c
363src/testbed-logger/testbed_logger_api.c
362src/testbed/generate-underlay-topology.c 364src/testbed/generate-underlay-topology.c
363src/testbed/gnunet-daemon-latency-logger.c 365src/testbed/gnunet-daemon-latency-logger.c
364src/testbed/gnunet-daemon-testbed-blacklist.c 366src/testbed/gnunet-daemon-testbed-blacklist.c
365src/testbed/gnunet-daemon-testbed-underlay.c 367src/testbed/gnunet-daemon-testbed-underlay.c
366src/testbed/gnunet-helper-testbed.c 368src/testbed/gnunet-helper-testbed.c
367src/testbed/gnunet_mpi_test.c
368src/testbed/gnunet-service-test-barriers.c 369src/testbed/gnunet-service-test-barriers.c
369src/testbed/gnunet-service-testbed_barriers.c
370src/testbed/gnunet-service-testbed.c 370src/testbed/gnunet-service-testbed.c
371src/testbed/gnunet-service-testbed_barriers.c
371src/testbed/gnunet-service-testbed_cache.c 372src/testbed/gnunet-service-testbed_cache.c
372src/testbed/gnunet-service-testbed_connectionpool.c 373src/testbed/gnunet-service-testbed_connectionpool.c
373src/testbed/gnunet-service-testbed_cpustatus.c 374src/testbed/gnunet-service-testbed_cpustatus.c
@@ -375,20 +376,19 @@ src/testbed/gnunet-service-testbed_links.c
375src/testbed/gnunet-service-testbed_meminfo.c 376src/testbed/gnunet-service-testbed_meminfo.c
376src/testbed/gnunet-service-testbed_oc.c 377src/testbed/gnunet-service-testbed_oc.c
377src/testbed/gnunet-service-testbed_peers.c 378src/testbed/gnunet-service-testbed_peers.c
378src/testbed/gnunet_testbed_mpi_spawn.c
379src/testbed/gnunet-testbed-profiler.c 379src/testbed/gnunet-testbed-profiler.c
380src/testbed-logger/gnunet-service-testbed-logger.c 380src/testbed/gnunet_mpi_test.c
381src/testbed-logger/testbed_logger_api.c 381src/testbed/gnunet_testbed_mpi_spawn.c
382src/testbed/testbed_api_barriers.c
383src/testbed/testbed_api.c 382src/testbed/testbed_api.c
383src/testbed/testbed_api_barriers.c
384src/testbed/testbed_api_hosts.c 384src/testbed/testbed_api_hosts.c
385src/testbed/testbed_api_operations.c 385src/testbed/testbed_api_operations.c
386src/testbed/testbed_api_peers.c 386src/testbed/testbed_api_peers.c
387src/testbed/testbed_api_sd.c 387src/testbed/testbed_api_sd.c
388src/testbed/testbed_api_services.c 388src/testbed/testbed_api_services.c
389src/testbed/testbed_api_statistics.c 389src/testbed/testbed_api_statistics.c
390src/testbed/testbed_api_testbed.c
391src/testbed/testbed_api_test.c 390src/testbed/testbed_api_test.c
391src/testbed/testbed_api_testbed.c
392src/testbed/testbed_api_topology.c 392src/testbed/testbed_api_topology.c
393src/testbed/testbed_api_underlay.c 393src/testbed/testbed_api_underlay.c
394src/testing/gnunet-testing.c 394src/testing/gnunet-testing.c
@@ -397,28 +397,28 @@ src/testing/testing.c
397src/topology/friends.c 397src/topology/friends.c
398src/topology/gnunet-daemon-topology.c 398src/topology/gnunet-daemon-topology.c
399src/transport/gnunet-helper-transport-bluetooth.c 399src/transport/gnunet-helper-transport-bluetooth.c
400src/transport/gnunet-helper-transport-wlan.c
401src/transport/gnunet-helper-transport-wlan-dummy.c 400src/transport/gnunet-helper-transport-wlan-dummy.c
402src/transport/gnunet-service-transport_ats.c 401src/transport/gnunet-helper-transport-wlan.c
403src/transport/gnunet-service-transport.c 402src/transport/gnunet-service-transport.c
403src/transport/gnunet-service-transport_ats.c
404src/transport/gnunet-service-transport_hello.c 404src/transport/gnunet-service-transport_hello.c
405src/transport/gnunet-service-transport_manipulation.c 405src/transport/gnunet-service-transport_manipulation.c
406src/transport/gnunet-service-transport_neighbours.c 406src/transport/gnunet-service-transport_neighbours.c
407src/transport/gnunet-service-transport_plugins.c 407src/transport/gnunet-service-transport_plugins.c
408src/transport/gnunet-service-transport_validation.c 408src/transport/gnunet-service-transport_validation.c
409src/transport/gnunet-transport.c
410src/transport/gnunet-transport-certificate-creation.c 409src/transport/gnunet-transport-certificate-creation.c
411src/transport/gnunet-transport-profiler.c 410src/transport/gnunet-transport-profiler.c
412src/transport/gnunet-transport-wlan-receiver.c 411src/transport/gnunet-transport-wlan-receiver.c
413src/transport/gnunet-transport-wlan-sender.c 412src/transport/gnunet-transport-wlan-sender.c
413src/transport/gnunet-transport.c
414src/transport/plugin_transport_http_client.c 414src/transport/plugin_transport_http_client.c
415src/transport/plugin_transport_http_common.c 415src/transport/plugin_transport_http_common.c
416src/transport/plugin_transport_http_server.c 416src/transport/plugin_transport_http_server.c
417src/transport/plugin_transport_smtp.c 417src/transport/plugin_transport_smtp.c
418src/transport/plugin_transport_tcp.c 418src/transport/plugin_transport_tcp.c
419src/transport/plugin_transport_template.c 419src/transport/plugin_transport_template.c
420src/transport/plugin_transport_udp_broadcasting.c
421src/transport/plugin_transport_udp.c 420src/transport/plugin_transport_udp.c
421src/transport/plugin_transport_udp_broadcasting.c
422src/transport/plugin_transport_unix.c 422src/transport/plugin_transport_unix.c
423src/transport/plugin_transport_wlan.c 423src/transport/plugin_transport_wlan.c
424src/transport/plugin_transport_xt.c 424src/transport/plugin_transport_xt.c
@@ -427,6 +427,11 @@ src/transport/tcp_connection_legacy.c
427src/transport/tcp_server_legacy.c 427src/transport/tcp_server_legacy.c
428src/transport/tcp_server_mst_legacy.c 428src/transport/tcp_server_mst_legacy.c
429src/transport/tcp_service_legacy.c 429src/transport/tcp_service_legacy.c
430src/transport/transport-testing-filenames.c
431src/transport/transport-testing-loggers.c
432src/transport/transport-testing-main.c
433src/transport/transport-testing-send.c
434src/transport/transport-testing.c
430src/transport/transport_api_address_to_string.c 435src/transport/transport_api_address_to_string.c
431src/transport/transport_api_blacklist.c 436src/transport/transport_api_blacklist.c
432src/transport/transport_api_core.c 437src/transport/transport_api_core.c
@@ -435,11 +440,6 @@ src/transport/transport_api_manipulation.c
435src/transport/transport_api_monitor_peers.c 440src/transport/transport_api_monitor_peers.c
436src/transport/transport_api_monitor_plugins.c 441src/transport/transport_api_monitor_plugins.c
437src/transport/transport_api_offer_hello.c 442src/transport/transport_api_offer_hello.c
438src/transport/transport-testing.c
439src/transport/transport-testing-filenames.c
440src/transport/transport-testing-loggers.c
441src/transport/transport-testing-main.c
442src/transport/transport-testing-send.c
443src/util/bandwidth.c 443src/util/bandwidth.c
444src/util/bio.c 444src/util/bio.c
445src/util/client.c 445src/util/client.c
@@ -451,8 +451,8 @@ src/util/configuration_loader.c
451src/util/container_bloomfilter.c 451src/util/container_bloomfilter.c
452src/util/container_heap.c 452src/util/container_heap.c
453src/util/container_meta_data.c 453src/util/container_meta_data.c
454src/util/container_multihashmap32.c
455src/util/container_multihashmap.c 454src/util/container_multihashmap.c
455src/util/container_multihashmap32.c
456src/util/container_multipeermap.c 456src/util/container_multipeermap.c
457src/util/container_multishortmap.c 457src/util/container_multishortmap.c
458src/util/crypto_abe.c 458src/util/crypto_abe.c
@@ -474,13 +474,15 @@ src/util/dnsparser.c
474src/util/dnsstub.c 474src/util/dnsstub.c
475src/util/getopt.c 475src/util/getopt.c
476src/util/getopt_helpers.c 476src/util/getopt_helpers.c
477src/util/gnunet-config.c
478src/util/gnunet-config-diff.c 477src/util/gnunet-config-diff.c
478src/util/gnunet-config.c
479src/util/gnunet-ecc.c 479src/util/gnunet-ecc.c
480src/util/gnunet-helper-w32-console.c 480src/util/gnunet-helper-w32-console.c
481src/util/gnunet-resolver.c 481src/util/gnunet-resolver.c
482src/util/gnunet-scrypt.c 482src/util/gnunet-scrypt.c
483src/util/gnunet-service-resolver.c 483src/util/gnunet-service-resolver.c
484src/util/gnunet-timeout-w32.c
485src/util/gnunet-timeout.c
484src/util/gnunet-uri.c 486src/util/gnunet-uri.c
485src/util/helper.c 487src/util/helper.c
486src/util/load.c 488src/util/load.c
@@ -508,13 +510,13 @@ src/util/tun.c
508src/util/w32cat.c 510src/util/w32cat.c
509src/util/win.c 511src/util/win.c
510src/util/winproc.c 512src/util/winproc.c
511src/vpn/gnunet-helper-vpn.c
512src/vpn/gnunet-helper-vpn-windows.c 513src/vpn/gnunet-helper-vpn-windows.c
514src/vpn/gnunet-helper-vpn.c
513src/vpn/gnunet-service-vpn.c 515src/vpn/gnunet-service-vpn.c
514src/vpn/gnunet-vpn.c 516src/vpn/gnunet-vpn.c
515src/vpn/vpn_api.c 517src/vpn/vpn_api.c
516src/zonemaster/gnunet-service-zonemaster.c
517src/zonemaster/gnunet-service-zonemaster-monitor.c 518src/zonemaster/gnunet-service-zonemaster-monitor.c
519src/zonemaster/gnunet-service-zonemaster.c
518src/fs/fs_api.h 520src/fs/fs_api.h
519src/include/gnunet_common.h 521src/include/gnunet_common.h
520src/include/gnunet_mq_lib.h 522src/include/gnunet_mq_lib.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 00f30adc3..4ded81891 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,11 +19,13 @@ if HAVE_EXPERIMENTAL
19 social 19 social
20# dv (FTBFS) 20# dv (FTBFS)
21if HAVE_ABE 21if HAVE_ABE
22if HAVE_JSON
22 EXP_DIR += \ 23 EXP_DIR += \
23 abe \ 24 abe \
24 credential \ 25 credential \
25 identity-attribute \ 26 reclaim-attribute \
26 identity-provider 27 reclaim
28endif
27endif 29endif
28if HAVE_JSON 30if HAVE_JSON
29 EXP_DIR += \ 31 EXP_DIR += \
diff --git a/src/arm/test_exponential_backoff.c b/src/arm/test_exponential_backoff.c
index 4a7d51bc7..f15bca2db 100644
--- a/src/arm/test_exponential_backoff.c
+++ b/src/arm/test_exponential_backoff.c
@@ -343,7 +343,10 @@ init ()
343 cfg = GNUNET_CONFIGURATION_create (); 343 cfg = GNUNET_CONFIGURATION_create ();
344 if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg, 344 if (GNUNET_OK != GNUNET_CONFIGURATION_parse (cfg,
345 "test_arm_api_data.conf")) 345 "test_arm_api_data.conf"))
346 {
347 GNUNET_CONFIGURATION_destroy (cfg);
346 return GNUNET_SYSERR; 348 return GNUNET_SYSERR;
349 }
347 if (NULL == getcwd (pwd, PATH_MAX)) 350 if (NULL == getcwd (pwd, PATH_MAX))
348 return GNUNET_SYSERR; 351 return GNUNET_SYSERR;
349 GNUNET_assert (0 < GNUNET_asprintf (&binary, 352 GNUNET_assert (0 < GNUNET_asprintf (&binary,
diff --git a/src/cadet/cadet.conf.in b/src/cadet/cadet.conf.in
index 2f4c6a6db..d1ddcb96f 100644
--- a/src/cadet/cadet.conf.in
+++ b/src/cadet/cadet.conf.in
@@ -8,7 +8,7 @@ BINARY = gnunet-service-cadet
8ACCEPT_FROM = 127.0.0.1; 8ACCEPT_FROM = 127.0.0.1;
9ACCEPT_FROM6 = ::1; 9ACCEPT_FROM6 = ::1;
10UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-cadet.sock 10UNIXPATH = $GNUNET_RUNTIME_DIR/gnunet-service-cadet.sock
11UNIX_MATCH_UID = YES 11UNIX_MATCH_UID = NO
12UNIX_MATCH_GID = YES 12UNIX_MATCH_GID = YES
13 13
14 14
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c
index 980b9abbf..e2ca461a5 100644
--- a/src/cadet/cadet_api.c
+++ b/src/cadet/cadet_api.c
@@ -841,6 +841,7 @@ handle_mq_error (void *cls,
841 h); 841 h);
842 GNUNET_MQ_destroy (h->mq); 842 GNUNET_MQ_destroy (h->mq);
843 h->mq = NULL; 843 h->mq = NULL;
844 GNUNET_assert (NULL == h->reconnect_task);
844 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time, 845 h->reconnect_task = GNUNET_SCHEDULER_add_delayed (h->reconnect_time,
845 &reconnect_cbk, 846 &reconnect_cbk,
846 h); 847 h);
@@ -1253,18 +1254,21 @@ GNUNET_CADET_disconnect (struct GNUNET_CADET_Handle *handle)
1253void 1254void
1254GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p) 1255GNUNET_CADET_close_port (struct GNUNET_CADET_Port *p)
1255{ 1256{
1256 struct GNUNET_CADET_PortMessage *msg;
1257 struct GNUNET_MQ_Envelope *env;
1258
1259 GNUNET_assert (GNUNET_YES == 1257 GNUNET_assert (GNUNET_YES ==
1260 GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports, 1258 GNUNET_CONTAINER_multihashmap_remove (p->cadet->ports,
1261 &p->id, 1259 &p->id,
1262 p)); 1260 p));
1263 env = GNUNET_MQ_msg (msg, 1261 if (NULL != p->cadet->mq)
1264 GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE); 1262 {
1265 msg->port = p->id; 1263 struct GNUNET_CADET_PortMessage *msg;
1266 GNUNET_MQ_send (p->cadet->mq, 1264 struct GNUNET_MQ_Envelope *env;
1267 env); 1265
1266 env = GNUNET_MQ_msg (msg,
1267 GNUNET_MESSAGE_TYPE_CADET_LOCAL_PORT_CLOSE);
1268 msg->port = p->id;
1269 GNUNET_MQ_send (p->cadet->mq,
1270 env);
1271 }
1268 GNUNET_free_non_null (p->handlers); 1272 GNUNET_free_non_null (p->handlers);
1269 GNUNET_free (p); 1273 GNUNET_free (p);
1270} 1274}
diff --git a/src/cadet/gnunet-cadet.c b/src/cadet/gnunet-cadet.c
index d629df9b2..13b04b885 100644
--- a/src/cadet/gnunet-cadet.c
+++ b/src/cadet/gnunet-cadet.c
@@ -231,7 +231,7 @@ shutdown_task (void *cls)
231 } 231 }
232} 232}
233 233
234void * 234void
235mq_cb(void *cls) 235mq_cb(void *cls)
236{ 236{
237 listen_stdio (); 237 listen_stdio ();
diff --git a/src/core/test_core_api_reliability.c b/src/core/test_core_api_reliability.c
index 4cc5b4bcd..c7c71f1f1 100644
--- a/src/core/test_core_api_reliability.c
+++ b/src/core/test_core_api_reliability.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -143,6 +143,8 @@ do_shutdown (void *cls)
143 unsigned long long delta; 143 unsigned long long delta;
144 144
145 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; 145 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
146 if (0 == delta)
147 delta = 1;
146 FPRINTF (stderr, 148 FPRINTF (stderr,
147 "\nThroughput was %llu kb/s\n", 149 "\nThroughput was %llu kb/s\n",
148 total_bytes * 1000000LL / 1024 / delta); 150 total_bytes * 1000000LL / 1024 / delta);
diff --git a/src/core/test_core_quota_compliance.c b/src/core/test_core_quota_compliance.c
index a15105556..caff045f0 100644
--- a/src/core/test_core_quota_compliance.c
+++ b/src/core/test_core_quota_compliance.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -227,7 +227,8 @@ measurement_stop (void *cls)
227 running = GNUNET_NO; 227 running = GNUNET_NO;
228 228
229 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; 229 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
230 230 if (0 == delta)
231 delta = 1;
231 throughput_out = total_bytes_sent * 1000000LL / delta; /* convert to bytes/s */ 232 throughput_out = total_bytes_sent * 1000000LL / delta; /* convert to bytes/s */
232 throughput_in = total_bytes_recv * 1000000LL / delta; /* convert to bytes/s */ 233 throughput_in = total_bytes_recv * 1000000LL / delta; /* convert to bytes/s */
233 234
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c
index 4684e514c..dc4236a8b 100644
--- a/src/datacache/plugin_datacache_sqlite.c
+++ b/src/datacache/plugin_datacache_sqlite.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -749,7 +749,8 @@ libgnunet_plugin_datacache_sqlite_init (void *cls)
749 " value BLOB NOT NULL," 749 " value BLOB NOT NULL,"
750 " path BLOB DEFAULT '')"); 750 " path BLOB DEFAULT '')");
751 SQLITE3_EXEC (dbh, "CREATE INDEX idx_hashidx ON ds091 (key,type,expire)"); 751 SQLITE3_EXEC (dbh, "CREATE INDEX idx_hashidx ON ds091 (key,type,expire)");
752 SQLITE3_EXEC (dbh, "CREATE INDEX idx_expire ON ds091 (prox,expire)"); 752 SQLITE3_EXEC (dbh, "CREATE INDEX idx_prox_expire ON ds091 (prox,expire)");
753 SQLITE3_EXEC (dbh, "CREATE INDEX idx_expire_only ON ds091 (expire)");
753 plugin = GNUNET_new (struct Plugin); 754 plugin = GNUNET_new (struct Plugin);
754 plugin->env = env; 755 plugin->env = env;
755 plugin->dbh = dbh; 756 plugin->dbh = dbh;
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 0ec9209da..3b658da92 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -232,7 +232,6 @@ reconnect (struct GNUNET_GNS_Handle *handle)
232 handle), 232 handle),
233 GNUNET_MQ_handler_end () 233 GNUNET_MQ_handler_end ()
234 }; 234 };
235 struct GNUNET_GNS_LookupRequest *lh;
236 235
237 GNUNET_assert (NULL == handle->mq); 236 GNUNET_assert (NULL == handle->mq);
238 LOG (GNUNET_ERROR_TYPE_DEBUG, 237 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -244,7 +243,9 @@ reconnect (struct GNUNET_GNS_Handle *handle)
244 handle); 243 handle);
245 if (NULL == handle->mq) 244 if (NULL == handle->mq)
246 return; 245 return;
247 for (lh = handle->lookup_head; NULL != lh; lh = lh->next) 246 for (struct GNUNET_GNS_LookupRequest *lh = handle->lookup_head;
247 NULL != lh;
248 lh = lh->next)
248 GNUNET_MQ_send_copy (handle->mq, 249 GNUNET_MQ_send_copy (handle->mq,
249 lh->env); 250 lh->env);
250} 251}
diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c
index e6e53d405..8d39e8c53 100644
--- a/src/gns/gnunet-dns2gns.c
+++ b/src/gns/gnunet-dns2gns.c
@@ -269,6 +269,7 @@ dns_result_processor (void *cls,
269 } 269 }
270 request->packet = GNUNET_DNSPARSER_parse ((char*)dns, 270 request->packet = GNUNET_DNSPARSER_parse ((char*)dns,
271 r); 271 r);
272 GNUNET_DNSSTUB_resolve_cancel (request->dns_lookup);
272 send_response (request); 273 send_response (request);
273} 274}
274 275
diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c
index 149c8a7bb..463348ed3 100644
--- a/src/gns/gnunet-gns.c
+++ b/src/gns/gnunet-gns.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -65,8 +65,9 @@ static struct GNUNET_GNS_LookupWithTldRequest *lr;
65/** 65/**
66 * Global return value. 66 * Global return value.
67 * 0 on success (default), 67 * 0 on success (default),
68 * 1 on internal failures, 2 on launch failure, 68 * 1 on internal failures
69 * 3 if the name is not a GNS-supported TLD, 69 * 2 on launch failure,
70 * 4 if the name is not a GNS-supported TLD,
70 */ 71 */
71static int global_ret; 72static int global_ret;
72 73
@@ -114,7 +115,7 @@ process_lookup_result (void *cls,
114 lr = NULL; 115 lr = NULL;
115 if (GNUNET_NO == was_gns) 116 if (GNUNET_NO == was_gns)
116 { 117 {
117 global_ret = 3; 118 global_ret = 4; /* not for GNS */
118 GNUNET_SCHEDULER_shutdown (); 119 GNUNET_SCHEDULER_shutdown ();
119 return; 120 return;
120 } 121 }
@@ -183,7 +184,6 @@ run (void *cls,
183 global_ret = 2; 184 global_ret = 2;
184 return; 185 return;
185 } 186 }
186
187 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, 187 GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
188 NULL); 188 NULL);
189 189
diff --git a/src/gns/nss/nss_gns.c b/src/gns/nss/nss_gns.c
index 9c9233d35..58aab47fd 100644
--- a/src/gns/nss/nss_gns.c
+++ b/src/gns/nss/nss_gns.c
@@ -54,121 +54,126 @@
54 * @return a nss_status code 54 * @return a nss_status code
55 */ 55 */
56enum nss_status 56enum nss_status
57_nss_gns_gethostbyname2_r( 57_nss_gns_gethostbyname2_r(const char *name,
58 const char *name, 58 int af,
59 int af, 59 struct hostent *result,
60 struct hostent * result, 60 char *buffer,
61 char *buffer, 61 size_t buflen,
62 size_t buflen, 62 int *errnop,
63 int *errnop, 63 int *h_errnop)
64 int *h_errnop) { 64{
65 65 struct userdata u;
66 struct userdata u; 66 enum nss_status status = NSS_STATUS_UNAVAIL;
67 enum nss_status status = NSS_STATUS_UNAVAIL; 67 int i;
68 int i; 68 size_t address_length;
69 size_t address_length, l, idx, astart; 69 size_t l;
70 70 size_t idx;
71 if (af == AF_UNSPEC) 71 size_t astart;
72
73 if (af == AF_UNSPEC)
72#ifdef NSS_IPV6_ONLY 74#ifdef NSS_IPV6_ONLY
73 af = AF_INET6; 75 af = AF_INET6;
74#else 76#else
75 af = AF_INET; 77 af = AF_INET;
76#endif 78#endif
77 79
78#ifdef NSS_IPV4_ONLY 80#ifdef NSS_IPV4_ONLY
79 if (af != AF_INET) 81 if (af != AF_INET)
80#elif NSS_IPV6_ONLY 82#elif NSS_IPV6_ONLY
81 if (af != AF_INET6) 83 if (af != AF_INET6)
82#else 84#else
83 if (af != AF_INET && af != AF_INET6) 85 if ( (af != AF_INET) &&
86 (af != AF_INET6) )
84#endif 87#endif
85 { 88 {
86 *errnop = EINVAL; 89 *errnop = EINVAL;
87 *h_errnop = NO_RECOVERY; 90 *h_errnop = NO_RECOVERY;
88 91
89 goto finish; 92 goto finish;
90 } 93 }
91
92 address_length = af == AF_INET ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t);
93 if (buflen <
94 sizeof(char*)+ /* alias names */
95 strlen(name)+1) { /* official name */
96
97 *errnop = ERANGE;
98 *h_errnop = NO_RECOVERY;
99 status = NSS_STATUS_TRYAGAIN;
100
101 goto finish;
102 }
103
104 u.count = 0;
105 u.data_len = 0;
106
107 i = gns_resolve_name(af, name, &u);
108 if (-3 == i)
109 {
110 status = NSS_STATUS_NOTFOUND;
111 goto finish;
112 }
113 if (-2 == i)
114 {
115 status = NSS_STATUS_UNAVAIL;
116 goto finish;
117 }
118 if ( (-1 == i) ||
119 (u.count == 0) )
120 {
121 *errnop = ETIMEDOUT;
122 *h_errnop = HOST_NOT_FOUND;
123 status = NSS_STATUS_NOTFOUND;
124 goto finish;
125 }
126
127
128 /* Alias names */
129 *((char**) buffer) = NULL;
130 result->h_aliases = (char**) buffer;
131 idx = sizeof(char*);
132
133 /* Official name */
134 strcpy(buffer+idx, name);
135 result->h_name = buffer+idx;
136 idx += strlen(name)+1;
137
138 ALIGN(idx);
139
140 result->h_addrtype = af;
141 result->h_length = address_length;
142
143 /* Check if there's enough space for the addresses */
144 if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1)) {
145 *errnop = ERANGE;
146 *h_errnop = NO_RECOVERY;
147 status = NSS_STATUS_TRYAGAIN;
148 goto finish;
149 }
150 94
95 address_length = (af == AF_INET) ? sizeof(ipv4_address_t) : sizeof(ipv6_address_t);
96 if (buflen <
97 sizeof(char*)+ /* alias names */
98 strlen(name)+1)
99 { /* official name */
100 *errnop = ERANGE;
101 *h_errnop = NO_RECOVERY;
102 status = NSS_STATUS_TRYAGAIN;
103
104 goto finish;
105 }
106 u.count = 0;
107 u.data_len = 0;
108 i = gns_resolve_name (af,
109 name,
110 &u);
111 if (-3 == i)
112 {
113 status = NSS_STATUS_NOTFOUND;
114 goto finish;
115 }
116 if (-2 == i)
117 {
118 status = NSS_STATUS_UNAVAIL;
119 goto finish;
120 }
121 if ( (-1 == i) ||
122 (u.count == 0) )
123 {
124 *errnop = ETIMEDOUT;
125 *h_errnop = HOST_NOT_FOUND;
126 status = NSS_STATUS_NOTFOUND;
127 goto finish;
128 }
129 /* Alias names */
130 *((char**) buffer) = NULL;
131 result->h_aliases = (char**) buffer;
132 idx = sizeof(char*);
133
134 /* Official name */
135 strcpy (buffer+idx,
136 name);
137 result->h_name = buffer+idx;
138 idx += strlen (name)+1;
139
140 ALIGN(idx);
141
142 result->h_addrtype = af;
143 result->h_length = address_length;
144
145 /* Check if there's enough space for the addresses */
146 if (buflen < idx+u.data_len+sizeof(char*)*(u.count+1))
147 {
148 *errnop = ERANGE;
149 *h_errnop = NO_RECOVERY;
150 status = NSS_STATUS_TRYAGAIN;
151 goto finish;
152 }
151 /* Addresses */ 153 /* Addresses */
152 astart = idx; 154 astart = idx;
153 l = u.count*address_length; 155 l = u.count*address_length;
154 if (0 != l) 156 if (0 != l)
155 memcpy(buffer+astart, &u.data, l); 157 memcpy (buffer+astart,
156 /* address_length is a multiple of 32bits, so idx is still aligned 158 &u.data,
157 * correctly */ 159 l);
158 idx += l; 160 /* address_length is a multiple of 32bits, so idx is still aligned
159 161 * correctly */
160 /* Address array address_length is always a multiple of 32bits */ 162 idx += l;
161 for (i = 0; i < u.count; i++) 163
162 ((char**) (buffer+idx))[i] = buffer+astart+address_length*i; 164 /* Address array address_length is always a multiple of 32bits */
163 ((char**) (buffer+idx))[i] = NULL; 165 for (i = 0; i < u.count; i++)
164 result->h_addr_list = (char**) (buffer+idx); 166 ((char**) (buffer+idx))[i] = buffer+astart+address_length*i;
165 167 ((char**) (buffer+idx))[i] = NULL;
166 status = NSS_STATUS_SUCCESS; 168 result->h_addr_list = (char**) (buffer+idx);
169
170 status = NSS_STATUS_SUCCESS;
167 171
168finish: 172finish:
169 return status; 173 return status;
170} 174}
171 175
176
172/** 177/**
173 * The gethostbyname hook executed by nsswitch 178 * The gethostbyname hook executed by nsswitch
174 * 179 *
@@ -176,29 +181,28 @@ finish:
176 * @param result the result hostent 181 * @param result the result hostent
177 * @param buffer the result buffer 182 * @param buffer the result buffer
178 * @param buflen length of the buffer 183 * @param buflen length of the buffer
179 * @param errnop idk 184 * @param errnop[out] the low-level error code to return to the application
180 * @param h_errnop idk 185 * @param h_errnop idk
181 * @return a nss_status code 186 * @return a nss_status code
182 */ 187 */
183enum nss_status 188enum nss_status
184_nss_gns_gethostbyname_r ( 189_nss_gns_gethostbyname_r (const char *name,
185 const char *name, 190 struct hostent *result,
186 struct hostent *result, 191 char *buffer,
187 char *buffer, 192 size_t buflen,
188 size_t buflen, 193 int *errnop,
189 int *errnop, 194 int *h_errnop)
190 int *h_errnop) { 195{
191 196 return _nss_gns_gethostbyname2_r (name,
192 return _nss_gns_gethostbyname2_r( 197 AF_UNSPEC,
193 name, 198 result,
194 AF_UNSPEC, 199 buffer,
195 result, 200 buflen,
196 buffer, 201 errnop,
197 buflen, 202 h_errnop);
198 errnop,
199 h_errnop);
200} 203}
201 204
205
202/** 206/**
203 * The gethostbyaddr hook executed by nsswitch 207 * The gethostbyaddr hook executed by nsswitch
204 * We can't do this so we always return NSS_STATUS_UNAVAIL 208 * We can't do this so we always return NSS_STATUS_UNAVAIL
@@ -209,23 +213,22 @@ _nss_gns_gethostbyname_r (
209 * @param result the result hostent 213 * @param result the result hostent
210 * @param buffer the result buffer 214 * @param buffer the result buffer
211 * @param buflen length of the buffer 215 * @param buflen length of the buffer
212 * @param errnop idk 216 * @param errnop[out] the low-level error code to return to the application
213 * @param h_errnop idk 217 * @param h_errnop idk
214 * @return NSS_STATUS_UNAVAIL 218 * @return NSS_STATUS_UNAVAIL
215 */ 219 */
216enum nss_status 220enum nss_status
217_nss_gns_gethostbyaddr_r( 221_nss_gns_gethostbyaddr_r (const void* addr,
218 const void* addr, 222 int len,
219 int len, 223 int af,
220 int af, 224 struct hostent *result,
221 struct hostent *result, 225 char *buffer,
222 char *buffer, 226 size_t buflen,
223 size_t buflen, 227 int *errnop,
224 int *errnop, 228 int *h_errnop)
225 int *h_errnop) { 229{
226 230 *errnop = EINVAL;
227 *errnop = EINVAL; 231 *h_errnop = NO_RECOVERY;
228 *h_errnop = NO_RECOVERY; 232 //NOTE we allow to leak this into DNS so no NOTFOUND
229 //NOTE we allow to leak this into DNS so no NOTFOUND 233 return NSS_STATUS_UNAVAIL;
230 return NSS_STATUS_UNAVAIL;
231} 234}
diff --git a/src/gns/nss/nss_gns_query.c b/src/gns/nss/nss_gns_query.c
index 094e25ed5..867ead624 100644
--- a/src/gns/nss/nss_gns_query.c
+++ b/src/gns/nss/nss_gns_query.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -48,14 +48,16 @@ gns_resolve_name (int af,
48 { 48 {
49 if (-1 == asprintf (&cmd, 49 if (-1 == asprintf (&cmd,
50 "%s -t AAAA -u %s\n", 50 "%s -t AAAA -u %s\n",
51 "gnunet-gns -r", name)) 51 "gnunet-gns -r",
52 name))
52 return -1; 53 return -1;
53 } 54 }
54 else 55 else
55 { 56 {
56 if (-1 == asprintf (&cmd, 57 if (-1 == asprintf (&cmd,
57 "%s %s\n", 58 "%s %s\n",
58 "gnunet-gns -r -u", name)) 59 "gnunet-gns -r -u",
60 name))
59 return -1; 61 return -1;
60 } 62 }
61 if (NULL == (p = popen (cmd, "r"))) 63 if (NULL == (p = popen (cmd, "r")))
@@ -63,7 +65,9 @@ gns_resolve_name (int af,
63 free (cmd); 65 free (cmd);
64 return -1; 66 return -1;
65 } 67 }
66 while (NULL != fgets (line, sizeof(line), p)) 68 while (NULL != fgets (line,
69 sizeof(line),
70 p))
67 { 71 {
68 if (u->count >= MAX_ENTRIES) 72 if (u->count >= MAX_ENTRIES)
69 break; 73 break;
@@ -72,7 +76,9 @@ gns_resolve_name (int af,
72 line[strlen(line)-1] = '\0'; 76 line[strlen(line)-1] = '\0';
73 if (AF_INET == af) 77 if (AF_INET == af)
74 { 78 {
75 if (inet_pton(af, line, &(u->data.ipv4[u->count]))) 79 if (inet_pton(af,
80 line,
81 &u->data.ipv4[u->count]))
76 { 82 {
77 u->count++; 83 u->count++;
78 u->data_len += sizeof(ipv4_address_t); 84 u->data_len += sizeof(ipv4_address_t);
@@ -86,7 +92,9 @@ gns_resolve_name (int af,
86 } 92 }
87 else if (AF_INET6 == af) 93 else if (AF_INET6 == af)
88 { 94 {
89 if (inet_pton(af, line, &(u->data.ipv6[u->count]))) 95 if (inet_pton(af,
96 line,
97 &u->data.ipv6[u->count]))
90 { 98 {
91 u->count++; 99 u->count++;
92 u->data_len += sizeof(ipv6_address_t); 100 u->data_len += sizeof(ipv6_address_t);
@@ -105,7 +113,10 @@ gns_resolve_name (int af,
105 if (4 == ret) 113 if (4 == ret)
106 return -2; /* not for GNS */ 114 return -2; /* not for GNS */
107 if (3 == ret) 115 if (3 == ret)
108 return -3; /* timeout */ 116 return -3; /* timeout -> not found */
117 if ( (2 == ret) || (1 == ret) )
118 return -2; /* launch failure -> service unavailable */
109 return 0; 119 return 0;
110} 120}
121
111/* end of nss_gns_query.c */ 122/* end of nss_gns_query.c */
diff --git a/src/gns/nss/nss_gns_query.h b/src/gns/nss/nss_gns_query.h
index bb04f9004..48cab4b22 100644
--- a/src/gns/nss/nss_gns_query.h
+++ b/src/gns/nss/nss_gns_query.h
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -26,25 +26,30 @@
26/* Maximum number of entries to return */ 26/* Maximum number of entries to return */
27#define MAX_ENTRIES 16 27#define MAX_ENTRIES 16
28 28
29typedef struct { 29typedef struct
30 uint32_t address; 30{
31 uint32_t address;
31} ipv4_address_t; 32} ipv4_address_t;
32 33
33typedef struct { 34
34 uint8_t address[16]; 35typedef struct
36{
37 uint8_t address[16];
35} ipv6_address_t; 38} ipv6_address_t;
36 39
37 40
38struct userdata { 41struct userdata
42{
39 int count; 43 int count;
40 int data_len; /* only valid when doing reverse lookup */ 44 int data_len; /* only valid when doing reverse lookup */
41 union { 45 union {
42 ipv4_address_t ipv4[MAX_ENTRIES]; 46 ipv4_address_t ipv4[MAX_ENTRIES];
43 ipv6_address_t ipv6[MAX_ENTRIES]; 47 ipv6_address_t ipv6[MAX_ENTRIES];
44 char *name[MAX_ENTRIES]; 48 char *name[MAX_ENTRIES];
45 } data; 49 } data;
46}; 50};
47 51
52
48/** 53/**
49 * Wrapper function that uses gnunet-gns cli tool to resolve 54 * Wrapper function that uses gnunet-gns cli tool to resolve
50 * an IPv4/6 address. 55 * an IPv4/6 address.
@@ -54,8 +59,9 @@ struct userdata {
54 * @param u the userdata (result struct) 59 * @param u the userdata (result struct)
55 * @return -1 on error else 0 60 * @return -1 on error else 0
56 */ 61 */
57int gns_resolve_name(int af, 62int
58 const char *name, 63gns_resolve_name(int af,
59 struct userdata *userdata); 64 const char *name,
65 struct userdata *userdata);
60 66
61#endif 67#endif
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 2b729db54..e76a5d116 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -281,6 +281,15 @@ gnsrecord_to_json (const struct GNUNET_GNSRECORD_Data *rd)
281 return record_obj; 281 return record_obj;
282} 282}
283 283
284
285static void
286do_cleanup (void *cls)
287{
288 struct LookupHandle *handle = cls;
289 cleanup_handle (handle);
290}
291
292
284/** 293/**
285 * Function called with the result of a GNS lookup. 294 * Function called with the result of a GNS lookup.
286 * 295 *
@@ -325,7 +334,7 @@ process_lookup_result (void *cls, uint32_t rd_count,
325 resp = GNUNET_REST_create_response (result); 334 resp = GNUNET_REST_create_response (result);
326 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 335 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
327 GNUNET_free (result); 336 GNUNET_free (result);
328 cleanup_handle (handle); 337 GNUNET_SCHEDULER_add_now (&do_cleanup, handle);
329} 338}
330 339
331 340
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c b/src/gnsrecord/plugin_gnsrecord_dns.c
index 188afcae7..254ae15ea 100644
--- a/src/gnsrecord/plugin_gnsrecord_dns.c
+++ b/src/gnsrecord/plugin_gnsrecord_dns.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -463,7 +463,7 @@ dns_string_to_value (void *cls,
463 } 463 }
464 cert_size = GNUNET_STRINGS_base64_decode (certp, 464 cert_size = GNUNET_STRINGS_base64_decode (certp,
465 strlen (certp), 465 strlen (certp),
466 &cert_data); 466 (void **) &cert_data);
467 GNUNET_free (sdup); 467 GNUNET_free (sdup);
468 cert.cert_type = type; 468 cert.cert_type = type;
469 cert.cert_tag = key; 469 cert.cert_tag = key;
diff --git a/src/identity-provider/identity-token.conf b/src/identity-provider/identity-token.conf
deleted file mode 100644
index f29f6cdf3..000000000
--- a/src/identity-provider/identity-token.conf
+++ /dev/null
@@ -1,2 +0,0 @@
1[identity-token]
2BINARY=gnunet-service-identity-token
diff --git a/src/identity-provider/jwt.c b/src/identity-provider/jwt.c
deleted file mode 100644
index 1a984f7b5..000000000
--- a/src/identity-provider/jwt.c
+++ /dev/null
@@ -1,189 +0,0 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2010-2015 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
19/**
20 * @file identity-provider/jwt.c
21 * @brief helper library for JSON-Web-Tokens
22 * @author Martin Schanzenbach
23 */
24#include "platform.h"
25#include "gnunet_util_lib.h"
26#include "gnunet_signatures.h"
27#include "gnunet_identity_attribute_lib.h"
28#include <jansson.h>
29
30
31#define JWT_ALG "alg"
32
33/*TODO is this the correct way to define new algs? */
34#define JWT_ALG_VALUE "urn:org:gnunet:jwt:alg:ecdsa:ed25519"
35
36#define JWT_TYP "typ"
37
38#define JWT_TYP_VALUE "jwt"
39
40//TODO change server address
41#define SERVER_ADDRESS "https://localhost"
42
43static char*
44create_jwt_header(void)
45{
46 json_t *root;
47 char *json_str;
48
49 root = json_object ();
50 json_object_set_new (root, JWT_ALG, json_string (JWT_ALG_VALUE));
51 json_object_set_new (root, JWT_TYP, json_string (JWT_TYP_VALUE));
52
53 json_str = json_dumps (root, JSON_INDENT(1));
54 json_decref (root);
55 return json_str;
56}
57
58/**
59 * Create a JWT from attributes
60 *
61 * @param aud_key the public of the subject
62 * @param attrs the attribute list
63 * @param priv_key the key used to sign the JWT
64 * @return a new base64-encoded JWT string.
65 */
66char*
67jwt_create_from_list (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
68 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs,
69 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key)
70{
71 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le;
72 struct GNUNET_CRYPTO_EcdsaPublicKey sub_key;
73 struct GNUNET_CRYPTO_EcdsaSignature signature;
74 struct GNUNET_CRYPTO_EccSignaturePurpose *purpose;
75 char* audience;
76 char* subject;
77 char* header;
78 char* padding;
79 char* body_str;
80 char* result;
81 char* header_base64;
82 char* body_base64;
83 char* signature_target;
84 char* signature_base64;
85 char* attr_val_str;
86 json_t* body;
87
88 //exp REQUIRED time expired from config
89 //iat REQUIRED time now
90 //auth_time only if max_age
91 //nonce only if nonce
92 // OPTIONAL acr,amr,azp
93 GNUNET_CRYPTO_ecdsa_key_get_public (priv_key, &sub_key);
94 /* TODO maybe we should use a local identity here */
95 subject = GNUNET_STRINGS_data_to_string_alloc (&sub_key,
96 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
97 audience = GNUNET_STRINGS_data_to_string_alloc (aud_key,
98 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
99 header = create_jwt_header ();
100 body = json_object ();
101 /* TODO who is the issuer? local IdP or subject ? See self-issued tokens? */
102 //iss REQUIRED case sensitive server uri with https
103 json_object_set_new (body,
104 "iss", json_string (SERVER_ADDRESS));
105 //sub REQUIRED public key identity, not exceed 255 ASCII length
106 json_object_set_new (body,
107 "sub", json_string (subject));
108 /* TODO what should be in here exactly? */
109 //aud REQUIRED public key client_id must be there
110 json_object_set_new (body,
111 "aud", json_string (audience));
112 for (le = attrs->list_head; NULL != le; le = le->next)
113 {
114 /**
115 * TODO here we should have a function that
116 * calls the Attribute plugins to create a
117 * json representation for its value
118 */
119 attr_val_str = GNUNET_IDENTITY_ATTRIBUTE_value_to_string (le->claim->type,
120 le->claim->data,
121 le->claim->data_size);
122 json_object_set_new (body,
123 le->claim->name,
124 json_string (attr_val_str));
125 GNUNET_free (attr_val_str);
126 }
127 body_str = json_dumps (body, JSON_INDENT(0));
128 json_decref (body);
129
130 GNUNET_STRINGS_base64_encode (header,
131 strlen (header),
132 &header_base64);
133 //Remove GNUNET padding of base64
134 padding = strtok(header_base64, "=");
135 while (NULL != padding)
136 padding = strtok(NULL, "=");
137
138 GNUNET_STRINGS_base64_encode (body_str,
139 strlen (body_str),
140 &body_base64);
141
142 //Remove GNUNET padding of base64
143 padding = strtok(body_base64, "=");
144 while (NULL != padding)
145 padding = strtok(NULL, "=");
146
147 GNUNET_free (subject);
148 GNUNET_free (audience);
149
150 /**
151 * TODO
152 * Creating the JWT signature. This might not be
153 * standards compliant, check.
154 */
155 GNUNET_asprintf (&signature_target, "%s,%s", header_base64, body_base64);
156
157 purpose =
158 GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
159 strlen (signature_target));
160 purpose->size =
161 htonl (strlen (signature_target) + sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
162 purpose->purpose = htonl(GNUNET_SIGNATURE_PURPOSE_GNUID_TOKEN);
163 GNUNET_memcpy (&purpose[1], signature_target, strlen (signature_target));
164 if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_sign (priv_key,
165 purpose,
166 (struct GNUNET_CRYPTO_EcdsaSignature *)&signature))
167 {
168 GNUNET_free (signature_target);
169 GNUNET_free (body_str);
170 GNUNET_free (body_base64);
171 GNUNET_free (header_base64);
172 GNUNET_free (purpose);
173 return NULL;
174 }
175 GNUNET_STRINGS_base64_encode ((const char*)&signature,
176 sizeof (struct GNUNET_CRYPTO_EcdsaSignature),
177 &signature_base64);
178 GNUNET_asprintf (&result, "%s.%s.%s",
179 header_base64, body_base64, signature_base64);
180
181 GNUNET_free (signature_target);
182 GNUNET_free (header);
183 GNUNET_free (body_str);
184 GNUNET_free (signature_base64);
185 GNUNET_free (body_base64);
186 GNUNET_free (header_base64);
187 GNUNET_free (purpose);
188 return result;
189}
diff --git a/src/identity-provider/jwt.h b/src/identity-provider/jwt.h
deleted file mode 100644
index 072958973..000000000
--- a/src/identity-provider/jwt.h
+++ /dev/null
@@ -1,9 +0,0 @@
1#ifndef JWT_H
2#define JWT_H
3
4char*
5jwt_create_from_list (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
6 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs,
7 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key);
8
9#endif
diff --git a/src/identity-provider/test_idp.conf b/src/identity-provider/test_idp.conf
deleted file mode 100644
index 3e4df561a..000000000
--- a/src/identity-provider/test_idp.conf
+++ /dev/null
@@ -1,33 +0,0 @@
1@INLINE@ test_idp_defaults.conf
2
3[PATHS]
4GNUNET_TEST_HOME = $GNUNET_TMP/test-gnunet-idp-peer-1/
5
6[dht]
7START_ON_DEMAND = YES
8
9[rest]
10START_ON_DEMAND = YES
11PREFIX = valgrind --leak-check=full --track-origins=yes --log-file=$GNUNET_TMP/restlog
12
13[transport]
14PLUGINS =
15
16[identity-provider]
17START_ON_DEMAND = YES
18#PREFIX = valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --log-file=$GNUNET_TMP/idplog
19
20[gns]
21#PREFIX = valgrind --leak-check=full --track-origins=yes
22START_ON_DEMAND = YES
23AUTO_IMPORT_PKEY = YES
24MAX_PARALLEL_BACKGROUND_QUERIES = 10
25DEFAULT_LOOKUP_TIMEOUT = 15 s
26RECORD_PUT_INTERVAL = 1 h
27ZONE_PUBLISH_TIME_WINDOW = 1 h
28DNS_ROOT=PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
29
30[identity-rest-plugin]
31address = http://localhost:8000/#/login
32psw = mysupersecretpassword
33expiration_time = 3600
diff --git a/src/identity-provider/test_idp.sh b/src/identity-provider/test_idp.sh
deleted file mode 100755
index 598d1008c..000000000
--- a/src/identity-provider/test_idp.sh
+++ /dev/null
@@ -1,31 +0,0 @@
1#!/bin/bash
2#trap "gnunet-arm -e -c test_idp_lookup.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_idp.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_idp.conf
27gnunet-identity -C testego -c test_idp.conf
28valgrind gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf
29gnunet-idp -e testego -a name -V John -c test_idp.conf
30gnunet-idp -e testego -D -c test_idp.conf
31gnunet-arm -e -c test_idp.conf
diff --git a/src/identity-provider/test_idp_attribute.sh b/src/identity-provider/test_idp_attribute.sh
deleted file mode 100755
index 7f0f06dac..000000000
--- a/src/identity-provider/test_idp_attribute.sh
+++ /dev/null
@@ -1,40 +0,0 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_idp.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_idp.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_idp.conf
27#gnunet-arm -i rest -c test_idp.conf
28gnunet-identity -C testego -c test_idp.conf
29gnunet-identity -C rpego -c test_idp.conf
30TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print $3}')
31gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf
32gnunet-idp -e testego -a name -V John -c test_idp.conf > /dev/null 2>&1
33if test $? != 0
34then
35 echo "Failed."
36 exit 1
37fi
38
39#curl localhost:7776/idp/attributes/testego
40gnunet-arm -e -c test_idp.conf
diff --git a/src/identity-provider/test_idp_consume.sh b/src/identity-provider/test_idp_consume.sh
deleted file mode 100755
index 11f6865a4..000000000
--- a/src/identity-provider/test_idp_consume.sh
+++ /dev/null
@@ -1,43 +0,0 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_idp.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_idp.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_idp.conf
27#gnunet-arm -i rest -c test_idp.conf
28gnunet-identity -C testego -c test_idp.conf
29gnunet-identity -C rpego -c test_idp.conf
30SUBJECT_KEY=$(gnunet-identity -d -c test_idp.conf | grep rpego | awk '{print $3}')
31TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print $3}')
32gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf
33gnunet-idp -e testego -a name -V John -c test_idp.conf
34TICKET=$(gnunet-idp -e testego -i "email,name" -r $SUBJECT_KEY -c test_idp.conf | awk '{print $1}')
35gnunet-idp -e rpego -C $TICKET -c test_idp.conf > /dev/null 2>&1
36
37if test $? != 0
38then
39 "Failed."
40 exit 1
41fi
42#curl http://localhost:7776/idp/tickets/testego
43gnunet-arm -e -c test_idp.conf
diff --git a/src/identity-provider/test_idp_issue.sh b/src/identity-provider/test_idp_issue.sh
deleted file mode 100755
index 90487ee73..000000000
--- a/src/identity-provider/test_idp_issue.sh
+++ /dev/null
@@ -1,42 +0,0 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_idp.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_idp.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_idp.conf
27#gnunet-arm -i rest -c test_idp.conf
28gnunet-identity -C testego -c test_idp.conf
29gnunet-identity -C rpego -c test_idp.conf
30SUBJECT_KEY=$(gnunet-identity -d -c test_idp.conf | grep rpego | awk '{print $3}')
31TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print $3}')
32gnunet-idp -e testego -a email -V john@doe.gnu -c test_idp.conf > /dev/null 2>&1
33gnunet-idp -e testego -a name -V John -c test_idp.conf > /dev/null 2>&1
34#gnunet-idp -e testego -D -c test_idp.conf
35gnunet-idp -e testego -i "email,name" -r $SUBJECT_KEY -c test_idp.conf > /dev/null 2>&1
36if test $? != 0
37then
38 echo "Failed."
39 exit 1
40fi
41#curl http://localhost:7776/idp/attributes/testego
42gnunet-arm -e -c test_idp.conf
diff --git a/src/identity-provider/test_idp_revoke.sh b/src/identity-provider/test_idp_revoke.sh
deleted file mode 100755
index 7a3f5d030..000000000
--- a/src/identity-provider/test_idp_revoke.sh
+++ /dev/null
@@ -1,65 +0,0 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_idp.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_idp.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_idp.conf 2&>1 > /dev/null
27gnunet-identity -C alice -c test_idp.conf
28gnunet-identity -C bob -c test_idp.conf
29gnunet-identity -C eve -c test_idp.conf
30ALICE_KEY=$(gnunet-identity -d -c test_idp.conf | grep alice | awk '{print $3}')
31BOB_KEY=$(gnunet-identity -d -c test_idp.conf | grep bob | awk '{print $3}')
32EVE_KEY=$(gnunet-identity -d -c test_idp.conf | grep eve | awk '{print $3}')
33
34gnunet-idp -e alice -E 15s -a email -V john@doe.gnu -c test_idp.conf
35gnunet-idp -e alice -E 15s -a name -V John -c test_idp.conf
36TICKET_BOB=$(gnunet-idp -e alice -i "email,name" -r $BOB_KEY -c test_idp.conf | awk '{print $1}')
37#gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf
38TICKET_EVE=$(gnunet-idp -e alice -i "email" -r $EVE_KEY -c test_idp.conf | awk '{print $1}')
39
40#echo "Consuming $TICKET"
41#gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf
42gnunet-idp -e alice -R $TICKET_EVE -c test_idp.conf
43
44#sleep 6
45
46gnunet-idp -e eve -C $TICKET_EVE -c test_idp.conf 2&>1 >/dev/null
47if test $? == 0
48then
49 echo "Eve can still resolve attributes..."
50 gnunet-arm -e -c test_idp.conf
51 exit 1
52fi
53
54gnunet-arm -e -c test_idp.conf
55gnunet-arm -s -c test_idp.conf 2&>1 > /dev/null
56
57gnunet-idp -e bob -C $TICKET_BOB -c test_idp.conf 2&>1 >/dev/null
58if test $? != 0
59then
60 echo "Bob cannot resolve attributes..."
61 gnunet-arm -e -c test_idp.conf
62 exit 1
63fi
64
65gnunet-arm -e -c test_idp.conf
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index 6b8e21806..266f5ccc3 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -371,11 +371,12 @@ handle_get_default_message (void *cls,
371 struct GNUNET_MQ_Envelope *env; 371 struct GNUNET_MQ_Envelope *env;
372 struct GNUNET_SERVICE_Client *client = cls; 372 struct GNUNET_SERVICE_Client *client = cls;
373 struct Ego *ego; 373 struct Ego *ego;
374 const char *name; 374 char *name;
375 char *identifier; 375 char *identifier;
376 376
377 377
378 name = (const char *) &gdm[1]; 378 name = GNUNET_strdup ((const char *) &gdm[1]);
379 GNUNET_STRINGS_utf8_tolower ((const char *) &gdm[1], name);
379 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 380 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
380 "Received GET_DEFAULT for service `%s' from client\n", 381 "Received GET_DEFAULT for service `%s' from client\n",
381 name); 382 name);
@@ -387,6 +388,7 @@ handle_get_default_message (void *cls,
387 { 388 {
388 send_result_code (client, 1, gettext_noop ("no default known")); 389 send_result_code (client, 1, gettext_noop ("no default known"));
389 GNUNET_SERVICE_client_continue (client); 390 GNUNET_SERVICE_client_continue (client);
391 GNUNET_free (name);
390 return; 392 return;
391 } 393 }
392 for (ego = ego_head; NULL != ego; ego = ego->next) 394 for (ego = ego_head; NULL != ego; ego = ego->next)
@@ -399,6 +401,7 @@ handle_get_default_message (void *cls,
399 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env); 401 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client), env);
400 GNUNET_SERVICE_client_continue (client); 402 GNUNET_SERVICE_client_continue (client);
401 GNUNET_free (identifier); 403 GNUNET_free (identifier);
404 GNUNET_free (name);
402 return; 405 return;
403 } 406 }
404 } 407 }
@@ -406,6 +409,7 @@ handle_get_default_message (void *cls,
406 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 409 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
407 "Failed to find ego `%s'\n", 410 "Failed to find ego `%s'\n",
408 name); 411 name);
412 GNUNET_free (name);
409 send_result_code (client, 1, 413 send_result_code (client, 1,
410 gettext_noop ("default configured, but ego unknown (internal error)")); 414 gettext_noop ("default configured, but ego unknown (internal error)"));
411 GNUNET_SERVICE_client_continue (client); 415 GNUNET_SERVICE_client_continue (client);
@@ -477,9 +481,11 @@ handle_set_default_message (void *cls,
477{ 481{
478 struct Ego *ego; 482 struct Ego *ego;
479 struct GNUNET_SERVICE_Client *client = cls; 483 struct GNUNET_SERVICE_Client *client = cls;
480 const char *str; 484 char *str;
485
486 str = GNUNET_strdup ((const char *) &sdm[1]);
487 GNUNET_STRINGS_utf8_tolower ((const char *) &sdm[1], str);
481 488
482 str = (const char *) &sdm[1];
483 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 489 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
484 "Received SET_DEFAULT for service `%s' from client\n", 490 "Received SET_DEFAULT for service `%s' from client\n",
485 str); 491 str);
@@ -500,10 +506,12 @@ handle_set_default_message (void *cls,
500 subsystem_cfg_file); 506 subsystem_cfg_file);
501 send_result_code (client, 0, NULL); 507 send_result_code (client, 0, NULL);
502 GNUNET_SERVICE_client_continue (client); 508 GNUNET_SERVICE_client_continue (client);
509 GNUNET_free (str);
503 return; 510 return;
504 } 511 }
505 } 512 }
506 send_result_code (client, 1, _("Unknown ego specified for service (internal error)")); 513 send_result_code (client, 1, _("Unknown ego specified for service (internal error)"));
514 GNUNET_free (str);
507 GNUNET_SERVICE_client_continue (client); 515 GNUNET_SERVICE_client_continue (client);
508} 516}
509 517
@@ -585,12 +593,13 @@ handle_create_message (void *cls,
585{ 593{
586 struct GNUNET_SERVICE_Client *client = cls; 594 struct GNUNET_SERVICE_Client *client = cls;
587 struct Ego *ego; 595 struct Ego *ego;
588 const char *str; 596 char *str;
589 char *fn; 597 char *fn;
590 598
591 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 599 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
592 "Received CREATE message from client\n"); 600 "Received CREATE message from client\n");
593 str = (const char *) &crm[1]; 601 str = GNUNET_strdup ((const char *) &crm[1]);
602 GNUNET_STRINGS_utf8_tolower ((const char *) &crm[1], str);
594 for (ego = ego_head; NULL != ego; ego = ego->next) 603 for (ego = ego_head; NULL != ego; ego = ego->next)
595 { 604 {
596 if (0 == strcmp (ego->identifier, 605 if (0 == strcmp (ego->identifier,
@@ -598,6 +607,7 @@ handle_create_message (void *cls,
598 { 607 {
599 send_result_code (client, 1, gettext_noop ("identifier already in use for another ego")); 608 send_result_code (client, 1, gettext_noop ("identifier already in use for another ego"));
600 GNUNET_SERVICE_client_continue (client); 609 GNUNET_SERVICE_client_continue (client);
610 GNUNET_free (str);
601 return; 611 return;
602 } 612 }
603 } 613 }
@@ -620,6 +630,7 @@ handle_create_message (void *cls,
620 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, 630 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
621 "write", fn); 631 "write", fn);
622 GNUNET_free (fn); 632 GNUNET_free (fn);
633 GNUNET_free (str);
623 notify_listeners (ego); 634 notify_listeners (ego);
624 GNUNET_SERVICE_client_continue (client); 635 GNUNET_SERVICE_client_continue (client);
625} 636}
@@ -726,18 +737,22 @@ handle_rename_message (void *cls,
726{ 737{
727 uint16_t old_name_len; 738 uint16_t old_name_len;
728 struct Ego *ego; 739 struct Ego *ego;
729 const char *old_name; 740 char *old_name;
730 const char *new_name; 741 char *new_name;
731 struct RenameContext rename_ctx; 742 struct RenameContext rename_ctx;
732 struct GNUNET_SERVICE_Client *client = cls; 743 struct GNUNET_SERVICE_Client *client = cls;
733 char *fn_old; 744 char *fn_old;
734 char *fn_new; 745 char *fn_new;
746 const char *old_name_tmp;
735 747
736 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 748 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
737 "Received RENAME message from client\n"); 749 "Received RENAME message from client\n");
738 old_name_len = ntohs (rm->old_name_len); 750 old_name_len = ntohs (rm->old_name_len);
739 old_name = (const char *) &rm[1]; 751 old_name_tmp = (const char *) &rm[1];
740 new_name = &old_name[old_name_len]; 752 old_name = GNUNET_strdup (old_name_tmp);
753 GNUNET_STRINGS_utf8_tolower (old_name_tmp, old_name);
754 new_name = GNUNET_strdup (&old_name_tmp[old_name_len]);
755 GNUNET_STRINGS_utf8_tolower (&old_name_tmp[old_name_len], old_name);
741 756
742 /* check if new name is already in use */ 757 /* check if new name is already in use */
743 for (ego = ego_head; NULL != ego; ego = ego->next) 758 for (ego = ego_head; NULL != ego; ego = ego->next)
@@ -747,6 +762,8 @@ handle_rename_message (void *cls,
747 { 762 {
748 send_result_code (client, 1, gettext_noop ("target name already exists")); 763 send_result_code (client, 1, gettext_noop ("target name already exists"));
749 GNUNET_SERVICE_client_continue (client); 764 GNUNET_SERVICE_client_continue (client);
765 GNUNET_free (old_name);
766 GNUNET_free (new_name);
750 return; 767 return;
751 } 768 }
752 } 769 }
@@ -776,6 +793,8 @@ handle_rename_message (void *cls,
776 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old); 793 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, "rename", fn_old);
777 GNUNET_free (fn_old); 794 GNUNET_free (fn_old);
778 GNUNET_free (fn_new); 795 GNUNET_free (fn_new);
796 GNUNET_free (old_name);
797 GNUNET_free (new_name);
779 notify_listeners (ego); 798 notify_listeners (ego);
780 send_result_code (client, 0, NULL); 799 send_result_code (client, 0, NULL);
781 GNUNET_SERVICE_client_continue (client); 800 GNUNET_SERVICE_client_continue (client);
@@ -785,6 +804,8 @@ handle_rename_message (void *cls,
785 804
786 /* failed to locate old name */ 805 /* failed to locate old name */
787 send_result_code (client, 1, gettext_noop ("no matching ego found")); 806 send_result_code (client, 1, gettext_noop ("no matching ego found"));
807 GNUNET_free (old_name);
808 GNUNET_free (new_name);
788 GNUNET_SERVICE_client_continue (client); 809 GNUNET_SERVICE_client_continue (client);
789} 810}
790 811
@@ -868,13 +889,15 @@ handle_delete_message (void *cls,
868 const struct DeleteMessage *dm) 889 const struct DeleteMessage *dm)
869{ 890{
870 struct Ego *ego; 891 struct Ego *ego;
871 const char *name; 892 char *name;
872 char *fn; 893 char *fn;
873 struct GNUNET_SERVICE_Client *client = cls; 894 struct GNUNET_SERVICE_Client *client = cls;
874 895
875 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 896 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
876 "Received DELETE message from client\n"); 897 "Received DELETE message from client\n");
877 name = (const char *) &dm[1]; 898 name = GNUNET_strdup ((const char *) &dm[1]);
899 GNUNET_STRINGS_utf8_tolower ((const char *) &dm[1], name);
900
878 for (ego = ego_head; NULL != ego; ego = ego->next) 901 for (ego = ego_head; NULL != ego; ego = ego->next)
879 { 902 {
880 if (0 == strcmp (ego->identifier, 903 if (0 == strcmp (ego->identifier,
@@ -901,6 +924,7 @@ handle_delete_message (void *cls,
901 notify_listeners (ego); 924 notify_listeners (ego);
902 GNUNET_free (ego->pk); 925 GNUNET_free (ego->pk);
903 GNUNET_free (ego); 926 GNUNET_free (ego);
927 GNUNET_free (name);
904 send_result_code (client, 0, NULL); 928 send_result_code (client, 0, NULL);
905 GNUNET_SERVICE_client_continue (client); 929 GNUNET_SERVICE_client_continue (client);
906 return; 930 return;
@@ -908,6 +932,7 @@ handle_delete_message (void *cls,
908 } 932 }
909 933
910 send_result_code (client, 1, gettext_noop ("no matching ego found")); 934 send_result_code (client, 1, gettext_noop ("no matching ego found"));
935 GNUNET_free (name);
911 GNUNET_SERVICE_client_continue (client); 936 GNUNET_SERVICE_client_continue (client);
912} 937}
913 938
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c
index 593a5dbb0..25aec8ede 100644
--- a/src/identity/identity_api_lookup.c
+++ b/src/identity/identity_api_lookup.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -131,6 +131,12 @@ GNUNET_IDENTITY_ego_lookup (const struct GNUNET_CONFIGURATION_Handle *cfg,
131 el->identity = GNUNET_IDENTITY_connect (cfg, 131 el->identity = GNUNET_IDENTITY_connect (cfg,
132 &identity_cb, 132 &identity_cb,
133 el); 133 el);
134 if (NULL == el->identity)
135 {
136 GNUNET_free (el->name);
137 GNUNET_free (el);
138 return NULL;
139 }
134 return el; 140 return el;
135} 141}
136 142
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index 52685c52e..355d75fd9 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -436,13 +436,6 @@ ego_info_response (struct GNUNET_REST_RequestHandle *con,
436 json_decref (name_str); 436 json_decref (name_str);
437 GNUNET_JSONAPI_document_resource_add (json_document, json_resource); 437 GNUNET_JSONAPI_document_resource_add (json_document, json_resource);
438 } 438 }
439 if (0 == GNUNET_JSONAPI_document_resource_count (json_document))
440 {
441 GNUNET_JSONAPI_document_delete (json_document);
442 handle->emsg = GNUNET_strdup ("No identities found!");
443 GNUNET_SCHEDULER_add_now (&do_error, handle);
444 return;
445 }
446 GNUNET_JSONAPI_document_serialize (json_document, &result_str); 439 GNUNET_JSONAPI_document_serialize (json_document, &result_str);
447 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 440 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
448 resp = GNUNET_REST_create_response (result_str); 441 resp = GNUNET_REST_create_response (result_str);
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 08e9dd156..41b2b1382 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -66,7 +66,7 @@ gnunetinclude_HEADERS = \
66 gnunet_hello_lib.h \ 66 gnunet_hello_lib.h \
67 gnunet_helper_lib.h \ 67 gnunet_helper_lib.h \
68 gnunet_identity_service.h \ 68 gnunet_identity_service.h \
69 gnunet_identity_provider_service.h \ 69 gnunet_reclaim_service.h \
70 gnunet_json_lib.h \ 70 gnunet_json_lib.h \
71 gnunet_jsonapi_lib.h \ 71 gnunet_jsonapi_lib.h \
72 gnunet_jsonapi_util.h \ 72 gnunet_jsonapi_util.h \
diff --git a/src/include/gnunet_abe_lib.h b/src/include/gnunet_abe_lib.h
index d380c9b03..554d4488b 100644
--- a/src/include/gnunet_abe_lib.h
+++ b/src/include/gnunet_abe_lib.h
@@ -87,7 +87,7 @@ GNUNET_ABE_cpabe_create_key (struct GNUNET_ABE_AbeMasterKey *key,
87 * Delete a CP-ABE key. 87 * Delete a CP-ABE key.
88 * 88 *
89 * @param key the key to delete 89 * @param key the key to delete
90 * @param delete_pub GNUNE_YES if the public key should also be freed (bug in gabe) 90 * @param delete_pub GNUNET_YES if the public key should also be freed (bug in gabe)
91 * @return fresh private key; free using #GNUNET_free 91 * @return fresh private key; free using #GNUNET_free
92 */ 92 */
93void 93void
diff --git a/src/include/gnunet_common.h b/src/include/gnunet_common.h
index b4bf5b0aa..1b982cc15 100644
--- a/src/include/gnunet_common.h
+++ b/src/include/gnunet_common.h
@@ -1074,7 +1074,7 @@ GNUNET_ntoh_double (double d);
1074 * @param tsize the target size for the resulting vector, use 0 to 1074 * @param tsize the target size for the resulting vector, use 0 to
1075 * free the vector (then, arr will be NULL afterwards). 1075 * free the vector (then, arr will be NULL afterwards).
1076 */ 1076 */
1077#define GNUNET_array_grow(arr,size,tsize) GNUNET_xgrow_((void**)&arr, sizeof(arr[0]), &size, tsize, __FILE__, __LINE__) 1077#define GNUNET_array_grow(arr,size,tsize) GNUNET_xgrow_((void**)&(arr), sizeof((arr)[0]), &size, tsize, __FILE__, __LINE__)
1078 1078
1079/** 1079/**
1080 * @ingroup memory 1080 * @ingroup memory
@@ -1089,7 +1089,7 @@ GNUNET_ntoh_double (double d);
1089 * array size 1089 * array size
1090 * @param element the element that will be appended to the array 1090 * @param element the element that will be appended to the array
1091 */ 1091 */
1092#define GNUNET_array_append(arr,size,element) do { GNUNET_array_grow(arr,size,size+1); arr[size-1] = element; } while(0) 1092#define GNUNET_array_append(arr,size,element) do { GNUNET_array_grow(arr,size,size+1); (arr)[size-1] = element; } while(0)
1093 1093
1094/** 1094/**
1095 * @ingroup memory 1095 * @ingroup memory
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 0bffef212..8a591fa09 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -206,14 +206,15 @@ struct GNUNET_CRYPTO_EcdsaSignature
206 206
207 207
208/** 208/**
209 * Public ECC key (always for Curve25519) encoded in a format suitable 209 * Public ECC key (always for curve Ed25519) encoded in a format
210 * for network transmission and EdDSA signatures. 210 * suitable for network transmission and EdDSA signatures.
211 */ 211 */
212struct GNUNET_CRYPTO_EddsaPublicKey 212struct GNUNET_CRYPTO_EddsaPublicKey
213{ 213{
214 /** 214 /**
215 * Q consists of an x- and a y-value, each mod p (256 bits), given 215 * Point Q consists of a y-value mod p (256 bits); the x-value is
216 * here in affine coordinates and Ed25519 standard compact format. 216 * always positive. The point is stored in Ed25519 standard
217 * compact format.
217 */ 218 */
218 unsigned char q_y[256 / 8]; 219 unsigned char q_y[256 / 8];
219 220
@@ -725,6 +726,23 @@ GNUNET_CRYPTO_hash_context_abort (struct GNUNET_HashContext *hc);
725 726
726 727
727/** 728/**
729 * Calculate HMAC of a message (RFC 2104)
730 * TODO: Shouldn' this be the standard hmac function and
731 * the above be renamed?
732 *
733 * @param key secret key
734 * @param key_len secret key length
735 * @param plaintext input plaintext
736 * @param plaintext_len length of @a plaintext
737 * @param hmac where to store the hmac
738 */
739void
740GNUNET_CRYPTO_hmac_raw (const void *key, size_t key_len,
741 const void *plaintext, size_t plaintext_len,
742 struct GNUNET_HashCode *hmac);
743
744
745/**
728 * @ingroup hash 746 * @ingroup hash
729 * Calculate HMAC of a message (RFC 2104) 747 * Calculate HMAC of a message (RFC 2104)
730 * 748 *
diff --git a/src/include/gnunet_dnsparser_lib.h b/src/include/gnunet_dnsparser_lib.h
index ba1392510..0fc6ac19c 100644
--- a/src/include/gnunet_dnsparser_lib.h
+++ b/src/include/gnunet_dnsparser_lib.h
@@ -82,6 +82,7 @@
82#define GNUNET_DNSPARSER_TYPE_OPENPGPKEY 61 82#define GNUNET_DNSPARSER_TYPE_OPENPGPKEY 61
83#define GNUNET_DNSPARSER_TYPE_TKEY 249 83#define GNUNET_DNSPARSER_TYPE_TKEY 249
84#define GNUNET_DNSPARSER_TYPE_TSIG 250 84#define GNUNET_DNSPARSER_TYPE_TSIG 250
85#define GNUNET_DNSPARSER_TYPE_ALL 255
85#define GNUNET_DNSPARSER_TYPE_URI 256 86#define GNUNET_DNSPARSER_TYPE_URI 256
86#define GNUNET_DNSPARSER_TYPE_TA 32768 87#define GNUNET_DNSPARSER_TYPE_TA 32768
87 88
@@ -840,6 +841,58 @@ GNUNET_DNSPARSER_parse_srv (const char *udp_payload,
840 size_t udp_payload_length, 841 size_t udp_payload_length,
841 size_t *off); 842 size_t *off);
842 843
844/* ***************** low-level duplication API ******************** */
845
846/**
847 * Duplicate (deep-copy) the given DNS record
848 *
849 * @param r the record
850 * @return the newly allocated record
851 */
852struct GNUNET_DNSPARSER_Record *
853GNUNET_DNSPARSER_duplicate_record (const struct GNUNET_DNSPARSER_Record *r);
854
855
856/**
857 * Duplicate (deep-copy) the given DNS record
858 *
859 * @param r the record
860 * @return the newly allocated record
861 */
862struct GNUNET_DNSPARSER_SoaRecord *
863GNUNET_DNSPARSER_duplicate_soa_record (const struct GNUNET_DNSPARSER_SoaRecord *r);
864
865
866/**
867 * Duplicate (deep-copy) the given DNS record
868 *
869 * @param r the record
870 * @return the newly allocated record
871 */
872struct GNUNET_DNSPARSER_CertRecord *
873GNUNET_DNSPARSER_duplicate_cert_record (const struct GNUNET_DNSPARSER_CertRecord *r);
874
875
876/**
877 * Duplicate (deep-copy) the given DNS record
878 *
879 * @param r the record
880 * @return the newly allocated record
881 */
882struct GNUNET_DNSPARSER_MxRecord *
883GNUNET_DNSPARSER_duplicate_mx_record (const struct GNUNET_DNSPARSER_MxRecord *r);
884
885
886/**
887 * Duplicate (deep-copy) the given DNS record
888 *
889 * @param r the record
890 * @return the newly allocated record
891 */
892struct GNUNET_DNSPARSER_SrvRecord *
893GNUNET_DNSPARSER_duplicate_srv_record (const struct GNUNET_DNSPARSER_SrvRecord *r);
894
895
843/* ***************** low-level deallocation API ******************** */ 896/* ***************** low-level deallocation API ******************** */
844 897
845/** 898/**
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h
index 20846238b..693cc6cdb 100644
--- a/src/include/gnunet_gnsrecord_lib.h
+++ b/src/include/gnunet_gnsrecord_lib.h
@@ -132,6 +132,16 @@ extern "C"
132#define GNUNET_GNSRECORD_TYPE_ABE_MASTER 65551 132#define GNUNET_GNSRECORD_TYPE_ABE_MASTER 65551
133 133
134/** 134/**
135 * Record type for reclaim OIDC clients
136 */
137#define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT 65552
138
139/**
140 * Record type for reclaim OIDC redirect URIs
141 */
142#define GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT 65553
143
144/**
135 * Flags that can be set for a record. 145 * Flags that can be set for a record.
136 */ 146 */
137enum GNUNET_GNSRECORD_Flags 147enum GNUNET_GNSRECORD_Flags
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h
index 36aa424b4..4400db7e1 100644
--- a/src/include/gnunet_protocols.h
+++ b/src/include/gnunet_protocols.h
@@ -2656,35 +2656,35 @@ extern "C"
2656 * 2656 *
2657 * IDENTITY PROVIDER MESSAGE TYPES 2657 * IDENTITY PROVIDER MESSAGE TYPES
2658 */ 2658 */
2659#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE 961 2659#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE 961
2660 2660
2661#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE_RESPONSE 962 2661#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE 962
2662 2662
2663#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_START 963 2663#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START 963
2664 2664
2665#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_STOP 964 2665#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP 964
2666 2666
2667#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_NEXT 965 2667#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT 965
2668 2668
2669#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_RESULT 966 2669#define GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT 966
2670 2670
2671#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_TICKET 967 2671#define GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET 967
2672 2672
2673#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT 968 2673#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT 968
2674 2674
2675#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET 969 2675#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET 969
2676 2676
2677#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET_RESULT 970 2677#define GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT 970
2678 2678
2679#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET 971 2679#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET 971
2680 2680
2681#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET_RESULT 972 2681#define GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT 972
2682 2682
2683#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_START 973 2683#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START 973
2684 2684
2685#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_STOP 974 2685#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP 974
2686 2686
2687#define GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_NEXT 975 2687#define GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT 975
2688 2688
2689/************************************************** 2689/**************************************************
2690 * 2690 *
diff --git a/src/include/gnunet_identity_attribute_lib.h b/src/include/gnunet_reclaim_attribute_lib.h
index eb01f7ac2..df5356d76 100644
--- a/src/include/gnunet_identity_attribute_lib.h
+++ b/src/include/gnunet_reclaim_attribute_lib.h
@@ -25,8 +25,8 @@
25 * @defgroup identity-provider Identity Provider service 25 * @defgroup identity-provider Identity Provider service
26 * @{ 26 * @{
27 */ 27 */
28#ifndef GNUNET_IDENTITY_ATTRIBUTE_LIB_H 28#ifndef GNUNET_RECLAIM_ATTRIBUTE_LIB_H
29#define GNUNET_IDENTITY_ATTRIBUTE_LIB_H 29#define GNUNET_RECLAIM_ATTRIBUTE_LIB_H
30 30
31#ifdef __cplusplus 31#ifdef __cplusplus
32extern "C" 32extern "C"
@@ -42,19 +42,19 @@ extern "C"
42/** 42/**
43 * No value attribute. 43 * No value attribute.
44 */ 44 */
45#define GNUNET_IDENTITY_ATTRIBUTE_TYPE_NONE 0 45#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_NONE 0
46 46
47/** 47/**
48 * String attribute. 48 * String attribute.
49 */ 49 */
50#define GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING 1 50#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING 1
51 51
52 52
53 53
54/** 54/**
55 * An attribute. 55 * An attribute.
56 */ 56 */
57struct GNUNET_IDENTITY_ATTRIBUTE_Claim 57struct GNUNET_RECLAIM_ATTRIBUTE_Claim
58{ 58{
59 /** 59 /**
60 * The name of the attribute. Note "name" must never be individually 60 * The name of the attribute. Note "name" must never be individually
@@ -86,35 +86,35 @@ struct GNUNET_IDENTITY_ATTRIBUTE_Claim
86 86
87}; 87};
88 88
89struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList 89struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList
90{ 90{
91 /** 91 /**
92 * List head 92 * List head
93 */ 93 */
94 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *list_head; 94 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *list_head;
95 95
96 /** 96 /**
97 * List tail 97 * List tail
98 */ 98 */
99 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *list_tail; 99 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *list_tail;
100}; 100};
101 101
102struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry 102struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry
103{ 103{
104 /** 104 /**
105 * DLL 105 * DLL
106 */ 106 */
107 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *prev; 107 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *prev;
108 108
109 /** 109 /**
110 * DLL 110 * DLL
111 */ 111 */
112 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *next; 112 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *next;
113 113
114 /** 114 /**
115 * The attribute claim 115 * The attribute claim
116 */ 116 */
117 struct GNUNET_IDENTITY_ATTRIBUTE_Claim *claim; 117 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
118}; 118};
119 119
120/** 120/**
@@ -126,8 +126,8 @@ struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry
126 * @param data_size the attribute value size 126 * @param data_size the attribute value size
127 * @return the new attribute 127 * @return the new attribute
128 */ 128 */
129struct GNUNET_IDENTITY_ATTRIBUTE_Claim * 129struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
130GNUNET_IDENTITY_ATTRIBUTE_claim_new (const char* attr_name, 130GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name,
131 uint32_t type, 131 uint32_t type,
132 const void* data, 132 const void* data,
133 size_t data_size); 133 size_t data_size);
@@ -141,13 +141,13 @@ GNUNET_IDENTITY_ATTRIBUTE_claim_new (const char* attr_name,
141 * @return the required buffer size 141 * @return the required buffer size
142 */ 142 */
143size_t 143size_t
144GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); 144GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
145 145
146void 146void
147GNUNET_IDENTITY_ATTRIBUTE_list_destroy (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); 147GNUNET_RECLAIM_ATTRIBUTE_list_destroy (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
148 148
149void 149void
150GNUNET_IDENTITY_ATTRIBUTE_list_add (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, 150GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
151 const char* attr_name, 151 const char* attr_name,
152 uint32_t type, 152 uint32_t type,
153 const void* data, 153 const void* data,
@@ -162,7 +162,7 @@ GNUNET_IDENTITY_ATTRIBUTE_list_add (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *
162 * @return length of serialized data 162 * @return length of serialized data
163 */ 163 */
164size_t 164size_t
165GNUNET_IDENTITY_ATTRIBUTE_list_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, 165GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
166 char *result); 166 char *result);
167 167
168/** 168/**
@@ -173,8 +173,8 @@ GNUNET_IDENTITY_ATTRIBUTE_list_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE
173 * 173 *
174 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller 174 * @return a GNUNET_IDENTITY_PROVIDER_AttributeList, must be free'd by caller
175 */ 175 */
176struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList * 176struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
177GNUNET_IDENTITY_ATTRIBUTE_list_deserialize (const char* data, 177GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
178 size_t data_size); 178 size_t data_size);
179 179
180 180
@@ -186,7 +186,7 @@ GNUNET_IDENTITY_ATTRIBUTE_list_deserialize (const char* data,
186 * @return the required buffer size 186 * @return the required buffer size
187 */ 187 */
188size_t 188size_t
189GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr); 189GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
190 190
191 191
192 192
@@ -199,7 +199,7 @@ GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (const struct GNUNET_IDENTITY_ATTRI
199 * @return length of serialized data 199 * @return length of serialized data
200 */ 200 */
201size_t 201size_t
202GNUNET_IDENTITY_ATTRIBUTE_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, 202GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
203 char *result); 203 char *result);
204 204
205/** 205/**
@@ -210,12 +210,12 @@ GNUNET_IDENTITY_ATTRIBUTE_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_Clai
210 * 210 *
211 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller 211 * @return a GNUNET_IDENTITY_PROVIDER_Attribute, must be free'd by caller
212 */ 212 */
213struct GNUNET_IDENTITY_ATTRIBUTE_Claim * 213struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
214GNUNET_IDENTITY_ATTRIBUTE_deserialize (const char* data, 214GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data,
215 size_t data_size); 215 size_t data_size);
216 216
217struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList* 217struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList*
218GNUNET_IDENTITY_ATTRIBUTE_list_dup (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); 218GNUNET_RECLAIM_ATTRIBUTE_list_dup (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
219 219
220/** 220/**
221 * Convert a type name to the corresponding number 221 * Convert a type name to the corresponding number
@@ -224,7 +224,7 @@ GNUNET_IDENTITY_ATTRIBUTE_list_dup (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim
224 * @return corresponding number, UINT32_MAX on error 224 * @return corresponding number, UINT32_MAX on error
225 */ 225 */
226uint32_t 226uint32_t
227GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (const char *typename); 227GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename);
228 228
229/** 229/**
230 * Convert human-readable version of a 'claim' of an attribute to the binary 230 * Convert human-readable version of a 'claim' of an attribute to the binary
@@ -237,7 +237,7 @@ GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (const char *typename);
237 * @return #GNUNET_OK on success 237 * @return #GNUNET_OK on success
238 */ 238 */
239int 239int
240GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type, 240GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
241 const char *s, 241 const char *s,
242 void **data, 242 void **data,
243 size_t *data_size); 243 size_t *data_size);
@@ -251,7 +251,7 @@ GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type,
251 * @return NULL on error, otherwise human-readable representation of the claim 251 * @return NULL on error, otherwise human-readable representation of the claim
252 */ 252 */
253char * 253char *
254GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type, 254GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
255 const void* data, 255 const void* data,
256 size_t data_size); 256 size_t data_size);
257 257
@@ -262,7 +262,7 @@ GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type,
262 * @return corresponding typestring, NULL on error 262 * @return corresponding typestring, NULL on error
263 */ 263 */
264const char* 264const char*
265GNUNET_IDENTITY_ATTRIBUTE_number_to_typename (uint32_t type); 265GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type);
266 266
267 267
268#if 0 /* keep Emacsens' auto-indent happy */ 268#if 0 /* keep Emacsens' auto-indent happy */
@@ -273,9 +273,9 @@ GNUNET_IDENTITY_ATTRIBUTE_number_to_typename (uint32_t type);
273#endif 273#endif
274 274
275 275
276/* ifndef GNUNET_IDENTITY_ATTRIBUTE_LIB_H */ 276/* ifndef GNUNET_RECLAIM_ATTRIBUTE_LIB_H */
277#endif 277#endif
278 278
279/** @} */ /* end of group identity */ 279/** @} */ /* end of group identity */
280 280
281/* end of gnunet_identity_attribute_lib.h */ 281/* end of gnunet_reclaim_attribute_lib.h */
diff --git a/src/include/gnunet_identity_attribute_plugin.h b/src/include/gnunet_reclaim_attribute_plugin.h
index 7c399c616..cf0bb141a 100644
--- a/src/include/gnunet_identity_attribute_plugin.h
+++ b/src/include/gnunet_reclaim_attribute_plugin.h
@@ -26,11 +26,11 @@
26 * Plugin API for the idp database backend 26 * Plugin API for the idp database backend
27 * @{ 27 * @{
28 */ 28 */
29#ifndef GNUNET_IDENTITY_ATTRIBUTE_PLUGIN_H 29#ifndef GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
30#define GNUNET_IDENTITY_ATTRIBUTE_PLUGIN_H 30#define GNUNET_RECLAIM_ATTRIBUTE_PLUGIN_H
31 31
32#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
33#include "gnunet_identity_attribute_lib.h" 33#include "gnunet_reclaim_attribute_lib.h"
34 34
35#ifdef __cplusplus 35#ifdef __cplusplus
36extern "C" 36extern "C"
@@ -51,7 +51,7 @@ extern "C"
51 * @param data_size number of bytes in @a data 51 * @param data_size number of bytes in @a data
52 * @return NULL on error, otherwise human-readable representation of the value 52 * @return NULL on error, otherwise human-readable representation of the value
53 */ 53 */
54typedef char * (*GNUNET_IDENTITY_ATTRIBUTE_ValueToStringFunction) (void *cls, 54typedef char * (*GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction) (void *cls,
55 uint32_t type, 55 uint32_t type,
56 const void *data, 56 const void *data,
57 size_t data_size); 57 size_t data_size);
@@ -69,7 +69,7 @@ typedef char * (*GNUNET_IDENTITY_ATTRIBUTE_ValueToStringFunction) (void *cls,
69 * @param data_size set to number of bytes in @a data 69 * @param data_size set to number of bytes in @a data
70 * @return #GNUNET_OK on success 70 * @return #GNUNET_OK on success
71 */ 71 */
72typedef int (*GNUNET_IDENTITY_ATTRIBUTE_StringToValueFunction) (void *cls, 72typedef int (*GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction) (void *cls,
73 uint32_t type, 73 uint32_t type,
74 const char *s, 74 const char *s,
75 void **data, 75 void **data,
@@ -84,7 +84,7 @@ typedef int (*GNUNET_IDENTITY_ATTRIBUTE_StringToValueFunction) (void *cls,
84 * @param typename name to convert 84 * @param typename name to convert
85 * @return corresponding number, UINT32_MAX on error 85 * @return corresponding number, UINT32_MAX on error
86 */ 86 */
87typedef uint32_t (*GNUNET_IDENTITY_ATTRIBUTE_TypenameToNumberFunction) (void *cls, 87typedef uint32_t (*GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction) (void *cls,
88 const char *typename); 88 const char *typename);
89 89
90 90
@@ -96,7 +96,7 @@ typedef uint32_t (*GNUNET_IDENTITY_ATTRIBUTE_TypenameToNumberFunction) (void *cl
96 * @param type number of a type to convert 96 * @param type number of a type to convert
97 * @return corresponding typestring, NULL on error 97 * @return corresponding typestring, NULL on error
98 */ 98 */
99typedef const char * (*GNUNET_IDENTITY_ATTRIBUTE_NumberToTypenameFunction) (void *cls, 99typedef const char * (*GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction) (void *cls,
100 uint32_t type); 100 uint32_t type);
101 101
102 102
@@ -104,7 +104,7 @@ typedef const char * (*GNUNET_IDENTITY_ATTRIBUTE_NumberToTypenameFunction) (void
104 * Each plugin is required to return a pointer to a struct of this 104 * Each plugin is required to return a pointer to a struct of this
105 * type as the return value from its entry point. 105 * type as the return value from its entry point.
106 */ 106 */
107struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions 107struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions
108{ 108{
109 109
110 /** 110 /**
@@ -115,22 +115,22 @@ struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions
115 /** 115 /**
116 * Conversion to string. 116 * Conversion to string.
117 */ 117 */
118 GNUNET_IDENTITY_ATTRIBUTE_ValueToStringFunction value_to_string; 118 GNUNET_RECLAIM_ATTRIBUTE_ValueToStringFunction value_to_string;
119 119
120 /** 120 /**
121 * Conversion to binary. 121 * Conversion to binary.
122 */ 122 */
123 GNUNET_IDENTITY_ATTRIBUTE_StringToValueFunction string_to_value; 123 GNUNET_RECLAIM_ATTRIBUTE_StringToValueFunction string_to_value;
124 124
125 /** 125 /**
126 * Typename to number. 126 * Typename to number.
127 */ 127 */
128 GNUNET_IDENTITY_ATTRIBUTE_TypenameToNumberFunction typename_to_number; 128 GNUNET_RECLAIM_ATTRIBUTE_TypenameToNumberFunction typename_to_number;
129 129
130 /** 130 /**
131 * Number to typename. 131 * Number to typename.
132 */ 132 */
133 GNUNET_IDENTITY_ATTRIBUTE_NumberToTypenameFunction number_to_typename; 133 GNUNET_RECLAIM_ATTRIBUTE_NumberToTypenameFunction number_to_typename;
134 134
135}; 135};
136 136
diff --git a/src/include/gnunet_identity_provider_plugin.h b/src/include/gnunet_reclaim_plugin.h
index 2330066dd..c400af64c 100644
--- a/src/include/gnunet_identity_provider_plugin.h
+++ b/src/include/gnunet_reclaim_plugin.h
@@ -22,15 +22,15 @@
22 * @file 22 * @file
23 * Plugin API for the idp database backend 23 * Plugin API for the idp database backend
24 * 24 *
25 * @defgroup identity-provider-plugin IdP service plugin API 25 * @defgroup reclaim-plugin IdP service plugin API
26 * Plugin API for the idp database backend 26 * Plugin API for the idp database backend
27 * @{ 27 * @{
28 */ 28 */
29#ifndef GNUNET_IDENTITY_PROVIDER_PLUGIN_H 29#ifndef GNUNET_RECLAIM_PLUGIN_H
30#define GNUNET_IDENTITY_PROVIDER_PLUGIN_H 30#define GNUNET_RECLAIM_PLUGIN_H
31 31
32#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
33#include "gnunet_identity_provider_service.h" 33#include "gnunet_reclaim_service.h"
34 34
35#ifdef __cplusplus 35#ifdef __cplusplus
36extern "C" 36extern "C"
@@ -47,15 +47,15 @@ extern "C"
47 * @param cls closure 47 * @param cls closure
48 * @param ticket the ticket 48 * @param ticket the ticket
49 */ 49 */
50typedef void (*GNUNET_IDENTITY_PROVIDER_TicketIterator) (void *cls, 50typedef void (*GNUNET_RECLAIM_TicketIterator) (void *cls,
51 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 51 const struct GNUNET_RECLAIM_Ticket *ticket,
52 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); 52 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
53 53
54 54
55/** 55/**
56 * @brief struct returned by the initialization function of the plugin 56 * @brief struct returned by the initialization function of the plugin
57 */ 57 */
58struct GNUNET_IDENTITY_PROVIDER_PluginFunctions 58struct GNUNET_RECLAIM_PluginFunctions
59{ 59{
60 60
61 /** 61 /**
@@ -71,8 +71,8 @@ struct GNUNET_IDENTITY_PROVIDER_PluginFunctions
71 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 71 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
72 */ 72 */
73 int (*store_ticket) (void *cls, 73 int (*store_ticket) (void *cls,
74 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 74 const struct GNUNET_RECLAIM_Ticket *ticket,
75 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); 75 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
76 76
77 /** 77 /**
78 * Delete a ticket from the database. 78 * Delete a ticket from the database.
@@ -82,7 +82,7 @@ struct GNUNET_IDENTITY_PROVIDER_PluginFunctions
82 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 82 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
83 */ 83 */
84 int (*delete_ticket) (void *cls, 84 int (*delete_ticket) (void *cls,
85 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket); 85 const struct GNUNET_RECLAIM_Ticket *ticket);
86 86
87 87
88 88
@@ -101,11 +101,11 @@ struct GNUNET_IDENTITY_PROVIDER_PluginFunctions
101 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 101 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
102 int audience, 102 int audience,
103 uint64_t offset, 103 uint64_t offset,
104 GNUNET_IDENTITY_PROVIDER_TicketIterator iter, void *iter_cls); 104 GNUNET_RECLAIM_TicketIterator iter, void *iter_cls);
105 105
106 int (*get_ticket_attributes) (void* cls, 106 int (*get_ticket_attributes) (void* cls,
107 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 107 const struct GNUNET_RECLAIM_Ticket *ticket,
108 GNUNET_IDENTITY_PROVIDER_TicketIterator iter, 108 GNUNET_RECLAIM_TicketIterator iter,
109 void *iter_cls); 109 void *iter_cls);
110}; 110};
111 111
diff --git a/src/include/gnunet_identity_provider_service.h b/src/include/gnunet_reclaim_service.h
index 0c72556e8..7e668cd62 100644
--- a/src/include/gnunet_identity_provider_service.h
+++ b/src/include/gnunet_reclaim_service.h
@@ -22,11 +22,11 @@
22 * @file 22 * @file
23 * Identity provider service; implements identity provider for GNUnet 23 * Identity provider service; implements identity provider for GNUnet
24 * 24 *
25 * @defgroup identity-provider Identity Provider service 25 * @defgroup reclaim Identity Provider service
26 * @{ 26 * @{
27 */ 27 */
28#ifndef GNUNET_IDENTITY_PROVIDER_SERVICE_H 28#ifndef GNUNET_RECLAIM_SERVICE_H
29#define GNUNET_IDENTITY_PROVIDER_SERVICE_H 29#define GNUNET_RECLAIM_SERVICE_H
30 30
31#ifdef __cplusplus 31#ifdef __cplusplus
32extern "C" 32extern "C"
@@ -37,27 +37,27 @@ extern "C"
37#endif 37#endif
38 38
39#include "gnunet_util_lib.h" 39#include "gnunet_util_lib.h"
40#include "gnunet_identity_attribute_lib.h" 40#include "gnunet_reclaim_attribute_lib.h"
41 41
42/** 42/**
43 * Version number of GNUnet Identity Provider API. 43 * Version number of GNUnet Identity Provider API.
44 */ 44 */
45#define GNUNET_IDENTITY_PROVIDER_VERSION 0x00000000 45#define GNUNET_RECLAIM_VERSION 0x00000000
46 46
47/** 47/**
48 * Handle to access the identity service. 48 * Handle to access the identity service.
49 */ 49 */
50struct GNUNET_IDENTITY_PROVIDER_Handle; 50struct GNUNET_RECLAIM_Handle;
51 51
52/** 52/**
53 * Handle for a token. 53 * Handle for a token.
54 */ 54 */
55struct GNUNET_IDENTITY_PROVIDER_Token; 55struct GNUNET_RECLAIM_Token;
56 56
57/** 57/**
58 * The ticket 58 * The ticket
59 */ 59 */
60struct GNUNET_IDENTITY_PROVIDER_Ticket 60struct GNUNET_RECLAIM_Ticket
61{ 61{
62 /** 62 /**
63 * The ticket issuer 63 * The ticket issuer
@@ -78,7 +78,7 @@ struct GNUNET_IDENTITY_PROVIDER_Ticket
78/** 78/**
79 * Handle for an operation with the identity provider service. 79 * Handle for an operation with the identity provider service.
80 */ 80 */
81struct GNUNET_IDENTITY_PROVIDER_Operation; 81struct GNUNET_RECLAIM_Operation;
82 82
83 83
84/** 84/**
@@ -87,8 +87,8 @@ struct GNUNET_IDENTITY_PROVIDER_Operation;
87 * @param cfg Configuration to contact the identity provider service. 87 * @param cfg Configuration to contact the identity provider service.
88 * @return handle to communicate with identity provider service 88 * @return handle to communicate with identity provider service
89 */ 89 */
90struct GNUNET_IDENTITY_PROVIDER_Handle * 90struct GNUNET_RECLAIM_Handle *
91GNUNET_IDENTITY_PROVIDER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg); 91GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg);
92 92
93/** 93/**
94 * Continuation called to notify client about result of the 94 * Continuation called to notify client about result of the
@@ -101,7 +101,7 @@ GNUNET_IDENTITY_PROVIDER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
101 * @param emsg NULL on success, otherwise an error message 101 * @param emsg NULL on success, otherwise an error message
102 */ 102 */
103typedef void 103typedef void
104(*GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus) (void *cls, 104(*GNUNET_RECLAIM_ContinuationWithStatus) (void *cls,
105 int32_t success, 105 int32_t success,
106 const char *emsg); 106 const char *emsg);
107 107
@@ -118,12 +118,12 @@ typedef void
118 * @param cont_cls closure for @a cont 118 * @param cont_cls closure for @a cont
119 * @return handle to abort the request 119 * @return handle to abort the request
120 */ 120 */
121struct GNUNET_IDENTITY_PROVIDER_Operation * 121struct GNUNET_RECLAIM_Operation *
122GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 122GNUNET_RECLAIM_attribute_store (struct GNUNET_RECLAIM_Handle *h,
123 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 123 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
124 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, 124 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
125 const struct GNUNET_TIME_Relative *exp_interval, 125 const struct GNUNET_TIME_Relative *exp_interval,
126 GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cont, 126 GNUNET_RECLAIM_ContinuationWithStatus cont,
127 void *cont_cls); 127 void *cont_cls);
128 128
129 129
@@ -135,19 +135,19 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle
135 * @param attr the attribute 135 * @param attr the attribute
136 */ 136 */
137typedef void 137typedef void
138(*GNUNET_IDENTITY_PROVIDER_AttributeResult) (void *cls, 138(*GNUNET_RECLAIM_AttributeResult) (void *cls,
139 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 139 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
140 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr); 140 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr);
141 141
142 142
143 143
144/** 144/**
145 * List all attributes for a local identity. 145 * List all attributes for a local identity.
146 * This MUST lock the `struct GNUNET_IDENTITY_PROVIDER_Handle` 146 * This MUST lock the `struct GNUNET_RECLAIM_Handle`
147 * for any other calls than #GNUNET_IDENTITY_PROVIDER_get_attributes_next() and 147 * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and
148 * #GNUNET_IDENTITY_PROVIDER_get_attributes_stop. @a proc will be called once 148 * #GNUNET_RECLAIM_get_attributes_stop. @a proc will be called once
149 * immediately, and then again after 149 * immediately, and then again after
150 * #GNUNET_IDENTITY_PROVIDER_get_attributes_next() is invoked. 150 * #GNUNET_RECLAIM_get_attributes_next() is invoked.
151 * 151 *
152 * On error (disconnect), @a error_cb will be invoked. 152 * On error (disconnect), @a error_cb will be invoked.
153 * On normal completion, @a finish_cb proc will be 153 * On normal completion, @a finish_cb proc will be
@@ -166,36 +166,36 @@ typedef void
166 * @param finish_cb_cls closure for @a finish_cb 166 * @param finish_cb_cls closure for @a finish_cb
167 * @return an iterator handle to use for iteration 167 * @return an iterator handle to use for iteration
168 */ 168 */
169struct GNUNET_IDENTITY_PROVIDER_AttributeIterator * 169struct GNUNET_RECLAIM_AttributeIterator *
170GNUNET_IDENTITY_PROVIDER_get_attributes_start (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 170GNUNET_RECLAIM_get_attributes_start (struct GNUNET_RECLAIM_Handle *h,
171 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 171 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
172 GNUNET_SCHEDULER_TaskCallback error_cb, 172 GNUNET_SCHEDULER_TaskCallback error_cb,
173 void *error_cb_cls, 173 void *error_cb_cls,
174 GNUNET_IDENTITY_PROVIDER_AttributeResult proc, 174 GNUNET_RECLAIM_AttributeResult proc,
175 void *proc_cls, 175 void *proc_cls,
176 GNUNET_SCHEDULER_TaskCallback finish_cb, 176 GNUNET_SCHEDULER_TaskCallback finish_cb,
177 void *finish_cb_cls); 177 void *finish_cb_cls);
178 178
179 179
180/** 180/**
181 * Calls the record processor specified in #GNUNET_IDENTITY_PROVIDER_get_attributes_start 181 * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start
182 * for the next record. 182 * for the next record.
183 * 183 *
184 * @param it the iterator 184 * @param it the iterator
185 */ 185 */
186void 186void
187GNUNET_IDENTITY_PROVIDER_get_attributes_next (struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it); 187GNUNET_RECLAIM_get_attributes_next (struct GNUNET_RECLAIM_AttributeIterator *it);
188 188
189 189
190/** 190/**
191 * Stops iteration and releases the idp handle for further calls. Must 191 * Stops iteration and releases the idp handle for further calls. Must
192 * be called on any iteration that has not yet completed prior to calling 192 * be called on any iteration that has not yet completed prior to calling
193 * #GNUNET_IDENTITY_PROVIDER_disconnect. 193 * #GNUNET_RECLAIM_disconnect.
194 * 194 *
195 * @param it the iterator 195 * @param it the iterator
196 */ 196 */
197void 197void
198GNUNET_IDENTITY_PROVIDER_get_attributes_stop (struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it); 198GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it);
199 199
200 200
201/** 201/**
@@ -207,12 +207,12 @@ GNUNET_IDENTITY_PROVIDER_get_attributes_stop (struct GNUNET_IDENTITY_PROVIDER_At
207 * @param ticket the ticket 207 * @param ticket the ticket
208 */ 208 */
209typedef void 209typedef void
210(*GNUNET_IDENTITY_PROVIDER_TicketCallback)(void *cls, 210(*GNUNET_RECLAIM_TicketCallback)(void *cls,
211 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket); 211 const struct GNUNET_RECLAIM_Ticket *ticket);
212 212
213/** 213/**
214 * Issues a ticket to another identity. The identity may use 214 * Issues a ticket to another identity. The identity may use
215 * GNUNET_IDENTITY_PROVIDER_ticket_consume to consume the ticket 215 * GNUNET_RECLAIM_ticket_consume to consume the ticket
216 * and retrieve the attributes specified in the AttributeList. 216 * and retrieve the attributes specified in the AttributeList.
217 * 217 *
218 * @param h the identity provider to use 218 * @param h the identity provider to use
@@ -223,12 +223,12 @@ typedef void
223 * @param cb_cls the callback closure 223 * @param cb_cls the callback closure
224 * @return handle to abort the operation 224 * @return handle to abort the operation
225 */ 225 */
226struct GNUNET_IDENTITY_PROVIDER_Operation * 226struct GNUNET_RECLAIM_Operation *
227GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 227GNUNET_RECLAIM_ticket_issue (struct GNUNET_RECLAIM_Handle *h,
228 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, 228 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
229 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, 229 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
230 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, 230 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
231 GNUNET_IDENTITY_PROVIDER_TicketCallback cb, 231 GNUNET_RECLAIM_TicketCallback cb,
232 void *cb_cls); 232 void *cb_cls);
233 233
234/** 234/**
@@ -242,11 +242,11 @@ GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h
242 * @param cb_cls the callback closure 242 * @param cb_cls the callback closure
243 * @return handle to abort the operation 243 * @return handle to abort the operation
244 */ 244 */
245struct GNUNET_IDENTITY_PROVIDER_Operation * 245struct GNUNET_RECLAIM_Operation *
246GNUNET_IDENTITY_PROVIDER_ticket_revoke (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 246GNUNET_RECLAIM_ticket_revoke (struct GNUNET_RECLAIM_Handle *h,
247 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 247 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
248 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 248 const struct GNUNET_RECLAIM_Ticket *ticket,
249 GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cb, 249 GNUNET_RECLAIM_ContinuationWithStatus cb,
250 void *cb_cls); 250 void *cb_cls);
251 251
252 252
@@ -262,11 +262,11 @@ GNUNET_IDENTITY_PROVIDER_ticket_revoke (struct GNUNET_IDENTITY_PROVIDER_Handle *
262 * @param cb_cls the callback closure 262 * @param cb_cls the callback closure
263 * @return handle to abort the operation 263 * @return handle to abort the operation
264 */ 264 */
265struct GNUNET_IDENTITY_PROVIDER_Operation * 265struct GNUNET_RECLAIM_Operation *
266GNUNET_IDENTITY_PROVIDER_ticket_consume (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 266GNUNET_RECLAIM_ticket_consume (struct GNUNET_RECLAIM_Handle *h,
267 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 267 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
268 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 268 const struct GNUNET_RECLAIM_Ticket *ticket,
269 GNUNET_IDENTITY_PROVIDER_AttributeResult cb, 269 GNUNET_RECLAIM_AttributeResult cb,
270 void *cb_cls); 270 void *cb_cls);
271 271
272/** 272/**
@@ -286,12 +286,12 @@ GNUNET_IDENTITY_PROVIDER_ticket_consume (struct GNUNET_IDENTITY_PROVIDER_Handle
286 * @param finish_cb_cls closure for @a finish_cb 286 * @param finish_cb_cls closure for @a finish_cb
287 * @return an iterator handle to use for iteration 287 * @return an iterator handle to use for iteration
288 */ 288 */
289struct GNUNET_IDENTITY_PROVIDER_TicketIterator * 289struct GNUNET_RECLAIM_TicketIterator *
290GNUNET_IDENTITY_PROVIDER_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 290GNUNET_RECLAIM_ticket_iteration_start (struct GNUNET_RECLAIM_Handle *h,
291 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 291 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
292 GNUNET_SCHEDULER_TaskCallback error_cb, 292 GNUNET_SCHEDULER_TaskCallback error_cb,
293 void *error_cb_cls, 293 void *error_cb_cls,
294 GNUNET_IDENTITY_PROVIDER_TicketCallback proc, 294 GNUNET_RECLAIM_TicketCallback proc,
295 void *proc_cls, 295 void *proc_cls,
296 GNUNET_SCHEDULER_TaskCallback finish_cb, 296 GNUNET_SCHEDULER_TaskCallback finish_cb,
297 void *finish_cb_cls); 297 void *finish_cb_cls);
@@ -313,34 +313,34 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER
313 * @param finish_cb_cls closure for @a finish_cb 313 * @param finish_cb_cls closure for @a finish_cb
314 * @return an iterator handle to use for iteration 314 * @return an iterator handle to use for iteration
315 */ 315 */
316struct GNUNET_IDENTITY_PROVIDER_TicketIterator * 316struct GNUNET_RECLAIM_TicketIterator *
317GNUNET_IDENTITY_PROVIDER_ticket_iteration_start_rp (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 317GNUNET_RECLAIM_ticket_iteration_start_rp (struct GNUNET_RECLAIM_Handle *h,
318 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 318 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
319 GNUNET_SCHEDULER_TaskCallback error_cb, 319 GNUNET_SCHEDULER_TaskCallback error_cb,
320 void *error_cb_cls, 320 void *error_cb_cls,
321 GNUNET_IDENTITY_PROVIDER_TicketCallback proc, 321 GNUNET_RECLAIM_TicketCallback proc,
322 void *proc_cls, 322 void *proc_cls,
323 GNUNET_SCHEDULER_TaskCallback finish_cb, 323 GNUNET_SCHEDULER_TaskCallback finish_cb,
324 void *finish_cb_cls); 324 void *finish_cb_cls);
325 325
326/** 326/**
327 * Calls the record processor specified in #GNUNET_IDENTITY_PROVIDER_ticket_iteration_start 327 * Calls the record processor specified in #GNUNET_RECLAIM_ticket_iteration_start
328 * for the next record. 328 * for the next record.
329 * 329 *
330 * @param it the iterator 330 * @param it the iterator
331 */ 331 */
332void 332void
333GNUNET_IDENTITY_PROVIDER_ticket_iteration_next (struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it); 333GNUNET_RECLAIM_ticket_iteration_next (struct GNUNET_RECLAIM_TicketIterator *it);
334 334
335/** 335/**
336 * Stops iteration and releases the idp handle for further calls. Must 336 * Stops iteration and releases the idp handle for further calls. Must
337 * be called on any iteration that has not yet completed prior to calling 337 * be called on any iteration that has not yet completed prior to calling
338 * #GNUNET_IDENTITY_PROVIDER_disconnect. 338 * #GNUNET_RECLAIM_disconnect.
339 * 339 *
340 * @param it the iterator 340 * @param it the iterator
341 */ 341 */
342void 342void
343GNUNET_IDENTITY_PROVIDER_ticket_iteration_stop (struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it); 343GNUNET_RECLAIM_ticket_iteration_stop (struct GNUNET_RECLAIM_TicketIterator *it);
344 344
345/** 345/**
346 * Disconnect from identity provider service. 346 * Disconnect from identity provider service.
@@ -348,7 +348,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_stop (struct GNUNET_IDENTITY_PROVIDER_
348 * @param h identity provider service to disconnect 348 * @param h identity provider service to disconnect
349 */ 349 */
350void 350void
351GNUNET_IDENTITY_PROVIDER_disconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h); 351GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h);
352 352
353 353
354/** 354/**
@@ -360,7 +360,7 @@ GNUNET_IDENTITY_PROVIDER_disconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h);
360 * @param op operation to cancel 360 * @param op operation to cancel
361 */ 361 */
362void 362void
363GNUNET_IDENTITY_PROVIDER_cancel (struct GNUNET_IDENTITY_PROVIDER_Operation *op); 363GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op);
364 364
365#if 0 /* keep Emacsens' auto-indent happy */ 365#if 0 /* keep Emacsens' auto-indent happy */
366{ 366{
@@ -370,9 +370,9 @@ GNUNET_IDENTITY_PROVIDER_cancel (struct GNUNET_IDENTITY_PROVIDER_Operation *op);
370#endif 370#endif
371 371
372 372
373/* ifndef GNUNET_IDENTITY_PROVIDER_SERVICE_H */ 373/* ifndef GNUNET_RECLAIM_SERVICE_H */
374#endif 374#endif
375 375
376/** @} */ /* end of group identity */ 376/** @} */ /* end of group identity */
377 377
378/* end of gnunet_identity_provider_service.h */ 378/* end of gnunet_reclaim_service.h */
diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h
index d7accaf2c..829f8be7e 100644
--- a/src/include/gnunet_signatures.h
+++ b/src/include/gnunet_signatures.h
@@ -151,12 +151,12 @@ extern "C"
151/** 151/**
152 * Signature for the first round of distributed key generation. 152 * Signature for the first round of distributed key generation.
153 */ 153 */
154#define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1 22 154#define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG1 21
155 155
156/** 156/**
157 * Signature for the second round of distributed key generation. 157 * Signature for the second round of distributed key generation.
158 */ 158 */
159#define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG2 23 159#define GNUNET_SIGNATURE_PURPOSE_SECRETSHARING_DKG2 22
160 160
161/** 161/**
162 * Signature for cooperatice decryption. 162 * Signature for cooperatice decryption.
@@ -181,7 +181,7 @@ extern "C"
181/** 181/**
182 * Signature for a GNUid Ticket 182 * Signature for a GNUid Ticket
183 */ 183 */
184#define GNUNET_SIGNATURE_PURPOSE_GNUID_TICKET 27 184#define GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN 27
185 185
186/** 186/**
187 * Signature for a GNUnet credential 187 * Signature for a GNUnet credential
diff --git a/src/include/gnunet_strings_lib.h b/src/include/gnunet_strings_lib.h
index 1fdab93b2..c1d76ef71 100644
--- a/src/include/gnunet_strings_lib.h
+++ b/src/include/gnunet_strings_lib.h
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -339,7 +339,9 @@ GNUNET_STRINGS_string_to_data (const char *enc,
339 * @return the size of the output 339 * @return the size of the output
340 */ 340 */
341size_t 341size_t
342GNUNET_STRINGS_base64_encode (const char *data, size_t len, char **output); 342GNUNET_STRINGS_base64_encode (const void *in,
343 size_t len,
344 char **output);
343 345
344 346
345/** 347/**
@@ -354,7 +356,7 @@ GNUNET_STRINGS_base64_encode (const char *data, size_t len, char **output);
354size_t 356size_t
355GNUNET_STRINGS_base64_decode (const char *data, 357GNUNET_STRINGS_base64_decode (const char *data,
356 size_t len, 358 size_t len,
357 char **output); 359 void **output);
358 360
359 361
360/** 362/**
diff --git a/src/multicast/gnunet-service-multicast.c b/src/multicast/gnunet-service-multicast.c
index 20d29b906..f8441cc2b 100644
--- a/src/multicast/gnunet-service-multicast.c
+++ b/src/multicast/gnunet-service-multicast.c
@@ -1449,17 +1449,15 @@ check_client_member_join (void *cls,
1449 struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1]; 1449 struct GNUNET_PeerIdentity *relays = (struct GNUNET_PeerIdentity *) &msg[1];
1450 uint32_t relay_count = ntohl (msg->relay_count); 1450 uint32_t relay_count = ntohl (msg->relay_count);
1451 1451
1452 if (0 == relay_count) 1452 if (0 != relay_count)
1453 { 1453 {
1454 GNUNET_break (0); 1454 if (UINT32_MAX / relay_count < sizeof (*relays)){
1455 return GNUNET_SYSERR; 1455 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1456 } 1456 "relay_count (%lu) * sizeof (*relays) (%lu) exceeds UINT32_MAX!\n",
1457 if (UINT32_MAX / relay_count < sizeof (*relays)){ 1457 (unsigned long)relay_count,
1458 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1458 sizeof (*relays));
1459 "relay_count (%lu) * sizeof (*relays) (%lu) exceeds UINT32_MAX!\n", 1459 return GNUNET_SYSERR;
1460 (unsigned long)relay_count, 1460 }
1461 sizeof (*relays));
1462 return GNUNET_SYSERR;
1463 } 1461 }
1464 uint32_t relay_size = relay_count * sizeof (*relays); 1462 uint32_t relay_size = relay_count * sizeof (*relays);
1465 struct GNUNET_MessageHeader *join_msg = NULL; 1463 struct GNUNET_MessageHeader *join_msg = NULL;
diff --git a/src/multicast/test_multicast_multipeer.c b/src/multicast/test_multicast_multipeer.c
index 3a7c6d961..7766ff875 100644
--- a/src/multicast/test_multicast_multipeer.c
+++ b/src/multicast/test_multicast_multipeer.c
@@ -160,6 +160,7 @@ notify (void *cls,
160 160
161 *data_size = sizeof (struct pingpong_msg); 161 *data_size = sizeof (struct pingpong_msg);
162 GNUNET_memcpy(data, pp_msg, *data_size); 162 GNUNET_memcpy(data, pp_msg, *data_size);
163 GNUNET_free (pp_msg);
163 164
164 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 165 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
165 "Peer #%u sents ping to origin\n", mc_peer->peer); 166 "Peer #%u sents ping to origin\n", mc_peer->peer);
@@ -328,6 +329,7 @@ origin_notify (void *cls,
328 pp_msg->msg = PONG; 329 pp_msg->msg = PONG;
329 *data_size = sizeof (struct pingpong_msg); 330 *data_size = sizeof (struct pingpong_msg);
330 GNUNET_memcpy(data, pp_msg, *data_size); 331 GNUNET_memcpy(data, pp_msg, *data_size);
332 GNUNET_free (pp_msg);
331 333
332 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends pong\n"); 334 GNUNET_log (GNUNET_ERROR_TYPE_INFO, "origin sends pong\n");
333 335
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c
index 6c89cdb05..ddc8b483a 100644
--- a/src/namestore/gnunet-zoneimport.c
+++ b/src/namestore/gnunet-zoneimport.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -456,6 +456,7 @@ build_dns_query (struct Request *req,
456 char *rawp; 456 char *rawp;
457 struct GNUNET_DNSPARSER_Packet p; 457 struct GNUNET_DNSPARSER_Packet p;
458 struct GNUNET_DNSPARSER_Query q; 458 struct GNUNET_DNSPARSER_Query q;
459 int ret;
459 460
460 q.name = (char *) req->hostname; 461 q.name = (char *) req->hostname;
461 q.type = GNUNET_DNSPARSER_TYPE_NS; 462 q.type = GNUNET_DNSPARSER_TYPE_NS;
@@ -467,12 +468,14 @@ build_dns_query (struct Request *req,
467 p.num_queries = 1; 468 p.num_queries = 1;
468 p.queries = &q; 469 p.queries = &q;
469 p.id = req->id; 470 p.id = req->id;
470 if (GNUNET_OK != 471 ret = GNUNET_DNSPARSER_pack (&p,
471 GNUNET_DNSPARSER_pack (&p, 472 UINT16_MAX,
472 UINT16_MAX, 473 &rawp,
473 &rawp, 474 raw_size);
474 raw_size)) 475 if (GNUNET_OK != ret)
475 { 476 {
477 if (GNUNET_NO == ret)
478 GNUNET_free (rawp);
476 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 479 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
477 "Failed to pack query for hostname `%s'\n", 480 "Failed to pack query for hostname `%s'\n",
478 req->hostname); 481 req->hostname);
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c
index 33c48b244..e16fe91b7 100644
--- a/src/namestore/plugin_namestore_flat.c
+++ b/src/namestore/plugin_namestore_flat.c
@@ -55,7 +55,7 @@ struct FlatFileEntry
55 /** 55 /**
56 * Entry zone 56 * Entry zone
57 */ 57 */
58 struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key; 58 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
59 59
60 /** 60 /**
61 * Record cound 61 * Record cound
@@ -93,7 +93,6 @@ static int
93database_setup (struct Plugin *plugin) 93database_setup (struct Plugin *plugin)
94{ 94{
95 char *afsdir; 95 char *afsdir;
96 char *key;
97 char *record_data; 96 char *record_data;
98 char *zone_private_key; 97 char *zone_private_key;
99 char *record_data_b64; 98 char *record_data_b64;
@@ -104,7 +103,6 @@ database_setup (struct Plugin *plugin)
104 char *record_count; 103 char *record_count;
105 size_t record_data_size; 104 size_t record_data_size;
106 uint64_t size; 105 uint64_t size;
107 size_t key_len;
108 struct GNUNET_HashCode hkey; 106 struct GNUNET_HashCode hkey;
109 struct GNUNET_DISK_FileHandle *fh; 107 struct GNUNET_DISK_FileHandle *fh;
110 struct FlatFileEntry *entry; 108 struct FlatFileEntry *entry;
@@ -232,7 +230,7 @@ database_setup (struct Plugin *plugin)
232 record_data_size 230 record_data_size
233 = GNUNET_STRINGS_base64_decode (record_data_b64, 231 = GNUNET_STRINGS_base64_decode (record_data_b64,
234 strlen (record_data_b64), 232 strlen (record_data_b64),
235 &record_data); 233 (void **) &record_data);
236 entry->record_data = 234 entry->record_data =
237 GNUNET_new_array (entry->record_count, 235 GNUNET_new_array (entry->record_count,
238 struct GNUNET_GNSRECORD_Data); 236 struct GNUNET_GNSRECORD_Data);
@@ -251,21 +249,34 @@ database_setup (struct Plugin *plugin)
251 break; 249 break;
252 } 250 }
253 GNUNET_free (record_data); 251 GNUNET_free (record_data);
254 GNUNET_STRINGS_base64_decode (zone_private_key, 252
255 strlen (zone_private_key), 253 {
256 (char**)&entry->private_key); 254 struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key;
257 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); 255
258 key = GNUNET_malloc (strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 256 GNUNET_STRINGS_base64_decode (zone_private_key,
259 GNUNET_memcpy (key, 257 strlen (zone_private_key),
260 label, 258 (void**)&private_key);
261 strlen (label)); 259 entry->private_key = *private_key;
262 GNUNET_memcpy (key+strlen(label), 260 GNUNET_free (private_key);
263 entry->private_key, 261 }
264 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 262
265 GNUNET_CRYPTO_hash (key, 263 {
266 key_len, 264 char *key;
267 &hkey); 265 size_t key_len;
268 GNUNET_free (key); 266
267 key_len = strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey);
268 key = GNUNET_malloc (strlen (label) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
269 GNUNET_memcpy (key,
270 label,
271 strlen (label));
272 GNUNET_memcpy (key+strlen(label),
273 &entry->private_key,
274 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
275 GNUNET_CRYPTO_hash (key,
276 key_len,
277 &hkey);
278 GNUNET_free (key);
279 }
269 if (GNUNET_OK != 280 if (GNUNET_OK !=
270 GNUNET_CONTAINER_multihashmap_put (plugin->hm, 281 GNUNET_CONTAINER_multihashmap_put (plugin->hm,
271 &hkey, 282 &hkey,
@@ -302,7 +313,7 @@ store_and_free_entries (void *cls,
302 ssize_t data_size; 313 ssize_t data_size;
303 314
304 (void) key; 315 (void) key;
305 GNUNET_STRINGS_base64_encode ((char*)entry->private_key, 316 GNUNET_STRINGS_base64_encode (&entry->private_key,
306 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), 317 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey),
307 &zone_private_key); 318 &zone_private_key);
308 data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count, 319 data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count,
@@ -353,7 +364,6 @@ store_and_free_entries (void *cls,
353 strlen (line)); 364 strlen (line));
354 365
355 GNUNET_free (line); 366 GNUNET_free (line);
356 GNUNET_free (entry->private_key);
357 GNUNET_free (entry->label); 367 GNUNET_free (entry->label);
358 GNUNET_free (entry->record_data); 368 GNUNET_free (entry->record_data);
359 GNUNET_free (entry); 369 GNUNET_free (entry);
@@ -441,11 +451,10 @@ namestore_flat_store_records (void *cls,
441 return GNUNET_OK; 451 return GNUNET_OK;
442 } 452 }
443 entry = GNUNET_new (struct FlatFileEntry); 453 entry = GNUNET_new (struct FlatFileEntry);
444 entry->private_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey);
445 GNUNET_asprintf (&entry->label, 454 GNUNET_asprintf (&entry->label,
446 label, 455 label,
447 strlen (label)); 456 strlen (label));
448 GNUNET_memcpy (entry->private_key, 457 GNUNET_memcpy (&entry->private_key,
449 zone_key, 458 zone_key,
450 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); 459 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey));
451 entry->rvalue = rvalue; 460 entry->rvalue = rvalue;
@@ -519,7 +528,7 @@ namestore_flat_lookup_records (void *cls,
519 if (NULL != iter) 528 if (NULL != iter)
520 iter (iter_cls, 529 iter (iter_cls,
521 0, 530 0,
522 entry->private_key, 531 &entry->private_key,
523 entry->label, 532 entry->label,
524 entry->record_count, 533 entry->record_count,
525 entry->record_data); 534 entry->record_data);
@@ -586,7 +595,7 @@ iterate_zones (void *cls,
586 if (0 == ic->limit) 595 if (0 == ic->limit)
587 return GNUNET_NO; 596 return GNUNET_NO;
588 if ( (NULL != ic->zone) && 597 if ( (NULL != ic->zone) &&
589 (0 != memcmp (entry->private_key, 598 (0 != memcmp (&entry->private_key,
590 ic->zone, 599 ic->zone,
591 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) ) 600 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) )
592 return GNUNET_YES; 601 return GNUNET_YES;
@@ -598,7 +607,7 @@ iterate_zones (void *cls,
598 } 607 }
599 ic->iter (ic->iter_cls, 608 ic->iter (ic->iter_cls,
600 ic->pos, 609 ic->pos,
601 entry->private_key, 610 &entry->private_key,
602 entry->label, 611 entry->label,
603 entry->record_count, 612 entry->record_count,
604 entry->record_data); 613 entry->record_data);
@@ -668,7 +677,7 @@ zone_to_name (void *cls,
668 struct FlatFileEntry *entry = value; 677 struct FlatFileEntry *entry = value;
669 678
670 (void) key; 679 (void) key;
671 if (0 != memcmp (entry->private_key, 680 if (0 != memcmp (&entry->private_key,
672 ztn->zone, 681 ztn->zone,
673 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) 682 sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)))
674 return GNUNET_YES; 683 return GNUNET_YES;
@@ -683,7 +692,7 @@ zone_to_name (void *cls,
683 { 692 {
684 ztn->iter (ztn->iter_cls, 693 ztn->iter (ztn->iter_cls,
685 0, 694 0,
686 entry->private_key, 695 &entry->private_key,
687 entry->label, 696 entry->label,
688 entry->record_count, 697 entry->record_count,
689 entry->record_data); 698 entry->record_data);
diff --git a/src/psyc/Makefile.am b/src/psyc/Makefile.am
index 26db608f3..d5c797f52 100644
--- a/src/psyc/Makefile.am
+++ b/src/psyc/Makefile.am
@@ -48,8 +48,8 @@ gnunet_service_psyc_CFLAGS = $(AM_CFLAGS)
48 48
49 49
50if HAVE_TESTING 50if HAVE_TESTING
51check_PROGRAMS = \ 51#check_PROGRAMS = \
52 test_psyc2 52# test_psyc2
53# test_psyc 53# test_psyc
54endif 54endif
55 55
diff --git a/src/identity-attribute/Makefile.am b/src/reclaim-attribute/Makefile.am
index 2c73a443e..7db2925b1 100644
--- a/src/identity-attribute/Makefile.am
+++ b/src/reclaim-attribute/Makefile.am
@@ -17,28 +17,28 @@ if USE_COVERAGE
17endif 17endif
18 18
19lib_LTLIBRARIES = \ 19lib_LTLIBRARIES = \
20 libgnunetidentityattribute.la 20 libgnunetreclaimattribute.la
21 21
22libgnunetidentityattribute_la_SOURCES = \ 22libgnunetreclaimattribute_la_SOURCES = \
23 identity_attribute.c 23 reclaim_attribute.c
24libgnunetidentityattribute_la_LIBADD = \ 24libgnunetreclaimattribute_la_LIBADD = \
25 $(top_builddir)/src/util/libgnunetutil.la \ 25 $(top_builddir)/src/util/libgnunetutil.la \
26 $(GN_LIBINTL) 26 $(GN_LIBINTL)
27libgnunetidentityattribute_la_LDFLAGS = \ 27libgnunetreclaimattribute_la_LDFLAGS = \
28 $(GN_LIB_LDFLAGS) $(WINFLAGS) \ 28 $(GN_LIB_LDFLAGS) $(WINFLAGS) \
29 -version-info 0:0:0 29 -version-info 0:0:0
30 30
31 31
32plugin_LTLIBRARIES = \ 32plugin_LTLIBRARIES = \
33 libgnunet_plugin_identity_attribute_gnuid.la 33 libgnunet_plugin_reclaim_attribute_gnuid.la
34 34
35 35
36libgnunet_plugin_identity_attribute_gnuid_la_SOURCES = \ 36libgnunet_plugin_reclaim_attribute_gnuid_la_SOURCES = \
37 plugin_identity_attribute_gnuid.c 37 plugin_reclaim_attribute_gnuid.c
38libgnunet_plugin_identity_attribute_gnuid_la_LIBADD = \ 38libgnunet_plugin_reclaim_attribute_gnuid_la_LIBADD = \
39 $(top_builddir)/src/util/libgnunetutil.la \ 39 $(top_builddir)/src/util/libgnunetutil.la \
40 $(LTLIBINTL) 40 $(LTLIBINTL)
41libgnunet_plugin_identity_attribute_gnuid_la_LDFLAGS = \ 41libgnunet_plugin_reclaim_attribute_gnuid_la_LDFLAGS = \
42 $(GN_PLUGIN_LDFLAGS) 42 $(GN_PLUGIN_LDFLAGS)
43 43
44 44
diff --git a/src/identity-attribute/plugin_identity_attribute_gnuid.c b/src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
index c09b167f5..48afc0732 100644
--- a/src/identity-attribute/plugin_identity_attribute_gnuid.c
+++ b/src/reclaim-attribute/plugin_reclaim_attribute_gnuid.c
@@ -17,7 +17,7 @@
17*/ 17*/
18 18
19/** 19/**
20 * @file identity-attribute/plugin_identity_attribute_gnuid.c 20 * @file reclaim-attribute/plugin_reclaim_attribute_gnuid.c
21 * @brief identity attribute plugin to provide the API for fundamental 21 * @brief identity attribute plugin to provide the API for fundamental
22 * attribute types. 22 * attribute types.
23 * 23 *
@@ -25,7 +25,7 @@
25 */ 25 */
26#include "platform.h" 26#include "platform.h"
27#include "gnunet_util_lib.h" 27#include "gnunet_util_lib.h"
28#include "gnunet_identity_attribute_plugin.h" 28#include "gnunet_reclaim_attribute_plugin.h"
29#include <inttypes.h> 29#include <inttypes.h>
30 30
31 31
@@ -47,7 +47,7 @@ gnuid_value_to_string (void *cls,
47 47
48 switch (type) 48 switch (type)
49 { 49 {
50 case GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING: 50 case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
51 return GNUNET_strndup (data, data_size); 51 return GNUNET_strndup (data, data_size);
52 default: 52 default:
53 return NULL; 53 return NULL;
@@ -78,7 +78,7 @@ gnuid_string_to_value (void *cls,
78 switch (type) 78 switch (type)
79 { 79 {
80 80
81 case GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING: 81 case GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING:
82 *data = GNUNET_strdup (s); 82 *data = GNUNET_strdup (s);
83 *data_size = strlen (s); 83 *data_size = strlen (s);
84 return GNUNET_OK; 84 return GNUNET_OK;
@@ -96,7 +96,7 @@ static struct {
96 const char *name; 96 const char *name;
97 uint32_t number; 97 uint32_t number;
98} gnuid_name_map[] = { 98} gnuid_name_map[] = {
99 { "STRING", GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING }, 99 { "STRING", GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING },
100 { NULL, UINT32_MAX } 100 { NULL, UINT32_MAX }
101}; 101};
102 102
@@ -151,11 +151,11 @@ gnuid_number_to_typename (void *cls,
151 * @return the exported block API 151 * @return the exported block API
152 */ 152 */
153void * 153void *
154libgnunet_plugin_identity_attribute_gnuid_init (void *cls) 154libgnunet_plugin_reclaim_attribute_gnuid_init (void *cls)
155{ 155{
156 struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api; 156 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api;
157 157
158 api = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions); 158 api = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions);
159 api->value_to_string = &gnuid_value_to_string; 159 api->value_to_string = &gnuid_value_to_string;
160 api->string_to_value = &gnuid_string_to_value; 160 api->string_to_value = &gnuid_string_to_value;
161 api->typename_to_number = &gnuid_typename_to_number; 161 api->typename_to_number = &gnuid_typename_to_number;
@@ -171,12 +171,12 @@ libgnunet_plugin_identity_attribute_gnuid_init (void *cls)
171 * @return NULL 171 * @return NULL
172 */ 172 */
173void * 173void *
174libgnunet_plugin_identity_attribute_gnuid_done (void *cls) 174libgnunet_plugin_reclaim_attribute_gnuid_done (void *cls)
175{ 175{
176 struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api = cls; 176 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api = cls;
177 177
178 GNUNET_free (api); 178 GNUNET_free (api);
179 return NULL; 179 return NULL;
180} 180}
181 181
182/* end of plugin_identity_attribute_type_gnuid.c */ 182/* end of plugin_reclaim_attribute_type_gnuid.c */
diff --git a/src/identity-attribute/identity_attribute.c b/src/reclaim-attribute/reclaim_attribute.c
index 7d47c46a7..1ffa9618f 100644
--- a/src/identity-attribute/identity_attribute.c
+++ b/src/reclaim-attribute/reclaim_attribute.c
@@ -17,14 +17,14 @@
17 */ 17 */
18 18
19/** 19/**
20 * @file identity-attribute/identity_attribute.c 20 * @file reclaim-attribute/reclaim_attribute.c
21 * @brief helper library to manage identity attributes 21 * @brief helper library to manage identity attributes
22 * @author Martin Schanzenbach 22 * @author Martin Schanzenbach
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_util_lib.h" 25#include "gnunet_util_lib.h"
26#include "identity_attribute.h" 26#include "reclaim_attribute.h"
27#include "gnunet_identity_attribute_plugin.h" 27#include "gnunet_reclaim_attribute_plugin.h"
28 28
29/** 29/**
30 * Handle for a plugin 30 * Handle for a plugin
@@ -39,7 +39,7 @@ struct Plugin
39 /** 39 /**
40 * Plugin API 40 * Plugin API
41 */ 41 */
42 struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api; 42 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api;
43}; 43};
44 44
45/** 45/**
@@ -65,7 +65,7 @@ add_plugin (void* cls,
65 const char *library_name, 65 const char *library_name,
66 void *lib_ret) 66 void *lib_ret)
67{ 67{
68 struct GNUNET_IDENTITY_ATTRIBUTE_PluginFunctions *api = lib_ret; 68 struct GNUNET_RECLAIM_ATTRIBUTE_PluginFunctions *api = lib_ret;
69 struct Plugin *plugin; 69 struct Plugin *plugin;
70 70
71 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 71 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -86,7 +86,7 @@ init()
86 if (GNUNET_YES == initialized) 86 if (GNUNET_YES == initialized)
87 return; 87 return;
88 initialized = GNUNET_YES; 88 initialized = GNUNET_YES;
89 GNUNET_PLUGIN_load_all ("libgnunet_plugin_identity_attribute_", NULL, 89 GNUNET_PLUGIN_load_all ("libgnunet_plugin_reclaim_attribute_", NULL,
90 &add_plugin, NULL); 90 &add_plugin, NULL);
91} 91}
92 92
@@ -97,7 +97,7 @@ init()
97 * @return corresponding number, UINT32_MAX on error 97 * @return corresponding number, UINT32_MAX on error
98 */ 98 */
99uint32_t 99uint32_t
100GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (const char *typename) 100GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (const char *typename)
101{ 101{
102 unsigned int i; 102 unsigned int i;
103 struct Plugin *plugin; 103 struct Plugin *plugin;
@@ -121,7 +121,7 @@ GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (const char *typename)
121 * @return corresponding typestring, NULL on error 121 * @return corresponding typestring, NULL on error
122 */ 122 */
123const char* 123const char*
124GNUNET_IDENTITY_ATTRIBUTE_number_to_typename (uint32_t type) 124GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (uint32_t type)
125{ 125{
126 unsigned int i; 126 unsigned int i;
127 struct Plugin *plugin; 127 struct Plugin *plugin;
@@ -149,7 +149,7 @@ GNUNET_IDENTITY_ATTRIBUTE_number_to_typename (uint32_t type)
149 * @return #GNUNET_OK on success 149 * @return #GNUNET_OK on success
150 */ 150 */
151int 151int
152GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type, 152GNUNET_RECLAIM_ATTRIBUTE_string_to_value (uint32_t type,
153 const char *s, 153 const char *s,
154 void **data, 154 void **data,
155 size_t *data_size) 155 size_t *data_size)
@@ -180,7 +180,7 @@ GNUNET_IDENTITY_ATTRIBUTE_string_to_value (uint32_t type,
180 * @return NULL on error, otherwise human-readable representation of the claim 180 * @return NULL on error, otherwise human-readable representation of the claim
181 */ 181 */
182char * 182char *
183GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type, 183GNUNET_RECLAIM_ATTRIBUTE_value_to_string (uint32_t type,
184 const void* data, 184 const void* data,
185 size_t data_size) 185 size_t data_size)
186{ 186{
@@ -210,31 +210,35 @@ GNUNET_IDENTITY_ATTRIBUTE_value_to_string (uint32_t type,
210 * @param data_size the attribute value size 210 * @param data_size the attribute value size
211 * @return the new attribute 211 * @return the new attribute
212 */ 212 */
213struct GNUNET_IDENTITY_ATTRIBUTE_Claim * 213struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
214GNUNET_IDENTITY_ATTRIBUTE_claim_new (const char* attr_name, 214GNUNET_RECLAIM_ATTRIBUTE_claim_new (const char* attr_name,
215 uint32_t type, 215 uint32_t type,
216 const void* data, 216 const void* data,
217 size_t data_size) 217 size_t data_size)
218{ 218{
219 struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; 219 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
220 char *write_ptr; 220 char *write_ptr;
221 char *attr_name_tmp = GNUNET_strdup (attr_name);
221 222
222 attr = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) + 223 GNUNET_STRINGS_utf8_tolower (attr_name, attr_name_tmp);
223 strlen (attr_name) + 1 + 224
225 attr = GNUNET_malloc (sizeof (struct GNUNET_RECLAIM_ATTRIBUTE_Claim) +
226 strlen (attr_name_tmp) + 1 +
224 data_size); 227 data_size);
225 attr->type = type; 228 attr->type = type;
226 attr->data_size = data_size; 229 attr->data_size = data_size;
227 attr->version = 0; 230 attr->version = 0;
228 write_ptr = (char*)&attr[1]; 231 write_ptr = (char*)&attr[1];
229 GNUNET_memcpy (write_ptr, 232 GNUNET_memcpy (write_ptr,
230 attr_name, 233 attr_name_tmp,
231 strlen (attr_name) + 1); 234 strlen (attr_name_tmp) + 1);
232 attr->name = write_ptr; 235 attr->name = write_ptr;
233 write_ptr += strlen (attr->name) + 1; 236 write_ptr += strlen (attr->name) + 1;
234 GNUNET_memcpy (write_ptr, 237 GNUNET_memcpy (write_ptr,
235 data, 238 data,
236 data_size); 239 data_size);
237 attr->data = write_ptr; 240 attr->data = write_ptr;
241 GNUNET_free (attr_name_tmp);
238 return attr; 242 return attr;
239} 243}
240 244
@@ -249,15 +253,15 @@ GNUNET_IDENTITY_ATTRIBUTE_claim_new (const char* attr_name,
249 * @return 253 * @return
250 */ 254 */
251void 255void
252GNUNET_IDENTITY_ATTRIBUTE_list_add (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *claim_list, 256GNUNET_RECLAIM_ATTRIBUTE_list_add (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *claim_list,
253 const char* attr_name, 257 const char* attr_name,
254 uint32_t type, 258 uint32_t type,
255 const void* data, 259 const void* data,
256 size_t data_size) 260 size_t data_size)
257{ 261{
258 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 262 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
259 le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); 263 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
260 le->claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name, 264 le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name,
261 type, 265 type,
262 data, 266 data,
263 data_size); 267 data_size);
@@ -267,20 +271,20 @@ GNUNET_IDENTITY_ATTRIBUTE_list_add (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *
267} 271}
268 272
269size_t 273size_t
270GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) 274GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
271{ 275{
272 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 276 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
273 size_t len = 0; 277 size_t len = 0;
274 for (le = attrs->list_head; NULL != le; le = le->next) 278 for (le = attrs->list_head; NULL != le; le = le->next)
275 len += GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (le->claim); 279 len += GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim);
276 return len; 280 return len;
277} 281}
278 282
279size_t 283size_t
280GNUNET_IDENTITY_ATTRIBUTE_list_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, 284GNUNET_RECLAIM_ATTRIBUTE_list_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
281 char *result) 285 char *result)
282{ 286{
283 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 287 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
284 size_t len; 288 size_t len;
285 size_t total_len; 289 size_t total_len;
286 char* write_ptr; 290 char* write_ptr;
@@ -289,7 +293,7 @@ GNUNET_IDENTITY_ATTRIBUTE_list_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE
289 total_len = 0; 293 total_len = 0;
290 for (le = attrs->list_head; NULL != le; le = le->next) 294 for (le = attrs->list_head; NULL != le; le = le->next)
291 { 295 {
292 len = GNUNET_IDENTITY_ATTRIBUTE_serialize (le->claim, 296 len = GNUNET_RECLAIM_ATTRIBUTE_serialize (le->claim,
293 write_ptr); 297 write_ptr);
294 total_len += len; 298 total_len += len;
295 write_ptr += len; 299 write_ptr += len;
@@ -297,49 +301,49 @@ GNUNET_IDENTITY_ATTRIBUTE_list_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE
297 return total_len; 301 return total_len;
298} 302}
299 303
300struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList * 304struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *
301GNUNET_IDENTITY_ATTRIBUTE_list_deserialize (const char* data, 305GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (const char* data,
302 size_t data_size) 306 size_t data_size)
303{ 307{
304 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; 308 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
305 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 309 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
306 size_t attr_len; 310 size_t attr_len;
307 const char* read_ptr; 311 const char* read_ptr;
308 312
309 if (data_size < sizeof (struct Attribute)) 313 if (data_size < sizeof (struct Attribute))
310 return NULL; 314 return NULL;
311 315
312 attrs = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); 316 attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
313 read_ptr = data; 317 read_ptr = data;
314 while (((data + data_size) - read_ptr) >= sizeof (struct Attribute)) 318 while (((data + data_size) - read_ptr) >= sizeof (struct Attribute))
315 { 319 {
316 320
317 le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); 321 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
318 le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (read_ptr, 322 le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (read_ptr,
319 data_size - (read_ptr - data)); 323 data_size - (read_ptr - data));
320 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 324 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
321 "Deserialized attribute %s\n", le->claim->name); 325 "Deserialized attribute %s\n", le->claim->name);
322 GNUNET_CONTAINER_DLL_insert (attrs->list_head, 326 GNUNET_CONTAINER_DLL_insert (attrs->list_head,
323 attrs->list_tail, 327 attrs->list_tail,
324 le); 328 le);
325 attr_len = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (le->claim); 329 attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (le->claim);
326 read_ptr += attr_len; 330 read_ptr += attr_len;
327 } 331 }
328 return attrs; 332 return attrs;
329} 333}
330 334
331struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList* 335struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList*
332GNUNET_IDENTITY_ATTRIBUTE_list_dup (const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) 336GNUNET_RECLAIM_ATTRIBUTE_list_dup (const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
333{ 337{
334 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 338 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
335 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *result_le; 339 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *result_le;
336 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *result; 340 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *result;
337 341
338 result = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); 342 result = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
339 for (le = attrs->list_head; NULL != le; le = le->next) 343 for (le = attrs->list_head; NULL != le; le = le->next)
340 { 344 {
341 result_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); 345 result_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
342 result_le->claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (le->claim->name, 346 result_le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (le->claim->name,
343 le->claim->type, 347 le->claim->type,
344 le->claim->data, 348 le->claim->data,
345 le->claim->data_size); 349 le->claim->data_size);
@@ -352,10 +356,10 @@ GNUNET_IDENTITY_ATTRIBUTE_list_dup (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim
352 356
353 357
354void 358void
355GNUNET_IDENTITY_ATTRIBUTE_list_destroy (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) 359GNUNET_RECLAIM_ATTRIBUTE_list_destroy (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
356{ 360{
357 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 361 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
358 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *tmp_le; 362 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *tmp_le;
359 363
360 for (le = attrs->list_head; NULL != le;) 364 for (le = attrs->list_head; NULL != le;)
361 { 365 {
@@ -369,7 +373,7 @@ GNUNET_IDENTITY_ATTRIBUTE_list_destroy (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimLi
369} 373}
370 374
371size_t 375size_t
372GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) 376GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
373{ 377{
374 return sizeof (struct Attribute) 378 return sizeof (struct Attribute)
375 + strlen (attr->name) 379 + strlen (attr->name)
@@ -377,7 +381,7 @@ GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (const struct GNUNET_IDENTITY_ATTRI
377} 381}
378 382
379size_t 383size_t
380GNUNET_IDENTITY_ATTRIBUTE_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, 384GNUNET_RECLAIM_ATTRIBUTE_serialize (const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
381 char *result) 385 char *result)
382{ 386{
383 size_t data_len_ser; 387 size_t data_len_ser;
@@ -403,11 +407,11 @@ GNUNET_IDENTITY_ATTRIBUTE_serialize (const struct GNUNET_IDENTITY_ATTRIBUTE_Clai
403 return sizeof (struct Attribute) + strlen (attr->name) + attr->data_size; 407 return sizeof (struct Attribute) + strlen (attr->name) + attr->data_size;
404} 408}
405 409
406struct GNUNET_IDENTITY_ATTRIBUTE_Claim * 410struct GNUNET_RECLAIM_ATTRIBUTE_Claim *
407GNUNET_IDENTITY_ATTRIBUTE_deserialize (const char* data, 411GNUNET_RECLAIM_ATTRIBUTE_deserialize (const char* data,
408 size_t data_size) 412 size_t data_size)
409{ 413{
410 struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; 414 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
411 struct Attribute *attr_ser; 415 struct Attribute *attr_ser;
412 size_t data_len; 416 size_t data_len;
413 size_t name_len; 417 size_t name_len;
@@ -419,7 +423,7 @@ GNUNET_IDENTITY_ATTRIBUTE_deserialize (const char* data,
419 attr_ser = (struct Attribute*)data; 423 attr_ser = (struct Attribute*)data;
420 data_len = ntohs (attr_ser->data_size); 424 data_len = ntohs (attr_ser->data_size);
421 name_len = ntohs (attr_ser->name_len); 425 name_len = ntohs (attr_ser->name_len);
422 attr = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_ATTRIBUTE_Claim) 426 attr = GNUNET_malloc (sizeof (struct GNUNET_RECLAIM_ATTRIBUTE_Claim)
423 + data_len + name_len + 1); 427 + data_len + name_len + 1);
424 attr->type = ntohs (attr_ser->attribute_type); 428 attr->type = ntohs (attr_ser->attribute_type);
425 attr->version = ntohl (attr_ser->attribute_version); 429 attr->version = ntohl (attr_ser->attribute_version);
@@ -441,4 +445,4 @@ GNUNET_IDENTITY_ATTRIBUTE_deserialize (const char* data,
441 445
442} 446}
443 447
444/* end of identity_attribute.c */ 448/* end of reclaim_attribute.c */
diff --git a/src/identity-attribute/identity_attribute.h b/src/reclaim-attribute/reclaim_attribute.h
index 2346dcde1..746d32980 100644
--- a/src/identity-attribute/identity_attribute.h
+++ b/src/reclaim-attribute/reclaim_attribute.h
@@ -17,14 +17,14 @@
17 */ 17 */
18/** 18/**
19 * @author Martin Schanzenbach 19 * @author Martin Schanzenbach
20 * @file identity-attribute/identity_attribute.h 20 * @file reclaim-attribute/reclaim_attribute.h
21 * @brief GNUnet Identity attributes 21 * @brief GNUnet reclaim identity attributes
22 * 22 *
23 */ 23 */
24#ifndef IDENTITY_ATTRIBUTE_H 24#ifndef RECLAIM_ATTRIBUTE_H
25#define IDENTITY_ATTRIBUTE_H 25#define RECLAIM_ATTRIBUTE_H
26 26
27#include "gnunet_identity_provider_service.h" 27#include "gnunet_reclaim_service.h"
28 28
29struct Attribute 29struct Attribute
30{ 30{
diff --git a/src/identity-provider/.gitignore b/src/reclaim/.gitignore
index ef77fccdc..ef77fccdc 100644
--- a/src/identity-provider/.gitignore
+++ b/src/reclaim/.gitignore
diff --git a/src/identity-provider/Makefile.am b/src/reclaim/Makefile.am
index 2eb699542..2ee43d21a 100644
--- a/src/identity-provider/Makefile.am
+++ b/src/reclaim/Makefile.am
@@ -13,12 +13,12 @@ if USE_COVERAGE
13endif 13endif
14 14
15if HAVE_SQLITE 15if HAVE_SQLITE
16SQLITE_PLUGIN = libgnunet_plugin_identity_provider_sqlite.la 16SQLITE_PLUGIN = libgnunet_plugin_reclaim_sqlite.la
17endif 17endif
18 18
19EXTRA_DIST = \ 19EXTRA_DIST = \
20 test_idp_defaults.conf \ 20 test_reclaim_defaults.conf \
21 test_idp.conf \ 21 test_reclaim.conf \
22 $(check_SCRIPTS) 22 $(check_SCRIPTS)
23 23
24pkgcfgdir= $(pkgdatadir)/config.d/ 24pkgcfgdir= $(pkgdatadir)/config.d/
@@ -26,46 +26,46 @@ pkgcfgdir= $(pkgdatadir)/config.d/
26libexecdir= $(pkglibdir)/libexec/ 26libexecdir= $(pkglibdir)/libexec/
27 27
28pkgcfg_DATA = \ 28pkgcfg_DATA = \
29 identity-provider.conf 29 reclaim.conf
30 30
31lib_LTLIBRARIES = \ 31lib_LTLIBRARIES = \
32 libgnunetidentityprovider.la 32 libgnunetreclaim.la
33plugin_LTLIBRARIES = \ 33plugin_LTLIBRARIES = \
34 libgnunet_plugin_rest_identity_provider.la \ 34 libgnunet_plugin_rest_reclaim.la \
35 libgnunet_plugin_rest_openid_connect.la \ 35 libgnunet_plugin_rest_openid_connect.la \
36 libgnunet_plugin_gnsrecord_identity_provider.la \ 36 libgnunet_plugin_gnsrecord_reclaim.la \
37 $(SQLITE_PLUGIN) 37 $(SQLITE_PLUGIN)
38 38
39bin_PROGRAMS = \ 39bin_PROGRAMS = \
40 gnunet-idp 40 gnunet-reclaim
41 41
42libexec_PROGRAMS = \ 42libexec_PROGRAMS = \
43 gnunet-service-identity-provider 43 gnunet-service-reclaim
44 44
45libgnunet_plugin_gnsrecord_identity_provider_la_SOURCES = \ 45libgnunet_plugin_gnsrecord_reclaim_la_SOURCES = \
46 plugin_gnsrecord_identity_provider.c 46 plugin_gnsrecord_reclaim.c
47libgnunet_plugin_gnsrecord_identity_provider_la_LIBADD = \ 47libgnunet_plugin_gnsrecord_reclaim_la_LIBADD = \
48 $(top_builddir)/src/util/libgnunetutil.la \ 48 $(top_builddir)/src/util/libgnunetutil.la \
49 $(LTLIBINTL) 49 $(LTLIBINTL)
50libgnunet_plugin_gnsrecord_identity_provider_la_LDFLAGS = \ 50libgnunet_plugin_gnsrecord_reclaim_la_LDFLAGS = \
51 $(GN_PLUGIN_LDFLAGS) 51 $(GN_PLUGIN_LDFLAGS)
52 52
53libgnunet_plugin_identity_provider_sqlite_la_SOURCES = \ 53libgnunet_plugin_reclaim_sqlite_la_SOURCES = \
54 plugin_identity_provider_sqlite.c 54 plugin_reclaim_sqlite.c
55libgnunet_plugin_identity_provider_sqlite_la_LIBADD = \ 55libgnunet_plugin_reclaim_sqlite_la_LIBADD = \
56 libgnunetidentityprovider.la \ 56 libgnunetreclaim.la \
57 $(top_builddir)/src/sq/libgnunetsq.la \ 57 $(top_builddir)/src/sq/libgnunetsq.la \
58 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 58 $(top_builddir)/src/statistics/libgnunetstatistics.la \
59 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \ 59 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) -lsqlite3 \
60 $(LTLIBINTL) 60 $(LTLIBINTL)
61libgnunet_plugin_identity_provider_sqlite_la_LDFLAGS = \ 61libgnunet_plugin_reclaim_sqlite_la_LDFLAGS = \
62 $(GN_PLUGIN_LDFLAGS) 62 $(GN_PLUGIN_LDFLAGS)
63 63
64 64
65 65
66gnunet_service_identity_provider_SOURCES = \ 66gnunet_service_reclaim_SOURCES = \
67 gnunet-service-identity-provider.c 67 gnunet-service-reclaim.c
68gnunet_service_identity_provider_LDADD = \ 68gnunet_service_reclaim_LDADD = \
69 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ 69 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
70 $(top_builddir)/src/util/libgnunetutil.la \ 70 $(top_builddir)/src/util/libgnunetutil.la \
71 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 71 $(top_builddir)/src/namestore/libgnunetnamestore.la \
@@ -73,66 +73,67 @@ gnunet_service_identity_provider_LDADD = \
73 $(top_builddir)/src/statistics/libgnunetstatistics.la \ 73 $(top_builddir)/src/statistics/libgnunetstatistics.la \
74 $(top_builddir)/src/abe/libgnunetabe.la \ 74 $(top_builddir)/src/abe/libgnunetabe.la \
75 $(top_builddir)/src/credential/libgnunetcredential.la \ 75 $(top_builddir)/src/credential/libgnunetcredential.la \
76 $(top_builddir)/src/identity-attribute/libgnunetidentityattribute.la \ 76 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
77 libgnunetidentityprovider.la \ 77 libgnunetreclaim.la \
78 $(top_builddir)/src/gns/libgnunetgns.la \ 78 $(top_builddir)/src/gns/libgnunetgns.la \
79 $(GN_LIBINTL) 79 $(GN_LIBINTL)
80 80
81libgnunetidentityprovider_la_SOURCES = \ 81libgnunetreclaim_la_SOURCES = \
82 identity_provider_api.c \ 82 reclaim_api.c \
83 identity_provider.h 83 reclaim.h
84libgnunetidentityprovider_la_LIBADD = \ 84libgnunetreclaim_la_LIBADD = \
85 $(top_builddir)/src/util/libgnunetutil.la \ 85 $(top_builddir)/src/util/libgnunetutil.la \
86 $(GN_LIBINTL) $(XLIB) 86 $(GN_LIBINTL) $(XLIB)
87libgnunetidentityprovider_la_LDFLAGS = \ 87libgnunetreclaim_la_LDFLAGS = \
88 $(GN_LIB_LDFLAGS) $(WINFLAGS) \ 88 $(GN_LIB_LDFLAGS) $(WINFLAGS) \
89 -version-info 0:0:0 89 -version-info 0:0:0
90 90
91libgnunet_plugin_rest_identity_provider_la_SOURCES = \ 91libgnunet_plugin_rest_reclaim_la_SOURCES = \
92 plugin_rest_identity_provider.c \ 92 plugin_rest_reclaim.c
93 jwt.c 93libgnunet_plugin_rest_reclaim_la_LIBADD = \
94libgnunet_plugin_rest_identity_provider_la_LIBADD = \
95 $(top_builddir)/src/identity/libgnunetidentity.la \ 94 $(top_builddir)/src/identity/libgnunetidentity.la \
96 libgnunetidentityprovider.la \ 95 libgnunetreclaim.la \
97 $(top_builddir)/src/rest/libgnunetrest.la \ 96 $(top_builddir)/src/rest/libgnunetrest.la \
98 $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \ 97 $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \
99 $(top_builddir)/src/identity-attribute/libgnunetidentityattribute.la \ 98 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
100 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 99 $(top_builddir)/src/namestore/libgnunetnamestore.la \
101 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ 100 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
102 $(LTLIBINTL) -ljansson -lmicrohttpd 101 $(LTLIBINTL) -ljansson -lmicrohttpd
103libgnunet_plugin_rest_identity_provider_la_LDFLAGS = \ 102libgnunet_plugin_rest_reclaim_la_LDFLAGS = \
104 $(GN_PLUGIN_LDFLAGS) 103 $(GN_PLUGIN_LDFLAGS)
105 104
106libgnunet_plugin_rest_openid_connect_la_SOURCES = \ 105libgnunet_plugin_rest_openid_connect_la_SOURCES = \
107 plugin_rest_openid_connect.c \ 106 plugin_rest_openid_connect.c \
108 jwt.c 107 oidc_helper.c
109libgnunet_plugin_rest_openid_connect_la_LIBADD = \ 108libgnunet_plugin_rest_openid_connect_la_LIBADD = \
110 $(top_builddir)/src/identity/libgnunetidentity.la \ 109 $(top_builddir)/src/identity/libgnunetidentity.la \
111 libgnunetidentityprovider.la \ 110 libgnunetreclaim.la \
112 $(top_builddir)/src/rest/libgnunetrest.la \ 111 $(top_builddir)/src/rest/libgnunetrest.la \
113 $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \ 112 $(top_builddir)/src/jsonapi/libgnunetjsonapi.la \
114 $(top_builddir)/src/identity-attribute/libgnunetidentityattribute.la \ 113 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
115 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 114 $(top_builddir)/src/namestore/libgnunetnamestore.la \
115 $(top_builddir)/src/gns/libgnunetgns.la \
116 $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \
116 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ 117 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
117 $(LTLIBINTL) -ljansson -lmicrohttpd 118 $(LTLIBINTL) -ljansson -lmicrohttpd
118libgnunet_plugin_rest_openid_connect_la_LDFLAGS = \ 119libgnunet_plugin_rest_openid_connect_la_LDFLAGS = \
119 $(GN_PLUGIN_LDFLAGS) 120 $(GN_PLUGIN_LDFLAGS)
120 121
121gnunet_idp_SOURCES = \ 122gnunet_reclaim_SOURCES = \
122 gnunet-idp.c 123 gnunet-reclaim.c
123gnunet_idp_LDADD = \ 124gnunet_reclaim_LDADD = \
124 $(top_builddir)/src/util/libgnunetutil.la \ 125 $(top_builddir)/src/util/libgnunetutil.la \
125 $(top_builddir)/src/namestore/libgnunetnamestore.la \ 126 $(top_builddir)/src/namestore/libgnunetnamestore.la \
126 libgnunetidentityprovider.la \ 127 libgnunetreclaim.la \
127 $(top_builddir)/src/identity/libgnunetidentity.la \ 128 $(top_builddir)/src/identity/libgnunetidentity.la \
128 $(top_builddir)/src/identity-attribute/libgnunetidentityattribute.la \ 129 $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \
129 $(GN_LIBINTL) 130 $(GN_LIBINTL)
130 131
131check_SCRIPTS = \ 132check_SCRIPTS = \
132 test_idp_attribute.sh \ 133 test_reclaim_attribute.sh \
133 test_idp_issue.sh \ 134 test_reclaim_issue.sh \
134 test_idp_consume.sh \ 135 test_reclaim_consume.sh \
135 test_idp_revoke.sh 136 test_reclaim_revoke.sh
136 137
137if ENABLE_TEST_RUN 138if ENABLE_TEST_RUN
138 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME; 139 AM_TESTS_ENVIRONMENT=export GNUNET_PREFIX=$${GNUNET_PREFIX:-@libdir@};export PATH=$${GNUNET_PREFIX:-@prefix@}/bin:$$PATH;unset XDG_DATA_HOME;unset XDG_CONFIG_HOME;
diff --git a/src/identity-provider/gnunet-idp.c b/src/reclaim/gnunet-reclaim.c
index 79e4f8d27..677e9f49f 100644
--- a/src/identity-provider/gnunet-idp.c
+++ b/src/reclaim/gnunet-reclaim.c
@@ -17,7 +17,7 @@
17 */ 17 */
18/** 18/**
19 * @author Martin Schanzenbach 19 * @author Martin Schanzenbach
20 * @file src/identity-provider/gnunet-idp.c 20 * @file src/reclaim/gnunet-reclaim.c
21 * @brief Identity Provider utility 21 * @brief Identity Provider utility
22 * 22 *
23 */ 23 */
@@ -25,7 +25,7 @@
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_util_lib.h" 26#include "gnunet_util_lib.h"
27#include "gnunet_namestore_service.h" 27#include "gnunet_namestore_service.h"
28#include "gnunet_identity_provider_service.h" 28#include "gnunet_reclaim_service.h"
29#include "gnunet_identity_service.h" 29#include "gnunet_identity_service.h"
30#include "gnunet_signatures.h" 30#include "gnunet_signatures.h"
31 31
@@ -85,19 +85,19 @@ static char* ego_name;
85static struct GNUNET_IDENTITY_Handle *identity_handle; 85static struct GNUNET_IDENTITY_Handle *identity_handle;
86 86
87/** 87/**
88 * IdP handle 88 * reclaim handle
89 */ 89 */
90static struct GNUNET_IDENTITY_PROVIDER_Handle *idp_handle; 90static struct GNUNET_RECLAIM_Handle *reclaim_handle;
91 91
92/** 92/**
93 * IdP operation 93 * reclaim operation
94 */ 94 */
95static struct GNUNET_IDENTITY_PROVIDER_Operation *idp_op; 95static struct GNUNET_RECLAIM_Operation *reclaim_op;
96 96
97/** 97/**
98 * Attribute iterator 98 * Attribute iterator
99 */ 99 */
100static struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *attr_iterator; 100static struct GNUNET_RECLAIM_AttributeIterator *attr_iterator;
101 101
102/** 102/**
103 * Master ABE key 103 * Master ABE key
@@ -117,12 +117,12 @@ static struct GNUNET_CRYPTO_EcdsaPublicKey rp_key;
117/** 117/**
118 * Ticket to consume 118 * Ticket to consume
119 */ 119 */
120static struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 120static struct GNUNET_RECLAIM_Ticket ticket;
121 121
122/** 122/**
123 * Attribute list 123 * Attribute list
124 */ 124 */
125static struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attr_list; 125static struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list;
126 126
127/** 127/**
128 * Attribute expiration interval 128 * Attribute expiration interval
@@ -134,17 +134,28 @@ static struct GNUNET_TIME_Relative exp_interval;
134 */ 134 */
135static struct GNUNET_SCHEDULER_Task *timeout; 135static struct GNUNET_SCHEDULER_Task *timeout;
136 136
137/**
138 * Cleanup task
139 */
140static struct GNUNET_SCHEDULER_Task *cleanup_task;
141
142/**
143 * Claim to store
144 */
145struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
146
137static void 147static void
138do_cleanup(void *cls) 148do_cleanup(void *cls)
139{ 149{
150 cleanup_task = NULL;
140 if (NULL != timeout) 151 if (NULL != timeout)
141 GNUNET_SCHEDULER_cancel (timeout); 152 GNUNET_SCHEDULER_cancel (timeout);
142 if (NULL != idp_op) 153 if (NULL != reclaim_op)
143 GNUNET_IDENTITY_PROVIDER_cancel (idp_op); 154 GNUNET_RECLAIM_cancel (reclaim_op);
144 if (NULL != attr_iterator) 155 if (NULL != attr_iterator)
145 GNUNET_IDENTITY_PROVIDER_get_attributes_stop (attr_iterator); 156 GNUNET_RECLAIM_get_attributes_stop (attr_iterator);
146 if (NULL != idp_handle) 157 if (NULL != reclaim_handle)
147 GNUNET_IDENTITY_PROVIDER_disconnect (idp_handle); 158 GNUNET_RECLAIM_disconnect (reclaim_handle);
148 if (NULL != identity_handle) 159 if (NULL != identity_handle)
149 GNUNET_IDENTITY_disconnect (identity_handle); 160 GNUNET_IDENTITY_disconnect (identity_handle);
150 if (NULL != abe_key) 161 if (NULL != abe_key)
@@ -155,18 +166,18 @@ do_cleanup(void *cls)
155 166
156static void 167static void
157ticket_issue_cb (void* cls, 168ticket_issue_cb (void* cls,
158 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket) 169 const struct GNUNET_RECLAIM_Ticket *ticket)
159{ 170{
160 char* ticket_str; 171 char* ticket_str;
161 idp_op = NULL; 172 reclaim_op = NULL;
162 if (NULL != ticket) { 173 if (NULL != ticket) {
163 ticket_str = GNUNET_STRINGS_data_to_string_alloc (ticket, 174 ticket_str = GNUNET_STRINGS_data_to_string_alloc (ticket,
164 sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); 175 sizeof (struct GNUNET_RECLAIM_Ticket));
165 printf("%s\n", 176 printf("%s\n",
166 ticket_str); 177 ticket_str);
167 GNUNET_free (ticket_str); 178 GNUNET_free (ticket_str);
168 } 179 }
169 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 180 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
170} 181}
171 182
172static void 183static void
@@ -174,24 +185,26 @@ store_attr_cont (void *cls,
174 int32_t success, 185 int32_t success,
175 const char*emsg) 186 const char*emsg)
176{ 187{
177 idp_op = NULL; 188 reclaim_op = NULL;
178 if (GNUNET_SYSERR == success) { 189 if (GNUNET_SYSERR == success) {
179 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 190 fprintf (stderr,
180 "%s\n", emsg); 191 "%s\n", emsg);
181 } 192 }
182 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 193 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
183} 194}
184 195
185static void 196static void
186process_attrs (void *cls, 197process_attrs (void *cls,
187 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 198 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
188 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) 199 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
189{ 200{
190 char *value_str; 201 char *value_str;
202 const char* attr_type;
203
191 if (NULL == identity) 204 if (NULL == identity)
192 { 205 {
193 idp_op = NULL; 206 reclaim_op = NULL;
194 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 207 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
195 return; 208 return;
196 } 209 }
197 if (NULL == attr) 210 if (NULL == attr)
@@ -199,11 +212,12 @@ process_attrs (void *cls,
199 ret = 1; 212 ret = 1;
200 return; 213 return;
201 } 214 }
202 value_str = GNUNET_IDENTITY_ATTRIBUTE_value_to_string (attr->type, 215 value_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
203 attr->data, 216 attr->data,
204 attr->data_size); 217 attr->data_size);
205 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 218 attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
206 "%s: %s\n", attr->name, value_str); 219 fprintf (stdout,
220 "%s: %s [%s,v%u]\n", attr->name, value_str, attr_type, attr->version);
207} 221}
208 222
209 223
@@ -211,9 +225,9 @@ static void
211iter_error (void *cls) 225iter_error (void *cls)
212{ 226{
213 attr_iterator = NULL; 227 attr_iterator = NULL;
214 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 228 fprintf (stderr,
215 "Failed to iterate over attributes\n"); 229 "Failed to iterate over attributes\n");
216 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 230 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
217} 231}
218 232
219static void 233static void
@@ -221,28 +235,28 @@ timeout_task (void *cls)
221{ 235{
222 timeout = NULL; 236 timeout = NULL;
223 ret = 1; 237 ret = 1;
224 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 238 fprintf (stderr,
225 "Timeout\n"); 239 "Timeout\n");
226 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 240 if (NULL == cleanup_task)
241 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
227} 242}
228 243
229static void 244static void
230process_rvk (void *cls, int success, const char* msg) 245process_rvk (void *cls, int success, const char* msg)
231{ 246{
232 idp_op = NULL; 247 reclaim_op = NULL;
233 if (GNUNET_OK != success) 248 if (GNUNET_OK != success)
234 { 249 {
235 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 250 fprintf (stderr,
236 "Revocation failed.\n"); 251 "Revocation failed.\n");
237 ret = 1; 252 ret = 1;
238 } 253 }
239 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 254 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
240} 255}
241 256
242static void 257static void
243iter_finished (void *cls) 258iter_finished (void *cls)
244{ 259{
245 struct GNUNET_IDENTITY_ATTRIBUTE_Claim *claim;
246 char *data; 260 char *data;
247 size_t data_size; 261 size_t data_size;
248 int type; 262 int type;
@@ -250,27 +264,27 @@ iter_finished (void *cls)
250 attr_iterator = NULL; 264 attr_iterator = NULL;
251 if (list) 265 if (list)
252 { 266 {
253 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 267 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
254 return; 268 return;
255 } 269 }
256 270
257 if (issue_attrs) 271 if (issue_attrs)
258 { 272 {
259 idp_op = GNUNET_IDENTITY_PROVIDER_ticket_issue (idp_handle, 273 reclaim_op = GNUNET_RECLAIM_ticket_issue (reclaim_handle,
260 pkey, 274 pkey,
261 &rp_key, 275 &rp_key,
262 attr_list, 276 attr_list,
263 &ticket_issue_cb, 277 &ticket_issue_cb,
264 NULL); 278 NULL);
265 return; 279 return;
266 } 280 }
267 if (consume_ticket) 281 if (consume_ticket)
268 { 282 {
269 idp_op = GNUNET_IDENTITY_PROVIDER_ticket_consume (idp_handle, 283 reclaim_op = GNUNET_RECLAIM_ticket_consume (reclaim_handle,
270 pkey, 284 pkey,
271 &ticket, 285 &ticket,
272 &process_attrs, 286 &process_attrs,
273 NULL); 287 NULL);
274 timeout = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10), 288 timeout = GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_relative_multiply(GNUNET_TIME_UNIT_SECONDS, 10),
275 &timeout_task, 289 &timeout_task,
276 NULL); 290 NULL);
@@ -278,82 +292,112 @@ iter_finished (void *cls)
278 } 292 }
279 if (revoke_ticket) 293 if (revoke_ticket)
280 { 294 {
281 idp_op = GNUNET_IDENTITY_PROVIDER_ticket_revoke (idp_handle, 295 reclaim_op = GNUNET_RECLAIM_ticket_revoke (reclaim_handle,
282 pkey, 296 pkey,
283 &ticket, 297 &ticket,
284 &process_rvk, 298 &process_rvk,
285 NULL); 299 NULL);
286 return; 300 return;
287 } 301 }
288 if (attr_name) 302 if (attr_name)
289 { 303 {
290 if (NULL == type_str) 304 if (NULL == type_str)
291 type = GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING; 305 type = GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING;
292 else 306 else
293 type = GNUNET_IDENTITY_ATTRIBUTE_typename_to_number (type_str); 307 type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str);
294 308
295 GNUNET_assert (GNUNET_SYSERR != GNUNET_IDENTITY_ATTRIBUTE_string_to_value (type, 309 GNUNET_assert (GNUNET_SYSERR != GNUNET_RECLAIM_ATTRIBUTE_string_to_value (type,
296 attr_value, 310 attr_value,
297 (void**)&data, 311 (void**)&data,
298 &data_size)); 312 &data_size));
299 claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr_name, 313 if (NULL != claim)
300 type, 314 {
301 data, 315 claim->type = type;
302 data_size); 316 claim->data = data;
303 idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (idp_handle, 317 claim->data_size = data_size;
304 pkey, 318 }
305 claim, 319 else
306 &exp_interval, 320 {
307 &store_attr_cont, 321 claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr_name,
308 NULL); 322 type,
323 data,
324 data_size);
325 }
326 reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle,
327 pkey,
328 claim,
329 &exp_interval,
330 &store_attr_cont,
331 NULL);
332 GNUNET_free (data);
333 GNUNET_free (claim);
309 return; 334 return;
310 } 335 }
311 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); 336 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
312} 337}
313 338
314static void 339static void
315iter_cb (void *cls, 340iter_cb (void *cls,
316 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 341 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
317 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) 342 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
318{ 343{
319 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 344 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
320 char *attrs_tmp; 345 char *attrs_tmp;
321 char *attr_str; 346 char *attr_str;
347 const char *attr_type;
322 348
323 if (issue_attrs) 349 if ((NULL != attr_name) && (NULL != claim))
350 {
351 if (0 == strcasecmp (attr_name, attr->name))
352 {
353 claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
354 attr->type,
355 attr->data,
356 attr->data_size);
357 }
358 }
359 else if (issue_attrs)
324 { 360 {
325 attrs_tmp = GNUNET_strdup (issue_attrs); 361 attrs_tmp = GNUNET_strdup (issue_attrs);
326 attr_str = strtok (attrs_tmp, ","); 362 attr_str = strtok (attrs_tmp, ",");
327 while (NULL != attr_str) { 363 while (NULL != attr_str) {
328 if (0 != strcmp (attr_str, attr->name)) { 364 if (0 != strcasecmp (attr_str, attr->name)) {
329 attr_str = strtok (NULL, ","); 365 attr_str = strtok (NULL, ",");
330 continue; 366 continue;
331 } 367 }
332 le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); 368 le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
333 le->claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr->name, 369 le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name,
334 attr->type, 370 attr->type,
335 attr->data, 371 attr->data,
336 attr->data_size); 372 attr->data_size);
373 le->claim->version = attr->version;
337 GNUNET_CONTAINER_DLL_insert (attr_list->list_head, 374 GNUNET_CONTAINER_DLL_insert (attr_list->list_head,
338 attr_list->list_tail, 375 attr_list->list_tail,
339 le); 376 le);
340 break; 377 break;
341 } 378 }
342 GNUNET_free (attrs_tmp); 379 GNUNET_free (attrs_tmp);
343 } else if (list) { 380 }
344 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 381 else if (list)
345 "%s: %s\n", attr->name, (char*)attr->data); 382 {
383 attr_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
384 attr->data,
385 attr->data_size);
386 attr_type = GNUNET_RECLAIM_ATTRIBUTE_number_to_typename (attr->type);
387 fprintf (stdout,
388 "%s: %s [%s,v%u]\n", attr->name, attr_str, attr_type, attr->version);
346 } 389 }
347 GNUNET_IDENTITY_PROVIDER_get_attributes_next (attr_iterator); 390 GNUNET_RECLAIM_get_attributes_next (attr_iterator);
348} 391}
349 392
350static void 393static void
351ego_iter_finished (void *cls) 394start_get_attributes ()
352{ 395{
353 if (NULL == pkey) 396 if (NULL == pkey)
354 { 397 {
355 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 398 fprintf (stderr,
356 "Ego %s not found\n", ego_name); 399 "Ego %s not found\n", ego_name);
400 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
357 return; 401 return;
358 } 402 }
359 403
@@ -365,24 +409,23 @@ ego_iter_finished (void *cls)
365 GNUNET_STRINGS_string_to_data (consume_ticket, 409 GNUNET_STRINGS_string_to_data (consume_ticket,
366 strlen (consume_ticket), 410 strlen (consume_ticket),
367 &ticket, 411 &ticket,
368 sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); 412 sizeof (struct GNUNET_RECLAIM_Ticket));
369 if (NULL != revoke_ticket) 413 if (NULL != revoke_ticket)
370 GNUNET_STRINGS_string_to_data (revoke_ticket, 414 GNUNET_STRINGS_string_to_data (revoke_ticket,
371 strlen (revoke_ticket), 415 strlen (revoke_ticket),
372 &ticket, 416 &ticket,
373 sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); 417 sizeof (struct GNUNET_RECLAIM_Ticket));
374
375
376 attr_list = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList);
377 418
378 attr_iterator = GNUNET_IDENTITY_PROVIDER_get_attributes_start (idp_handle, 419 attr_list = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
379 pkey, 420 claim = NULL;
380 &iter_error, 421 attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
381 NULL, 422 pkey,
382 &iter_cb, 423 &iter_error,
383 NULL, 424 NULL,
384 &iter_finished, 425 &iter_cb,
385 NULL); 426 NULL,
427 &iter_finished,
428 NULL);
386 429
387 430
388} 431}
@@ -398,7 +441,7 @@ ego_cb (void *cls,
398 if (NULL == name) { 441 if (NULL == name) {
399 if (GNUNET_YES == init) { 442 if (GNUNET_YES == init) {
400 init = GNUNET_NO; 443 init = GNUNET_NO;
401 GNUNET_SCHEDULER_add_now (&ego_iter_finished, NULL); 444 start_get_attributes();
402 } 445 }
403 return; 446 return;
404 } 447 }
@@ -418,28 +461,28 @@ run (void *cls,
418 if (NULL == ego_name) 461 if (NULL == ego_name)
419 { 462 {
420 ret = 1; 463 ret = 1;
421 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 464 fprintf (stderr,
422 _("Ego is required\n")); 465 _("Ego is required\n"));
423 return; 466 return;
424 } 467 }
425 468
426 if ( (NULL == attr_value) && (NULL != attr_name) ) 469 if ( (NULL == attr_value) && (NULL != attr_name) )
427 { 470 {
428 ret = 1; 471 ret = 1;
429 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 472 fprintf (stderr,
430 _("Attribute value missing!\n")); 473 _("Attribute value missing!\n"));
431 return; 474 return;
432 } 475 }
433 476
434 if ( (NULL == rp) && (NULL != issue_attrs) ) 477 if ( (NULL == rp) && (NULL != issue_attrs) )
435 { 478 {
436 ret = 1; 479 ret = 1;
437 GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, 480 fprintf (stderr,
438 _("Requesting party key is required!\n")); 481 _("Requesting party key is required!\n"));
439 return; 482 return;
440 } 483 }
441 484
442 idp_handle = GNUNET_IDENTITY_PROVIDER_connect (c); 485 reclaim_handle = GNUNET_RECLAIM_connect (c);
443 //Get Ego 486 //Get Ego
444 identity_handle = GNUNET_IDENTITY_connect (c, 487 identity_handle = GNUNET_IDENTITY_connect (c,
445 &ego_cb, 488 &ego_cb,
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/reclaim/gnunet-service-reclaim.c
index c53e72477..3321a79d8 100644
--- a/src/identity-provider/gnunet-service-identity-provider.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -17,8 +17,8 @@
17 */ 17 */
18/** 18/**
19 * @author Martin Schanzenbach 19 * @author Martin Schanzenbach
20 * @file src/identity-provider/gnunet-service-identity-provider.c 20 * @file src/reclaim/gnunet-service-reclaim.c
21 * @brief Identity Token Service 21 * @brief reclaim Service
22 * 22 *
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
@@ -32,10 +32,10 @@
32#include "gnunet_credential_service.h" 32#include "gnunet_credential_service.h"
33#include "gnunet_statistics_service.h" 33#include "gnunet_statistics_service.h"
34#include "gnunet_gns_service.h" 34#include "gnunet_gns_service.h"
35#include "gnunet_identity_provider_plugin.h" 35#include "gnunet_reclaim_plugin.h"
36#include "gnunet_identity_attribute_lib.h" 36#include "gnunet_reclaim_attribute_lib.h"
37#include "gnunet_signatures.h" 37#include "gnunet_signatures.h"
38#include "identity_provider.h" 38#include "reclaim.h"
39 39
40/** 40/**
41 * First pass state 41 * First pass state
@@ -65,7 +65,7 @@ static struct GNUNET_IDENTITY_Handle *identity_handle;
65/** 65/**
66 * Database handle 66 * Database handle
67 */ 67 */
68static struct GNUNET_IDENTITY_PROVIDER_PluginFunctions *TKT_database; 68static struct GNUNET_RECLAIM_PluginFunctions *TKT_database;
69 69
70/** 70/**
71 * Name of DB plugin 71 * Name of DB plugin
@@ -396,7 +396,7 @@ struct AttributeStoreHandle
396 /** 396 /**
397 * The attribute to store 397 * The attribute to store
398 */ 398 */
399 struct GNUNET_IDENTITY_ATTRIBUTE_Claim *claim; 399 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *claim;
400 400
401 /** 401 /**
402 * The attribute expiration interval 402 * The attribute expiration interval
@@ -433,7 +433,7 @@ struct ConsumeTicketHandle
433 /** 433 /**
434 * Ticket 434 * Ticket
435 */ 435 */
436 struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 436 struct GNUNET_RECLAIM_Ticket ticket;
437 437
438 /** 438 /**
439 * LookupRequest 439 * LookupRequest
@@ -473,7 +473,7 @@ struct ConsumeTicketHandle
473 /** 473 /**
474 * Attributes 474 * Attributes
475 */ 475 */
476 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; 476 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
477 477
478 /** 478 /**
479 * Lookup time 479 * Lookup time
@@ -535,12 +535,12 @@ struct TicketRevocationHandle
535 /** 535 /**
536 * Attributes to reissue 536 * Attributes to reissue
537 */ 537 */
538 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; 538 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
539 539
540 /** 540 /**
541 * Attributes to revoke 541 * Attributes to revoke
542 */ 542 */
543 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *rvk_attrs; 543 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *rvk_attrs;
544 544
545 /** 545 /**
546 * Issuer Key 546 * Issuer Key
@@ -550,7 +550,7 @@ struct TicketRevocationHandle
550 /** 550 /**
551 * Ticket to issue 551 * Ticket to issue
552 */ 552 */
553 struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 553 struct GNUNET_RECLAIM_Ticket ticket;
554 554
555 /** 555 /**
556 * QueueEntry 556 * QueueEntry
@@ -603,7 +603,7 @@ struct TicketIssueHandle
603 /** 603 /**
604 * Attributes to issue 604 * Attributes to issue
605 */ 605 */
606 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; 606 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
607 607
608 /** 608 /**
609 * Issuer Key 609 * Issuer Key
@@ -613,7 +613,7 @@ struct TicketIssueHandle
613 /** 613 /**
614 * Ticket to issue 614 * Ticket to issue
615 */ 615 */
616 struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 616 struct GNUNET_RECLAIM_Ticket ticket;
617 617
618 /** 618 /**
619 * QueueEntry 619 * QueueEntry
@@ -861,7 +861,7 @@ static void
861cleanup_ticket_issue_handle (struct TicketIssueHandle *handle) 861cleanup_ticket_issue_handle (struct TicketIssueHandle *handle)
862{ 862{
863 if (NULL != handle->attrs) 863 if (NULL != handle->attrs)
864 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); 864 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (handle->attrs);
865 if (NULL != handle->ns_qe) 865 if (NULL != handle->ns_qe)
866 GNUNET_NAMESTORE_cancel (handle->ns_qe); 866 GNUNET_NAMESTORE_cancel (handle->ns_qe);
867 GNUNET_free (handle); 867 GNUNET_free (handle);
@@ -871,12 +871,12 @@ cleanup_ticket_issue_handle (struct TicketIssueHandle *handle)
871static void 871static void
872send_ticket_result (struct IdpClient *client, 872send_ticket_result (struct IdpClient *client,
873 uint32_t r_id, 873 uint32_t r_id,
874 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 874 const struct GNUNET_RECLAIM_Ticket *ticket,
875 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) 875 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
876{ 876{
877 struct TicketResultMessage *irm; 877 struct TicketResultMessage *irm;
878 struct GNUNET_MQ_Envelope *env; 878 struct GNUNET_MQ_Envelope *env;
879 struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket_buf; 879 struct GNUNET_RECLAIM_Ticket *ticket_buf;
880 880
881 /* store ticket in DB */ 881 /* store ticket in DB */
882 if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls, 882 if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls,
@@ -889,9 +889,9 @@ send_ticket_result (struct IdpClient *client,
889 } 889 }
890 890
891 env = GNUNET_MQ_msg_extra (irm, 891 env = GNUNET_MQ_msg_extra (irm,
892 sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket), 892 sizeof (struct GNUNET_RECLAIM_Ticket),
893 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT); 893 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
894 ticket_buf = (struct GNUNET_IDENTITY_PROVIDER_Ticket *)&irm[1]; 894 ticket_buf = (struct GNUNET_RECLAIM_Ticket *)&irm[1];
895 *ticket_buf = *ticket; 895 *ticket_buf = *ticket;
896 irm->id = htonl (r_id); 896 irm->id = htonl (r_id);
897 GNUNET_MQ_send (client->mq, 897 GNUNET_MQ_send (client->mq,
@@ -927,14 +927,14 @@ store_ticket_issue_cont (void *cls,
927 927
928 928
929int 929int
930serialize_abe_keyinfo2 (const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 930serialize_abe_keyinfo2 (const struct GNUNET_RECLAIM_Ticket *ticket,
931 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, 931 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
932 const struct GNUNET_ABE_AbeKey *rp_key, 932 const struct GNUNET_ABE_AbeKey *rp_key,
933 struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey, 933 struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey,
934 char **result) 934 char **result)
935{ 935{
936 struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey; 936 struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey;
937 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 937 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
938 char *enc_keyinfo; 938 char *enc_keyinfo;
939 char *serialized_key; 939 char *serialized_key;
940 char *buf; 940 char *buf;
@@ -1009,7 +1009,7 @@ issue_ticket_after_abe_bootstrap (void *cls,
1009 struct GNUNET_ABE_AbeMasterKey *abe_key) 1009 struct GNUNET_ABE_AbeMasterKey *abe_key)
1010{ 1010{
1011 struct TicketIssueHandle *ih = cls; 1011 struct TicketIssueHandle *ih = cls;
1012 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 1012 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
1013 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; 1013 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
1014 struct GNUNET_GNSRECORD_Data code_record[1]; 1014 struct GNUNET_GNSRECORD_Data code_record[1];
1015 struct GNUNET_ABE_AbeKey *rp_key; 1015 struct GNUNET_ABE_AbeKey *rp_key;
@@ -1101,7 +1101,7 @@ handle_issue_ticket_message (void *cls,
1101 1101
1102 ih = GNUNET_new (struct TicketIssueHandle); 1102 ih = GNUNET_new (struct TicketIssueHandle);
1103 attrs_len = ntohs (im->attr_len); 1103 attrs_len = ntohs (im->attr_len);
1104 ih->attrs = GNUNET_IDENTITY_ATTRIBUTE_list_deserialize ((char*)&im[1], attrs_len); 1104 ih->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char*)&im[1], attrs_len);
1105 ih->r_id = ntohl (im->id); 1105 ih->r_id = ntohl (im->id);
1106 ih->client = idp; 1106 ih->client = idp;
1107 ih->identity = im->identity; 1107 ih->identity = im->identity;
@@ -1132,9 +1132,9 @@ static void
1132cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh) 1132cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh)
1133{ 1133{
1134 if (NULL != rh->attrs) 1134 if (NULL != rh->attrs)
1135 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (rh->attrs); 1135 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->attrs);
1136 if (NULL != rh->rvk_attrs) 1136 if (NULL != rh->rvk_attrs)
1137 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (rh->rvk_attrs); 1137 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->rvk_attrs);
1138 if (NULL != rh->abe_key) 1138 if (NULL != rh->abe_key)
1139 GNUNET_ABE_cpabe_delete_master_key (rh->abe_key); 1139 GNUNET_ABE_cpabe_delete_master_key (rh->abe_key);
1140 if (NULL != rh->ns_qe) 1140 if (NULL != rh->ns_qe)
@@ -1157,9 +1157,12 @@ send_revocation_finished (struct TicketRevocationHandle *rh,
1157{ 1157{
1158 struct GNUNET_MQ_Envelope *env; 1158 struct GNUNET_MQ_Envelope *env;
1159 struct RevokeTicketResultMessage *trm; 1159 struct RevokeTicketResultMessage *trm;
1160
1161 GNUNET_break(TKT_database->delete_ticket (TKT_database->cls,
1162 &rh->ticket));
1160 1163
1161 env = GNUNET_MQ_msg (trm, 1164 env = GNUNET_MQ_msg (trm,
1162 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET_RESULT); 1165 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT);
1163 trm->id = htonl (rh->r_id); 1166 trm->id = htonl (rh->r_id);
1164 trm->success = htonl (success); 1167 trm->success = htonl (success);
1165 GNUNET_MQ_send (rh->client->mq, 1168 GNUNET_MQ_send (rh->client->mq,
@@ -1179,8 +1182,8 @@ send_revocation_finished (struct TicketRevocationHandle *rh,
1179 */ 1182 */
1180static void 1183static void
1181ticket_reissue_proc (void *cls, 1184ticket_reissue_proc (void *cls,
1182 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 1185 const struct GNUNET_RECLAIM_Ticket *ticket,
1183 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs); 1186 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs);
1184 1187
1185static void 1188static void
1186revocation_reissue_tickets (struct TicketRevocationHandle *rh); 1189revocation_reissue_tickets (struct TicketRevocationHandle *rh);
@@ -1206,9 +1209,6 @@ reissue_ticket_cont (void *cls,
1206 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", 1209 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n",
1207 "Unknown Error\n"); 1210 "Unknown Error\n");
1208 send_revocation_finished (rh, GNUNET_SYSERR); 1211 send_revocation_finished (rh, GNUNET_SYSERR);
1209 GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
1210 rh->client->revoke_op_tail,
1211 rh);
1212 cleanup_revoke_ticket_handle (rh); 1212 cleanup_revoke_ticket_handle (rh);
1213 return; 1213 return;
1214 } 1214 }
@@ -1226,12 +1226,12 @@ reissue_ticket_cont (void *cls,
1226 */ 1226 */
1227static void 1227static void
1228ticket_reissue_proc (void *cls, 1228ticket_reissue_proc (void *cls,
1229 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 1229 const struct GNUNET_RECLAIM_Ticket *ticket,
1230 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) 1230 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
1231{ 1231{
1232 struct TicketRevocationHandle *rh = cls; 1232 struct TicketRevocationHandle *rh = cls;
1233 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 1233 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
1234 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le_rollover; 1234 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le_rollover;
1235 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; 1235 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
1236 struct GNUNET_GNSRECORD_Data code_record[1]; 1236 struct GNUNET_GNSRECORD_Data code_record[1];
1237 struct GNUNET_ABE_AbeKey *rp_key; 1237 struct GNUNET_ABE_AbeKey *rp_key;
@@ -1258,9 +1258,18 @@ ticket_reissue_proc (void *cls,
1258 { 1258 {
1259 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1259 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1260 "Do not reissue for this identity.!\n"); 1260 "Do not reissue for this identity.!\n");
1261 1261 label = GNUNET_STRINGS_data_to_string_alloc (&rh->ticket.rnd,
1262 rh->offset++; 1262 sizeof (uint64_t));
1263 GNUNET_SCHEDULER_add_now (&reissue_next, rh); 1263 //Delete record
1264 rh->ns_qe = GNUNET_NAMESTORE_records_store (ns_handle,
1265 &rh->identity,
1266 label,
1267 0,
1268 NULL,
1269 &reissue_ticket_cont,
1270 rh);
1271
1272 GNUNET_free (label);
1264 return; 1273 return;
1265 } 1274 }
1266 1275
@@ -1374,9 +1383,6 @@ revocation_reissue_tickets (struct TicketRevocationHandle *rh)
1374 if (GNUNET_NO == ret) 1383 if (GNUNET_NO == ret)
1375 { 1384 {
1376 send_revocation_finished (rh, GNUNET_OK); 1385 send_revocation_finished (rh, GNUNET_OK);
1377 GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
1378 rh->client->revoke_op_tail,
1379 rh);
1380 cleanup_revoke_ticket_handle (rh); 1386 cleanup_revoke_ticket_handle (rh);
1381 return; 1387 return;
1382 } 1388 }
@@ -1391,10 +1397,8 @@ check_attr_error (void *cls)
1391 struct TicketRevocationHandle *rh = cls; 1397 struct TicketRevocationHandle *rh = cls;
1392 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1398 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1393 "Unable to check for existing attribute\n"); 1399 "Unable to check for existing attribute\n");
1400 rh->ns_qe = NULL;
1394 send_revocation_finished (rh, GNUNET_SYSERR); 1401 send_revocation_finished (rh, GNUNET_SYSERR);
1395 GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
1396 rh->client->revoke_op_tail,
1397 rh);
1398 cleanup_revoke_ticket_handle (rh); 1402 cleanup_revoke_ticket_handle (rh);
1399} 1403}
1400 1404
@@ -1426,17 +1430,18 @@ check_attr_cb (void *cls,
1426 char* policy; 1430 char* policy;
1427 uint32_t attr_ver; 1431 uint32_t attr_ver;
1428 1432
1433 rh->ns_qe = NULL;
1429 if (1 != rd_count) { 1434 if (1 != rd_count) {
1430 GNUNET_SCHEDULER_add_now (&reenc_next_attribute, 1435 GNUNET_SCHEDULER_add_now (&reenc_next_attribute,
1431 rh); 1436 rh);
1432 return; 1437 return;
1433 } 1438 }
1434 1439
1435 buf_size = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (rh->attrs->list_head->claim); 1440 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (rh->attrs->list_head->claim);
1436 buf = GNUNET_malloc (buf_size); 1441 buf = GNUNET_malloc (buf_size);
1437 GNUNET_IDENTITY_ATTRIBUTE_serialize (rh->attrs->list_head->claim,
1438 buf);
1439 rh->attrs->list_head->claim->version++; 1442 rh->attrs->list_head->claim->version++;
1443 GNUNET_RECLAIM_ATTRIBUTE_serialize (rh->attrs->list_head->claim,
1444 buf);
1440 GNUNET_asprintf (&policy, "%s_%lu", 1445 GNUNET_asprintf (&policy, "%s_%lu",
1441 rh->attrs->list_head->claim->name, 1446 rh->attrs->list_head->claim->name,
1442 rh->attrs->list_head->claim->version); 1447 rh->attrs->list_head->claim->version);
@@ -1458,9 +1463,6 @@ check_attr_cb (void *cls,
1458 policy); 1463 policy);
1459 GNUNET_free (policy); 1464 GNUNET_free (policy);
1460 send_revocation_finished (rh, GNUNET_SYSERR); 1465 send_revocation_finished (rh, GNUNET_SYSERR);
1461 GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
1462 rh->client->revoke_op_tail,
1463 rh);
1464 cleanup_revoke_ticket_handle (rh); 1466 cleanup_revoke_ticket_handle (rh);
1465 return; 1467 return;
1466 } 1468 }
@@ -1525,8 +1527,9 @@ attr_reenc_cont (void *cls,
1525 const char *emsg) 1527 const char *emsg)
1526{ 1528{
1527 struct TicketRevocationHandle *rh = cls; 1529 struct TicketRevocationHandle *rh = cls;
1528 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 1530 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
1529 1531
1532 rh->ns_qe = NULL;
1530 if (GNUNET_SYSERR == success) 1533 if (GNUNET_SYSERR == success)
1531 { 1534 {
1532 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1535 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -1558,12 +1561,12 @@ attr_reenc_cont (void *cls,
1558 1561
1559static void 1562static void
1560process_attributes_to_update (void *cls, 1563process_attributes_to_update (void *cls,
1561 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 1564 const struct GNUNET_RECLAIM_Ticket *ticket,
1562 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) 1565 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
1563{ 1566{
1564 struct TicketRevocationHandle *rh = cls; 1567 struct TicketRevocationHandle *rh = cls;
1565 1568
1566 rh->attrs = GNUNET_IDENTITY_ATTRIBUTE_list_dup (attrs); 1569 rh->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_dup (attrs);
1567 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1570 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1568 "Revocation Phase I: Collecting attributes\n"); 1571 "Revocation Phase I: Collecting attributes\n");
1569 /* Reencrypt all attributes with new key */ 1572 /* Reencrypt all attributes with new key */
@@ -1571,9 +1574,6 @@ process_attributes_to_update (void *cls,
1571 { 1574 {
1572 /* No attributes to reencrypt */ 1575 /* No attributes to reencrypt */
1573 send_revocation_finished (rh, GNUNET_OK); 1576 send_revocation_finished (rh, GNUNET_OK);
1574 GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head,
1575 rh->client->revoke_op_tail,
1576 rh);
1577 cleanup_revoke_ticket_handle (rh); 1577 cleanup_revoke_ticket_handle (rh);
1578 return; 1578 return;
1579 } else { 1579 } else {
@@ -1621,11 +1621,11 @@ handle_revoke_ticket_message (void *cls,
1621{ 1621{
1622 struct TicketRevocationHandle *rh; 1622 struct TicketRevocationHandle *rh;
1623 struct IdpClient *idp = cls; 1623 struct IdpClient *idp = cls;
1624 struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket; 1624 struct GNUNET_RECLAIM_Ticket *ticket;
1625 1625
1626 rh = GNUNET_new (struct TicketRevocationHandle); 1626 rh = GNUNET_new (struct TicketRevocationHandle);
1627 ticket = (struct GNUNET_IDENTITY_PROVIDER_Ticket*)&rm[1]; 1627 ticket = (struct GNUNET_RECLAIM_Ticket*)&rm[1];
1628 rh->rvk_attrs = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); 1628 rh->rvk_attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
1629 rh->ticket = *ticket; 1629 rh->ticket = *ticket;
1630 rh->r_id = ntohl (rm->id); 1630 rh->r_id = ntohl (rm->id);
1631 rh->client = idp; 1631 rh->client = idp;
@@ -1667,7 +1667,7 @@ cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle)
1667 GNUNET_ABE_cpabe_delete_key (handle->key, 1667 GNUNET_ABE_cpabe_delete_key (handle->key,
1668 GNUNET_YES); 1668 GNUNET_YES);
1669 if (NULL != handle->attrs) 1669 if (NULL != handle->attrs)
1670 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs); 1670 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (handle->attrs);
1671 GNUNET_free (handle); 1671 GNUNET_free (handle);
1672} 1672}
1673 1673
@@ -1698,7 +1698,7 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1698 struct ConsumeTicketHandle *handle = parallel_lookup->handle; 1698 struct ConsumeTicketHandle *handle = parallel_lookup->handle;
1699 struct ConsumeTicketResultMessage *crm; 1699 struct ConsumeTicketResultMessage *crm;
1700 struct GNUNET_MQ_Envelope *env; 1700 struct GNUNET_MQ_Envelope *env;
1701 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *attr_le; 1701 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le;
1702 struct GNUNET_TIME_Absolute decrypt_duration; 1702 struct GNUNET_TIME_Absolute decrypt_duration;
1703 char *data; 1703 char *data;
1704 char *data_tmp; 1704 char *data_tmp;
@@ -1741,8 +1741,8 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1741 1, 1741 1,
1742 GNUNET_YES); 1742 GNUNET_YES);
1743 1743
1744 attr_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); 1744 attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
1745 attr_le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (data, 1745 attr_le->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (data,
1746 attr_len); 1746 attr_len);
1747 attr_le->claim->version = ntohl(*(uint32_t*)rd->data); 1747 attr_le->claim->version = ntohl(*(uint32_t*)rd->data);
1748 GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head, 1748 GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head,
@@ -1766,15 +1766,15 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1766 } 1766 }
1767 1767
1768 GNUNET_SCHEDULER_cancel (handle->kill_task); 1768 GNUNET_SCHEDULER_cancel (handle->kill_task);
1769 attrs_len = GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (handle->attrs); 1769 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (handle->attrs);
1770 env = GNUNET_MQ_msg_extra (crm, 1770 env = GNUNET_MQ_msg_extra (crm,
1771 attrs_len, 1771 attrs_len,
1772 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET_RESULT); 1772 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT);
1773 crm->id = htonl (handle->r_id); 1773 crm->id = htonl (handle->r_id);
1774 crm->attrs_len = htons (attrs_len); 1774 crm->attrs_len = htons (attrs_len);
1775 crm->identity = handle->ticket.identity; 1775 crm->identity = handle->ticket.identity;
1776 data_tmp = (char *) &crm[1]; 1776 data_tmp = (char *) &crm[1];
1777 GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs, 1777 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (handle->attrs,
1778 data_tmp); 1778 data_tmp);
1779 GNUNET_MQ_send (handle->client->mq, env); 1779 GNUNET_MQ_send (handle->client->mq, env);
1780 GNUNET_CONTAINER_DLL_remove (handle->client->consume_op_head, 1780 GNUNET_CONTAINER_DLL_remove (handle->client->consume_op_head,
@@ -1805,7 +1805,7 @@ abort_parallel_lookups2 (void *cls)
1805 lu = tmp; 1805 lu = tmp;
1806 } 1806 }
1807 env = GNUNET_MQ_msg (arm, 1807 env = GNUNET_MQ_msg (arm,
1808 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_RESULT); 1808 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
1809 arm->id = htonl (handle->r_id); 1809 arm->id = htonl (handle->r_id);
1810 arm->attr_len = htons (0); 1810 arm->attr_len = htons (0);
1811 GNUNET_MQ_send (handle->client->mq, env); 1811 GNUNET_MQ_send (handle->client->mq, env);
@@ -1918,10 +1918,10 @@ handle_consume_ticket_message (void *cls,
1918 ch->r_id = ntohl (cm->id); 1918 ch->r_id = ntohl (cm->id);
1919 ch->client = idp; 1919 ch->client = idp;
1920 ch->identity = cm->identity; 1920 ch->identity = cm->identity;
1921 ch->attrs = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); 1921 ch->attrs = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
1922 GNUNET_CRYPTO_ecdsa_key_get_public (&ch->identity, 1922 GNUNET_CRYPTO_ecdsa_key_get_public (&ch->identity,
1923 &ch->identity_pub); 1923 &ch->identity_pub);
1924 ch->ticket = *((struct GNUNET_IDENTITY_PROVIDER_Ticket*)&cm[1]); 1924 ch->ticket = *((struct GNUNET_RECLAIM_Ticket*)&cm[1]);
1925 rnd_label = GNUNET_STRINGS_data_to_string_alloc (&ch->ticket.rnd, 1925 rnd_label = GNUNET_STRINGS_data_to_string_alloc (&ch->ticket.rnd,
1926 sizeof (uint64_t)); 1926 sizeof (uint64_t));
1927 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1927 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1967,7 +1967,7 @@ attr_store_cont (void *cls,
1967 struct AttributeStoreHandle *as_handle = cls; 1967 struct AttributeStoreHandle *as_handle = cls;
1968 struct GNUNET_MQ_Envelope *env; 1968 struct GNUNET_MQ_Envelope *env;
1969 struct AttributeStoreResultMessage *acr_msg; 1969 struct AttributeStoreResultMessage *acr_msg;
1970 1970
1971 as_handle->ns_qe = NULL; 1971 as_handle->ns_qe = NULL;
1972 GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head, 1972 GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head,
1973 as_handle->client->store_op_tail, 1973 as_handle->client->store_op_tail,
@@ -1986,7 +1986,7 @@ attr_store_cont (void *cls,
1986 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1986 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1987 "Sending ATTRIBUTE_STORE_RESPONSE message\n"); 1987 "Sending ATTRIBUTE_STORE_RESPONSE message\n");
1988 env = GNUNET_MQ_msg (acr_msg, 1988 env = GNUNET_MQ_msg (acr_msg,
1989 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE_RESPONSE); 1989 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE);
1990 acr_msg->id = htonl (as_handle->r_id); 1990 acr_msg->id = htonl (as_handle->r_id);
1991 acr_msg->op_result = htonl (GNUNET_OK); 1991 acr_msg->op_result = htonl (GNUNET_OK);
1992 GNUNET_MQ_send (as_handle->client->mq, 1992 GNUNET_MQ_send (as_handle->client->mq,
@@ -2009,10 +2009,10 @@ attr_store_task (void *cls)
2009 2009
2010 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2010 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2011 "Storing attribute\n"); 2011 "Storing attribute\n");
2012 buf_size = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (as_handle->claim); 2012 buf_size = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (as_handle->claim);
2013 buf = GNUNET_malloc (buf_size); 2013 buf = GNUNET_malloc (buf_size);
2014 2014
2015 GNUNET_IDENTITY_ATTRIBUTE_serialize (as_handle->claim, 2015 GNUNET_RECLAIM_ATTRIBUTE_serialize (as_handle->claim,
2016 buf); 2016 buf);
2017 2017
2018 GNUNET_asprintf (&policy, 2018 GNUNET_asprintf (&policy,
@@ -2111,7 +2111,7 @@ handle_attribute_store_message (void *cls,
2111 data_len = ntohs (sam->attr_len); 2111 data_len = ntohs (sam->attr_len);
2112 2112
2113 as_handle = GNUNET_new (struct AttributeStoreHandle); 2113 as_handle = GNUNET_new (struct AttributeStoreHandle);
2114 as_handle->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&sam[1], 2114 as_handle->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&sam[1],
2115 data_len); 2115 data_len);
2116 2116
2117 as_handle->r_id = ntohl (sam->id); 2117 as_handle->r_id = ntohl (sam->id);
@@ -2158,7 +2158,7 @@ attr_iter_finished (void *cls)
2158 struct AttributeResultMessage *arm; 2158 struct AttributeResultMessage *arm;
2159 2159
2160 env = GNUNET_MQ_msg (arm, 2160 env = GNUNET_MQ_msg (arm,
2161 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_RESULT); 2161 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
2162 arm->id = htonl (ai->request_id); 2162 arm->id = htonl (ai->request_id);
2163 arm->attr_len = htons (0); 2163 arm->attr_len = htons (0);
2164 GNUNET_MQ_send (ai->client->mq, env); 2164 GNUNET_MQ_send (ai->client->mq, env);
@@ -2189,14 +2189,14 @@ attr_iter_cb (void *cls,
2189 if (rd_count != 1) 2189 if (rd_count != 1)
2190 { 2190 {
2191 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 2191 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
2192 1); 2192 1);
2193 return; 2193 return;
2194 } 2194 }
2195 2195
2196 if (GNUNET_GNSRECORD_TYPE_ID_ATTR != rd->record_type) 2196 if (GNUNET_GNSRECORD_TYPE_ID_ATTR != rd->record_type)
2197 { 2197 {
2198 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 2198 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
2199 1); 2199 1);
2200 return; 2200 return;
2201 } 2201 }
2202 attr_ver = ntohl(*((uint32_t*)rd->data)); 2202 attr_ver = ntohl(*((uint32_t*)rd->data));
@@ -2213,7 +2213,7 @@ attr_iter_cb (void *cls,
2213 if (GNUNET_SYSERR == msg_extra_len) 2213 if (GNUNET_SYSERR == msg_extra_len)
2214 { 2214 {
2215 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 2215 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
2216 1); 2216 1);
2217 return; 2217 return;
2218 } 2218 }
2219 2219
@@ -2224,7 +2224,7 @@ attr_iter_cb (void *cls,
2224 "Found attribute: %s\n", label); 2224 "Found attribute: %s\n", label);
2225 env = GNUNET_MQ_msg_extra (arm, 2225 env = GNUNET_MQ_msg_extra (arm,
2226 msg_extra_len, 2226 msg_extra_len,
2227 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_RESULT); 2227 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
2228 arm->id = htonl (ai->request_id); 2228 arm->id = htonl (ai->request_id);
2229 arm->attr_len = htons (msg_extra_len); 2229 arm->attr_len = htons (msg_extra_len);
2230 GNUNET_CRYPTO_ecdsa_key_get_public (zone, 2230 GNUNET_CRYPTO_ecdsa_key_get_public (zone,
@@ -2264,7 +2264,7 @@ iterate_next_after_abe_bootstrap (void *cls,
2264 struct AttributeIterator *ai = cls; 2264 struct AttributeIterator *ai = cls;
2265 ai->abe_key = abe_key; 2265 ai->abe_key = abe_key;
2266 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 2266 GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it,
2267 1); 2267 1);
2268} 2268}
2269 2269
2270 2270
@@ -2406,8 +2406,8 @@ cleanup_ticket_iter_handle (struct TicketIteration *ti)
2406 */ 2406 */
2407static void 2407static void
2408ticket_iterate_proc (void *cls, 2408ticket_iterate_proc (void *cls,
2409 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 2409 const struct GNUNET_RECLAIM_Ticket *ticket,
2410 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) 2410 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
2411{ 2411{
2412 struct TicketIterationProcResult *proc = cls; 2412 struct TicketIterationProcResult *proc = cls;
2413 2413
@@ -2467,7 +2467,7 @@ run_ticket_iteration_round (struct TicketIteration *ti)
2467 } 2467 }
2468 /* send empty response to indicate end of list */ 2468 /* send empty response to indicate end of list */
2469 env = GNUNET_MQ_msg (trm, 2469 env = GNUNET_MQ_msg (trm,
2470 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT); 2470 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
2471 trm->id = htonl (ti->r_id); 2471 trm->id = htonl (ti->r_id);
2472 GNUNET_MQ_send (ti->client->mq, 2472 GNUNET_MQ_send (ti->client->mq,
2473 env); 2473 env);
@@ -2572,7 +2572,7 @@ run (void *cls,
2572 char *database; 2572 char *database;
2573 cfg = c; 2573 cfg = c;
2574 2574
2575 stats = GNUNET_STATISTICS_create ("identity-provider", cfg); 2575 stats = GNUNET_STATISTICS_create ("reclaim", cfg);
2576 2576
2577 //Connect to identity and namestore services 2577 //Connect to identity and namestore services
2578 ns_handle = GNUNET_NAMESTORE_connect (cfg); 2578 ns_handle = GNUNET_NAMESTORE_connect (cfg);
@@ -2597,13 +2597,13 @@ run (void *cls,
2597 /* Loading DB plugin */ 2597 /* Loading DB plugin */
2598 if (GNUNET_OK != 2598 if (GNUNET_OK !=
2599 GNUNET_CONFIGURATION_get_value_string (cfg, 2599 GNUNET_CONFIGURATION_get_value_string (cfg,
2600 "identity-provider", 2600 "reclaim",
2601 "database", 2601 "database",
2602 &database)) 2602 &database))
2603 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 2603 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2604 "No database backend configured\n"); 2604 "No database backend configured\n");
2605 GNUNET_asprintf (&db_lib_name, 2605 GNUNET_asprintf (&db_lib_name,
2606 "libgnunet_plugin_identity_provider_%s", 2606 "libgnunet_plugin_reclaim_%s",
2607 database); 2607 database);
2608 TKT_database = GNUNET_PLUGIN_load (db_lib_name, 2608 TKT_database = GNUNET_PLUGIN_load (db_lib_name,
2609 (void *) cfg); 2609 (void *) cfg);
@@ -2619,7 +2619,7 @@ run (void *cls,
2619 2619
2620 if (GNUNET_OK == 2620 if (GNUNET_OK ==
2621 GNUNET_CONFIGURATION_get_value_time (cfg, 2621 GNUNET_CONFIGURATION_get_value_time (cfg,
2622 "identity-provider", 2622 "reclaim",
2623 "TOKEN_EXPIRATION_INTERVAL", 2623 "TOKEN_EXPIRATION_INTERVAL",
2624 &token_expiration_interval)) 2624 &token_expiration_interval))
2625 { 2625 {
@@ -2736,51 +2736,51 @@ client_connect_cb (void *cls,
2736 * Define "main" method using service macro. 2736 * Define "main" method using service macro.
2737 */ 2737 */
2738GNUNET_SERVICE_MAIN 2738GNUNET_SERVICE_MAIN
2739("identity-provider", 2739("reclaim",
2740 GNUNET_SERVICE_OPTION_NONE, 2740 GNUNET_SERVICE_OPTION_NONE,
2741 &run, 2741 &run,
2742 &client_connect_cb, 2742 &client_connect_cb,
2743 &client_disconnect_cb, 2743 &client_disconnect_cb,
2744 NULL, 2744 NULL,
2745 GNUNET_MQ_hd_var_size (attribute_store_message, 2745 GNUNET_MQ_hd_var_size (attribute_store_message,
2746 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE, 2746 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE,
2747 struct AttributeStoreMessage, 2747 struct AttributeStoreMessage,
2748 NULL), 2748 NULL),
2749 GNUNET_MQ_hd_fixed_size (iteration_start, 2749 GNUNET_MQ_hd_fixed_size (iteration_start,
2750 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_START, 2750 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START,
2751 struct AttributeIterationStartMessage, 2751 struct AttributeIterationStartMessage,
2752 NULL), 2752 NULL),
2753 GNUNET_MQ_hd_fixed_size (iteration_next, 2753 GNUNET_MQ_hd_fixed_size (iteration_next,
2754 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_NEXT, 2754 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT,
2755 struct AttributeIterationNextMessage, 2755 struct AttributeIterationNextMessage,
2756 NULL), 2756 NULL),
2757 GNUNET_MQ_hd_fixed_size (iteration_stop, 2757 GNUNET_MQ_hd_fixed_size (iteration_stop,
2758 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_STOP, 2758 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP,
2759 struct AttributeIterationStopMessage, 2759 struct AttributeIterationStopMessage,
2760 NULL), 2760 NULL),
2761 GNUNET_MQ_hd_var_size (issue_ticket_message, 2761 GNUNET_MQ_hd_var_size (issue_ticket_message,
2762 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_TICKET, 2762 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET,
2763 struct IssueTicketMessage, 2763 struct IssueTicketMessage,
2764 NULL), 2764 NULL),
2765 GNUNET_MQ_hd_var_size (consume_ticket_message, 2765 GNUNET_MQ_hd_var_size (consume_ticket_message,
2766 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET, 2766 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET,
2767 struct ConsumeTicketMessage, 2767 struct ConsumeTicketMessage,
2768 NULL), 2768 NULL),
2769 GNUNET_MQ_hd_fixed_size (ticket_iteration_start, 2769 GNUNET_MQ_hd_fixed_size (ticket_iteration_start,
2770 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_START, 2770 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START,
2771 struct TicketIterationStartMessage, 2771 struct TicketIterationStartMessage,
2772 NULL), 2772 NULL),
2773 GNUNET_MQ_hd_fixed_size (ticket_iteration_next, 2773 GNUNET_MQ_hd_fixed_size (ticket_iteration_next,
2774 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_NEXT, 2774 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT,
2775 struct TicketIterationNextMessage, 2775 struct TicketIterationNextMessage,
2776 NULL), 2776 NULL),
2777 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, 2777 GNUNET_MQ_hd_fixed_size (ticket_iteration_stop,
2778 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_STOP, 2778 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP,
2779 struct TicketIterationStopMessage, 2779 struct TicketIterationStopMessage,
2780 NULL), 2780 NULL),
2781 GNUNET_MQ_hd_var_size (revoke_ticket_message, 2781 GNUNET_MQ_hd_var_size (revoke_ticket_message,
2782 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET, 2782 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET,
2783 struct RevokeTicketMessage, 2783 struct RevokeTicketMessage,
2784 NULL), 2784 NULL),
2785 GNUNET_MQ_handler_end()); 2785 GNUNET_MQ_handler_end());
2786/* end of gnunet-service-identity-provider.c */ 2786/* end of gnunet-service-reclaim.c */
diff --git a/src/reclaim/jwt.c b/src/reclaim/jwt.c
new file mode 100644
index 000000000..8b1378917
--- /dev/null
+++ b/src/reclaim/jwt.c
@@ -0,0 +1 @@
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c
new file mode 100644
index 000000000..1e9e64fec
--- /dev/null
+++ b/src/reclaim/oidc_helper.c
@@ -0,0 +1,440 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2010-2015 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
19/**
20 * @file reclaim/oidc_helper.c
21 * @brief helper library for OIDC related functions
22 * @author Martin Schanzenbach
23 */
24#include "platform.h"
25#include "gnunet_util_lib.h"
26#include "gnunet_signatures.h"
27#include "gnunet_reclaim_service.h"
28#include "gnunet_reclaim_attribute_lib.h"
29#include <jansson.h>
30#include <inttypes.h>
31#include "oidc_helper.h"
32
33static char*
34create_jwt_header(void)
35{
36 json_t *root;
37 char *json_str;
38
39 root = json_object ();
40 json_object_set_new (root, JWT_ALG, json_string (JWT_ALG_VALUE));
41 json_object_set_new (root, JWT_TYP, json_string (JWT_TYP_VALUE));
42
43 json_str = json_dumps (root, JSON_INDENT(0) | JSON_COMPACT);
44 json_decref (root);
45 return json_str;
46}
47
48static void
49replace_char(char* str, char find, char replace){
50 char *current_pos = strchr(str,find);
51 while (current_pos){
52 *current_pos = replace;
53 current_pos = strchr(current_pos,find);
54 }
55}
56
57//RFC4648
58static void
59fix_base64(char* str) {
60 char *padding;
61 //First, remove trailing padding '='
62 padding = strtok(str, "=");
63 while (NULL != padding)
64 padding = strtok(NULL, "=");
65
66 //Replace + with -
67 replace_char (str, '+', '-');
68
69 //Replace / with _
70 replace_char (str, '/', '_');
71
72}
73
74/**
75 * Create a JWT from attributes
76 *
77 * @param aud_key the public of the audience
78 * @param sub_key the public key of the subject
79 * @param attrs the attribute list
80 * @param expiration_time the validity of the token
81 * @param secret_key the key used to sign the JWT
82 * @return a new base64-encoded JWT string.
83 */
84char*
85OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
86 const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
87 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
88 const struct GNUNET_TIME_Relative *expiration_time,
89 const char *nonce,
90 const char *secret_key)
91{
92 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
93 struct GNUNET_HashCode signature;
94 struct GNUNET_TIME_Absolute exp_time;
95 struct GNUNET_TIME_Absolute time_now;
96 char* audience;
97 char* subject;
98 char* header;
99 char* body_str;
100 char* result;
101 char* header_base64;
102 char* body_base64;
103 char* signature_target;
104 char* signature_base64;
105 char* attr_val_str;
106 json_t* body;
107
108 //iat REQUIRED time now
109 time_now = GNUNET_TIME_absolute_get();
110 //exp REQUIRED time expired from config
111 exp_time = GNUNET_TIME_absolute_add (time_now, *expiration_time);
112 //auth_time only if max_age
113 //nonce only if nonce
114 // OPTIONAL acr,amr,azp
115 subject = GNUNET_STRINGS_data_to_string_alloc (sub_key,
116 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
117 audience = GNUNET_STRINGS_data_to_string_alloc (aud_key,
118 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
119 header = create_jwt_header ();
120 body = json_object ();
121
122 //iss REQUIRED case sensitive server uri with https
123 //The issuer is the local reclaim instance (e.g. https://reclaim.id/api/openid)
124 json_object_set_new (body,
125 "iss", json_string (SERVER_ADDRESS));
126 //sub REQUIRED public key identity, not exceed 255 ASCII length
127 json_object_set_new (body,
128 "sub", json_string (subject));
129 //aud REQUIRED public key client_id must be there
130 json_object_set_new (body,
131 "aud", json_string (audience));
132 //iat
133 json_object_set_new (body,
134 "iat", json_integer (time_now.abs_value_us / (1000*1000)));
135 //exp
136 json_object_set_new (body,
137 "exp", json_integer (exp_time.abs_value_us / (1000*1000)));
138 //nbf
139 json_object_set_new (body,
140 "nbf", json_integer (time_now.abs_value_us / (1000*1000)));
141 //nonce
142 if (NULL != nonce)
143 json_object_set_new (body,
144 "nonce", json_string (nonce));
145
146 for (le = attrs->list_head; NULL != le; le = le->next)
147 {
148 attr_val_str = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (le->claim->type,
149 le->claim->data,
150 le->claim->data_size);
151 json_object_set_new (body,
152 le->claim->name,
153 json_string (attr_val_str));
154 GNUNET_free (attr_val_str);
155 }
156 body_str = json_dumps (body, JSON_INDENT(0) | JSON_COMPACT);
157 json_decref (body);
158
159 GNUNET_STRINGS_base64_encode (header,
160 strlen (header),
161 &header_base64);
162 fix_base64(header_base64);
163
164 GNUNET_STRINGS_base64_encode (body_str,
165 strlen (body_str),
166 &body_base64);
167 fix_base64(body_base64);
168
169 GNUNET_free (subject);
170 GNUNET_free (audience);
171
172 /**
173 * Creating the JWT signature. This might not be
174 * standards compliant, check.
175 */
176 GNUNET_asprintf (&signature_target, "%s.%s", header_base64, body_base64);
177 GNUNET_CRYPTO_hmac_raw (secret_key, strlen (secret_key), signature_target, strlen (signature_target), &signature);
178 GNUNET_STRINGS_base64_encode ((const char*)&signature,
179 sizeof (struct GNUNET_HashCode),
180 &signature_base64);
181 fix_base64(signature_base64);
182
183 GNUNET_asprintf (&result, "%s.%s.%s",
184 header_base64, body_base64, signature_base64);
185
186 GNUNET_free (signature_target);
187 GNUNET_free (header);
188 GNUNET_free (body_str);
189 GNUNET_free (signature_base64);
190 GNUNET_free (body_base64);
191 GNUNET_free (header_base64);
192 return result;
193}
194/**
195 * Builds an OIDC authorization code including
196 * a reclaim ticket and nonce
197 *
198 * @param issuer the issuer of the ticket, used to sign the ticket and nonce
199 * @param ticket the ticket to include in the code
200 * @param nonce the nonce to include in the code
201 * @return a new authorization code (caller must free)
202 */
203char*
204OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
205 const struct GNUNET_RECLAIM_Ticket *ticket,
206 const char* nonce)
207{
208 char *ticket_str;
209 json_t *code_json;
210 char *signature_payload;
211 char *signature_str;
212 char *authz_code;
213 size_t signature_payload_len;
214 struct GNUNET_CRYPTO_EcdsaSignature signature;
215 struct GNUNET_CRYPTO_EccSignaturePurpose *purpose;
216
217 signature_payload_len = sizeof (struct GNUNET_RECLAIM_Ticket);
218 if (NULL != nonce)
219 signature_payload_len += strlen (nonce);
220
221 signature_payload = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + signature_payload_len);
222 purpose = (struct GNUNET_CRYPTO_EccSignaturePurpose *)signature_payload;
223 purpose->size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + signature_payload_len);
224 purpose->purpose = htonl (GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN);
225 memcpy (&purpose[1],
226 ticket,
227 sizeof (struct GNUNET_RECLAIM_Ticket));
228 if (NULL != nonce)
229 memcpy (((char*)&purpose[1]) + sizeof (struct GNUNET_RECLAIM_Ticket),
230 nonce,
231 strlen (nonce));
232 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_sign (issuer,
233 purpose,
234 &signature))
235 {
236 GNUNET_free (signature_payload);
237 return NULL;
238 }
239 signature_str = GNUNET_STRINGS_data_to_string_alloc (&signature,
240 sizeof (signature));
241 ticket_str = GNUNET_STRINGS_data_to_string_alloc (ticket,
242 sizeof (struct GNUNET_RECLAIM_Ticket));
243
244 code_json = json_object ();
245 json_object_set_new (code_json,
246 "ticket",
247 json_string (ticket_str));
248 if (NULL != nonce)
249 json_object_set_new (code_json,
250 "nonce",
251 json_string (nonce));
252 json_object_set_new (code_json,
253 "signature",
254 json_string (signature_str));
255 authz_code = json_dumps (code_json,
256 JSON_INDENT(0) | JSON_COMPACT);
257 GNUNET_free (signature_payload);
258 GNUNET_free (signature_str);
259 GNUNET_free (ticket_str);
260 json_decref (code_json);
261 return authz_code;
262}
263
264
265
266
267/**
268 * Parse reclaim ticket and nonce from
269 * authorization code.
270 * This also verifies the signature in the code.
271 *
272 * @param audience the expected audience of the code
273 * @param code the string representation of the code
274 * @param ticket where to store the ticket
275 * @param nonce where to store the nonce
276 * @return GNUNET_OK if successful, else GNUNET_SYSERR
277 */
278int
279OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
280 const char* code,
281 struct GNUNET_RECLAIM_Ticket **ticket,
282 char **nonce)
283{
284 json_error_t error;
285 json_t *code_json;
286 json_t *ticket_json;
287 json_t *nonce_json;
288 json_t *signature_json;
289 const char *ticket_str;
290 const char *signature_str;
291 const char *nonce_str;
292 char *code_output;
293 struct GNUNET_CRYPTO_EccSignaturePurpose *purpose;
294 struct GNUNET_CRYPTO_EcdsaSignature signature;
295 size_t signature_payload_len;
296
297 code_output = NULL;
298 GNUNET_STRINGS_base64_decode (code,
299 strlen(code),
300 (void**)&code_output);
301 code_json = json_loads (code_output, 0 , &error);
302 GNUNET_free (code_output);
303 ticket_json = json_object_get (code_json, "ticket");
304 nonce_json = json_object_get (code_json, "nonce");
305 signature_json = json_object_get (code_json, "signature");
306 *ticket = NULL;
307 *nonce = NULL;
308
309 if ((NULL == ticket_json || !json_is_string (ticket_json)) ||
310 (NULL == signature_json || !json_is_string (signature_json)))
311 {
312 json_decref (code_json);
313 return GNUNET_SYSERR;
314 }
315 ticket_str = json_string_value (ticket_json);
316 signature_str = json_string_value (signature_json);
317 nonce_str = NULL;
318 if (NULL != nonce_json)
319 nonce_str = json_string_value (nonce_json);
320 signature_payload_len = sizeof (struct GNUNET_RECLAIM_Ticket);
321 if (NULL != nonce_str)
322 signature_payload_len += strlen (nonce_str);
323 purpose = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
324 signature_payload_len);
325 purpose->size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + signature_payload_len);
326 purpose->purpose = htonl (GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN);
327 if (GNUNET_OK != GNUNET_STRINGS_string_to_data (ticket_str,
328 strlen (ticket_str),
329 &purpose[1],
330 sizeof (struct GNUNET_RECLAIM_Ticket)))
331 {
332 GNUNET_free (purpose);
333 json_decref (code_json);
334 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
335 "Cannot parse ticket!\n");
336 return GNUNET_SYSERR;
337 }
338 if (GNUNET_OK != GNUNET_STRINGS_string_to_data (signature_str,
339 strlen (signature_str),
340 &signature,
341 sizeof (struct GNUNET_CRYPTO_EcdsaSignature)))
342 {
343 GNUNET_free (purpose);
344 json_decref (code_json);
345 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
346 "Cannot parse signature!\n");
347 return GNUNET_SYSERR;
348 }
349 *ticket = GNUNET_new (struct GNUNET_RECLAIM_Ticket);
350 memcpy (*ticket,
351 &purpose[1],
352 sizeof (struct GNUNET_RECLAIM_Ticket));
353 if (0 != memcmp (audience,
354 &(*ticket)->audience,
355 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
356 {
357 GNUNET_free (purpose);
358 GNUNET_free (*ticket);
359 json_decref (code_json);
360 *ticket = NULL;
361 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
362 "Audience in ticket does not match client!\n");
363 return GNUNET_SYSERR;
364
365 }
366 if (NULL != nonce_str)
367 memcpy (((char*)&purpose[1]) + sizeof (struct GNUNET_RECLAIM_Ticket),
368 nonce_str,
369 strlen (nonce_str));
370 if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_RECLAIM_CODE_SIGN,
371 purpose,
372 &signature,
373 &(*ticket)->identity))
374 {
375 GNUNET_free (purpose);
376 GNUNET_free (*ticket);
377 json_decref (code_json);
378 *ticket = NULL;
379 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
380 "Signature of authZ code invalid!\n");
381 return GNUNET_SYSERR;
382 }
383 *nonce = GNUNET_strdup (nonce_str);
384 return GNUNET_OK;
385}
386
387/**
388 * Build a token response for a token request
389 * TODO: Maybe we should add the scope here?
390 *
391 * @param access_token the access token to include
392 * @param id_token the id_token to include
393 * @param expiration_time the expiration time of the token(s)
394 * @param token_response where to store the response
395 */
396void
397OIDC_build_token_response (const char *access_token,
398 const char *id_token,
399 const struct GNUNET_TIME_Relative *expiration_time,
400 char **token_response)
401{
402 json_t *root_json;
403
404 root_json = json_object ();
405
406 GNUNET_assert (NULL != access_token);
407 GNUNET_assert (NULL != id_token);
408 GNUNET_assert (NULL != expiration_time);
409 json_object_set_new (root_json,
410 "access_token",
411 json_string (access_token));
412 json_object_set_new (root_json,
413 "token_type",
414 json_string ("Bearer"));
415 json_object_set_new (root_json,
416 "expires_in",
417 json_integer (expiration_time->rel_value_us / (1000 * 1000)));
418 json_object_set_new (root_json,
419 "id_token",
420 json_string (id_token));
421 *token_response = json_dumps (root_json,
422 JSON_INDENT(0) | JSON_COMPACT);
423 json_decref (root_json);
424}
425
426/**
427 * Generate a new access token
428 */
429char*
430OIDC_access_token_new ()
431{
432 char* access_token_number;
433 char* access_token;
434 uint64_t random_number;
435
436 random_number = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_NONCE, UINT64_MAX);
437 GNUNET_asprintf (&access_token_number, "%" PRIu64, random_number);
438 GNUNET_STRINGS_base64_encode(access_token_number,strlen(access_token_number),&access_token);
439 return access_token;
440}
diff --git a/src/reclaim/oidc_helper.h b/src/reclaim/oidc_helper.h
new file mode 100644
index 000000000..7a0f45bf9
--- /dev/null
+++ b/src/reclaim/oidc_helper.h
@@ -0,0 +1,109 @@
1/*
2 This file is part of GNUnet
3 Copyright (C) 2010-2015 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
19/**
20 * @file reclaim/oidc_helper.h
21 * @brief helper library for OIDC related functions
22 * @author Martin Schanzenbach
23 */
24
25#ifndef JWT_H
26#define JWT_H
27
28#define JWT_ALG "alg"
29
30/* Use 512bit HMAC */
31#define JWT_ALG_VALUE "HS512"
32
33#define JWT_TYP "typ"
34
35#define JWT_TYP_VALUE "jwt"
36
37#define SERVER_ADDRESS "https://reclaim.id"
38
39/**
40 * Create a JWT from attributes
41 *
42 * @param aud_key the public of the audience
43 * @param sub_key the public key of the subject
44 * @param attrs the attribute list
45 * @param expiration_time the validity of the token
46 * @param secret_key the key used to sign the JWT
47 * @return a new base64-encoded JWT string.
48 */
49char*
50OIDC_id_token_new (const struct GNUNET_CRYPTO_EcdsaPublicKey *aud_key,
51 const struct GNUNET_CRYPTO_EcdsaPublicKey *sub_key,
52 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
53 const struct GNUNET_TIME_Relative *expiration_time,
54 const char *nonce,
55 const char *secret_key);
56
57/**
58 * Builds an OIDC authorization code including
59 * a reclaim ticket and nonce
60 *
61 * @param issuer the issuer of the ticket, used to sign the ticket and nonce
62 * @param ticket the ticket to include in the code
63 * @param nonce the nonce to include in the code
64 * @return a new authorization code (caller must free)
65 */
66char*
67OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer,
68 const struct GNUNET_RECLAIM_Ticket *ticket,
69 const char* nonce);
70
71/**
72 * Parse reclaim ticket and nonce from
73 * authorization code.
74 * This also verifies the signature in the code.
75 *
76 * @param audience the expected audience of the code
77 * @param code the string representation of the code
78 * @param ticket where to store the ticket
79 * @param nonce where to store the nonce
80 * @return GNUNET_OK if successful, else GNUNET_SYSERR
81 */
82int
83OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPublicKey *audience,
84 const char* code,
85 struct GNUNET_RECLAIM_Ticket **ticket,
86 char **nonce);
87
88/**
89 * Build a token response for a token request
90 * TODO: Maybe we should add the scope here?
91 *
92 * @param access_token the access token to include
93 * @param id_token the id_token to include
94 * @param expiration_time the expiration time of the token(s)
95 * @param token_response where to store the response
96 */
97void
98OIDC_build_token_response (const char *access_token,
99 const char *id_token,
100 const struct GNUNET_TIME_Relative *expiration_time,
101 char **token_response);
102/**
103 * Generate a new access token
104 */
105char*
106OIDC_access_token_new ();
107
108
109#endif
diff --git a/src/identity-provider/plugin_gnsrecord_identity_provider.c b/src/reclaim/plugin_gnsrecord_reclaim.c
index f0dc563dc..781b88abc 100644
--- a/src/identity-provider/plugin_gnsrecord_identity_provider.c
+++ b/src/reclaim/plugin_gnsrecord_reclaim.c
@@ -17,7 +17,7 @@
17*/ 17*/
18 18
19/** 19/**
20 * @file identity-provider/plugin_gnsrecord_identity_provider.c 20 * @file reclaim/plugin_gnsrecord_reclaim.c
21 * @brief gnsrecord plugin to provide the API for identity records 21 * @brief gnsrecord plugin to provide the API for identity records
22 * @author Martin Schanzenbach 22 * @author Martin Schanzenbach
23 */ 23 */
@@ -54,6 +54,8 @@ value_to_string (void *cls,
54 case GNUNET_GNSRECORD_TYPE_ID_ATTR: 54 case GNUNET_GNSRECORD_TYPE_ID_ATTR:
55 return GNUNET_STRINGS_data_to_string_alloc (data, data_size); 55 return GNUNET_STRINGS_data_to_string_alloc (data, data_size);
56 case GNUNET_GNSRECORD_TYPE_ID_TOKEN: //DEPRECATED 56 case GNUNET_GNSRECORD_TYPE_ID_TOKEN: //DEPRECATED
57 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
58 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
57 return GNUNET_strndup (data, data_size); 59 return GNUNET_strndup (data, data_size);
58 case GNUNET_GNSRECORD_TYPE_ABE_KEY: 60 case GNUNET_GNSRECORD_TYPE_ABE_KEY:
59 case GNUNET_GNSRECORD_TYPE_ABE_MASTER: 61 case GNUNET_GNSRECORD_TYPE_ABE_MASTER:
@@ -113,6 +115,8 @@ string_to_value (void *cls,
113 *data, 115 *data,
114 *data_size); 116 *data_size);
115 case GNUNET_GNSRECORD_TYPE_ID_TOKEN: 117 case GNUNET_GNSRECORD_TYPE_ID_TOKEN:
118 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT:
119 case GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT:
116 *data = GNUNET_strdup (s); 120 *data = GNUNET_strdup (s);
117 *data_size = strlen (s); 121 *data_size = strlen (s);
118 return GNUNET_OK; 122 return GNUNET_OK;
@@ -181,6 +185,8 @@ static struct {
181 { "ABE_KEY", GNUNET_GNSRECORD_TYPE_ABE_KEY }, 185 { "ABE_KEY", GNUNET_GNSRECORD_TYPE_ABE_KEY },
182 { "ABE_MASTER", GNUNET_GNSRECORD_TYPE_ABE_MASTER }, 186 { "ABE_MASTER", GNUNET_GNSRECORD_TYPE_ABE_MASTER },
183 { "ID_TOKEN_METADATA", GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA }, 187 { "ID_TOKEN_METADATA", GNUNET_GNSRECORD_TYPE_ID_TOKEN_METADATA },
188 { "RECLAIM_OIDC_CLIENT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_CLIENT },
189 { "RECLAIM_OIDC_REDIRECT", GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT },
184 { NULL, UINT32_MAX } 190 { NULL, UINT32_MAX }
185}; 191};
186 192
@@ -234,7 +240,7 @@ number_to_typename (void *cls,
234 * @return the exported block API 240 * @return the exported block API
235 */ 241 */
236void * 242void *
237libgnunet_plugin_gnsrecord_identity_provider_init (void *cls) 243libgnunet_plugin_gnsrecord_reclaim_init (void *cls)
238{ 244{
239 struct GNUNET_GNSRECORD_PluginFunctions *api; 245 struct GNUNET_GNSRECORD_PluginFunctions *api;
240 246
@@ -254,7 +260,7 @@ libgnunet_plugin_gnsrecord_identity_provider_init (void *cls)
254 * @return NULL 260 * @return NULL
255 */ 261 */
256void * 262void *
257libgnunet_plugin_gnsrecord_identity_provider_done (void *cls) 263libgnunet_plugin_gnsrecord_reclaim_done (void *cls)
258{ 264{
259 struct GNUNET_GNSRECORD_PluginFunctions *api = cls; 265 struct GNUNET_GNSRECORD_PluginFunctions *api = cls;
260 266
diff --git a/src/identity-provider/plugin_identity_provider_sqlite.c b/src/reclaim/plugin_reclaim_sqlite.c
index f2a8b7b54..b545a94e8 100644
--- a/src/identity-provider/plugin_identity_provider_sqlite.c
+++ b/src/reclaim/plugin_reclaim_sqlite.c
@@ -17,15 +17,15 @@
17 */ 17 */
18 18
19/** 19/**
20 * @file identity-provider/plugin_identity_provider_sqlite.c 20 * @file reclaim/plugin_reclaim_sqlite.c
21 * @brief sqlite-based idp backend 21 * @brief sqlite-based idp backend
22 * @author Martin Schanzenbach 22 * @author Martin Schanzenbach
23 */ 23 */
24 24
25#include "platform.h" 25#include "platform.h"
26#include "gnunet_identity_provider_service.h" 26#include "gnunet_reclaim_service.h"
27#include "gnunet_identity_provider_plugin.h" 27#include "gnunet_reclaim_plugin.h"
28#include "gnunet_identity_attribute_lib.h" 28#include "gnunet_reclaim_attribute_lib.h"
29#include "gnunet_sq_lib.h" 29#include "gnunet_sq_lib.h"
30#include <sqlite3.h> 30#include <sqlite3.h>
31 31
@@ -47,9 +47,9 @@
47 * a failure of the command 'cmd' on file 'filename' 47 * a failure of the command 'cmd' on file 'filename'
48 * with the message given by strerror(errno). 48 * with the message given by strerror(errno).
49 */ 49 */
50#define LOG_SQLITE(db, level, cmd) do { GNUNET_log_from (level, "identity-provider", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, sqlite3_errmsg(db->dbh)); } while(0) 50#define LOG_SQLITE(db, level, cmd) do { GNUNET_log_from (level, "reclaim", _("`%s' failed at %s:%d with error: %s\n"), cmd, __FILE__, __LINE__, sqlite3_errmsg(db->dbh)); } while(0)
51 51
52#define LOG(kind,...) GNUNET_log_from (kind, "identity-provider-sqlite", __VA_ARGS__) 52#define LOG(kind,...) GNUNET_log_from (kind, "reclaim-sqlite", __VA_ARGS__)
53 53
54 54
55/** 55/**
@@ -180,12 +180,12 @@ database_setup (struct Plugin *plugin)
180 180
181 if (GNUNET_OK != 181 if (GNUNET_OK !=
182 GNUNET_CONFIGURATION_get_value_filename (plugin->cfg, 182 GNUNET_CONFIGURATION_get_value_filename (plugin->cfg,
183 "identity-provider-sqlite", 183 "reclaim-sqlite",
184 "FILENAME", 184 "FILENAME",
185 &afsdir)) 185 &afsdir))
186 { 186 {
187 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, 187 GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
188 "identity-provider-sqlite", 188 "reclaim-sqlite",
189 "FILENAME"); 189 "FILENAME");
190 return GNUNET_SYSERR; 190 return GNUNET_SYSERR;
191 } 191 }
@@ -370,9 +370,9 @@ database_shutdown (struct Plugin *plugin)
370 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 370 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
371 */ 371 */
372static int 372static int
373identity_provider_sqlite_store_ticket (void *cls, 373reclaim_sqlite_store_ticket (void *cls,
374 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 374 const struct GNUNET_RECLAIM_Ticket *ticket,
375 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs) 375 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs)
376{ 376{
377 struct Plugin *plugin = cls; 377 struct Plugin *plugin = cls;
378 size_t attrs_len; 378 size_t attrs_len;
@@ -401,9 +401,9 @@ identity_provider_sqlite_store_ticket (void *cls,
401 GNUNET_SQ_reset (plugin->dbh, 401 GNUNET_SQ_reset (plugin->dbh,
402 plugin->delete_ticket); 402 plugin->delete_ticket);
403 403
404 attrs_len = GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (attrs); 404 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
405 attrs_ser = GNUNET_malloc (attrs_len); 405 attrs_ser = GNUNET_malloc (attrs_len);
406 GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs, 406 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs,
407 attrs_ser); 407 attrs_ser);
408 struct GNUNET_SQ_QueryParam sparams[] = { 408 struct GNUNET_SQ_QueryParam sparams[] = {
409 GNUNET_SQ_query_param_auto_from_type (&ticket->identity), 409 GNUNET_SQ_query_param_auto_from_type (&ticket->identity),
@@ -458,8 +458,8 @@ identity_provider_sqlite_store_ticket (void *cls,
458 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 458 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
459 */ 459 */
460static int 460static int
461identity_provider_sqlite_delete_ticket (void *cls, 461reclaim_sqlite_delete_ticket (void *cls,
462 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket) 462 const struct GNUNET_RECLAIM_Ticket *ticket)
463{ 463{
464 struct Plugin *plugin = cls; 464 struct Plugin *plugin = cls;
465 int n; 465 int n;
@@ -521,11 +521,11 @@ identity_provider_sqlite_delete_ticket (void *cls,
521static int 521static int
522get_ticket_and_call_iterator (struct Plugin *plugin, 522get_ticket_and_call_iterator (struct Plugin *plugin,
523 sqlite3_stmt *stmt, 523 sqlite3_stmt *stmt,
524 GNUNET_IDENTITY_PROVIDER_TicketIterator iter, 524 GNUNET_RECLAIM_TicketIterator iter,
525 void *iter_cls) 525 void *iter_cls)
526{ 526{
527 struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 527 struct GNUNET_RECLAIM_Ticket ticket;
528 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; 528 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
529 int ret; 529 int ret;
530 int sret; 530 int sret;
531 size_t attrs_len; 531 size_t attrs_len;
@@ -552,13 +552,13 @@ get_ticket_and_call_iterator (struct Plugin *plugin,
552 } 552 }
553 else 553 else
554 { 554 {
555 attrs = GNUNET_IDENTITY_ATTRIBUTE_list_deserialize (attrs_ser, 555 attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize (attrs_ser,
556 attrs_len); 556 attrs_len);
557 if (NULL != iter) 557 if (NULL != iter)
558 iter (iter_cls, 558 iter (iter_cls,
559 &ticket, 559 &ticket,
560 attrs); 560 attrs);
561 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs); 561 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
562 ret = GNUNET_YES; 562 ret = GNUNET_YES;
563 } 563 }
564 GNUNET_SQ_cleanup_result (rs); 564 GNUNET_SQ_cleanup_result (rs);
@@ -586,9 +586,9 @@ get_ticket_and_call_iterator (struct Plugin *plugin,
586 * @return #GNUNET_OK on success, else #GNUNET_SYSERR 586 * @return #GNUNET_OK on success, else #GNUNET_SYSERR
587 */ 587 */
588static int 588static int
589identity_provider_sqlite_ticket_get_attrs (void *cls, 589reclaim_sqlite_ticket_get_attrs (void *cls,
590 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 590 const struct GNUNET_RECLAIM_Ticket *ticket,
591 GNUNET_IDENTITY_PROVIDER_TicketIterator iter, 591 GNUNET_RECLAIM_TicketIterator iter,
592 void *iter_cls) 592 void *iter_cls)
593{ 593{
594 struct Plugin *plugin = cls; 594 struct Plugin *plugin = cls;
@@ -628,11 +628,11 @@ identity_provider_sqlite_ticket_get_attrs (void *cls,
628 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error 628 * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error
629 */ 629 */
630static int 630static int
631identity_provider_sqlite_iterate_tickets (void *cls, 631reclaim_sqlite_iterate_tickets (void *cls,
632 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 632 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
633 int audience, 633 int audience,
634 uint64_t offset, 634 uint64_t offset,
635 GNUNET_IDENTITY_PROVIDER_TicketIterator iter, 635 GNUNET_RECLAIM_TicketIterator iter,
636 void *iter_cls) 636 void *iter_cls)
637{ 637{
638 struct Plugin *plugin = cls; 638 struct Plugin *plugin = cls;
@@ -680,15 +680,15 @@ identity_provider_sqlite_iterate_tickets (void *cls,
680/** 680/**
681 * Entry point for the plugin. 681 * Entry point for the plugin.
682 * 682 *
683 * @param cls the "struct GNUNET_IDENTITY_PROVIDER_PluginEnvironment*" 683 * @param cls the "struct GNUNET_RECLAIM_PluginEnvironment*"
684 * @return NULL on error, otherwise the plugin context 684 * @return NULL on error, otherwise the plugin context
685 */ 685 */
686void * 686void *
687libgnunet_plugin_identity_provider_sqlite_init (void *cls) 687libgnunet_plugin_reclaim_sqlite_init (void *cls)
688{ 688{
689 static struct Plugin plugin; 689 static struct Plugin plugin;
690 const struct GNUNET_CONFIGURATION_Handle *cfg = cls; 690 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
691 struct GNUNET_IDENTITY_PROVIDER_PluginFunctions *api; 691 struct GNUNET_RECLAIM_PluginFunctions *api;
692 692
693 if (NULL != plugin.cfg) 693 if (NULL != plugin.cfg)
694 return NULL; /* can only initialize once! */ 694 return NULL; /* can only initialize once! */
@@ -699,12 +699,12 @@ libgnunet_plugin_identity_provider_sqlite_init (void *cls)
699 database_shutdown (&plugin); 699 database_shutdown (&plugin);
700 return NULL; 700 return NULL;
701 } 701 }
702 api = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_PluginFunctions); 702 api = GNUNET_new (struct GNUNET_RECLAIM_PluginFunctions);
703 api->cls = &plugin; 703 api->cls = &plugin;
704 api->store_ticket = &identity_provider_sqlite_store_ticket; 704 api->store_ticket = &reclaim_sqlite_store_ticket;
705 api->delete_ticket = &identity_provider_sqlite_delete_ticket; 705 api->delete_ticket = &reclaim_sqlite_delete_ticket;
706 api->iterate_tickets = &identity_provider_sqlite_iterate_tickets; 706 api->iterate_tickets = &reclaim_sqlite_iterate_tickets;
707 api->get_ticket_attributes = &identity_provider_sqlite_ticket_get_attrs; 707 api->get_ticket_attributes = &reclaim_sqlite_ticket_get_attrs;
708 LOG (GNUNET_ERROR_TYPE_INFO, 708 LOG (GNUNET_ERROR_TYPE_INFO,
709 _("Sqlite database running\n")); 709 _("Sqlite database running\n"));
710 return api; 710 return api;
@@ -718,9 +718,9 @@ libgnunet_plugin_identity_provider_sqlite_init (void *cls)
718 * @return always NULL 718 * @return always NULL
719 */ 719 */
720void * 720void *
721libgnunet_plugin_identity_provider_sqlite_done (void *cls) 721libgnunet_plugin_reclaim_sqlite_done (void *cls)
722{ 722{
723 struct GNUNET_IDENTITY_PROVIDER_PluginFunctions *api = cls; 723 struct GNUNET_RECLAIM_PluginFunctions *api = cls;
724 struct Plugin *plugin = api->cls; 724 struct Plugin *plugin = api->cls;
725 725
726 database_shutdown (plugin); 726 database_shutdown (plugin);
@@ -731,4 +731,4 @@ libgnunet_plugin_identity_provider_sqlite_done (void *cls)
731 return NULL; 731 return NULL;
732} 732}
733 733
734/* end of plugin_identity_provider_sqlite.c */ 734/* end of plugin_reclaim_sqlite.c */
diff --git a/src/identity-provider/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c
index d87a345cf..24673c692 100644
--- a/src/identity-provider/plugin_rest_openid_connect.c
+++ b/src/reclaim/plugin_rest_openid_connect.c
@@ -36,9 +36,9 @@
36#include <jansson.h> 36#include <jansson.h>
37#include <inttypes.h> 37#include <inttypes.h>
38#include "gnunet_signatures.h" 38#include "gnunet_signatures.h"
39#include "gnunet_identity_attribute_lib.h" 39#include "gnunet_reclaim_attribute_lib.h"
40#include "gnunet_identity_provider_service.h" 40#include "gnunet_reclaim_service.h"
41#include "jwt.h" 41#include "oidc_helper.h"
42 42
43/** 43/**
44 * REST root namespace 44 * REST root namespace
@@ -68,7 +68,7 @@
68/** 68/**
69 * Attribute key 69 * Attribute key
70 */ 70 */
71#define GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE "attribute" 71#define GNUNET_REST_JSONAPI_RECLAIM_ATTRIBUTE "attribute"
72 72
73/** 73/**
74 * Ticket key 74 * Ticket key
@@ -79,7 +79,7 @@
79/** 79/**
80 * Value key 80 * Value key
81 */ 81 */
82#define GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE_VALUE "value" 82#define GNUNET_REST_JSONAPI_RECLAIM_ATTRIBUTE_VALUE "value"
83 83
84/** 84/**
85 * State while collecting all egos 85 * State while collecting all egos
@@ -168,7 +168,6 @@ static char* OIDC_ignored_parameter_array [] =
168{ 168{
169 "display", 169 "display",
170 "prompt", 170 "prompt",
171 "max_age",
172 "ui_locales", 171 "ui_locales",
173 "response_mode", 172 "response_mode",
174 "id_token_hint", 173 "id_token_hint",
@@ -230,12 +229,6 @@ struct OIDC_Variables
230 char *client_id; 229 char *client_id;
231 230
232 /** 231 /**
233 * GNUNET_YES if there is a delegation to
234 * this RP or if it is a local identity
235 */
236 int is_client_trusted;
237
238 /**
239 * The OIDC redirect uri 232 * The OIDC redirect uri
240 */ 233 */
241 char *redirect_uri; 234 char *redirect_uri;
@@ -347,6 +340,16 @@ struct RequestHandle
347 struct GNUNET_REST_RequestHandle *rest_handle; 340 struct GNUNET_REST_RequestHandle *rest_handle;
348 341
349 /** 342 /**
343 * GNS handle
344 */
345 struct GNUNET_GNS_Handle *gns_handle;
346
347 /**
348 * GNS lookup op
349 */
350 struct GNUNET_GNS_LookupRequest *gns_op;
351
352 /**
350 * Handle to NAMESTORE 353 * Handle to NAMESTORE
351 */ 354 */
352 struct GNUNET_NAMESTORE_Handle *namestore_handle; 355 struct GNUNET_NAMESTORE_Handle *namestore_handle;
@@ -359,7 +362,7 @@ struct RequestHandle
359 /** 362 /**
360 * Attribute claim list 363 * Attribute claim list
361 */ 364 */
362 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attr_list; 365 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list;
363 366
364 /** 367 /**
365 * IDENTITY Operation 368 * IDENTITY Operation
@@ -369,27 +372,27 @@ struct RequestHandle
369 /** 372 /**
370 * Identity Provider 373 * Identity Provider
371 */ 374 */
372 struct GNUNET_IDENTITY_PROVIDER_Handle *idp; 375 struct GNUNET_RECLAIM_Handle *idp;
373 376
374 /** 377 /**
375 * Idp Operation 378 * Idp Operation
376 */ 379 */
377 struct GNUNET_IDENTITY_PROVIDER_Operation *idp_op; 380 struct GNUNET_RECLAIM_Operation *idp_op;
378 381
379 /** 382 /**
380 * Attribute iterator 383 * Attribute iterator
381 */ 384 */
382 struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *attr_it; 385 struct GNUNET_RECLAIM_AttributeIterator *attr_it;
383 386
384 /** 387 /**
385 * Ticket iterator 388 * Ticket iterator
386 */ 389 */
387 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *ticket_it; 390 struct GNUNET_RECLAIM_TicketIterator *ticket_it;
388 391
389 /** 392 /**
390 * A ticket 393 * A ticket
391 */ 394 */
392 struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 395 struct GNUNET_RECLAIM_Ticket ticket;
393 396
394 /** 397 /**
395 * Desired timeout for the lookup (default is no timeout). 398 * Desired timeout for the lookup (default is no timeout).
@@ -422,6 +425,16 @@ struct RequestHandle
422 char *tld; 425 char *tld;
423 426
424 /** 427 /**
428 * The redirect prefix
429 */
430 char *redirect_prefix;
431
432 /**
433 * The redirect suffix
434 */
435 char *redirect_suffix;
436
437 /**
425 * Error response message 438 * Error response message
426 */ 439 */
427 char *emsg; 440 char *emsg;
@@ -450,8 +463,8 @@ struct RequestHandle
450static void 463static void
451cleanup_handle (struct RequestHandle *handle) 464cleanup_handle (struct RequestHandle *handle)
452{ 465{
453 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *claim_entry; 466 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_entry;
454 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *claim_tmp; 467 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_tmp;
455 struct EgoEntry *ego_entry; 468 struct EgoEntry *ego_entry;
456 struct EgoEntry *ego_tmp; 469 struct EgoEntry *ego_tmp;
457 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 470 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -463,19 +476,28 @@ cleanup_handle (struct RequestHandle *handle)
463 if (NULL != handle->identity_handle) 476 if (NULL != handle->identity_handle)
464 GNUNET_IDENTITY_disconnect (handle->identity_handle); 477 GNUNET_IDENTITY_disconnect (handle->identity_handle);
465 if (NULL != handle->attr_it) 478 if (NULL != handle->attr_it)
466 GNUNET_IDENTITY_PROVIDER_get_attributes_stop (handle->attr_it); 479 GNUNET_RECLAIM_get_attributes_stop (handle->attr_it);
467 if (NULL != handle->ticket_it) 480 if (NULL != handle->ticket_it)
468 GNUNET_IDENTITY_PROVIDER_ticket_iteration_stop (handle->ticket_it); 481 GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it);
469 if (NULL != handle->idp) 482 if (NULL != handle->idp)
470 GNUNET_IDENTITY_PROVIDER_disconnect (handle->idp); 483 GNUNET_RECLAIM_disconnect (handle->idp);
471 if (NULL != handle->url) 484 if (NULL != handle->url)
472 GNUNET_free (handle->url); 485 GNUNET_free (handle->url);
473 if (NULL != handle->tld) 486 if (NULL != handle->tld)
474 GNUNET_free (handle->tld); 487 GNUNET_free (handle->tld);
488 if (NULL != handle->redirect_prefix)
489 GNUNET_free (handle->redirect_prefix);
490 if (NULL != handle->redirect_suffix)
491 GNUNET_free (handle->redirect_suffix);
475 if (NULL != handle->emsg) 492 if (NULL != handle->emsg)
476 GNUNET_free (handle->emsg); 493 GNUNET_free (handle->emsg);
477 if (NULL != handle->edesc) 494 if (NULL != handle->edesc)
478 GNUNET_free (handle->edesc); 495 GNUNET_free (handle->edesc);
496 if (NULL != handle->gns_op)
497 GNUNET_GNS_lookup_cancel (handle->gns_op);
498 if (NULL != handle->gns_handle)
499 GNUNET_GNS_disconnect (handle->gns_handle);
500
479 if (NULL != handle->namestore_handle) 501 if (NULL != handle->namestore_handle)
480 GNUNET_NAMESTORE_disconnect (handle->namestore_handle); 502 GNUNET_NAMESTORE_disconnect (handle->namestore_handle);
481 if (NULL != handle->oidc) 503 if (NULL != handle->oidc)
@@ -732,6 +754,8 @@ cookie_identity_interpretation (struct RequestHandle *handle)
732 { 754 {
733 handle->oidc->login_identity = strtok(handle->oidc->login_identity, OIDC_COOKIE_HEADER_INFORMATION_KEY); 755 handle->oidc->login_identity = strtok(handle->oidc->login_identity, OIDC_COOKIE_HEADER_INFORMATION_KEY);
734 handle->oidc->login_identity = GNUNET_strdup(handle->oidc->login_identity); 756 handle->oidc->login_identity = GNUNET_strdup(handle->oidc->login_identity);
757 } else {
758 handle->oidc->login_identity = NULL;
735 } 759 }
736 } 760 }
737 else 761 else
@@ -753,7 +777,7 @@ login_redirection(void *cls)
753 struct RequestHandle *handle = cls; 777 struct RequestHandle *handle = cls;
754 778
755 if ( GNUNET_OK 779 if ( GNUNET_OK
756 == GNUNET_CONFIGURATION_get_value_string (cfg, "identity-rest-plugin", 780 == GNUNET_CONFIGURATION_get_value_string (cfg, "reclaim-rest-plugin",
757 "address", &login_base_url) ) 781 "address", &login_base_url) )
758 { 782 {
759 GNUNET_asprintf (&new_redirect, "%s?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s&%s=%s", 783 GNUNET_asprintf (&new_redirect, "%s?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s&%s=%s",
@@ -799,11 +823,12 @@ oidc_iteration_error (void *cls)
799 GNUNET_SCHEDULER_add_now (&do_error, handle); 823 GNUNET_SCHEDULER_add_now (&do_error, handle);
800} 824}
801 825
802static void get_client_name_result (void *cls, 826static void
803 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, 827get_client_name_result (void *cls,
804 const char *label, 828 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone,
805 unsigned int rd_count, 829 const char *label,
806 const struct GNUNET_GNSRECORD_Data *rd) 830 unsigned int rd_count,
831 const struct GNUNET_GNSRECORD_Data *rd)
807{ 832{
808 struct RequestHandle *handle = cls; 833 struct RequestHandle *handle = cls;
809 struct MHD_Response *resp; 834 struct MHD_Response *resp;
@@ -811,46 +836,33 @@ static void get_client_name_result (void *cls,
811 char *redirect_uri; 836 char *redirect_uri;
812 char *code_json_string; 837 char *code_json_string;
813 char *code_base64_final_string; 838 char *code_base64_final_string;
814 char *redirect_path; 839
815 char *tmp;
816 char *tmp_prefix;
817 char *prefix;
818 ticket_str = GNUNET_STRINGS_data_to_string_alloc (&handle->ticket, 840 ticket_str = GNUNET_STRINGS_data_to_string_alloc (&handle->ticket,
819 sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); 841 sizeof (struct GNUNET_RECLAIM_Ticket));
820 //TODO change if more attributes are needed (see max_age) 842 //TODO change if more attributes are needed (see max_age)
821 GNUNET_asprintf (&code_json_string, "{\"ticket\":\"%s\"%s%s%s}", 843 code_json_string = OIDC_build_authz_code (&handle->priv_key,
822 ticket_str, 844 &handle->ticket,
823 (NULL != handle->oidc->nonce) ? ", \"nonce\":\"" : "", 845 handle->oidc->nonce);
824 (NULL != handle->oidc->nonce) ? handle->oidc->nonce : "",
825 (NULL != handle->oidc->nonce) ? "\"" : "");
826 code_base64_final_string = base_64_encode(code_json_string); 846 code_base64_final_string = base_64_encode(code_json_string);
827 tmp = GNUNET_strdup (handle->oidc->redirect_uri);
828 redirect_path = strtok (tmp, "/");
829 redirect_path = strtok (NULL, "/");
830 redirect_path = strtok (NULL, "/");
831 tmp_prefix = GNUNET_strdup (handle->oidc->redirect_uri);
832 prefix = strrchr (tmp_prefix,
833 (unsigned char) '.');
834 *prefix = '\0';
835 GNUNET_asprintf (&redirect_uri, "%s.%s/%s?%s=%s&state=%s", 847 GNUNET_asprintf (&redirect_uri, "%s.%s/%s?%s=%s&state=%s",
836 tmp_prefix, 848 handle->redirect_prefix,
837 handle->tld, 849 handle->tld,
838 redirect_path, 850 handle->redirect_suffix,
839 handle->oidc->response_type, 851 handle->oidc->response_type,
840 code_base64_final_string, handle->oidc->state); 852 code_base64_final_string, handle->oidc->state);
841 resp = GNUNET_REST_create_response (""); 853 resp = GNUNET_REST_create_response ("");
842 MHD_add_response_header (resp, "Location", redirect_uri); 854 MHD_add_response_header (resp, "Location", redirect_uri);
843 handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND); 855 handle->proc (handle->proc_cls, resp, MHD_HTTP_FOUND);
844 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle); 856 GNUNET_SCHEDULER_add_now (&cleanup_handle_delayed, handle);
845 GNUNET_free (tmp);
846 GNUNET_free (tmp_prefix);
847 GNUNET_free (redirect_uri); 857 GNUNET_free (redirect_uri);
848 GNUNET_free (ticket_str); 858 GNUNET_free (ticket_str);
849 GNUNET_free (code_json_string); 859 GNUNET_free (code_json_string);
850 GNUNET_free (code_base64_final_string); 860 GNUNET_free (code_base64_final_string);
851 return; 861 return;
862
852} 863}
853 864
865
854static void 866static void
855get_client_name_error (void *cls) 867get_client_name_error (void *cls)
856{ 868{
@@ -861,32 +873,93 @@ get_client_name_error (void *cls)
861 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle); 873 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
862} 874}
863 875
864/** 876
865 * Issues ticket and redirects to relying party with the authorization code as
866 * parameter. Otherwise redirects with error
867 */
868static void 877static void
869oidc_ticket_issue_cb (void* cls, 878lookup_redirect_uri_result (void *cls,
870 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket) 879 uint32_t rd_count,
880 const struct GNUNET_GNSRECORD_Data *rd)
871{ 881{
872 struct RequestHandle *handle = cls; 882 struct RequestHandle *handle = cls;
873 handle->idp_op = NULL; 883 char *tmp;
874 handle->ticket = *ticket; 884 char *tmp_key_str;
875 if (NULL != ticket) { 885 char *pos;
886 struct GNUNET_CRYPTO_EcdsaPublicKey redirect_zone;
887
888 handle->gns_op = NULL;
889 if (0 == rd_count)
890 {
891 handle->emsg = GNUNET_strdup("server_error");
892 handle->edesc = GNUNET_strdup("Server cannot generate ticket, redirect uri not found.");
893 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
894 return;
895 }
896 for (int i = 0; i < rd_count; i++)
897 {
898 if (GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT != rd[i].record_type)
899 continue;
900 if (0 != strcmp (rd[i].data,
901 handle->oidc->redirect_uri))
902 continue;
903 tmp = GNUNET_strdup (rd[i].data);
904 pos = strrchr (tmp,
905 (unsigned char) '.');
906 *pos = '\0';
907 handle->redirect_prefix = GNUNET_strdup (tmp);
908 tmp_key_str = pos + 1;
909 pos = strchr (tmp_key_str,
910 (unsigned char) '/');
911 *pos = '\0';
912 handle->redirect_suffix = GNUNET_strdup (pos + 1);
913
914 GNUNET_STRINGS_string_to_data (tmp_key_str,
915 strlen (tmp_key_str),
916 &redirect_zone,
917 sizeof (redirect_zone));
918
876 GNUNET_NAMESTORE_zone_to_name (handle->namestore_handle, 919 GNUNET_NAMESTORE_zone_to_name (handle->namestore_handle,
877 &handle->priv_key, 920 &handle->priv_key,
878 &handle->oidc->client_pkey, 921 &redirect_zone,
879 &get_client_name_error, 922 &get_client_name_error,
880 handle, 923 handle,
881 &get_client_name_result, 924 &get_client_name_result,
882 handle); 925 handle);
926 GNUNET_free (tmp);
883 return; 927 return;
884 } 928 }
885 handle->emsg = GNUNET_strdup("server_error"); 929 handle->emsg = GNUNET_strdup("server_error");
886 handle->edesc = GNUNET_strdup("Server cannot generate ticket."); 930 handle->edesc = GNUNET_strdup("Server cannot generate ticket, redirect uri not found.");
887 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle); 931 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
888} 932}
889 933
934/**
935 * Issues ticket and redirects to relying party with the authorization code as
936 * parameter. Otherwise redirects with error
937 */
938static void
939oidc_ticket_issue_cb (void* cls,
940 const struct GNUNET_RECLAIM_Ticket *ticket)
941{
942 struct RequestHandle *handle = cls;
943
944 handle->idp_op = NULL;
945 handle->ticket = *ticket;
946 if (NULL == ticket)
947 {
948 handle->emsg = GNUNET_strdup("server_error");
949 handle->edesc = GNUNET_strdup("Server cannot generate ticket.");
950 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
951 return;
952 }
953 handle->gns_op = GNUNET_GNS_lookup (handle->gns_handle,
954 "+",
955 &handle->oidc->client_pkey,
956 GNUNET_GNSRECORD_TYPE_RECLAIM_OIDC_REDIRECT,
957 GNUNET_GNS_LO_DEFAULT,
958 &lookup_redirect_uri_result,
959 handle);
960
961}
962
890static void 963static void
891oidc_collect_finished_cb (void *cls) 964oidc_collect_finished_cb (void *cls)
892{ 965{
@@ -900,12 +973,12 @@ oidc_collect_finished_cb (void *cls)
900 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle); 973 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
901 return; 974 return;
902 } 975 }
903 handle->idp_op = GNUNET_IDENTITY_PROVIDER_ticket_issue (handle->idp, 976 handle->idp_op = GNUNET_RECLAIM_ticket_issue (handle->idp,
904 &handle->priv_key, 977 &handle->priv_key,
905 &handle->oidc->client_pkey, 978 &handle->oidc->client_pkey,
906 handle->attr_list, 979 handle->attr_list,
907 &oidc_ticket_issue_cb, 980 &oidc_ticket_issue_cb,
908 handle); 981 handle);
909} 982}
910 983
911 984
@@ -915,17 +988,17 @@ oidc_collect_finished_cb (void *cls)
915static void 988static void
916oidc_attr_collect (void *cls, 989oidc_attr_collect (void *cls,
917 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 990 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
918 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) 991 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
919{ 992{
920 struct RequestHandle *handle = cls; 993 struct RequestHandle *handle = cls;
921 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 994 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
922 char* scope_variables; 995 char* scope_variables;
923 char* scope_variable; 996 char* scope_variable;
924 char delimiter[]=" "; 997 char delimiter[]=" ";
925 998
926 if ( (NULL == attr->name) || (NULL == attr->data) ) 999 if ( (NULL == attr->name) || (NULL == attr->data) )
927 { 1000 {
928 GNUNET_IDENTITY_PROVIDER_get_attributes_next (handle->attr_it); 1001 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
929 return; 1002 return;
930 } 1003 }
931 1004
@@ -941,18 +1014,18 @@ oidc_attr_collect (void *cls,
941 } 1014 }
942 if ( NULL == scope_variable ) 1015 if ( NULL == scope_variable )
943 { 1016 {
944 GNUNET_IDENTITY_PROVIDER_get_attributes_next (handle->attr_it); 1017 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
945 GNUNET_free(scope_variables); 1018 GNUNET_free(scope_variables);
946 return; 1019 return;
947 } 1020 }
948 GNUNET_free(scope_variables); 1021 GNUNET_free(scope_variables);
949 1022
950 le = GNUNET_new(struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry); 1023 le = GNUNET_new(struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry);
951 le->claim = GNUNET_IDENTITY_ATTRIBUTE_claim_new (attr->name, attr->type, 1024 le->claim = GNUNET_RECLAIM_ATTRIBUTE_claim_new (attr->name, attr->type,
952 attr->data, attr->data_size); 1025 attr->data, attr->data_size);
953 GNUNET_CONTAINER_DLL_insert(handle->attr_list->list_head, 1026 GNUNET_CONTAINER_DLL_insert(handle->attr_list->list_head,
954 handle->attr_list->list_tail, le); 1027 handle->attr_list->list_tail, le);
955 GNUNET_IDENTITY_PROVIDER_get_attributes_next (handle->attr_it); 1028 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
956} 1029}
957 1030
958 1031
@@ -1005,88 +1078,33 @@ login_check (void *cls)
1005 handle->priv_key = *GNUNET_IDENTITY_ego_get_private_key ( 1078 handle->priv_key = *GNUNET_IDENTITY_ego_get_private_key (
1006 handle->ego_entry->ego); 1079 handle->ego_entry->ego);
1007 handle->resp_object = GNUNET_JSONAPI_document_new (); 1080 handle->resp_object = GNUNET_JSONAPI_document_new ();
1008 handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); 1081 handle->idp = GNUNET_RECLAIM_connect (cfg);
1009 handle->attr_list = GNUNET_new( 1082 handle->attr_list = GNUNET_new(
1010 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList); 1083 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
1011 handle->attr_it = GNUNET_IDENTITY_PROVIDER_get_attributes_start ( 1084 handle->attr_it = GNUNET_RECLAIM_get_attributes_start (
1012 handle->idp, &handle->priv_key, &oidc_iteration_error, handle, 1085 handle->idp, &handle->priv_key, &oidc_iteration_error, handle,
1013 &oidc_attr_collect, handle, &oidc_collect_finished_cb, handle); 1086 &oidc_attr_collect, handle, &oidc_collect_finished_cb, handle);
1014 return; 1087 return;
1015 } 1088 }
1016 } 1089 }
1017 handle->emsg = GNUNET_strdup("invalid_cookie"); 1090 //handle->emsg = GNUNET_strdup("invalid_cookie");
1018 handle->edesc = GNUNET_strdup( 1091 //handle->edesc = GNUNET_strdup(
1019 "The cookie of the login identity is not valid"); 1092 // "The cookie of the login identity is not valid");
1020 GNUNET_SCHEDULER_add_now (&do_redirect_error, handle); 1093 //GNUNET_SCHEDULER_add_now (&do_redirect_error, handle);
1094 GNUNET_SCHEDULER_add_now (&login_redirection,handle);
1021 return; 1095 return;
1022 } 1096 }
1023 } 1097 }
1024} 1098}
1025 1099
1026/** 1100/**
1027 * Searches for client_id in namestore. If found trust status stored in handle
1028 * Else continues to search
1029 *
1030 * @param handle the RequestHandle
1031 */
1032static void
1033namestore_iteration_callback (
1034 void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
1035 const char *rname, unsigned int rd_len,
1036 const struct GNUNET_GNSRECORD_Data *rd)
1037{
1038 struct RequestHandle *handle = cls;
1039 struct GNUNET_CRYPTO_EcdsaPublicKey login_identity_pkey;
1040 struct GNUNET_CRYPTO_EcdsaPublicKey current_zone_pkey;
1041 int i;
1042
1043 for (i = 0; i < rd_len; i++)
1044 {
1045 if ( GNUNET_GNSRECORD_TYPE_PKEY != rd[i].record_type )
1046 continue;
1047
1048 if ( NULL != handle->oidc->login_identity )
1049 {
1050 GNUNET_CRYPTO_ecdsa_public_key_from_string (
1051 handle->oidc->login_identity,
1052 strlen (handle->oidc->login_identity),
1053 &login_identity_pkey);
1054 GNUNET_IDENTITY_ego_get_public_key (handle->ego_entry->ego,
1055 &current_zone_pkey);
1056
1057 if ( 0 == memcmp (rd[i].data, &handle->oidc->client_pkey,
1058 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) )
1059 {
1060 if ( 0 == memcmp (&login_identity_pkey, &current_zone_pkey,
1061 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) )
1062 {
1063 handle->oidc->is_client_trusted = GNUNET_YES;
1064 }
1065 }
1066 }
1067 else
1068 {
1069 if ( 0 == memcmp (rd[i].data, &handle->oidc->client_pkey,
1070 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) )
1071 {
1072 handle->oidc->is_client_trusted = GNUNET_YES;
1073 }
1074 }
1075 }
1076
1077 GNUNET_NAMESTORE_zone_iterator_next (handle->namestore_handle_it,
1078 1);
1079}
1080
1081
1082/**
1083 * Iteration over all results finished, build final 1101 * Iteration over all results finished, build final
1084 * response. 1102 * response.
1085 * 1103 *
1086 * @param cls the `struct RequestHandle` 1104 * @param cls the `struct RequestHandle`
1087 */ 1105 */
1088static void 1106static void
1089namestore_iteration_finished (void *cls) 1107build_authz_response (void *cls)
1090{ 1108{
1091 struct RequestHandle *handle = cls; 1109 struct RequestHandle *handle = cls;
1092 struct GNUNET_HashCode cache_key; 1110 struct GNUNET_HashCode cache_key;
@@ -1096,25 +1114,6 @@ namestore_iteration_finished (void *cls)
1096 int number_of_ignored_parameter, iterator; 1114 int number_of_ignored_parameter, iterator;
1097 1115
1098 1116
1099 handle->ego_entry = handle->ego_entry->next;
1100
1101 if(NULL != handle->ego_entry)
1102 {
1103 handle->priv_key = *GNUNET_IDENTITY_ego_get_private_key (handle->ego_entry->ego);
1104 handle->namestore_handle_it = GNUNET_NAMESTORE_zone_iteration_start (handle->namestore_handle, &handle->priv_key,
1105 &oidc_iteration_error, handle, &namestore_iteration_callback, handle,
1106 &namestore_iteration_finished, handle);
1107 return;
1108 }
1109 if (GNUNET_NO == handle->oidc->is_client_trusted)
1110 {
1111 handle->emsg = GNUNET_strdup("unauthorized_client");
1112 handle->edesc = GNUNET_strdup("The client is not authorized to request an "
1113 "authorization code using this method.");
1114 GNUNET_SCHEDULER_add_now (&do_error, handle);
1115 return;
1116 }
1117
1118 // REQUIRED value: redirect_uri 1117 // REQUIRED value: redirect_uri
1119 GNUNET_CRYPTO_hash (OIDC_REDIRECT_URI_KEY, strlen (OIDC_REDIRECT_URI_KEY), 1118 GNUNET_CRYPTO_hash (OIDC_REDIRECT_URI_KEY, strlen (OIDC_REDIRECT_URI_KEY),
1120 &cache_key); 1119 &cache_key);
@@ -1244,8 +1243,8 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1244 struct RequestHandle *handle = cls; 1243 struct RequestHandle *handle = cls;
1245 struct GNUNET_HashCode cache_key; 1244 struct GNUNET_HashCode cache_key;
1246 struct EgoEntry *tmp_ego; 1245 struct EgoEntry *tmp_ego;
1247 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
1248 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; 1246 const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key;
1247 struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
1249 1248
1250 cookie_identity_interpretation(handle); 1249 cookie_identity_interpretation(handle);
1251 1250
@@ -1299,9 +1298,8 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1299 1298
1300 handle->ego_entry = handle->ego_head; 1299 handle->ego_entry = handle->ego_head;
1301 handle->priv_key = *GNUNET_IDENTITY_ego_get_private_key (handle->ego_head->ego); 1300 handle->priv_key = *GNUNET_IDENTITY_ego_get_private_key (handle->ego_head->ego);
1302 handle->oidc->is_client_trusted = GNUNET_NO; 1301 //If we know this identity, translated the corresponding TLD
1303 1302 //TODO: We might want to have a reverse lookup functionality for TLDs?
1304 //First check if client_id is one of our egos; TODO: handle other TLD cases: Delegation, from config
1305 for (tmp_ego = handle->ego_head; NULL != tmp_ego; tmp_ego = tmp_ego->next) 1303 for (tmp_ego = handle->ego_head; NULL != tmp_ego; tmp_ego = tmp_ego->next)
1306 { 1304 {
1307 priv_key = GNUNET_IDENTITY_ego_get_private_key (tmp_ego->ego); 1305 priv_key = GNUNET_IDENTITY_ego_get_private_key (tmp_ego->ego);
@@ -1311,17 +1309,10 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1311 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) ) 1309 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) )
1312 { 1310 {
1313 handle->tld = GNUNET_strdup (tmp_ego->identifier); 1311 handle->tld = GNUNET_strdup (tmp_ego->identifier);
1314 handle->oidc->is_client_trusted = GNUNET_YES;
1315 handle->ego_entry = handle->ego_tail; 1312 handle->ego_entry = handle->ego_tail;
1316 } 1313 }
1317 } 1314 }
1318 1315 GNUNET_SCHEDULER_add_now (&build_authz_response, handle);
1319
1320 // Checks if client_id is valid:
1321 handle->namestore_handle_it = GNUNET_NAMESTORE_zone_iteration_start (
1322 handle->namestore_handle, &handle->priv_key, &oidc_iteration_error,
1323 handle, &namestore_iteration_callback, handle,
1324 &namestore_iteration_finished, handle);
1325} 1316}
1326 1317
1327/** 1318/**
@@ -1359,8 +1350,8 @@ login_cont (struct GNUNET_REST_RequestHandle *con_handle,
1359 1350
1360 current_time = GNUNET_new(struct GNUNET_TIME_Absolute); 1351 current_time = GNUNET_new(struct GNUNET_TIME_Absolute);
1361 *current_time = GNUNET_TIME_relative_to_absolute ( 1352 *current_time = GNUNET_TIME_relative_to_absolute (
1362 GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_minute_ (), 1353 GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (),
1363 30)); 1354 5));
1364 last_time = GNUNET_CONTAINER_multihashmap_get(OIDC_identity_login_time, &cache_key); 1355 last_time = GNUNET_CONTAINER_multihashmap_get(OIDC_identity_login_time, &cache_key);
1365 if (NULL != last_time) 1356 if (NULL != last_time)
1366 { 1357 {
@@ -1382,37 +1373,19 @@ login_cont (struct GNUNET_REST_RequestHandle *con_handle,
1382 return; 1373 return;
1383} 1374}
1384 1375
1385/** 1376static int
1386 * Responds to token url-encoded POST request 1377check_authorization (struct RequestHandle *handle,
1387 * 1378 struct GNUNET_CRYPTO_EcdsaPublicKey *cid)
1388 * @param con_handle the connection handle
1389 * @param url the url
1390 * @param cls the RequestHandle
1391 */
1392static void
1393token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1394 const char* url,
1395 void *cls)
1396{ 1379{
1397 //TODO static strings
1398 struct RequestHandle *handle = cls;
1399 struct GNUNET_HashCode cache_key; 1380 struct GNUNET_HashCode cache_key;
1400 char *authorization, *credentials; 1381 char *authorization;
1401 char delimiter[]=" "; 1382 char *credentials;
1402 char delimiter_user_psw[]=":"; 1383 char *basic_authorization;
1403 char *grant_type, *code; 1384 char *client_id;
1404 char *user_psw = NULL, *client_id, *psw; 1385 char *pass;
1405 char *expected_psw; 1386 char *expected_pass;
1406 int client_exists = GNUNET_NO; 1387 int client_exists = GNUNET_NO;
1407 struct MHD_Response *resp;
1408 char* code_output;
1409 json_t *root, *ticket_string, *nonce, *max_age;
1410 json_error_t error;
1411 char *json_response;
1412 1388
1413 /*
1414 * Check Authorization
1415 */
1416 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY, 1389 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY,
1417 strlen (OIDC_AUTHORIZATION_HEADER_KEY), 1390 strlen (OIDC_AUTHORIZATION_HEADER_KEY),
1418 &cache_key); 1391 &cache_key);
@@ -1422,80 +1395,75 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1422 handle->emsg=GNUNET_strdup("invalid_client"); 1395 handle->emsg=GNUNET_strdup("invalid_client");
1423 handle->edesc=GNUNET_strdup("missing authorization"); 1396 handle->edesc=GNUNET_strdup("missing authorization");
1424 handle->response_code = MHD_HTTP_UNAUTHORIZED; 1397 handle->response_code = MHD_HTTP_UNAUTHORIZED;
1425 GNUNET_SCHEDULER_add_now (&do_error, handle); 1398 return GNUNET_SYSERR;
1426 return;
1427 } 1399 }
1428 authorization = GNUNET_CONTAINER_multihashmap_get ( handle->rest_handle->header_param_map, &cache_key); 1400 authorization = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->header_param_map,
1401 &cache_key);
1429 1402
1430 //split header in "Basic" and [content] 1403 //split header in "Basic" and [content]
1431 credentials = strtok (authorization, delimiter); 1404 credentials = strtok (authorization, " ");
1432 if (0 != strcmp ("Basic",credentials)) 1405 if (0 != strcmp ("Basic", credentials))
1433 { 1406 {
1434 handle->emsg=GNUNET_strdup("invalid_client"); 1407 handle->emsg=GNUNET_strdup("invalid_client");
1435 handle->response_code = MHD_HTTP_UNAUTHORIZED; 1408 handle->response_code = MHD_HTTP_UNAUTHORIZED;
1436 GNUNET_SCHEDULER_add_now (&do_error, handle); 1409 return GNUNET_SYSERR;
1437 return;
1438 } 1410 }
1439 credentials = strtok(NULL, delimiter); 1411 credentials = strtok(NULL, " ");
1440 if (NULL == credentials) 1412 if (NULL == credentials)
1441 { 1413 {
1442 handle->emsg=GNUNET_strdup("invalid_client"); 1414 handle->emsg=GNUNET_strdup("invalid_client");
1443 handle->response_code = MHD_HTTP_UNAUTHORIZED; 1415 handle->response_code = MHD_HTTP_UNAUTHORIZED;
1444 GNUNET_SCHEDULER_add_now (&do_error, handle); 1416 return GNUNET_SYSERR;
1445 return;
1446 } 1417 }
1447 GNUNET_STRINGS_base64_decode (credentials, strlen (credentials), &user_psw); 1418 GNUNET_STRINGS_base64_decode (credentials,
1419 strlen (credentials),
1420 (void**)&basic_authorization);
1448 1421
1449 if ( NULL == user_psw ) 1422 if ( NULL == basic_authorization )
1450 { 1423 {
1451 handle->emsg=GNUNET_strdup("invalid_client"); 1424 handle->emsg=GNUNET_strdup("invalid_client");
1452 handle->response_code = MHD_HTTP_UNAUTHORIZED; 1425 handle->response_code = MHD_HTTP_UNAUTHORIZED;
1453 GNUNET_SCHEDULER_add_now (&do_error, handle); 1426 return GNUNET_SYSERR;
1454 return;
1455 } 1427 }
1456 client_id = strtok (user_psw, delimiter_user_psw); 1428 client_id = strtok (basic_authorization, ":");
1457 if ( NULL == client_id ) 1429 if ( NULL == client_id )
1458 { 1430 {
1459 GNUNET_free_non_null(user_psw); 1431 GNUNET_free_non_null(basic_authorization);
1460 handle->emsg=GNUNET_strdup("invalid_client"); 1432 handle->emsg=GNUNET_strdup("invalid_client");
1461 handle->response_code = MHD_HTTP_UNAUTHORIZED; 1433 handle->response_code = MHD_HTTP_UNAUTHORIZED;
1462 GNUNET_SCHEDULER_add_now (&do_error, handle); 1434 return GNUNET_SYSERR;
1463 return;
1464 } 1435 }
1465 psw = strtok (NULL, delimiter_user_psw); 1436 pass = strtok (NULL, ":");
1466 if (NULL == psw) 1437 if (NULL == pass)
1467 { 1438 {
1468 GNUNET_free_non_null(user_psw); 1439 GNUNET_free_non_null(basic_authorization);
1469 handle->emsg=GNUNET_strdup("invalid_client"); 1440 handle->emsg=GNUNET_strdup("invalid_client");
1470 handle->response_code = MHD_HTTP_UNAUTHORIZED; 1441 handle->response_code = MHD_HTTP_UNAUTHORIZED;
1471 GNUNET_SCHEDULER_add_now (&do_error, handle); 1442 return GNUNET_SYSERR;
1472 return;
1473 } 1443 }
1474 1444
1475 //check client password 1445 //check client password
1476 if ( GNUNET_OK 1446 if ( GNUNET_OK
1477 == GNUNET_CONFIGURATION_get_value_string (cfg, "identity-rest-plugin", 1447 == GNUNET_CONFIGURATION_get_value_string (cfg, "reclaim-rest-plugin",
1478 "psw", &expected_psw) ) 1448 "psw", &expected_pass) )
1479 { 1449 {
1480 if (0 != strcmp (expected_psw, psw)) 1450 if (0 != strcmp (expected_pass, pass))
1481 { 1451 {
1482 GNUNET_free_non_null(user_psw); 1452 GNUNET_free_non_null(basic_authorization);
1483 GNUNET_free(expected_psw); 1453 GNUNET_free(expected_pass);
1484 handle->emsg=GNUNET_strdup("invalid_client"); 1454 handle->emsg=GNUNET_strdup("invalid_client");
1485 handle->response_code = MHD_HTTP_UNAUTHORIZED; 1455 handle->response_code = MHD_HTTP_UNAUTHORIZED;
1486 GNUNET_SCHEDULER_add_now (&do_error, handle); 1456 return GNUNET_SYSERR;
1487 return;
1488 } 1457 }
1489 GNUNET_free(expected_psw); 1458 GNUNET_free(expected_pass);
1490 } 1459 }
1491 else 1460 else
1492 { 1461 {
1493 GNUNET_free_non_null(user_psw); 1462 GNUNET_free_non_null(basic_authorization);
1494 handle->emsg = GNUNET_strdup("server_error"); 1463 handle->emsg = GNUNET_strdup("server_error");
1495 handle->edesc = GNUNET_strdup ("gnunet configuration failed"); 1464 handle->edesc = GNUNET_strdup ("gnunet configuration failed");
1496 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; 1465 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
1497 GNUNET_SCHEDULER_add_now (&do_error, handle); 1466 return GNUNET_SYSERR;
1498 return;
1499 } 1467 }
1500 1468
1501 //check client_id 1469 //check client_id
@@ -1510,9 +1478,107 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1510 } 1478 }
1511 if (GNUNET_NO == client_exists) 1479 if (GNUNET_NO == client_exists)
1512 { 1480 {
1513 GNUNET_free_non_null(user_psw); 1481 GNUNET_free_non_null(basic_authorization);
1514 handle->emsg=GNUNET_strdup("invalid_client"); 1482 handle->emsg=GNUNET_strdup("invalid_client");
1515 handle->response_code = MHD_HTTP_UNAUTHORIZED; 1483 handle->response_code = MHD_HTTP_UNAUTHORIZED;
1484 return GNUNET_SYSERR;
1485 }
1486 GNUNET_STRINGS_string_to_data (client_id,
1487 strlen(client_id),
1488 cid,
1489 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
1490
1491 GNUNET_free (basic_authorization);
1492 return GNUNET_OK;
1493}
1494
1495static int
1496ego_exists (struct RequestHandle *handle,
1497 struct GNUNET_CRYPTO_EcdsaPublicKey *test_key)
1498{
1499 struct EgoEntry *ego_entry;
1500 struct GNUNET_CRYPTO_EcdsaPublicKey pub_key;
1501
1502 for (ego_entry = handle->ego_head; NULL != ego_entry; ego_entry = ego_entry->next)
1503 {
1504 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &pub_key);
1505 if (0 == memcmp (&pub_key,
1506 test_key,
1507 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
1508 {
1509 break;
1510 }
1511 }
1512 if (NULL == ego_entry)
1513 return GNUNET_NO;
1514 return GNUNET_YES;
1515}
1516
1517static void
1518store_ticket_reference (const struct RequestHandle *handle,
1519 const char* access_token,
1520 const struct GNUNET_RECLAIM_Ticket *ticket,
1521 const struct GNUNET_CRYPTO_EcdsaPublicKey *cid)
1522{
1523 struct GNUNET_HashCode cache_key;
1524 char *id_ticket_combination;
1525 char *ticket_string;
1526 char *client_id;
1527
1528 GNUNET_CRYPTO_hash(access_token, strlen(access_token), &cache_key);
1529 client_id = GNUNET_STRINGS_data_to_string_alloc (cid,
1530 sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
1531 ticket_string = GNUNET_STRINGS_data_to_string_alloc (ticket,
1532 sizeof (struct GNUNET_RECLAIM_Ticket));
1533 GNUNET_asprintf(&id_ticket_combination,
1534 "%s;%s",
1535 client_id,
1536 ticket_string);
1537 GNUNET_CONTAINER_multihashmap_put(OIDC_interpret_access_token,
1538 &cache_key,
1539 id_ticket_combination,
1540 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
1541
1542 GNUNET_free (client_id);
1543 GNUNET_free (ticket_string);
1544}
1545
1546/**
1547 * Responds to token url-encoded POST request
1548 *
1549 * @param con_handle the connection handle
1550 * @param url the url
1551 * @param cls the RequestHandle
1552 */
1553static void
1554token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1555 const char* url,
1556 void *cls)
1557{
1558 struct RequestHandle *handle = cls;
1559 struct GNUNET_TIME_Relative expiration_time;
1560 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *cl;
1561 struct GNUNET_RECLAIM_Ticket *ticket;
1562 struct GNUNET_CRYPTO_EcdsaPublicKey cid;
1563 struct GNUNET_HashCode cache_key;
1564 struct MHD_Response *resp;
1565 char *grant_type;
1566 char *code;
1567 char *json_response;
1568 char *id_token;
1569 char *access_token;
1570 char *jwt_secret;
1571 char *nonce;
1572 int i = 1;
1573
1574 /*
1575 * Check Authorization
1576 */
1577 if (GNUNET_SYSERR == check_authorization (handle,
1578 &cid))
1579 {
1580 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1581 "OIDC authorization for token endpoint failed\n");
1516 GNUNET_SCHEDULER_add_now (&do_error, handle); 1582 GNUNET_SCHEDULER_add_now (&do_error, handle);
1517 return; 1583 return;
1518 } 1584 }
@@ -1524,27 +1590,25 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1524 //TODO Do not allow multiple equal parameter names 1590 //TODO Do not allow multiple equal parameter names
1525 //REQUIRED grant_type 1591 //REQUIRED grant_type
1526 GNUNET_CRYPTO_hash (OIDC_GRANT_TYPE_KEY, strlen (OIDC_GRANT_TYPE_KEY), &cache_key); 1592 GNUNET_CRYPTO_hash (OIDC_GRANT_TYPE_KEY, strlen (OIDC_GRANT_TYPE_KEY), &cache_key);
1527 if ( GNUNET_NO 1593 if (GNUNET_NO ==
1528 == GNUNET_CONTAINER_multihashmap_contains ( 1594 GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle->url_param_map,
1529 handle->rest_handle->url_param_map, &cache_key) ) 1595 &cache_key))
1530 { 1596 {
1531 GNUNET_free_non_null(user_psw);
1532 handle->emsg = GNUNET_strdup("invalid_request"); 1597 handle->emsg = GNUNET_strdup("invalid_request");
1533 handle->edesc = GNUNET_strdup("missing parameter grant_type"); 1598 handle->edesc = GNUNET_strdup("missing parameter grant_type");
1534 handle->response_code = MHD_HTTP_BAD_REQUEST; 1599 handle->response_code = MHD_HTTP_BAD_REQUEST;
1535 GNUNET_SCHEDULER_add_now (&do_error, handle); 1600 GNUNET_SCHEDULER_add_now (&do_error, handle);
1536 return; 1601 return;
1537 } 1602 }
1538 grant_type = GNUNET_CONTAINER_multihashmap_get ( 1603 grant_type = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map,
1539 handle->rest_handle->url_param_map, &cache_key); 1604 &cache_key);
1540 1605
1541 //REQUIRED code 1606 //REQUIRED code
1542 GNUNET_CRYPTO_hash (OIDC_CODE_KEY, strlen (OIDC_CODE_KEY), &cache_key); 1607 GNUNET_CRYPTO_hash (OIDC_CODE_KEY, strlen (OIDC_CODE_KEY), &cache_key);
1543 if ( GNUNET_NO 1608 if (GNUNET_NO ==
1544 == GNUNET_CONTAINER_multihashmap_contains ( 1609 GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle->url_param_map,
1545 handle->rest_handle->url_param_map, &cache_key) ) 1610 &cache_key))
1546 { 1611 {
1547 GNUNET_free_non_null(user_psw);
1548 handle->emsg = GNUNET_strdup("invalid_request"); 1612 handle->emsg = GNUNET_strdup("invalid_request");
1549 handle->edesc = GNUNET_strdup("missing parameter code"); 1613 handle->edesc = GNUNET_strdup("missing parameter code");
1550 handle->response_code = MHD_HTTP_BAD_REQUEST; 1614 handle->response_code = MHD_HTTP_BAD_REQUEST;
@@ -1557,11 +1621,10 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1557 //REQUIRED redirect_uri 1621 //REQUIRED redirect_uri
1558 GNUNET_CRYPTO_hash (OIDC_REDIRECT_URI_KEY, strlen (OIDC_REDIRECT_URI_KEY), 1622 GNUNET_CRYPTO_hash (OIDC_REDIRECT_URI_KEY, strlen (OIDC_REDIRECT_URI_KEY),
1559 &cache_key); 1623 &cache_key);
1560 if ( GNUNET_NO 1624 if (GNUNET_NO ==
1561 == GNUNET_CONTAINER_multihashmap_contains ( 1625 GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle->url_param_map,
1562 handle->rest_handle->url_param_map, &cache_key) ) 1626 &cache_key) )
1563 { 1627 {
1564 GNUNET_free_non_null(user_psw);
1565 handle->emsg = GNUNET_strdup("invalid_request"); 1628 handle->emsg = GNUNET_strdup("invalid_request");
1566 handle->edesc = GNUNET_strdup("missing parameter redirect_uri"); 1629 handle->edesc = GNUNET_strdup("missing parameter redirect_uri");
1567 handle->response_code = MHD_HTTP_BAD_REQUEST; 1630 handle->response_code = MHD_HTTP_BAD_REQUEST;
@@ -1572,21 +1635,18 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1572 //Check parameter grant_type == "authorization_code" 1635 //Check parameter grant_type == "authorization_code"
1573 if (0 != strcmp(OIDC_GRANT_TYPE_VALUE, grant_type)) 1636 if (0 != strcmp(OIDC_GRANT_TYPE_VALUE, grant_type))
1574 { 1637 {
1575 GNUNET_free_non_null(user_psw);
1576 handle->emsg=GNUNET_strdup("unsupported_grant_type"); 1638 handle->emsg=GNUNET_strdup("unsupported_grant_type");
1577 handle->response_code = MHD_HTTP_BAD_REQUEST; 1639 handle->response_code = MHD_HTTP_BAD_REQUEST;
1578 GNUNET_SCHEDULER_add_now (&do_error, handle); 1640 GNUNET_SCHEDULER_add_now (&do_error, handle);
1579 return; 1641 return;
1580 } 1642 }
1581 GNUNET_CRYPTO_hash (code, strlen (code), &cache_key); 1643 GNUNET_CRYPTO_hash (code, strlen (code), &cache_key);
1582 int i = 1; 1644 if (GNUNET_SYSERR ==
1583 if ( GNUNET_SYSERR 1645 GNUNET_CONTAINER_multihashmap_put (OIDC_ticket_once,
1584 == GNUNET_CONTAINER_multihashmap_put (OIDC_ticket_once, 1646 &cache_key,
1585 &cache_key, 1647 &i,
1586 &i, 1648 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) )
1587 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY) )
1588 { 1649 {
1589 GNUNET_free_non_null(user_psw);
1590 handle->emsg = GNUNET_strdup("invalid_request"); 1650 handle->emsg = GNUNET_strdup("invalid_request");
1591 handle->edesc = GNUNET_strdup("Cannot use the same code more than once"); 1651 handle->edesc = GNUNET_strdup("Cannot use the same code more than once");
1592 handle->response_code = MHD_HTTP_BAD_REQUEST; 1652 handle->response_code = MHD_HTTP_BAD_REQUEST;
@@ -1595,16 +1655,11 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1595 } 1655 }
1596 1656
1597 //decode code 1657 //decode code
1598 GNUNET_STRINGS_base64_decode(code,strlen(code),&code_output); 1658 if(GNUNET_OK != OIDC_parse_authz_code (&cid,
1599 root = json_loads (code_output, 0, &error); 1659 code,
1600 GNUNET_free(code_output); 1660 &ticket,
1601 ticket_string = json_object_get (root, "ticket"); 1661 &nonce))
1602 nonce = json_object_get (root, "nonce");
1603 max_age = json_object_get (root, "max_age");
1604
1605 if(ticket_string == NULL && !json_is_string(ticket_string))
1606 { 1662 {
1607 GNUNET_free_non_null(user_psw);
1608 handle->emsg = GNUNET_strdup("invalid_request"); 1663 handle->emsg = GNUNET_strdup("invalid_request");
1609 handle->edesc = GNUNET_strdup("invalid code"); 1664 handle->edesc = GNUNET_strdup("invalid code");
1610 handle->response_code = MHD_HTTP_BAD_REQUEST; 1665 handle->response_code = MHD_HTTP_BAD_REQUEST;
@@ -1612,42 +1667,13 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1612 return; 1667 return;
1613 } 1668 }
1614 1669
1615 struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket = GNUNET_new(struct GNUNET_IDENTITY_PROVIDER_Ticket);
1616 if ( GNUNET_OK
1617 != GNUNET_STRINGS_string_to_data (json_string_value(ticket_string),
1618 strlen (json_string_value(ticket_string)),
1619 ticket,
1620 sizeof(struct GNUNET_IDENTITY_PROVIDER_Ticket)))
1621 {
1622 GNUNET_free_non_null(user_psw);
1623 handle->emsg = GNUNET_strdup("invalid_request");
1624 handle->edesc = GNUNET_strdup("invalid code");
1625 handle->response_code = MHD_HTTP_BAD_REQUEST;
1626 GNUNET_SCHEDULER_add_now (&do_error, handle);
1627 GNUNET_free(ticket);
1628 return;
1629 }
1630 // this is the current client (relying party)
1631 struct GNUNET_CRYPTO_EcdsaPublicKey pub_key;
1632 GNUNET_IDENTITY_ego_get_public_key(handle->ego_entry->ego,&pub_key);
1633 if (0 != memcmp(&pub_key,&ticket->audience,sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
1634 {
1635 GNUNET_free_non_null(user_psw);
1636 handle->emsg = GNUNET_strdup("invalid_request");
1637 handle->edesc = GNUNET_strdup("invalid code");
1638 handle->response_code = MHD_HTTP_BAD_REQUEST;
1639 GNUNET_SCHEDULER_add_now (&do_error, handle);
1640 GNUNET_free(ticket);
1641 return;
1642 }
1643
1644 //create jwt 1670 //create jwt
1645 unsigned long long int expiration_time; 1671 if (GNUNET_OK !=
1646 if ( GNUNET_OK 1672 GNUNET_CONFIGURATION_get_value_time(cfg,
1647 != GNUNET_CONFIGURATION_get_value_number(cfg, "identity-rest-plugin", 1673 "reclaim-rest-plugin",
1648 "expiration_time", &expiration_time) ) 1674 "expiration_time",
1675 &expiration_time))
1649 { 1676 {
1650 GNUNET_free_non_null(user_psw);
1651 handle->emsg = GNUNET_strdup("server_error"); 1677 handle->emsg = GNUNET_strdup("server_error");
1652 handle->edesc = GNUNET_strdup ("gnunet configuration failed"); 1678 handle->edesc = GNUNET_strdup ("gnunet configuration failed");
1653 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR; 1679 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
@@ -1656,118 +1682,56 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1656 return; 1682 return;
1657 } 1683 }
1658 1684
1659 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *cl = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList);
1660 //aud REQUIRED public key client_id must be there
1661 GNUNET_IDENTITY_ATTRIBUTE_list_add(cl,
1662 "aud",
1663 GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING,
1664 client_id,
1665 strlen(client_id));
1666 //exp REQUIRED time expired from config
1667 struct GNUNET_TIME_Absolute exp_time = GNUNET_TIME_relative_to_absolute (
1668 GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (),
1669 expiration_time));
1670 const char* exp_time_string = GNUNET_STRINGS_absolute_time_to_string(exp_time);
1671 GNUNET_IDENTITY_ATTRIBUTE_list_add (cl,
1672 "exp",
1673 GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING,
1674 exp_time_string,
1675 strlen(exp_time_string));
1676 //iat REQUIRED time now
1677 struct GNUNET_TIME_Absolute time_now = GNUNET_TIME_absolute_get();
1678 const char* time_now_string = GNUNET_STRINGS_absolute_time_to_string(time_now);
1679 GNUNET_IDENTITY_ATTRIBUTE_list_add (cl,
1680 "iat",
1681 GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING,
1682 time_now_string,
1683 strlen(time_now_string));
1684 //nonce only if nonce is provided
1685 if ( NULL != nonce && json_is_string(nonce) )
1686 {
1687 GNUNET_IDENTITY_ATTRIBUTE_list_add (cl,
1688 "nonce",
1689 GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING,
1690 json_string_value(nonce),
1691 strlen(json_string_value(nonce)));
1692 }
1693 //auth_time only if max_age is provided
1694 if ( NULL != max_age && json_is_string(max_age) )
1695 {
1696 GNUNET_IDENTITY_ATTRIBUTE_list_add (cl,
1697 "auth_time",
1698 GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING,
1699 json_string_value(max_age),
1700 strlen(json_string_value(max_age)));
1701 }
1702 //TODO OPTIONAL acr,amr,azp
1703 1685
1704 struct EgoEntry *ego_entry; 1686 //TODO OPTIONAL acr,amr,azp
1705 for (ego_entry = handle->ego_head; NULL != ego_entry; ego_entry = ego_entry->next) 1687 if (GNUNET_NO == ego_exists (handle,
1688 &ticket->audience))
1706 { 1689 {
1707 GNUNET_IDENTITY_ego_get_public_key (ego_entry->ego, &pub_key); 1690 handle->emsg = GNUNET_strdup("invalid_request");
1708 if (0 == memcmp (&pub_key, &ticket->audience, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) 1691 handle->edesc = GNUNET_strdup("invalid code...");
1709 { 1692 handle->response_code = MHD_HTTP_BAD_REQUEST;
1710 break; 1693 GNUNET_SCHEDULER_add_now (&do_error, handle);
1711 } 1694 GNUNET_free(ticket);
1712 } 1695 }
1713 if ( NULL == ego_entry ) 1696 if ( GNUNET_OK
1697 != GNUNET_CONFIGURATION_get_value_string (cfg, "reclaim-rest-plugin",
1698 "jwt_secret", &jwt_secret) )
1714 { 1699 {
1715 GNUNET_free_non_null(user_psw);
1716 handle->emsg = GNUNET_strdup("invalid_request"); 1700 handle->emsg = GNUNET_strdup("invalid_request");
1717 handle->edesc = GNUNET_strdup("invalid code...."); 1701 handle->edesc = GNUNET_strdup("No signing secret configured!");
1718 handle->response_code = MHD_HTTP_BAD_REQUEST; 1702 handle->response_code = MHD_HTTP_INTERNAL_SERVER_ERROR;
1719 GNUNET_SCHEDULER_add_now (&do_error, handle); 1703 GNUNET_SCHEDULER_add_now (&do_error, handle);
1720 GNUNET_free(ticket); 1704 GNUNET_free(ticket);
1721 return; 1705 return;
1722 } 1706 }
1723 char *id_token = jwt_create_from_list(&ticket->audience, 1707 //TODO We should collect the attributes here. cl always empty
1724 cl, 1708 cl = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList);
1725 GNUNET_IDENTITY_ego_get_private_key(ego_entry->ego)); 1709 id_token = OIDC_id_token_new (&ticket->audience,
1726 1710 &ticket->identity,
1727 //Create random access_token 1711 cl,
1728 char* access_token_number; 1712 &expiration_time,
1729 char* access_token; 1713 (NULL != nonce) ? nonce : NULL,
1730 uint64_t random_number; 1714 jwt_secret);
1731 random_number = GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_NONCE, UINT64_MAX); 1715 access_token = OIDC_access_token_new ();
1732 GNUNET_asprintf(&access_token_number, "%" PRIu64, random_number); 1716 OIDC_build_token_response (access_token,
1733 GNUNET_STRINGS_base64_encode(access_token_number,strlen(access_token_number),&access_token); 1717 id_token,
1734 1718 &expiration_time,
1735 1719 &json_response);
1736 1720
1737 //TODO OPTIONAL add refresh_token and scope 1721 store_ticket_reference (handle,
1738 GNUNET_asprintf (&json_response, 1722 access_token,
1739 "{ \"access_token\" : \"%s\", " 1723 ticket,
1740 "\"token_type\" : \"Bearer\", " 1724 &cid);
1741 "\"expires_in\" : %d, "
1742 "\"id_token\" : \"%s\"}",
1743 access_token,
1744 expiration_time,
1745 id_token);
1746 GNUNET_CRYPTO_hash(access_token, strlen(access_token), &cache_key);
1747 char *id_ticket_combination;
1748 GNUNET_asprintf(&id_ticket_combination,
1749 "%s;%s",
1750 client_id,
1751 json_string_value(ticket_string));
1752 GNUNET_CONTAINER_multihashmap_put(OIDC_interpret_access_token,
1753 &cache_key,
1754 id_ticket_combination,
1755 GNUNET_CONTAINER_MULTIHASHMAPOPTION_REPLACE);
1756
1757 resp = GNUNET_REST_create_response (json_response); 1725 resp = GNUNET_REST_create_response (json_response);
1758 MHD_add_response_header (resp, "Cache-Control", "no-store"); 1726 MHD_add_response_header (resp, "Cache-Control", "no-store");
1759 MHD_add_response_header (resp, "Pragma", "no-cache"); 1727 MHD_add_response_header (resp, "Pragma", "no-cache");
1760 MHD_add_response_header (resp, "Content-Type", "application/json"); 1728 MHD_add_response_header (resp, "Content-Type", "application/json");
1761 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 1729 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
1762 1730 GNUNET_RECLAIM_ATTRIBUTE_list_destroy(cl);
1763 GNUNET_IDENTITY_ATTRIBUTE_list_destroy(cl);
1764 GNUNET_free(access_token_number);
1765 GNUNET_free(access_token); 1731 GNUNET_free(access_token);
1766 GNUNET_free(user_psw);
1767 GNUNET_free(json_response); 1732 GNUNET_free(json_response);
1768 GNUNET_free(ticket); 1733 GNUNET_free(ticket);
1769 GNUNET_free(id_token); 1734 GNUNET_free(id_token);
1770 json_decref (root);
1771 GNUNET_SCHEDULER_add_now(&cleanup_handle_delayed, handle); 1735 GNUNET_SCHEDULER_add_now(&cleanup_handle_delayed, handle);
1772} 1736}
1773 1737
@@ -1777,7 +1741,7 @@ token_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1777static void 1741static void
1778consume_ticket (void *cls, 1742consume_ticket (void *cls,
1779 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1743 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1780 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) 1744 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
1781{ 1745{
1782 struct RequestHandle *handle = cls; 1746 struct RequestHandle *handle = cls;
1783 char *tmp_value; 1747 char *tmp_value;
@@ -1789,9 +1753,9 @@ consume_ticket (void *cls,
1789 return; 1753 return;
1790 } 1754 }
1791 1755
1792 tmp_value = GNUNET_IDENTITY_ATTRIBUTE_value_to_string (attr->type, 1756 tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
1793 attr->data, 1757 attr->data,
1794 attr->data_size); 1758 attr->data_size);
1795 1759
1796 value = json_string (tmp_value); 1760 value = json_string (tmp_value);
1797 1761
@@ -1820,7 +1784,7 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1820 struct GNUNET_HashCode cache_key; 1784 struct GNUNET_HashCode cache_key;
1821 char *authorization, *authorization_type, *authorization_access_token; 1785 char *authorization, *authorization_type, *authorization_access_token;
1822 char *client_ticket, *client, *ticket_str; 1786 char *client_ticket, *client, *ticket_str;
1823 struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket; 1787 struct GNUNET_RECLAIM_Ticket *ticket;
1824 1788
1825 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY, 1789 GNUNET_CRYPTO_hash (OIDC_AUTHORIZATION_HEADER_KEY,
1826 strlen (OIDC_AUTHORIZATION_HEADER_KEY), 1790 strlen (OIDC_AUTHORIZATION_HEADER_KEY),
@@ -1918,12 +1882,12 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1918 GNUNET_free(client_ticket); 1882 GNUNET_free(client_ticket);
1919 return; 1883 return;
1920 } 1884 }
1921 ticket = GNUNET_new(struct GNUNET_IDENTITY_PROVIDER_Ticket); 1885 ticket = GNUNET_new(struct GNUNET_RECLAIM_Ticket);
1922 if ( GNUNET_OK 1886 if ( GNUNET_OK
1923 != GNUNET_STRINGS_string_to_data (ticket_str, 1887 != GNUNET_STRINGS_string_to_data (ticket_str,
1924 strlen (ticket_str), 1888 strlen (ticket_str),
1925 ticket, 1889 ticket,
1926 sizeof(struct GNUNET_IDENTITY_PROVIDER_Ticket))) 1890 sizeof(struct GNUNET_RECLAIM_Ticket)))
1927 { 1891 {
1928 handle->emsg = GNUNET_strdup("invalid_token"); 1892 handle->emsg = GNUNET_strdup("invalid_token");
1929 handle->edesc = GNUNET_strdup("The Access Token expired"); 1893 handle->edesc = GNUNET_strdup("The Access Token expired");
@@ -1935,15 +1899,15 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle,
1935 return; 1899 return;
1936 } 1900 }
1937 1901
1938 handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); 1902 handle->idp = GNUNET_RECLAIM_connect (cfg);
1939 handle->oidc->response = json_object(); 1903 handle->oidc->response = json_object();
1940 json_object_set_new( handle->oidc->response, "sub", json_string( handle->ego_entry->keystring)); 1904 json_object_set_new( handle->oidc->response, "sub", json_string( handle->ego_entry->keystring));
1941 handle->idp_op = GNUNET_IDENTITY_PROVIDER_ticket_consume ( 1905 handle->idp_op = GNUNET_RECLAIM_ticket_consume (
1942 handle->idp, 1906 handle->idp,
1943 GNUNET_IDENTITY_ego_get_private_key (handle->ego_entry->ego), 1907 GNUNET_IDENTITY_ego_get_private_key (handle->ego_entry->ego),
1944 ticket, 1908 ticket,
1945 consume_ticket, 1909 consume_ticket,
1946 handle); 1910 handle);
1947 GNUNET_free(ticket); 1911 GNUNET_free(ticket);
1948 GNUNET_free(authorization); 1912 GNUNET_free(authorization);
1949 GNUNET_free(client_ticket); 1913 GNUNET_free(client_ticket);
@@ -2103,6 +2067,7 @@ rest_identity_process_request(struct GNUNET_REST_RequestHandle *rest_handle,
2103 handle->identity_handle = GNUNET_IDENTITY_connect (cfg, 2067 handle->identity_handle = GNUNET_IDENTITY_connect (cfg,
2104 &list_ego, 2068 &list_ego,
2105 handle); 2069 handle);
2070 handle->gns_handle = GNUNET_GNS_connect (cfg);
2106 handle->namestore_handle = GNUNET_NAMESTORE_connect (cfg); 2071 handle->namestore_handle = GNUNET_NAMESTORE_connect (cfg);
2107 handle->timeout_task = 2072 handle->timeout_task =
2108 GNUNET_SCHEDULER_add_delayed (handle->timeout, 2073 GNUNET_SCHEDULER_add_delayed (handle->timeout,
diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/reclaim/plugin_rest_reclaim.c
index a83163db2..38ffc4ddb 100644
--- a/src/identity-provider/plugin_rest_identity_provider.c
+++ b/src/reclaim/plugin_rest_reclaim.c
@@ -18,8 +18,8 @@
18/** 18/**
19 * @author Martin Schanzenbach 19 * @author Martin Schanzenbach
20 * @author Philippe Buschmann 20 * @author Philippe Buschmann
21 * @file identity/plugin_rest_identity.c 21 * @file reclaim/plugin_rest_reclaim.c
22 * @brief GNUnet Namestore REST plugin 22 * @brief GNUnet reclaim REST plugin
23 * 23 *
24 */ 24 */
25 25
@@ -36,38 +36,38 @@
36#include <jansson.h> 36#include <jansson.h>
37#include <inttypes.h> 37#include <inttypes.h>
38#include "gnunet_signatures.h" 38#include "gnunet_signatures.h"
39#include "gnunet_identity_attribute_lib.h" 39#include "gnunet_reclaim_attribute_lib.h"
40#include "gnunet_identity_provider_service.h" 40#include "gnunet_reclaim_service.h"
41 41
42/** 42/**
43 * REST root namespace 43 * REST root namespace
44 */ 44 */
45#define GNUNET_REST_API_NS_IDENTITY_PROVIDER "/idp" 45#define GNUNET_REST_API_NS_RECLAIM "/reclaim"
46 46
47/** 47/**
48 * Attribute namespace 48 * Attribute namespace
49 */ 49 */
50#define GNUNET_REST_API_NS_IDENTITY_ATTRIBUTES "/idp/attributes" 50#define GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES "/reclaim/attributes"
51 51
52/** 52/**
53 * Ticket namespace 53 * Ticket namespace
54 */ 54 */
55#define GNUNET_REST_API_NS_IDENTITY_TICKETS "/idp/tickets" 55#define GNUNET_REST_API_NS_IDENTITY_TICKETS "/reclaim/tickets"
56 56
57/** 57/**
58 * Revoke namespace 58 * Revoke namespace
59 */ 59 */
60#define GNUNET_REST_API_NS_IDENTITY_REVOKE "/idp/revoke" 60#define GNUNET_REST_API_NS_IDENTITY_REVOKE "/reclaim/revoke"
61 61
62/** 62/**
63 * Revoke namespace 63 * Revoke namespace
64 */ 64 */
65#define GNUNET_REST_API_NS_IDENTITY_CONSUME "/idp/consume" 65#define GNUNET_REST_API_NS_IDENTITY_CONSUME "/reclaim/consume"
66 66
67/** 67/**
68 * Attribute key 68 * Attribute key
69 */ 69 */
70#define GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE "attribute" 70#define GNUNET_REST_JSONAPI_RECLAIM_ATTRIBUTE "attribute"
71 71
72/** 72/**
73 * Ticket key 73 * Ticket key
@@ -78,7 +78,7 @@
78/** 78/**
79 * Value key 79 * Value key
80 */ 80 */
81#define GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE_VALUE "value" 81#define GNUNET_REST_JSONAPI_RECLAIM_ATTRIBUTE_VALUE "value"
82 82
83/** 83/**
84 * State while collecting all egos 84 * State while collecting all egos
@@ -190,7 +190,7 @@ struct RequestHandle
190 /** 190 /**
191 * Attribute claim list 191 * Attribute claim list
192 */ 192 */
193 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attr_list; 193 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list;
194 194
195 /** 195 /**
196 * IDENTITY Operation 196 * IDENTITY Operation
@@ -200,27 +200,27 @@ struct RequestHandle
200 /** 200 /**
201 * Identity Provider 201 * Identity Provider
202 */ 202 */
203 struct GNUNET_IDENTITY_PROVIDER_Handle *idp; 203 struct GNUNET_RECLAIM_Handle *idp;
204 204
205 /** 205 /**
206 * Idp Operation 206 * Idp Operation
207 */ 207 */
208 struct GNUNET_IDENTITY_PROVIDER_Operation *idp_op; 208 struct GNUNET_RECLAIM_Operation *idp_op;
209 209
210 /** 210 /**
211 * Attribute iterator 211 * Attribute iterator
212 */ 212 */
213 struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *attr_it; 213 struct GNUNET_RECLAIM_AttributeIterator *attr_it;
214 214
215 /** 215 /**
216 * Ticket iterator 216 * Ticket iterator
217 */ 217 */
218 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *ticket_it; 218 struct GNUNET_RECLAIM_TicketIterator *ticket_it;
219 219
220 /** 220 /**
221 * A ticket 221 * A ticket
222 */ 222 */
223 struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 223 struct GNUNET_RECLAIM_Ticket ticket;
224 224
225 /** 225 /**
226 * Desired timeout for the lookup (default is no timeout). 226 * Desired timeout for the lookup (default is no timeout).
@@ -271,8 +271,8 @@ struct RequestHandle
271static void 271static void
272cleanup_handle (struct RequestHandle *handle) 272cleanup_handle (struct RequestHandle *handle)
273{ 273{
274 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *claim_entry; 274 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_entry;
275 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *claim_tmp; 275 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *claim_tmp;
276 struct EgoEntry *ego_entry; 276 struct EgoEntry *ego_entry;
277 struct EgoEntry *ego_tmp; 277 struct EgoEntry *ego_tmp;
278 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 278 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -284,11 +284,11 @@ cleanup_handle (struct RequestHandle *handle)
284 if (NULL != handle->identity_handle) 284 if (NULL != handle->identity_handle)
285 GNUNET_IDENTITY_disconnect (handle->identity_handle); 285 GNUNET_IDENTITY_disconnect (handle->identity_handle);
286 if (NULL != handle->attr_it) 286 if (NULL != handle->attr_it)
287 GNUNET_IDENTITY_PROVIDER_get_attributes_stop (handle->attr_it); 287 GNUNET_RECLAIM_get_attributes_stop (handle->attr_it);
288 if (NULL != handle->ticket_it) 288 if (NULL != handle->ticket_it)
289 GNUNET_IDENTITY_PROVIDER_ticket_iteration_stop (handle->ticket_it); 289 GNUNET_RECLAIM_ticket_iteration_stop (handle->ticket_it);
290 if (NULL != handle->idp) 290 if (NULL != handle->idp)
291 GNUNET_IDENTITY_PROVIDER_disconnect (handle->idp); 291 GNUNET_RECLAIM_disconnect (handle->idp);
292 if (NULL != handle->url) 292 if (NULL != handle->url)
293 GNUNET_free (handle->url); 293 GNUNET_free (handle->url);
294 if (NULL != handle->emsg) 294 if (NULL != handle->emsg)
@@ -435,7 +435,7 @@ collect_finished_cb (void *cls)
435 */ 435 */
436static void 436static void
437ticket_collect (void *cls, 437ticket_collect (void *cls,
438 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket) 438 const struct GNUNET_RECLAIM_Ticket *ticket)
439{ 439{
440 struct GNUNET_JSONAPI_Resource *json_resource; 440 struct GNUNET_JSONAPI_Resource *json_resource;
441 struct RequestHandle *handle = cls; 441 struct RequestHandle *handle = cls;
@@ -474,7 +474,7 @@ ticket_collect (void *cls,
474 value); 474 value);
475 GNUNET_free (tmp); 475 GNUNET_free (tmp);
476 json_decref (value); 476 json_decref (value);
477 GNUNET_IDENTITY_PROVIDER_ticket_iteration_next (handle->ticket_it); 477 GNUNET_RECLAIM_ticket_iteration_next (handle->ticket_it);
478} 478}
479 479
480 480
@@ -523,8 +523,8 @@ list_tickets_cont (struct GNUNET_REST_RequestHandle *con_handle,
523 return; 523 return;
524 } 524 }
525 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 525 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
526 handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); 526 handle->idp = GNUNET_RECLAIM_connect (cfg);
527 handle->ticket_it = GNUNET_IDENTITY_PROVIDER_ticket_iteration_start (handle->idp, 527 handle->ticket_it = GNUNET_RECLAIM_ticket_iteration_start (handle->idp,
528 priv_key, 528 priv_key,
529 &collect_error_cb, 529 &collect_error_cb,
530 handle, 530 handle,
@@ -549,7 +549,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
549 struct RequestHandle *handle = cls; 549 struct RequestHandle *handle = cls;
550 struct EgoEntry *ego_entry; 550 struct EgoEntry *ego_entry;
551 struct MHD_Response *resp; 551 struct MHD_Response *resp;
552 struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attribute; 552 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attribute;
553 struct GNUNET_JSONAPI_Document *json_obj; 553 struct GNUNET_JSONAPI_Document *json_obj;
554 struct GNUNET_JSONAPI_Resource *json_res; 554 struct GNUNET_JSONAPI_Resource *json_res;
555 struct GNUNET_TIME_Relative exp; 555 struct GNUNET_TIME_Relative exp;
@@ -565,14 +565,14 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
565 565
566 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding an attribute for %s.\n", 566 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding an attribute for %s.\n",
567 handle->url); 567 handle->url);
568 if ( strlen (GNUNET_REST_API_NS_IDENTITY_ATTRIBUTES) >= 568 if ( strlen (GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES) >=
569 strlen (handle->url)) 569 strlen (handle->url))
570 { 570 {
571 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); 571 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
572 GNUNET_SCHEDULER_add_now (&do_error, handle); 572 GNUNET_SCHEDULER_add_now (&do_error, handle);
573 return; 573 return;
574 } 574 }
575 identity = handle->url + strlen (GNUNET_REST_API_NS_IDENTITY_ATTRIBUTES) + 1; 575 identity = handle->url + strlen (GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES) + 1;
576 576
577 for (ego_entry = handle->ego_head; 577 for (ego_entry = handle->ego_head;
578 NULL != ego_entry; 578 NULL != ego_entry;
@@ -625,7 +625,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
625 } 625 }
626 json_res = GNUNET_JSONAPI_document_get_resource (json_obj, 0); 626 json_res = GNUNET_JSONAPI_document_get_resource (json_obj, 0);
627 if (GNUNET_NO == GNUNET_JSONAPI_resource_check_type (json_res, 627 if (GNUNET_NO == GNUNET_JSONAPI_resource_check_type (json_res,
628 GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE)) 628 GNUNET_REST_JSONAPI_RECLAIM_ATTRIBUTE))
629 { 629 {
630 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 630 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
631 "Unsupported JSON data type\n"); 631 "Unsupported JSON data type\n");
@@ -651,12 +651,12 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
651 value_json = GNUNET_JSONAPI_resource_read_attr (json_res, 651 value_json = GNUNET_JSONAPI_resource_read_attr (json_res,
652 "value"); 652 "value");
653 value_str = json_string_value (value_json); 653 value_str = json_string_value (value_json);
654 attribute = GNUNET_IDENTITY_ATTRIBUTE_claim_new (name_str, 654 attribute = GNUNET_RECLAIM_ATTRIBUTE_claim_new (name_str,
655 GNUNET_IDENTITY_ATTRIBUTE_TYPE_STRING, 655 GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING,
656 value_str, 656 value_str,
657 strlen (value_str) + 1); 657 strlen (value_str) + 1);
658 handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); 658 handle->idp = GNUNET_RECLAIM_connect (cfg);
659 handle->idp_op = GNUNET_IDENTITY_PROVIDER_attribute_store (handle->idp, 659 handle->idp_op = GNUNET_RECLAIM_attribute_store (handle->idp,
660 identity_priv, 660 identity_priv,
661 attribute, 661 attribute,
662 &exp, 662 &exp,
@@ -675,7 +675,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
675static void 675static void
676attr_collect (void *cls, 676attr_collect (void *cls,
677 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 677 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
678 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) 678 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
679{ 679{
680 struct GNUNET_JSONAPI_Resource *json_resource; 680 struct GNUNET_JSONAPI_Resource *json_resource;
681 struct RequestHandle *handle = cls; 681 struct RequestHandle *handle = cls;
@@ -684,17 +684,17 @@ attr_collect (void *cls,
684 684
685 if ((NULL == attr->name) || (NULL == attr->data)) 685 if ((NULL == attr->name) || (NULL == attr->data))
686 { 686 {
687 GNUNET_IDENTITY_PROVIDER_get_attributes_next (handle->attr_it); 687 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
688 return; 688 return;
689 } 689 }
690 690
691 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", 691 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n",
692 attr->name); 692 attr->name);
693 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE, 693 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_RECLAIM_ATTRIBUTE,
694 attr->name); 694 attr->name);
695 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource); 695 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
696 696
697 tmp_value = GNUNET_IDENTITY_ATTRIBUTE_value_to_string (attr->type, 697 tmp_value = GNUNET_RECLAIM_ATTRIBUTE_value_to_string (attr->type,
698 attr->data, 698 attr->data,
699 attr->data_size); 699 attr->data_size);
700 700
@@ -705,7 +705,7 @@ attr_collect (void *cls,
705 value); 705 value);
706 json_decref (value); 706 json_decref (value);
707 GNUNET_free(tmp_value); 707 GNUNET_free(tmp_value);
708 GNUNET_IDENTITY_PROVIDER_get_attributes_next (handle->attr_it); 708 GNUNET_RECLAIM_get_attributes_next (handle->attr_it);
709} 709}
710 710
711 711
@@ -729,14 +729,14 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
729 729
730 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Getting attributes for %s.\n", 730 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Getting attributes for %s.\n",
731 handle->url); 731 handle->url);
732 if ( strlen (GNUNET_REST_API_NS_IDENTITY_ATTRIBUTES) >= 732 if ( strlen (GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES) >=
733 strlen (handle->url)) 733 strlen (handle->url))
734 { 734 {
735 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n"); 735 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No identity given.\n");
736 GNUNET_SCHEDULER_add_now (&do_error, handle); 736 GNUNET_SCHEDULER_add_now (&do_error, handle);
737 return; 737 return;
738 } 738 }
739 identity = handle->url + strlen (GNUNET_REST_API_NS_IDENTITY_ATTRIBUTES) + 1; 739 identity = handle->url + strlen (GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES) + 1;
740 740
741 for (ego_entry = handle->ego_head; 741 for (ego_entry = handle->ego_head;
742 NULL != ego_entry; 742 NULL != ego_entry;
@@ -755,8 +755,8 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle,
755 return; 755 return;
756 } 756 }
757 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 757 priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
758 handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); 758 handle->idp = GNUNET_RECLAIM_connect (cfg);
759 handle->attr_it = GNUNET_IDENTITY_PROVIDER_get_attributes_start (handle->idp, 759 handle->attr_it = GNUNET_RECLAIM_get_attributes_start (handle->idp,
760 priv_key, 760 priv_key,
761 &collect_error_cb, 761 &collect_error_cb,
762 handle, 762 handle,
@@ -780,7 +780,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
780 struct RequestHandle *handle = cls; 780 struct RequestHandle *handle = cls;
781 struct EgoEntry *ego_entry; 781 struct EgoEntry *ego_entry;
782 struct MHD_Response *resp; 782 struct MHD_Response *resp;
783 struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 783 struct GNUNET_RECLAIM_Ticket ticket;
784 struct GNUNET_JSONAPI_Document *json_obj; 784 struct GNUNET_JSONAPI_Document *json_obj;
785 struct GNUNET_JSONAPI_Resource *json_res; 785 struct GNUNET_JSONAPI_Resource *json_res;
786 struct GNUNET_CRYPTO_EcdsaPublicKey tmp_pk; 786 struct GNUNET_CRYPTO_EcdsaPublicKey tmp_pk;
@@ -844,7 +844,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
844 rnd_json = GNUNET_JSONAPI_resource_read_attr (json_res, 844 rnd_json = GNUNET_JSONAPI_resource_read_attr (json_res,
845 "rnd"); 845 "rnd");
846 identity_json = GNUNET_JSONAPI_resource_read_attr (json_res, 846 identity_json = GNUNET_JSONAPI_resource_read_attr (json_res,
847 "identity"); 847 "issuer");
848 audience_json = GNUNET_JSONAPI_resource_read_attr (json_res, 848 audience_json = GNUNET_JSONAPI_resource_read_attr (json_res,
849 "audience"); 849 "audience");
850 rnd_str = json_string_value (rnd_json); 850 rnd_str = json_string_value (rnd_json);
@@ -884,8 +884,8 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
884 } 884 }
885 identity_priv = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 885 identity_priv = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
886 886
887 handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); 887 handle->idp = GNUNET_RECLAIM_connect (cfg);
888 handle->idp_op = GNUNET_IDENTITY_PROVIDER_ticket_revoke (handle->idp, 888 handle->idp_op = GNUNET_RECLAIM_ticket_revoke (handle->idp,
889 identity_priv, 889 identity_priv,
890 &ticket, 890 &ticket,
891 &finished_cont, 891 &finished_cont,
@@ -896,7 +896,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
896static void 896static void
897consume_cont (void *cls, 897consume_cont (void *cls,
898 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 898 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
899 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr) 899 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr)
900{ 900{
901 struct RequestHandle *handle = cls; 901 struct RequestHandle *handle = cls;
902 struct GNUNET_JSONAPI_Resource *json_resource; 902 struct GNUNET_JSONAPI_Resource *json_resource;
@@ -910,7 +910,7 @@ consume_cont (void *cls,
910 910
911 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n", 911 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n",
912 attr->name); 912 attr->name);
913 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE, 913 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_RECLAIM_ATTRIBUTE,
914 attr->name); 914 attr->name);
915 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource); 915 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
916 916
@@ -934,7 +934,7 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
934 struct RequestHandle *handle = cls; 934 struct RequestHandle *handle = cls;
935 struct EgoEntry *ego_entry; 935 struct EgoEntry *ego_entry;
936 struct MHD_Response *resp; 936 struct MHD_Response *resp;
937 struct GNUNET_IDENTITY_PROVIDER_Ticket ticket; 937 struct GNUNET_RECLAIM_Ticket ticket;
938 struct GNUNET_JSONAPI_Document *json_obj; 938 struct GNUNET_JSONAPI_Document *json_obj;
939 struct GNUNET_JSONAPI_Resource *json_res; 939 struct GNUNET_JSONAPI_Resource *json_res;
940 struct GNUNET_CRYPTO_EcdsaPublicKey tmp_pk; 940 struct GNUNET_CRYPTO_EcdsaPublicKey tmp_pk;
@@ -1038,8 +1038,8 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle,
1038 } 1038 }
1039 identity_priv = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); 1039 identity_priv = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego);
1040 handle->resp_object = GNUNET_JSONAPI_document_new (); 1040 handle->resp_object = GNUNET_JSONAPI_document_new ();
1041 handle->idp = GNUNET_IDENTITY_PROVIDER_connect (cfg); 1041 handle->idp = GNUNET_RECLAIM_connect (cfg);
1042 handle->idp_op = GNUNET_IDENTITY_PROVIDER_ticket_consume (handle->idp, 1042 handle->idp_op = GNUNET_RECLAIM_ticket_consume (handle->idp,
1043 identity_priv, 1043 identity_priv,
1044 &ticket, 1044 &ticket,
1045 &consume_cont, 1045 &consume_cont,
@@ -1084,12 +1084,12 @@ init_cont (struct RequestHandle *handle)
1084{ 1084{
1085 struct GNUNET_REST_RequestHandlerError err; 1085 struct GNUNET_REST_RequestHandlerError err;
1086 static const struct GNUNET_REST_RequestHandler handlers[] = { 1086 static const struct GNUNET_REST_RequestHandler handlers[] = {
1087 {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_ATTRIBUTES, &list_attribute_cont}, 1087 {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &list_attribute_cont},
1088 {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_ATTRIBUTES, &add_attribute_cont}, 1088 {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, &add_attribute_cont},
1089 {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont}, 1089 {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_TICKETS, &list_tickets_cont},
1090 {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_REVOKE, &revoke_ticket_cont}, 1090 {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_REVOKE, &revoke_ticket_cont},
1091 {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_CONSUME, &consume_ticket_cont}, 1091 {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_CONSUME, &consume_ticket_cont},
1092 {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_IDENTITY_PROVIDER, 1092 {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM,
1093 &options_cont}, 1093 &options_cont},
1094 GNUNET_REST_HANDLER_END 1094 GNUNET_REST_HANDLER_END
1095 }; 1095 };
@@ -1202,7 +1202,7 @@ rest_identity_process_request(struct GNUNET_REST_RequestHandle *rest_handle,
1202 * @return NULL on error, otherwise the plugin context 1202 * @return NULL on error, otherwise the plugin context
1203 */ 1203 */
1204void * 1204void *
1205libgnunet_plugin_rest_identity_provider_init (void *cls) 1205libgnunet_plugin_rest_reclaim_init (void *cls)
1206{ 1206{
1207 static struct Plugin plugin; 1207 static struct Plugin plugin;
1208 struct GNUNET_REST_Plugin *api; 1208 struct GNUNET_REST_Plugin *api;
@@ -1214,7 +1214,7 @@ libgnunet_plugin_rest_identity_provider_init (void *cls)
1214 plugin.cfg = cfg; 1214 plugin.cfg = cfg;
1215 api = GNUNET_new (struct GNUNET_REST_Plugin); 1215 api = GNUNET_new (struct GNUNET_REST_Plugin);
1216 api->cls = &plugin; 1216 api->cls = &plugin;
1217 api->name = GNUNET_REST_API_NS_IDENTITY_PROVIDER; 1217 api->name = GNUNET_REST_API_NS_RECLAIM;
1218 api->process_request = &rest_identity_process_request; 1218 api->process_request = &rest_identity_process_request;
1219 GNUNET_asprintf (&allow_methods, 1219 GNUNET_asprintf (&allow_methods,
1220 "%s, %s, %s, %s, %s", 1220 "%s, %s, %s, %s, %s",
@@ -1237,7 +1237,7 @@ libgnunet_plugin_rest_identity_provider_init (void *cls)
1237 * @return always NULL 1237 * @return always NULL
1238 */ 1238 */
1239void * 1239void *
1240libgnunet_plugin_rest_identity_provider_done (void *cls) 1240libgnunet_plugin_rest_reclaim_done (void *cls)
1241{ 1241{
1242 struct GNUNET_REST_Plugin *api = cls; 1242 struct GNUNET_REST_Plugin *api = cls;
1243 struct Plugin *plugin = api->cls; 1243 struct Plugin *plugin = api->cls;
@@ -1250,4 +1250,4 @@ libgnunet_plugin_rest_identity_provider_done (void *cls)
1250 return NULL; 1250 return NULL;
1251} 1251}
1252 1252
1253/* end of plugin_rest_identity_provider.c */ 1253/* end of plugin_rest_reclaim.c */
diff --git a/src/identity-provider/identity-provider.conf b/src/reclaim/reclaim.conf
index cc50152a1..cf0a0dc5e 100644
--- a/src/identity-provider/identity-provider.conf
+++ b/src/reclaim/reclaim.conf
@@ -1,22 +1,23 @@
1[identity-provider] 1[reclaim]
2START_ON_DEMAND = NO 2START_ON_DEMAND = NO
3RUN_PER_USER = YES 3RUN_PER_USER = YES
4#PORT = 2108 4#PORT = 2108
5HOSTNAME = localhost 5HOSTNAME = localhost
6BINARY = gnunet-service-identity-provider 6BINARY = gnunet-service-reclaim
7ACCEPT_FROM = 127.0.0.1; 7ACCEPT_FROM = 127.0.0.1;
8ACCEPT_FROM6 = ::1; 8ACCEPT_FROM6 = ::1;
9UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-identity-provider.sock 9UNIXPATH = $GNUNET_USER_RUNTIME_DIR/gnunet-service-reclaim.sock
10UNIX_MATCH_UID = NO 10UNIX_MATCH_UID = NO
11UNIX_MATCH_GID = YES 11UNIX_MATCH_GID = YES
12TOKEN_EXPIRATION_INTERVAL = 30 m 12TOKEN_EXPIRATION_INTERVAL = 30 m
13DATABASE = sqlite 13DATABASE = sqlite
14 14
15[identity-rest-plugin] 15[reclaim-rest-plugin]
16#ADDRESS = https://identity.gnu:8000#/login 16#ADDRESS = https://identity.gnu:8000#/login
17ADDRESS = https://reclaim.ui/#/login 17ADDRESS = https://reclaim.ui/#/login
18PSW = secret 18PSW = secret
19EXPIRATION_TIME = 3600 19JWT_SECRET = secret
20EXPIRATION_TIME = 1d
20 21
21[identity-provider-sqlite] 22[reclaim-sqlite]
22FILENAME = $GNUNET_DATA_HOME/identity-provider/sqlite.db 23FILENAME = $GNUNET_DATA_HOME/reclaim/sqlite.db
diff --git a/src/identity-provider/identity_provider.h b/src/reclaim/reclaim.h
index 6a4b7769f..d2c84686d 100644
--- a/src/identity-provider/identity_provider.h
+++ b/src/reclaim/reclaim.h
@@ -18,13 +18,13 @@
18 18
19/** 19/**
20 * @author Martin Schanzenbach 20 * @author Martin Schanzenbach
21 * @file identity-provider/identity_provider.h 21 * @file reclaim/reclaim.h
22 * 22 *
23 * @brief Common type definitions for the identity provider 23 * @brief Common type definitions for the identity provider
24 * service and API. 24 * service and API.
25 */ 25 */
26#ifndef IDENTITY_PROVIDER_H 26#ifndef RECLAIM_H
27#define IDENTITY_PROVIDER_H 27#define RECLAIM_H
28 28
29#include "gnunet_common.h" 29#include "gnunet_common.h"
30 30
@@ -152,7 +152,7 @@ struct AttributeIterationStartMessage
152struct AttributeIterationNextMessage 152struct AttributeIterationNextMessage
153{ 153{
154 /** 154 /**
155 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_NEXT 155 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT
156 */ 156 */
157 struct GNUNET_MessageHeader header; 157 struct GNUNET_MessageHeader header;
158 158
@@ -170,7 +170,7 @@ struct AttributeIterationNextMessage
170struct AttributeIterationStopMessage 170struct AttributeIterationStopMessage
171{ 171{
172 /** 172 /**
173 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_STOP 173 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP
174 */ 174 */
175 struct GNUNET_MessageHeader header; 175 struct GNUNET_MessageHeader header;
176 176
@@ -214,7 +214,7 @@ struct TicketIterationStartMessage
214struct TicketIterationNextMessage 214struct TicketIterationNextMessage
215{ 215{
216 /** 216 /**
217 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_NEXT 217 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT
218 */ 218 */
219 struct GNUNET_MessageHeader header; 219 struct GNUNET_MessageHeader header;
220 220
@@ -232,7 +232,7 @@ struct TicketIterationNextMessage
232struct TicketIterationStopMessage 232struct TicketIterationStopMessage
233{ 233{
234 /** 234 /**
235 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_STOP 235 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP
236 */ 236 */
237 struct GNUNET_MessageHeader header; 237 struct GNUNET_MessageHeader header;
238 238
@@ -251,7 +251,7 @@ struct TicketIterationStopMessage
251struct IssueTicketMessage 251struct IssueTicketMessage
252{ 252{
253 /** 253 /**
254 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_TICKET 254 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET
255 */ 255 */
256 struct GNUNET_MessageHeader header; 256 struct GNUNET_MessageHeader header;
257 257
@@ -284,7 +284,7 @@ struct IssueTicketMessage
284struct RevokeTicketMessage 284struct RevokeTicketMessage
285{ 285{
286 /** 286 /**
287 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET 287 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET
288 */ 288 */
289 struct GNUNET_MessageHeader header; 289 struct GNUNET_MessageHeader header;
290 290
@@ -312,7 +312,7 @@ struct RevokeTicketMessage
312struct RevokeTicketResultMessage 312struct RevokeTicketResultMessage
313{ 313{
314 /** 314 /**
315 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET_RESULT 315 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
316 */ 316 */
317 struct GNUNET_MessageHeader header; 317 struct GNUNET_MessageHeader header;
318 318
@@ -334,7 +334,7 @@ struct RevokeTicketResultMessage
334struct TicketResultMessage 334struct TicketResultMessage
335{ 335{
336 /** 336 /**
337 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT 337 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
338 */ 338 */
339 struct GNUNET_MessageHeader header; 339 struct GNUNET_MessageHeader header;
340 340
@@ -351,7 +351,7 @@ struct TicketResultMessage
351struct ConsumeTicketMessage 351struct ConsumeTicketMessage
352{ 352{
353 /** 353 /**
354 * Type will be #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET 354 * Type will be #GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET
355 */ 355 */
356 struct GNUNET_MessageHeader header; 356 struct GNUNET_MessageHeader header;
357 357
diff --git a/src/identity-provider/identity_provider_api.c b/src/reclaim/reclaim_api.c
index 772b4a244..3f1584ccd 100644
--- a/src/identity-provider/identity_provider_api.c
+++ b/src/reclaim/reclaim_api.c
@@ -17,8 +17,8 @@
17*/ 17*/
18 18
19/** 19/**
20 * @file identity-provider/identity_provider_api.c 20 * @file reclaim/reclaim_api.c
21 * @brief api to interact with the identity provider service 21 * @brief api to interact with the reclaim service
22 * @author Martin Schanzenbach 22 * @author Martin Schanzenbach
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
@@ -26,33 +26,33 @@
26#include "gnunet_constants.h" 26#include "gnunet_constants.h"
27#include "gnunet_protocols.h" 27#include "gnunet_protocols.h"
28#include "gnunet_mq_lib.h" 28#include "gnunet_mq_lib.h"
29#include "gnunet_identity_provider_service.h" 29#include "gnunet_reclaim_service.h"
30#include "gnunet_identity_attribute_lib.h" 30#include "gnunet_reclaim_attribute_lib.h"
31#include "identity_provider.h" 31#include "reclaim.h"
32 32
33#define LOG(kind,...) GNUNET_log_from (kind, "identity-api",__VA_ARGS__) 33#define LOG(kind,...) GNUNET_log_from (kind, "reclaim-api",__VA_ARGS__)
34 34
35 35
36/** 36/**
37 * Handle for an operation with the service. 37 * Handle for an operation with the service.
38 */ 38 */
39struct GNUNET_IDENTITY_PROVIDER_Operation 39struct GNUNET_RECLAIM_Operation
40{ 40{
41 41
42 /** 42 /**
43 * Main handle. 43 * Main handle.
44 */ 44 */
45 struct GNUNET_IDENTITY_PROVIDER_Handle *h; 45 struct GNUNET_RECLAIM_Handle *h;
46 46
47 /** 47 /**
48 * We keep operations in a DLL. 48 * We keep operations in a DLL.
49 */ 49 */
50 struct GNUNET_IDENTITY_PROVIDER_Operation *next; 50 struct GNUNET_RECLAIM_Operation *next;
51 51
52 /** 52 /**
53 * We keep operations in a DLL. 53 * We keep operations in a DLL.
54 */ 54 */
55 struct GNUNET_IDENTITY_PROVIDER_Operation *prev; 55 struct GNUNET_RECLAIM_Operation *prev;
56 56
57 /** 57 /**
58 * Message to send to the service. 58 * Message to send to the service.
@@ -63,22 +63,22 @@ struct GNUNET_IDENTITY_PROVIDER_Operation
63 /** 63 /**
64 * Continuation to invoke after attribute store call 64 * Continuation to invoke after attribute store call
65 */ 65 */
66 GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus as_cb; 66 GNUNET_RECLAIM_ContinuationWithStatus as_cb;
67 67
68 /** 68 /**
69 * Attribute result callback 69 * Attribute result callback
70 */ 70 */
71 GNUNET_IDENTITY_PROVIDER_AttributeResult ar_cb; 71 GNUNET_RECLAIM_AttributeResult ar_cb;
72 72
73 /** 73 /**
74 * Revocation result callback 74 * Revocation result callback
75 */ 75 */
76 GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus rvk_cb; 76 GNUNET_RECLAIM_ContinuationWithStatus rvk_cb;
77 77
78 /** 78 /**
79 * Ticket result callback 79 * Ticket result callback
80 */ 80 */
81 GNUNET_IDENTITY_PROVIDER_TicketCallback tr_cb; 81 GNUNET_RECLAIM_TicketCallback tr_cb;
82 82
83 /** 83 /**
84 * Envelope with the message for this queue entry. 84 * Envelope with the message for this queue entry.
@@ -100,23 +100,23 @@ struct GNUNET_IDENTITY_PROVIDER_Operation
100/** 100/**
101 * Handle for a ticket iterator operation 101 * Handle for a ticket iterator operation
102 */ 102 */
103struct GNUNET_IDENTITY_PROVIDER_TicketIterator 103struct GNUNET_RECLAIM_TicketIterator
104{ 104{
105 105
106 /** 106 /**
107 * Kept in a DLL. 107 * Kept in a DLL.
108 */ 108 */
109 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *next; 109 struct GNUNET_RECLAIM_TicketIterator *next;
110 110
111 /** 111 /**
112 * Kept in a DLL. 112 * Kept in a DLL.
113 */ 113 */
114 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *prev; 114 struct GNUNET_RECLAIM_TicketIterator *prev;
115 115
116 /** 116 /**
117 * Main handle to access the idp. 117 * Main handle to access the idp.
118 */ 118 */
119 struct GNUNET_IDENTITY_PROVIDER_Handle *h; 119 struct GNUNET_RECLAIM_Handle *h;
120 120
121 /** 121 /**
122 * Function to call on completion. 122 * Function to call on completion.
@@ -131,7 +131,7 @@ struct GNUNET_IDENTITY_PROVIDER_TicketIterator
131 /** 131 /**
132 * The continuation to call with the results 132 * The continuation to call with the results
133 */ 133 */
134 GNUNET_IDENTITY_PROVIDER_TicketCallback tr_cb; 134 GNUNET_RECLAIM_TicketCallback tr_cb;
135 135
136 /** 136 /**
137 * Closure for @e tr_cb. 137 * Closure for @e tr_cb.
@@ -165,23 +165,23 @@ struct GNUNET_IDENTITY_PROVIDER_TicketIterator
165/** 165/**
166 * Handle for a attribute iterator operation 166 * Handle for a attribute iterator operation
167 */ 167 */
168struct GNUNET_IDENTITY_PROVIDER_AttributeIterator 168struct GNUNET_RECLAIM_AttributeIterator
169{ 169{
170 170
171 /** 171 /**
172 * Kept in a DLL. 172 * Kept in a DLL.
173 */ 173 */
174 struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *next; 174 struct GNUNET_RECLAIM_AttributeIterator *next;
175 175
176 /** 176 /**
177 * Kept in a DLL. 177 * Kept in a DLL.
178 */ 178 */
179 struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *prev; 179 struct GNUNET_RECLAIM_AttributeIterator *prev;
180 180
181 /** 181 /**
182 * Main handle to access the idp. 182 * Main handle to access the idp.
183 */ 183 */
184 struct GNUNET_IDENTITY_PROVIDER_Handle *h; 184 struct GNUNET_RECLAIM_Handle *h;
185 185
186 /** 186 /**
187 * Function to call on completion. 187 * Function to call on completion.
@@ -196,7 +196,7 @@ struct GNUNET_IDENTITY_PROVIDER_AttributeIterator
196 /** 196 /**
197 * The continuation to call with the results 197 * The continuation to call with the results
198 */ 198 */
199 GNUNET_IDENTITY_PROVIDER_AttributeResult proc; 199 GNUNET_RECLAIM_AttributeResult proc;
200 200
201 /** 201 /**
202 * Closure for @e proc. 202 * Closure for @e proc.
@@ -235,7 +235,7 @@ struct GNUNET_IDENTITY_PROVIDER_AttributeIterator
235/** 235/**
236 * Handle for the service. 236 * Handle for the service.
237 */ 237 */
238struct GNUNET_IDENTITY_PROVIDER_Handle 238struct GNUNET_RECLAIM_Handle
239{ 239{
240 /** 240 /**
241 * Configuration to use. 241 * Configuration to use.
@@ -255,32 +255,32 @@ struct GNUNET_IDENTITY_PROVIDER_Handle
255 /** 255 /**
256 * Head of active operations. 256 * Head of active operations.
257 */ 257 */
258 struct GNUNET_IDENTITY_PROVIDER_Operation *op_head; 258 struct GNUNET_RECLAIM_Operation *op_head;
259 259
260 /** 260 /**
261 * Tail of active operations. 261 * Tail of active operations.
262 */ 262 */
263 struct GNUNET_IDENTITY_PROVIDER_Operation *op_tail; 263 struct GNUNET_RECLAIM_Operation *op_tail;
264 264
265 /** 265 /**
266 * Head of active iterations 266 * Head of active iterations
267 */ 267 */
268 struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it_head; 268 struct GNUNET_RECLAIM_AttributeIterator *it_head;
269 269
270 /** 270 /**
271 * Tail of active iterations 271 * Tail of active iterations
272 */ 272 */
273 struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it_tail; 273 struct GNUNET_RECLAIM_AttributeIterator *it_tail;
274 274
275 /** 275 /**
276 * Head of active iterations 276 * Head of active iterations
277 */ 277 */
278 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *ticket_it_head; 278 struct GNUNET_RECLAIM_TicketIterator *ticket_it_head;
279 279
280 /** 280 /**
281 * Tail of active iterations 281 * Tail of active iterations
282 */ 282 */
283 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *ticket_it_tail; 283 struct GNUNET_RECLAIM_TicketIterator *ticket_it_tail;
284 284
285 285
286 /** 286 /**
@@ -318,10 +318,10 @@ struct GNUNET_IDENTITY_PROVIDER_Handle
318/** 318/**
319 * Try again to connect to the service. 319 * Try again to connect to the service.
320 * 320 *
321 * @param h handle to the identity provider service. 321 * @param h handle to the reclaim service.
322 */ 322 */
323static void 323static void
324reconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h); 324reconnect (struct GNUNET_RECLAIM_Handle *h);
325 325
326/** 326/**
327 * Reconnect 327 * Reconnect
@@ -331,7 +331,7 @@ reconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h);
331static void 331static void
332reconnect_task (void *cls) 332reconnect_task (void *cls)
333{ 333{
334 struct GNUNET_IDENTITY_PROVIDER_Handle *handle = cls; 334 struct GNUNET_RECLAIM_Handle *handle = cls;
335 335
336 handle->reconnect_task = NULL; 336 handle->reconnect_task = NULL;
337 reconnect (handle); 337 reconnect (handle);
@@ -344,7 +344,7 @@ reconnect_task (void *cls)
344 * @param handle our service 344 * @param handle our service
345 */ 345 */
346static void 346static void
347force_reconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *handle) 347force_reconnect (struct GNUNET_RECLAIM_Handle *handle)
348{ 348{
349 GNUNET_MQ_destroy (handle->mq); 349 GNUNET_MQ_destroy (handle->mq);
350 handle->mq = NULL; 350 handle->mq = NULL;
@@ -362,9 +362,9 @@ force_reconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *handle)
362 * @param it entry to free 362 * @param it entry to free
363 */ 363 */
364static void 364static void
365free_it (struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it) 365free_it (struct GNUNET_RECLAIM_AttributeIterator *it)
366{ 366{
367 struct GNUNET_IDENTITY_PROVIDER_Handle *h = it->h; 367 struct GNUNET_RECLAIM_Handle *h = it->h;
368 368
369 GNUNET_CONTAINER_DLL_remove (h->it_head, 369 GNUNET_CONTAINER_DLL_remove (h->it_head,
370 h->it_tail, 370 h->it_tail,
@@ -375,7 +375,7 @@ free_it (struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it)
375} 375}
376 376
377static void 377static void
378free_op (struct GNUNET_IDENTITY_PROVIDER_Operation* op) 378free_op (struct GNUNET_RECLAIM_Operation* op)
379{ 379{
380 if (NULL == op) 380 if (NULL == op)
381 return; 381 return;
@@ -397,7 +397,7 @@ static void
397mq_error_handler (void *cls, 397mq_error_handler (void *cls,
398 enum GNUNET_MQ_Error error) 398 enum GNUNET_MQ_Error error)
399{ 399{
400 struct GNUNET_IDENTITY_PROVIDER_Handle *handle = cls; 400 struct GNUNET_RECLAIM_Handle *handle = cls;
401 force_reconnect (handle); 401 force_reconnect (handle);
402} 402}
403 403
@@ -412,8 +412,8 @@ static void
412handle_attribute_store_response (void *cls, 412handle_attribute_store_response (void *cls,
413 const struct AttributeStoreResultMessage *msg) 413 const struct AttributeStoreResultMessage *msg)
414{ 414{
415 struct GNUNET_IDENTITY_PROVIDER_Handle *h = cls; 415 struct GNUNET_RECLAIM_Handle *h = cls;
416 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 416 struct GNUNET_RECLAIM_Operation *op;
417 uint32_t r_id = ntohl (msg->id); 417 uint32_t r_id = ntohl (msg->id);
418 int res; 418 int res;
419 const char *emsg; 419 const char *emsg;
@@ -448,7 +448,7 @@ handle_attribute_store_response (void *cls,
448 448
449/** 449/**
450 * Handle an incoming message of type 450 * Handle an incoming message of type
451 * #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET_RESULT 451 * #GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT
452 * 452 *
453 * @param cls 453 * @param cls
454 * @param msg the message we received 454 * @param msg the message we received
@@ -474,7 +474,7 @@ check_consume_ticket_result (void *cls,
474 474
475/** 475/**
476 * Handle an incoming message of type 476 * Handle an incoming message of type
477 * #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET_RESULT 477 * #GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT
478 * 478 *
479 * @param cls 479 * @param cls
480 * @param msg the message we received 480 * @param msg the message we received
@@ -483,8 +483,8 @@ static void
483handle_consume_ticket_result (void *cls, 483handle_consume_ticket_result (void *cls,
484 const struct ConsumeTicketResultMessage *msg) 484 const struct ConsumeTicketResultMessage *msg)
485{ 485{
486 struct GNUNET_IDENTITY_PROVIDER_Handle *h = cls; 486 struct GNUNET_RECLAIM_Handle *h = cls;
487 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 487 struct GNUNET_RECLAIM_Operation *op;
488 size_t attrs_len; 488 size_t attrs_len;
489 uint32_t r_id = ntohl (msg->id); 489 uint32_t r_id = ntohl (msg->id);
490 490
@@ -500,9 +500,9 @@ handle_consume_ticket_result (void *cls,
500 return; 500 return;
501 501
502 { 502 {
503 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs; 503 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
504 struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry *le; 504 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
505 attrs = GNUNET_IDENTITY_ATTRIBUTE_list_deserialize ((char*)&msg[1], 505 attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char*)&msg[1],
506 attrs_len); 506 attrs_len);
507 if (NULL != op->ar_cb) 507 if (NULL != op->ar_cb)
508 { 508 {
@@ -518,7 +518,7 @@ handle_consume_ticket_result (void *cls,
518 op->ar_cb (op->cls, 518 op->ar_cb (op->cls,
519 &msg->identity, 519 &msg->identity,
520 le->claim); 520 le->claim);
521 GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs); 521 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
522 } 522 }
523 } 523 }
524 if (NULL != op) 524 if (NULL != op)
@@ -539,7 +539,7 @@ handle_consume_ticket_result (void *cls,
539 539
540/** 540/**
541 * Handle an incoming message of type 541 * Handle an incoming message of type
542 * #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_RESULT 542 * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT
543 * 543 *
544 * @param cls 544 * @param cls
545 * @param msg the message we received 545 * @param msg the message we received
@@ -565,7 +565,7 @@ check_attribute_result (void *cls,
565 565
566/** 566/**
567 * Handle an incoming message of type 567 * Handle an incoming message of type
568 * #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_RESULT 568 * #GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT
569 * 569 *
570 * @param cls 570 * @param cls
571 * @param msg the message we received 571 * @param msg the message we received
@@ -575,9 +575,9 @@ handle_attribute_result (void *cls,
575 const struct AttributeResultMessage *msg) 575 const struct AttributeResultMessage *msg)
576{ 576{
577 static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; 577 static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy;
578 struct GNUNET_IDENTITY_PROVIDER_Handle *h = cls; 578 struct GNUNET_RECLAIM_Handle *h = cls;
579 struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it; 579 struct GNUNET_RECLAIM_AttributeIterator *it;
580 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 580 struct GNUNET_RECLAIM_Operation *op;
581 size_t attr_len; 581 size_t attr_len;
582 uint32_t r_id = ntohl (msg->id); 582 uint32_t r_id = ntohl (msg->id);
583 583
@@ -627,8 +627,8 @@ handle_attribute_result (void *cls,
627 } 627 }
628 628
629 { 629 {
630 struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr; 630 struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr;
631 attr = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&msg[1], 631 attr = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&msg[1],
632 attr_len); 632 attr_len);
633 if (NULL != it) 633 if (NULL != it)
634 { 634 {
@@ -652,7 +652,7 @@ handle_attribute_result (void *cls,
652 652
653/** 653/**
654 * Handle an incoming message of type 654 * Handle an incoming message of type
655 * #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT 655 * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
656 * 656 *
657 * @param cls 657 * @param cls
658 * @param msg the message we received 658 * @param msg the message we received
@@ -677,7 +677,7 @@ check_ticket_result (void *cls,
677 677
678/** 678/**
679 * Handle an incoming message of type 679 * Handle an incoming message of type
680 * #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT 680 * #GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT
681 * 681 *
682 * @param cls 682 * @param cls
683 * @param msg the message we received 683 * @param msg the message we received
@@ -686,10 +686,10 @@ static void
686handle_ticket_result (void *cls, 686handle_ticket_result (void *cls,
687 const struct TicketResultMessage *msg) 687 const struct TicketResultMessage *msg)
688{ 688{
689 struct GNUNET_IDENTITY_PROVIDER_Handle *handle = cls; 689 struct GNUNET_RECLAIM_Handle *handle = cls;
690 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 690 struct GNUNET_RECLAIM_Operation *op;
691 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it; 691 struct GNUNET_RECLAIM_TicketIterator *it;
692 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket; 692 const struct GNUNET_RECLAIM_Ticket *ticket;
693 uint32_t r_id = ntohl (msg->id); 693 uint32_t r_id = ntohl (msg->id);
694 size_t msg_len; 694 size_t msg_len;
695 695
@@ -712,7 +712,7 @@ handle_ticket_result (void *cls,
712 if (NULL != op->tr_cb) 712 if (NULL != op->tr_cb)
713 op->tr_cb (op->cls, NULL); 713 op->tr_cb (op->cls, NULL);
714 } else { 714 } else {
715 ticket = (struct GNUNET_IDENTITY_PROVIDER_Ticket *)&msg[1]; 715 ticket = (struct GNUNET_RECLAIM_Ticket *)&msg[1];
716 if (NULL != op->tr_cb) 716 if (NULL != op->tr_cb)
717 op->tr_cb (op->cls, ticket); 717 op->tr_cb (op->cls, ticket);
718 } 718 }
@@ -728,7 +728,7 @@ handle_ticket_result (void *cls,
728 it->finish_cb (it->finish_cb_cls); 728 it->finish_cb (it->finish_cb_cls);
729 GNUNET_free (it); 729 GNUNET_free (it);
730 } else { 730 } else {
731 ticket = (struct GNUNET_IDENTITY_PROVIDER_Ticket *)&msg[1]; 731 ticket = (struct GNUNET_RECLAIM_Ticket *)&msg[1];
732 if (NULL != it->tr_cb) 732 if (NULL != it->tr_cb)
733 it->tr_cb (it->cls, ticket); 733 it->tr_cb (it->cls, ticket);
734 } 734 }
@@ -740,7 +740,7 @@ handle_ticket_result (void *cls,
740 740
741/** 741/**
742 * Handle an incoming message of type 742 * Handle an incoming message of type
743 * #GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET_RESULT 743 * #GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT
744 * 744 *
745 * @param cls 745 * @param cls
746 * @param msg the message we received 746 * @param msg the message we received
@@ -749,8 +749,8 @@ static void
749handle_revoke_ticket_result (void *cls, 749handle_revoke_ticket_result (void *cls,
750 const struct RevokeTicketResultMessage *msg) 750 const struct RevokeTicketResultMessage *msg)
751{ 751{
752 struct GNUNET_IDENTITY_PROVIDER_Handle *h = cls; 752 struct GNUNET_RECLAIM_Handle *h = cls;
753 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 753 struct GNUNET_RECLAIM_Operation *op;
754 uint32_t r_id = ntohl (msg->id); 754 uint32_t r_id = ntohl (msg->id);
755 int32_t success; 755 int32_t success;
756 756
@@ -785,42 +785,42 @@ handle_revoke_ticket_result (void *cls,
785/** 785/**
786 * Try again to connect to the service. 786 * Try again to connect to the service.
787 * 787 *
788 * @param h handle to the identity provider service. 788 * @param h handle to the reclaim service.
789 */ 789 */
790static void 790static void
791reconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h) 791reconnect (struct GNUNET_RECLAIM_Handle *h)
792{ 792{
793 struct GNUNET_MQ_MessageHandler handlers[] = { 793 struct GNUNET_MQ_MessageHandler handlers[] = {
794 GNUNET_MQ_hd_fixed_size (attribute_store_response, 794 GNUNET_MQ_hd_fixed_size (attribute_store_response,
795 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE_RESPONSE, 795 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE_RESPONSE,
796 struct AttributeStoreResultMessage, 796 struct AttributeStoreResultMessage,
797 h), 797 h),
798 GNUNET_MQ_hd_var_size (attribute_result, 798 GNUNET_MQ_hd_var_size (attribute_result,
799 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_RESULT, 799 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT,
800 struct AttributeResultMessage, 800 struct AttributeResultMessage,
801 h), 801 h),
802 GNUNET_MQ_hd_var_size (ticket_result, 802 GNUNET_MQ_hd_var_size (ticket_result,
803 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_RESULT, 803 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT,
804 struct TicketResultMessage, 804 struct TicketResultMessage,
805 h), 805 h),
806 GNUNET_MQ_hd_var_size (consume_ticket_result, 806 GNUNET_MQ_hd_var_size (consume_ticket_result,
807 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET_RESULT, 807 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT,
808 struct ConsumeTicketResultMessage, 808 struct ConsumeTicketResultMessage,
809 h), 809 h),
810 GNUNET_MQ_hd_fixed_size (revoke_ticket_result, 810 GNUNET_MQ_hd_fixed_size (revoke_ticket_result,
811 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET_RESULT, 811 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT,
812 struct RevokeTicketResultMessage, 812 struct RevokeTicketResultMessage,
813 h), 813 h),
814 GNUNET_MQ_handler_end () 814 GNUNET_MQ_handler_end ()
815 }; 815 };
816 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 816 struct GNUNET_RECLAIM_Operation *op;
817 817
818 GNUNET_assert (NULL == h->mq); 818 GNUNET_assert (NULL == h->mq);
819 LOG (GNUNET_ERROR_TYPE_DEBUG, 819 LOG (GNUNET_ERROR_TYPE_DEBUG,
820 "Connecting to identity provider service.\n"); 820 "Connecting to reclaim service.\n");
821 821
822 h->mq = GNUNET_CLIENT_connect (h->cfg, 822 h->mq = GNUNET_CLIENT_connect (h->cfg,
823 "identity-provider", 823 "reclaim",
824 handlers, 824 handlers,
825 &mq_error_handler, 825 &mq_error_handler,
826 h); 826 h);
@@ -833,17 +833,17 @@ reconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h)
833 833
834 834
835/** 835/**
836 * Connect to the identity provider service. 836 * Connect to the reclaim service.
837 * 837 *
838 * @param cfg the configuration to use 838 * @param cfg the configuration to use
839 * @return handle to use 839 * @return handle to use
840 */ 840 */
841struct GNUNET_IDENTITY_PROVIDER_Handle * 841struct GNUNET_RECLAIM_Handle *
842GNUNET_IDENTITY_PROVIDER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg) 842GNUNET_RECLAIM_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
843{ 843{
844 struct GNUNET_IDENTITY_PROVIDER_Handle *h; 844 struct GNUNET_RECLAIM_Handle *h;
845 845
846 h = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_Handle); 846 h = GNUNET_new (struct GNUNET_RECLAIM_Handle);
847 h->cfg = cfg; 847 h->cfg = cfg;
848 reconnect (h); 848 reconnect (h);
849 if (NULL == h->mq) 849 if (NULL == h->mq)
@@ -864,9 +864,9 @@ GNUNET_IDENTITY_PROVIDER_connect (const struct GNUNET_CONFIGURATION_Handle *cfg)
864 * @param op operation to cancel 864 * @param op operation to cancel
865 */ 865 */
866void 866void
867GNUNET_IDENTITY_PROVIDER_cancel (struct GNUNET_IDENTITY_PROVIDER_Operation *op) 867GNUNET_RECLAIM_cancel (struct GNUNET_RECLAIM_Operation *op)
868{ 868{
869 struct GNUNET_IDENTITY_PROVIDER_Handle *h = op->h; 869 struct GNUNET_RECLAIM_Handle *h = op->h;
870 870
871 GNUNET_CONTAINER_DLL_remove (h->op_head, 871 GNUNET_CONTAINER_DLL_remove (h->op_head,
872 h->op_tail, 872 h->op_tail,
@@ -881,7 +881,7 @@ GNUNET_IDENTITY_PROVIDER_cancel (struct GNUNET_IDENTITY_PROVIDER_Operation *op)
881 * @param h handle to destroy 881 * @param h handle to destroy
882 */ 882 */
883void 883void
884GNUNET_IDENTITY_PROVIDER_disconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h) 884GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h)
885{ 885{
886 GNUNET_assert (NULL != h); 886 GNUNET_assert (NULL != h);
887 if (NULL != h->mq) 887 if (NULL != h->mq)
@@ -902,7 +902,7 @@ GNUNET_IDENTITY_PROVIDER_disconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h)
902 * Store an attribute. If the attribute is already present, 902 * Store an attribute. If the attribute is already present,
903 * it is replaced with the new attribute. 903 * it is replaced with the new attribute.
904 * 904 *
905 * @param h handle to the identity provider 905 * @param h handle to the reclaim
906 * @param pkey private key of the identity 906 * @param pkey private key of the identity
907 * @param attr the attribute value 907 * @param attr the attribute value
908 * @param exp_interval the relative expiration interval for the attribute 908 * @param exp_interval the relative expiration interval for the attribute
@@ -910,19 +910,19 @@ GNUNET_IDENTITY_PROVIDER_disconnect (struct GNUNET_IDENTITY_PROVIDER_Handle *h)
910 * @param cont_cls closure for @a cont 910 * @param cont_cls closure for @a cont
911 * @return handle to abort the request 911 * @return handle to abort the request
912 */ 912 */
913struct GNUNET_IDENTITY_PROVIDER_Operation * 913struct GNUNET_RECLAIM_Operation *
914GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 914GNUNET_RECLAIM_attribute_store (struct GNUNET_RECLAIM_Handle *h,
915 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, 915 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey,
916 const struct GNUNET_IDENTITY_ATTRIBUTE_Claim *attr, 916 const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr,
917 const struct GNUNET_TIME_Relative *exp_interval, 917 const struct GNUNET_TIME_Relative *exp_interval,
918 GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cont, 918 GNUNET_RECLAIM_ContinuationWithStatus cont,
919 void *cont_cls) 919 void *cont_cls)
920{ 920{
921 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 921 struct GNUNET_RECLAIM_Operation *op;
922 struct AttributeStoreMessage *sam; 922 struct AttributeStoreMessage *sam;
923 size_t attr_len; 923 size_t attr_len;
924 924
925 op = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_Operation); 925 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
926 op->h = h; 926 op->h = h;
927 op->as_cb = cont; 927 op->as_cb = cont;
928 op->cls = cont_cls; 928 op->cls = cont_cls;
@@ -930,15 +930,15 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle
930 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, 930 GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
931 h->op_tail, 931 h->op_tail,
932 op); 932 op);
933 attr_len = GNUNET_IDENTITY_ATTRIBUTE_serialize_get_size (attr); 933 attr_len = GNUNET_RECLAIM_ATTRIBUTE_serialize_get_size (attr);
934 op->env = GNUNET_MQ_msg_extra (sam, 934 op->env = GNUNET_MQ_msg_extra (sam,
935 attr_len, 935 attr_len,
936 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_STORE); 936 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE);
937 sam->identity = *pkey; 937 sam->identity = *pkey;
938 sam->id = htonl (op->r_id); 938 sam->id = htonl (op->r_id);
939 sam->exp = GNUNET_htonll (exp_interval->rel_value_us); 939 sam->exp = GNUNET_htonll (exp_interval->rel_value_us);
940 940
941 GNUNET_IDENTITY_ATTRIBUTE_serialize (attr, 941 GNUNET_RECLAIM_ATTRIBUTE_serialize (attr,
942 (char*)&sam[1]); 942 (char*)&sam[1]);
943 943
944 sam->attr_len = htons (attr_len); 944 sam->attr_len = htons (attr_len);
@@ -952,11 +952,11 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle
952 952
953/** 953/**
954 * List all attributes for a local identity. 954 * List all attributes for a local identity.
955 * This MUST lock the `struct GNUNET_IDENTITY_PROVIDER_Handle` 955 * This MUST lock the `struct GNUNET_RECLAIM_Handle`
956 * for any other calls than #GNUNET_IDENTITY_PROVIDER_get_attributes_next() and 956 * for any other calls than #GNUNET_RECLAIM_get_attributes_next() and
957 * #GNUNET_IDENTITY_PROVIDER_get_attributes_stop. @a proc will be called once 957 * #GNUNET_RECLAIM_get_attributes_stop. @a proc will be called once
958 * immediately, and then again after 958 * immediately, and then again after
959 * #GNUNET_IDENTITY_PROVIDER_get_attributes_next() is invoked. 959 * #GNUNET_RECLAIM_get_attributes_next() is invoked.
960 * 960 *
961 * On error (disconnect), @a error_cb will be invoked. 961 * On error (disconnect), @a error_cb will be invoked.
962 * On normal completion, @a finish_cb proc will be 962 * On normal completion, @a finish_cb proc will be
@@ -975,23 +975,23 @@ GNUNET_IDENTITY_PROVIDER_attribute_store (struct GNUNET_IDENTITY_PROVIDER_Handle
975 * @param finish_cb_cls closure for @a finish_cb 975 * @param finish_cb_cls closure for @a finish_cb
976 * @return an iterator handle to use for iteration 976 * @return an iterator handle to use for iteration
977 */ 977 */
978struct GNUNET_IDENTITY_PROVIDER_AttributeIterator * 978struct GNUNET_RECLAIM_AttributeIterator *
979GNUNET_IDENTITY_PROVIDER_get_attributes_start (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 979GNUNET_RECLAIM_get_attributes_start (struct GNUNET_RECLAIM_Handle *h,
980 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 980 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
981 GNUNET_SCHEDULER_TaskCallback error_cb, 981 GNUNET_SCHEDULER_TaskCallback error_cb,
982 void *error_cb_cls, 982 void *error_cb_cls,
983 GNUNET_IDENTITY_PROVIDER_AttributeResult proc, 983 GNUNET_RECLAIM_AttributeResult proc,
984 void *proc_cls, 984 void *proc_cls,
985 GNUNET_SCHEDULER_TaskCallback finish_cb, 985 GNUNET_SCHEDULER_TaskCallback finish_cb,
986 void *finish_cb_cls) 986 void *finish_cb_cls)
987{ 987{
988 struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it; 988 struct GNUNET_RECLAIM_AttributeIterator *it;
989 struct GNUNET_MQ_Envelope *env; 989 struct GNUNET_MQ_Envelope *env;
990 struct AttributeIterationStartMessage *msg; 990 struct AttributeIterationStartMessage *msg;
991 uint32_t rid; 991 uint32_t rid;
992 992
993 rid = h->r_id_gen++; 993 rid = h->r_id_gen++;
994 it = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_AttributeIterator); 994 it = GNUNET_new (struct GNUNET_RECLAIM_AttributeIterator);
995 it->h = h; 995 it->h = h;
996 it->error_cb = error_cb; 996 it->error_cb = error_cb;
997 it->error_cb_cls = error_cb_cls; 997 it->error_cb_cls = error_cb_cls;
@@ -1005,7 +1005,7 @@ GNUNET_IDENTITY_PROVIDER_get_attributes_start (struct GNUNET_IDENTITY_PROVIDER_H
1005 h->it_tail, 1005 h->it_tail,
1006 it); 1006 it);
1007 env = GNUNET_MQ_msg (msg, 1007 env = GNUNET_MQ_msg (msg,
1008 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_START); 1008 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START);
1009 msg->id = htonl (rid); 1009 msg->id = htonl (rid);
1010 msg->identity = *identity; 1010 msg->identity = *identity;
1011 if (NULL == h->mq) 1011 if (NULL == h->mq)
@@ -1018,20 +1018,20 @@ GNUNET_IDENTITY_PROVIDER_get_attributes_start (struct GNUNET_IDENTITY_PROVIDER_H
1018 1018
1019 1019
1020/** 1020/**
1021 * Calls the record processor specified in #GNUNET_IDENTITY_PROVIDER_get_attributes_start 1021 * Calls the record processor specified in #GNUNET_RECLAIM_get_attributes_start
1022 * for the next record. 1022 * for the next record.
1023 * 1023 *
1024 * @param it the iterator 1024 * @param it the iterator
1025 */ 1025 */
1026void 1026void
1027GNUNET_IDENTITY_PROVIDER_get_attributes_next (struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it) 1027GNUNET_RECLAIM_get_attributes_next (struct GNUNET_RECLAIM_AttributeIterator *it)
1028{ 1028{
1029 struct GNUNET_IDENTITY_PROVIDER_Handle *h = it->h; 1029 struct GNUNET_RECLAIM_Handle *h = it->h;
1030 struct AttributeIterationNextMessage *msg; 1030 struct AttributeIterationNextMessage *msg;
1031 struct GNUNET_MQ_Envelope *env; 1031 struct GNUNET_MQ_Envelope *env;
1032 1032
1033 env = GNUNET_MQ_msg (msg, 1033 env = GNUNET_MQ_msg (msg,
1034 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_NEXT); 1034 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT);
1035 msg->id = htonl (it->r_id); 1035 msg->id = htonl (it->r_id);
1036 GNUNET_MQ_send (h->mq, 1036 GNUNET_MQ_send (h->mq,
1037 env); 1037 env);
@@ -1041,21 +1041,21 @@ GNUNET_IDENTITY_PROVIDER_get_attributes_next (struct GNUNET_IDENTITY_PROVIDER_At
1041/** 1041/**
1042 * Stops iteration and releases the idp handle for further calls. Must 1042 * Stops iteration and releases the idp handle for further calls. Must
1043 * be called on any iteration that has not yet completed prior to calling 1043 * be called on any iteration that has not yet completed prior to calling
1044 * #GNUNET_IDENTITY_PROVIDER_disconnect. 1044 * #GNUNET_RECLAIM_disconnect.
1045 * 1045 *
1046 * @param it the iterator 1046 * @param it the iterator
1047 */ 1047 */
1048void 1048void
1049GNUNET_IDENTITY_PROVIDER_get_attributes_stop (struct GNUNET_IDENTITY_PROVIDER_AttributeIterator *it) 1049GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it)
1050{ 1050{
1051 struct GNUNET_IDENTITY_PROVIDER_Handle *h = it->h; 1051 struct GNUNET_RECLAIM_Handle *h = it->h;
1052 struct GNUNET_MQ_Envelope *env; 1052 struct GNUNET_MQ_Envelope *env;
1053 struct AttributeIterationStopMessage *msg; 1053 struct AttributeIterationStopMessage *msg;
1054 1054
1055 if (NULL != h->mq) 1055 if (NULL != h->mq)
1056 { 1056 {
1057 env = GNUNET_MQ_msg (msg, 1057 env = GNUNET_MQ_msg (msg,
1058 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ATTRIBUTE_ITERATION_STOP); 1058 GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP);
1059 msg->id = htonl (it->r_id); 1059 msg->id = htonl (it->r_id);
1060 GNUNET_MQ_send (h->mq, 1060 GNUNET_MQ_send (h->mq,
1061 env); 1061 env);
@@ -1066,10 +1066,10 @@ GNUNET_IDENTITY_PROVIDER_get_attributes_stop (struct GNUNET_IDENTITY_PROVIDER_At
1066 1066
1067/** TODO 1067/** TODO
1068 * Issues a ticket to another identity. The identity may use 1068 * Issues a ticket to another identity. The identity may use
1069 * @GNUNET_IDENTITY_PROVIDER_authorization_ticket_consume to consume the ticket 1069 * @GNUNET_RECLAIM_authorization_ticket_consume to consume the ticket
1070 * and retrieve the attributes specified in the AttributeList. 1070 * and retrieve the attributes specified in the AttributeList.
1071 * 1071 *
1072 * @param h the identity provider to use 1072 * @param h the reclaim to use
1073 * @param iss the issuing identity 1073 * @param iss the issuing identity
1074 * @param rp the subject of the ticket (the relying party) 1074 * @param rp the subject of the ticket (the relying party)
1075 * @param attrs the attributes that the relying party is given access to 1075 * @param attrs the attributes that the relying party is given access to
@@ -1077,19 +1077,19 @@ GNUNET_IDENTITY_PROVIDER_get_attributes_stop (struct GNUNET_IDENTITY_PROVIDER_At
1077 * @param cb_cls the callback closure 1077 * @param cb_cls the callback closure
1078 * @return handle to abort the operation 1078 * @return handle to abort the operation
1079 */ 1079 */
1080struct GNUNET_IDENTITY_PROVIDER_Operation * 1080struct GNUNET_RECLAIM_Operation *
1081GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 1081GNUNET_RECLAIM_ticket_issue (struct GNUNET_RECLAIM_Handle *h,
1082 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, 1082 const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss,
1083 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, 1083 const struct GNUNET_CRYPTO_EcdsaPublicKey *rp,
1084 const struct GNUNET_IDENTITY_ATTRIBUTE_ClaimList *attrs, 1084 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
1085 GNUNET_IDENTITY_PROVIDER_TicketCallback cb, 1085 GNUNET_RECLAIM_TicketCallback cb,
1086 void *cb_cls) 1086 void *cb_cls)
1087{ 1087{
1088 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 1088 struct GNUNET_RECLAIM_Operation *op;
1089 struct IssueTicketMessage *tim; 1089 struct IssueTicketMessage *tim;
1090 size_t attr_len; 1090 size_t attr_len;
1091 1091
1092 op = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_Operation); 1092 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
1093 op->h = h; 1093 op->h = h;
1094 op->tr_cb = cb; 1094 op->tr_cb = cb;
1095 op->cls = cb_cls; 1095 op->cls = cb_cls;
@@ -1097,15 +1097,15 @@ GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h
1097 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, 1097 GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
1098 h->op_tail, 1098 h->op_tail,
1099 op); 1099 op);
1100 attr_len = GNUNET_IDENTITY_ATTRIBUTE_list_serialize_get_size (attrs); 1100 attr_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (attrs);
1101 op->env = GNUNET_MQ_msg_extra (tim, 1101 op->env = GNUNET_MQ_msg_extra (tim,
1102 attr_len, 1102 attr_len,
1103 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_TICKET); 1103 GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET);
1104 tim->identity = *iss; 1104 tim->identity = *iss;
1105 tim->rp = *rp; 1105 tim->rp = *rp;
1106 tim->id = htonl (op->r_id); 1106 tim->id = htonl (op->r_id);
1107 1107
1108 GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs, 1108 GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs,
1109 (char*)&tim[1]); 1109 (char*)&tim[1]);
1110 1110
1111 tim->attr_len = htons (attr_len); 1111 tim->attr_len = htons (attr_len);
@@ -1119,24 +1119,24 @@ GNUNET_IDENTITY_PROVIDER_ticket_issue (struct GNUNET_IDENTITY_PROVIDER_Handle *h
1119 * Consumes an issued ticket. The ticket is persisted 1119 * Consumes an issued ticket. The ticket is persisted
1120 * and used to retrieve identity information from the issuer 1120 * and used to retrieve identity information from the issuer
1121 * 1121 *
1122 * @param h the identity provider to use 1122 * @param h the reclaim to use
1123 * @param identity the identity that is the subject of the issued ticket (the relying party) 1123 * @param identity the identity that is the subject of the issued ticket (the relying party)
1124 * @param ticket the issued ticket to consume 1124 * @param ticket the issued ticket to consume
1125 * @param cb the callback to call 1125 * @param cb the callback to call
1126 * @param cb_cls the callback closure 1126 * @param cb_cls the callback closure
1127 * @return handle to abort the operation 1127 * @return handle to abort the operation
1128 */ 1128 */
1129struct GNUNET_IDENTITY_PROVIDER_Operation * 1129struct GNUNET_RECLAIM_Operation *
1130GNUNET_IDENTITY_PROVIDER_ticket_consume (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 1130GNUNET_RECLAIM_ticket_consume (struct GNUNET_RECLAIM_Handle *h,
1131 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1131 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
1132 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 1132 const struct GNUNET_RECLAIM_Ticket *ticket,
1133 GNUNET_IDENTITY_PROVIDER_AttributeResult cb, 1133 GNUNET_RECLAIM_AttributeResult cb,
1134 void *cb_cls) 1134 void *cb_cls)
1135{ 1135{
1136 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 1136 struct GNUNET_RECLAIM_Operation *op;
1137 struct ConsumeTicketMessage *ctm; 1137 struct ConsumeTicketMessage *ctm;
1138 1138
1139 op = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_Operation); 1139 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
1140 op->h = h; 1140 op->h = h;
1141 op->ar_cb = cb; 1141 op->ar_cb = cb;
1142 op->cls = cb_cls; 1142 op->cls = cb_cls;
@@ -1145,14 +1145,14 @@ GNUNET_IDENTITY_PROVIDER_ticket_consume (struct GNUNET_IDENTITY_PROVIDER_Handle
1145 h->op_tail, 1145 h->op_tail,
1146 op); 1146 op);
1147 op->env = GNUNET_MQ_msg_extra (ctm, 1147 op->env = GNUNET_MQ_msg_extra (ctm,
1148 sizeof (const struct GNUNET_IDENTITY_PROVIDER_Ticket), 1148 sizeof (const struct GNUNET_RECLAIM_Ticket),
1149 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_CONSUME_TICKET); 1149 GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET);
1150 ctm->identity = *identity; 1150 ctm->identity = *identity;
1151 ctm->id = htonl (op->r_id); 1151 ctm->id = htonl (op->r_id);
1152 1152
1153 GNUNET_memcpy ((char*)&ctm[1], 1153 GNUNET_memcpy ((char*)&ctm[1],
1154 ticket, 1154 ticket,
1155 sizeof (const struct GNUNET_IDENTITY_PROVIDER_Ticket)); 1155 sizeof (const struct GNUNET_RECLAIM_Ticket));
1156 1156
1157 if (NULL != h->mq) 1157 if (NULL != h->mq)
1158 GNUNET_MQ_send_copy (h->mq, 1158 GNUNET_MQ_send_copy (h->mq,
@@ -1166,7 +1166,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_consume (struct GNUNET_IDENTITY_PROVIDER_Handle
1166 * Lists all tickets that have been issued to remote 1166 * Lists all tickets that have been issued to remote
1167 * identites (relying parties) 1167 * identites (relying parties)
1168 * 1168 *
1169 * @param h the identity provider to use 1169 * @param h the reclaim to use
1170 * @param identity the issuing identity 1170 * @param identity the issuing identity
1171 * @param error_cb function to call on error (i.e. disconnect), 1171 * @param error_cb function to call on error (i.e. disconnect),
1172 * the handle is afterwards invalid 1172 * the handle is afterwards invalid
@@ -1179,17 +1179,17 @@ GNUNET_IDENTITY_PROVIDER_ticket_consume (struct GNUNET_IDENTITY_PROVIDER_Handle
1179 * @param finish_cb_cls closure for @a finish_cb 1179 * @param finish_cb_cls closure for @a finish_cb
1180 * @return an iterator handle to use for iteration 1180 * @return an iterator handle to use for iteration
1181 */ 1181 */
1182struct GNUNET_IDENTITY_PROVIDER_TicketIterator * 1182struct GNUNET_RECLAIM_TicketIterator *
1183GNUNET_IDENTITY_PROVIDER_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 1183GNUNET_RECLAIM_ticket_iteration_start (struct GNUNET_RECLAIM_Handle *h,
1184 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1184 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
1185 GNUNET_SCHEDULER_TaskCallback error_cb, 1185 GNUNET_SCHEDULER_TaskCallback error_cb,
1186 void *error_cb_cls, 1186 void *error_cb_cls,
1187 GNUNET_IDENTITY_PROVIDER_TicketCallback proc, 1187 GNUNET_RECLAIM_TicketCallback proc,
1188 void *proc_cls, 1188 void *proc_cls,
1189 GNUNET_SCHEDULER_TaskCallback finish_cb, 1189 GNUNET_SCHEDULER_TaskCallback finish_cb,
1190 void *finish_cb_cls) 1190 void *finish_cb_cls)
1191{ 1191{
1192 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it; 1192 struct GNUNET_RECLAIM_TicketIterator *it;
1193 struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub; 1193 struct GNUNET_CRYPTO_EcdsaPublicKey identity_pub;
1194 struct GNUNET_MQ_Envelope *env; 1194 struct GNUNET_MQ_Envelope *env;
1195 struct TicketIterationStartMessage *msg; 1195 struct TicketIterationStartMessage *msg;
@@ -1198,7 +1198,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER
1198 GNUNET_CRYPTO_ecdsa_key_get_public (identity, 1198 GNUNET_CRYPTO_ecdsa_key_get_public (identity,
1199 &identity_pub); 1199 &identity_pub);
1200 rid = h->r_id_gen++; 1200 rid = h->r_id_gen++;
1201 it = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_TicketIterator); 1201 it = GNUNET_new (struct GNUNET_RECLAIM_TicketIterator);
1202 it->h = h; 1202 it->h = h;
1203 it->error_cb = error_cb; 1203 it->error_cb = error_cb;
1204 it->error_cb_cls = error_cb_cls; 1204 it->error_cb_cls = error_cb_cls;
@@ -1211,7 +1211,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER
1211 h->ticket_it_tail, 1211 h->ticket_it_tail,
1212 it); 1212 it);
1213 env = GNUNET_MQ_msg (msg, 1213 env = GNUNET_MQ_msg (msg,
1214 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_START); 1214 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START);
1215 msg->id = htonl (rid); 1215 msg->id = htonl (rid);
1216 msg->identity = identity_pub; 1216 msg->identity = identity_pub;
1217 msg->is_audience = htonl (GNUNET_NO); 1217 msg->is_audience = htonl (GNUNET_NO);
@@ -1229,7 +1229,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER
1229 * Lists all tickets that have been issued to remote 1229 * Lists all tickets that have been issued to remote
1230 * identites (relying parties) 1230 * identites (relying parties)
1231 * 1231 *
1232 * @param h the identity provider to use 1232 * @param h the reclaim to use
1233 * @param identity the issuing identity 1233 * @param identity the issuing identity
1234 * @param error_cb function to call on error (i.e. disconnect), 1234 * @param error_cb function to call on error (i.e. disconnect),
1235 * the handle is afterwards invalid 1235 * the handle is afterwards invalid
@@ -1242,23 +1242,23 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_start (struct GNUNET_IDENTITY_PROVIDER
1242 * @param finish_cb_cls closure for @a finish_cb 1242 * @param finish_cb_cls closure for @a finish_cb
1243 * @return an iterator handle to use for iteration 1243 * @return an iterator handle to use for iteration
1244 */ 1244 */
1245struct GNUNET_IDENTITY_PROVIDER_TicketIterator * 1245struct GNUNET_RECLAIM_TicketIterator *
1246GNUNET_IDENTITY_PROVIDER_ticket_iteration_start_rp (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 1246GNUNET_RECLAIM_ticket_iteration_start_rp (struct GNUNET_RECLAIM_Handle *h,
1247 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, 1247 const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
1248 GNUNET_SCHEDULER_TaskCallback error_cb, 1248 GNUNET_SCHEDULER_TaskCallback error_cb,
1249 void *error_cb_cls, 1249 void *error_cb_cls,
1250 GNUNET_IDENTITY_PROVIDER_TicketCallback proc, 1250 GNUNET_RECLAIM_TicketCallback proc,
1251 void *proc_cls, 1251 void *proc_cls,
1252 GNUNET_SCHEDULER_TaskCallback finish_cb, 1252 GNUNET_SCHEDULER_TaskCallback finish_cb,
1253 void *finish_cb_cls) 1253 void *finish_cb_cls)
1254{ 1254{
1255 struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it; 1255 struct GNUNET_RECLAIM_TicketIterator *it;
1256 struct GNUNET_MQ_Envelope *env; 1256 struct GNUNET_MQ_Envelope *env;
1257 struct TicketIterationStartMessage *msg; 1257 struct TicketIterationStartMessage *msg;
1258 uint32_t rid; 1258 uint32_t rid;
1259 1259
1260 rid = h->r_id_gen++; 1260 rid = h->r_id_gen++;
1261 it = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_TicketIterator); 1261 it = GNUNET_new (struct GNUNET_RECLAIM_TicketIterator);
1262 it->h = h; 1262 it->h = h;
1263 it->error_cb = error_cb; 1263 it->error_cb = error_cb;
1264 it->error_cb_cls = error_cb_cls; 1264 it->error_cb_cls = error_cb_cls;
@@ -1271,7 +1271,7 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_start_rp (struct GNUNET_IDENTITY_PROVI
1271 h->ticket_it_tail, 1271 h->ticket_it_tail,
1272 it); 1272 it);
1273 env = GNUNET_MQ_msg (msg, 1273 env = GNUNET_MQ_msg (msg,
1274 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_START); 1274 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START);
1275 msg->id = htonl (rid); 1275 msg->id = htonl (rid);
1276 msg->identity = *identity; 1276 msg->identity = *identity;
1277 msg->is_audience = htonl (GNUNET_YES); 1277 msg->is_audience = htonl (GNUNET_YES);
@@ -1286,20 +1286,20 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_start_rp (struct GNUNET_IDENTITY_PROVI
1286} 1286}
1287 1287
1288/** 1288/**
1289 * Calls the record processor specified in #GNUNET_IDENTITY_PROVIDER_ticket_iteration_start 1289 * Calls the record processor specified in #GNUNET_RECLAIM_ticket_iteration_start
1290 * for the next record. 1290 * for the next record.
1291 * 1291 *
1292 * @param it the iterator 1292 * @param it the iterator
1293 */ 1293 */
1294void 1294void
1295GNUNET_IDENTITY_PROVIDER_ticket_iteration_next (struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it) 1295GNUNET_RECLAIM_ticket_iteration_next (struct GNUNET_RECLAIM_TicketIterator *it)
1296{ 1296{
1297 struct GNUNET_IDENTITY_PROVIDER_Handle *h = it->h; 1297 struct GNUNET_RECLAIM_Handle *h = it->h;
1298 struct TicketIterationNextMessage *msg; 1298 struct TicketIterationNextMessage *msg;
1299 struct GNUNET_MQ_Envelope *env; 1299 struct GNUNET_MQ_Envelope *env;
1300 1300
1301 env = GNUNET_MQ_msg (msg, 1301 env = GNUNET_MQ_msg (msg,
1302 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_NEXT); 1302 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT);
1303 msg->id = htonl (it->r_id); 1303 msg->id = htonl (it->r_id);
1304 GNUNET_MQ_send (h->mq, 1304 GNUNET_MQ_send (h->mq,
1305 env); 1305 env);
@@ -1309,21 +1309,21 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_next (struct GNUNET_IDENTITY_PROVIDER_
1309/** 1309/**
1310 * Stops iteration and releases the idp handle for further calls. Must 1310 * Stops iteration and releases the idp handle for further calls. Must
1311 * be called on any iteration that has not yet completed prior to calling 1311 * be called on any iteration that has not yet completed prior to calling
1312 * #GNUNET_IDENTITY_PROVIDER_disconnect. 1312 * #GNUNET_RECLAIM_disconnect.
1313 * 1313 *
1314 * @param it the iterator 1314 * @param it the iterator
1315 */ 1315 */
1316void 1316void
1317GNUNET_IDENTITY_PROVIDER_ticket_iteration_stop (struct GNUNET_IDENTITY_PROVIDER_TicketIterator *it) 1317GNUNET_RECLAIM_ticket_iteration_stop (struct GNUNET_RECLAIM_TicketIterator *it)
1318{ 1318{
1319 struct GNUNET_IDENTITY_PROVIDER_Handle *h = it->h; 1319 struct GNUNET_RECLAIM_Handle *h = it->h;
1320 struct GNUNET_MQ_Envelope *env; 1320 struct GNUNET_MQ_Envelope *env;
1321 struct TicketIterationStopMessage *msg; 1321 struct TicketIterationStopMessage *msg;
1322 1322
1323 if (NULL != h->mq) 1323 if (NULL != h->mq)
1324 { 1324 {
1325 env = GNUNET_MQ_msg (msg, 1325 env = GNUNET_MQ_msg (msg,
1326 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_TICKET_ITERATION_STOP); 1326 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP);
1327 msg->id = htonl (it->r_id); 1327 msg->id = htonl (it->r_id);
1328 GNUNET_MQ_send (h->mq, 1328 GNUNET_MQ_send (h->mq,
1329 env); 1329 env);
@@ -1335,27 +1335,26 @@ GNUNET_IDENTITY_PROVIDER_ticket_iteration_stop (struct GNUNET_IDENTITY_PROVIDER_
1335 * Revoked an issued ticket. The relying party will be unable to retrieve 1335 * Revoked an issued ticket. The relying party will be unable to retrieve
1336 * updated attributes. 1336 * updated attributes.
1337 * 1337 *
1338 * @param h the identity provider to use 1338 * @param h the reclaim to use
1339 * @param identity the issuing identity 1339 * @param identity the issuing identity
1340 * @param ticket the ticket to revoke 1340 * @param ticket the ticket to revoke
1341 * @param cb the callback 1341 * @param cb the callback
1342 * @param cb_cls the callback closure 1342 * @param cb_cls the callback closure
1343 * @return handle to abort the operation 1343 * @return handle to abort the operation
1344 */ 1344 */
1345struct GNUNET_IDENTITY_PROVIDER_Operation * 1345struct GNUNET_RECLAIM_Operation *
1346GNUNET_IDENTITY_PROVIDER_ticket_revoke (struct GNUNET_IDENTITY_PROVIDER_Handle *h, 1346GNUNET_RECLAIM_ticket_revoke (struct GNUNET_RECLAIM_Handle *h,
1347 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, 1347 const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity,
1348 const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, 1348 const struct GNUNET_RECLAIM_Ticket *ticket,
1349 GNUNET_IDENTITY_PROVIDER_ContinuationWithStatus cb, 1349 GNUNET_RECLAIM_ContinuationWithStatus cb,
1350 void *cb_cls) 1350 void *cb_cls)
1351{ 1351{
1352 struct GNUNET_IDENTITY_PROVIDER_Operation *op; 1352 struct GNUNET_RECLAIM_Operation *op;
1353 struct GNUNET_MQ_Envelope *env;
1354 struct RevokeTicketMessage *msg; 1353 struct RevokeTicketMessage *msg;
1355 uint32_t rid; 1354 uint32_t rid;
1356 1355
1357 rid = h->r_id_gen++; 1356 rid = h->r_id_gen++;
1358 op = GNUNET_new (struct GNUNET_IDENTITY_PROVIDER_Operation); 1357 op = GNUNET_new (struct GNUNET_RECLAIM_Operation);
1359 op->h = h; 1358 op->h = h;
1360 op->rvk_cb = cb; 1359 op->rvk_cb = cb;
1361 op->cls = cb_cls; 1360 op->cls = cb_cls;
@@ -1363,22 +1362,22 @@ GNUNET_IDENTITY_PROVIDER_ticket_revoke (struct GNUNET_IDENTITY_PROVIDER_Handle *
1363 GNUNET_CONTAINER_DLL_insert_tail (h->op_head, 1362 GNUNET_CONTAINER_DLL_insert_tail (h->op_head,
1364 h->op_tail, 1363 h->op_tail,
1365 op); 1364 op);
1366 env = GNUNET_MQ_msg_extra (msg, 1365 op->env = GNUNET_MQ_msg_extra (msg,
1367 sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket), 1366 sizeof (struct GNUNET_RECLAIM_Ticket),
1368 GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_REVOKE_TICKET); 1367 GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET);
1369 msg->id = htonl (rid); 1368 msg->id = htonl (rid);
1370 msg->identity = *identity; 1369 msg->identity = *identity;
1371 GNUNET_memcpy (&msg[1], 1370 GNUNET_memcpy (&msg[1],
1372 ticket, 1371 ticket,
1373 sizeof (struct GNUNET_IDENTITY_PROVIDER_Ticket)); 1372 sizeof (struct GNUNET_RECLAIM_Ticket));
1374 if (NULL == h->mq) 1373 if (NULL != h->mq) {
1375 op->env = env;
1376 else
1377 GNUNET_MQ_send (h->mq, 1374 GNUNET_MQ_send (h->mq,
1378 env); 1375 op->env);
1376 op->env = NULL;
1377 }
1379 return op; 1378 return op;
1380} 1379}
1381 1380
1382 1381
1383 1382
1384/* end of identity_provider_api.c */ 1383/* end of reclaim_api.c */
diff --git a/src/reclaim/test_reclaim.sh b/src/reclaim/test_reclaim.sh
new file mode 100755
index 000000000..311f5382a
--- /dev/null
+++ b/src/reclaim/test_reclaim.sh
@@ -0,0 +1,31 @@
1#!/bin/bash
2#trap "gnunet-arm -e -c test_reclaim_lookup.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_reclaim.conf
27gnunet-identity -C testego -c test_reclaim.conf
28valgrind gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf
29gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf
30gnunet-reclaim -e testego -D -c test_reclaim.conf
31gnunet-arm -e -c test_reclaim.conf
diff --git a/src/reclaim/test_reclaim_attribute.sh b/src/reclaim/test_reclaim_attribute.sh
new file mode 100755
index 000000000..39bd715b7
--- /dev/null
+++ b/src/reclaim/test_reclaim_attribute.sh
@@ -0,0 +1,40 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_reclaim.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_reclaim.conf
27#gnunet-arm -i rest -c test_reclaim.conf
28gnunet-identity -C testego -c test_reclaim.conf
29gnunet-identity -C rpego -c test_reclaim.conf
30TEST_KEY=$(gnunet-identity -d -c test_reclaim.conf | grep testego | awk '{print $3}')
31gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf
32gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf > /dev/null 2>&1
33if test $? != 0
34then
35 echo "Failed."
36 exit 1
37fi
38
39#curl localhost:7776/reclaim/attributes/testego
40gnunet-arm -e -c test_reclaim.conf
diff --git a/src/reclaim/test_reclaim_consume.sh b/src/reclaim/test_reclaim_consume.sh
new file mode 100755
index 000000000..36c8052d0
--- /dev/null
+++ b/src/reclaim/test_reclaim_consume.sh
@@ -0,0 +1,43 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_reclaim.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_reclaim.conf
27#gnunet-arm -i rest -c test_reclaim.conf
28gnunet-identity -C testego -c test_reclaim.conf
29gnunet-identity -C rpego -c test_reclaim.conf
30SUBJECT_KEY=$(gnunet-identity -d -c test_reclaim.conf | grep rpego | awk '{print $3}')
31TEST_KEY=$(gnunet-identity -d -c test_reclaim.conf | grep testego | awk '{print $3}')
32gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf
33gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf
34TICKET=$(gnunet-reclaim -e testego -i "email,name" -r $SUBJECT_KEY -c test_reclaim.conf | awk '{print $1}')
35gnunet-reclaim -e rpego -C $TICKET -c test_reclaim.conf > /dev/null 2>&1
36
37if test $? != 0
38then
39 "Failed."
40 exit 1
41fi
42#curl http://localhost:7776/reclaim/tickets/testego
43gnunet-arm -e -c test_reclaim.conf
diff --git a/src/identity-provider/test_idp_defaults.conf b/src/reclaim/test_reclaim_defaults.conf
index a9a197dea..a9a197dea 100644
--- a/src/identity-provider/test_idp_defaults.conf
+++ b/src/reclaim/test_reclaim_defaults.conf
diff --git a/src/reclaim/test_reclaim_issue.sh b/src/reclaim/test_reclaim_issue.sh
new file mode 100755
index 000000000..6a71470e1
--- /dev/null
+++ b/src/reclaim/test_reclaim_issue.sh
@@ -0,0 +1,42 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_reclaim.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_reclaim.conf
27#gnunet-arm -i rest -c test_reclaim.conf
28gnunet-identity -C testego -c test_reclaim.conf
29gnunet-identity -C rpego -c test_reclaim.conf
30SUBJECT_KEY=$(gnunet-identity -d -c test_reclaim.conf | grep rpego | awk '{print $3}')
31TEST_KEY=$(gnunet-identity -d -c test_reclaim.conf | grep testego | awk '{print $3}')
32gnunet-reclaim -e testego -a email -V john@doe.gnu -c test_reclaim.conf > /dev/null 2>&1
33gnunet-reclaim -e testego -a name -V John -c test_reclaim.conf > /dev/null 2>&1
34#gnunet-reclaim -e testego -D -c test_reclaim.conf
35gnunet-reclaim -e testego -i "email,name" -r $SUBJECT_KEY -c test_reclaim.conf > /dev/null 2>&1
36if test $? != 0
37then
38 echo "Failed."
39 exit 1
40fi
41#curl http://localhost:7776/reclaim/attributes/testego
42gnunet-arm -e -c test_reclaim.conf
diff --git a/src/reclaim/test_reclaim_revoke.sh b/src/reclaim/test_reclaim_revoke.sh
new file mode 100755
index 000000000..595752fd8
--- /dev/null
+++ b/src/reclaim/test_reclaim_revoke.sh
@@ -0,0 +1,65 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_reclaim.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
17
18# (1) PKEY1.user -> PKEY2.resu.user
19# (2) PKEY2.resu -> PKEY3
20# (3) PKEY3.user -> PKEY4
21
22
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24
25TEST_ATTR="test"
26gnunet-arm -s -c test_reclaim.conf 2&>1 > /dev/null
27gnunet-identity -C alice -c test_reclaim.conf
28gnunet-identity -C bob -c test_reclaim.conf
29gnunet-identity -C eve -c test_reclaim.conf
30ALICE_KEY=$(gnunet-identity -d -c test_reclaim.conf | grep alice | awk '{print $3}')
31BOB_KEY=$(gnunet-identity -d -c test_reclaim.conf | grep bob | awk '{print $3}')
32EVE_KEY=$(gnunet-identity -d -c test_reclaim.conf | grep eve | awk '{print $3}')
33
34gnunet-reclaim -e alice -E 15s -a email -V john@doe.gnu -c test_reclaim.conf
35gnunet-reclaim -e alice -E 15s -a name -V John -c test_reclaim.conf
36TICKET_BOB=$(gnunet-reclaim -e alice -i "email,name" -r $BOB_KEY -c test_reclaim.conf | awk '{print $1}')
37#gnunet-reclaim -e bob -C $TICKET_BOB -c test_reclaim.conf
38TICKET_EVE=$(gnunet-reclaim -e alice -i "email" -r $EVE_KEY -c test_reclaim.conf | awk '{print $1}')
39
40#echo "Consuming $TICKET"
41#gnunet-reclaim -e eve -C $TICKET_EVE -c test_reclaim.conf
42gnunet-reclaim -e alice -R $TICKET_EVE -c test_reclaim.conf
43
44#sleep 6
45
46gnunet-reclaim -e eve -C $TICKET_EVE -c test_reclaim.conf 2&>1 >/dev/null
47if test $? == 0
48then
49 echo "Eve can still resolve attributes..."
50 gnunet-arm -e -c test_reclaim.conf
51 exit 1
52fi
53
54gnunet-arm -e -c test_reclaim.conf
55gnunet-arm -s -c test_reclaim.conf 2&>1 > /dev/null
56
57gnunet-reclaim -e bob -C $TICKET_BOB -c test_reclaim.conf 2&>1 >/dev/null
58if test $? != 0
59then
60 echo "Bob cannot resolve attributes..."
61 gnunet-arm -e -c test_reclaim.conf
62 exit 1
63fi
64
65gnunet-arm -e -c test_reclaim.conf
diff --git a/src/rest/Makefile.am b/src/rest/Makefile.am
index ebfb98024..ce0454d53 100644
--- a/src/rest/Makefile.am
+++ b/src/rest/Makefile.am
@@ -29,6 +29,18 @@ libexec_PROGRAMS = \
29EXTRA_DIST = \ 29EXTRA_DIST = \
30 rest.conf 30 rest.conf
31 31
32plugin_LTLIBRARIES = libgnunet_plugin_rest_copying.la
33
34libgnunet_plugin_rest_copying_la_SOURCES = \
35 plugin_rest_copying.c
36libgnunet_plugin_rest_copying_la_LIBADD = \
37 $(top_builddir)/src/rest/libgnunetrest.la \
38 $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \
39 $(LTLIBINTL) -lmicrohttpd
40libgnunet_plugin_rest_copying_la_LDFLAGS = \
41 $(GN_PLUGIN_LDFLAGS)
42
43
32gnunet_rest_server_SOURCES = \ 44gnunet_rest_server_SOURCES = \
33 gnunet-rest-server.c 45 gnunet-rest-server.c
34 46
diff --git a/src/rest/plugin_rest_copying.c b/src/rest/plugin_rest_copying.c
new file mode 100644
index 000000000..668dc5d38
--- /dev/null
+++ b/src/rest/plugin_rest_copying.c
@@ -0,0 +1,231 @@
1/*
2 This file is part of GNUnet.
3 Copyright (C) 2012-2018 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/**
19 * @author Martin Schanzenbach
20 * @file gns/plugin_rest_copying.c
21 * @brief REST plugin that serves licensing information.
22 *
23 */
24
25#include "platform.h"
26#include "gnunet_rest_plugin.h"
27#include <gnunet_rest_lib.h>
28
29#define GNUNET_REST_API_NS_COPYING "/copying"
30
31#define GNUNET_REST_COPYING_TEXT "GNU Affero General Public License version 3 or later. See also: <http://www.gnu.org/licenses/>"
32
33/**
34 * @brief struct returned by the initialization function of the plugin
35 */
36struct Plugin
37{
38 const struct GNUNET_CONFIGURATION_Handle *cfg;
39};
40
41const struct GNUNET_CONFIGURATION_Handle *cfg;
42
43struct RequestHandle
44{
45 /**
46 * Handle to rest request
47 */
48 struct GNUNET_REST_RequestHandle *rest_handle;
49
50 /**
51 * The plugin result processor
52 */
53 GNUNET_REST_ResultProcessor proc;
54
55 /**
56 * The closure of the result processor
57 */
58 void *proc_cls;
59
60 /**
61 * HTTP response code
62 */
63 int response_code;
64
65};
66
67
68/**
69 * Cleanup request handle.
70 *
71 * @param handle Handle to clean up
72 */
73static void
74cleanup_handle (struct RequestHandle *handle)
75{
76 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
77 "Cleaning up\n");
78 GNUNET_free (handle);
79}
80
81
82/**
83 * Task run on shutdown. Cleans up everything.
84 *
85 * @param cls unused
86 * @param tc scheduler context
87 */
88static void
89do_error (void *cls)
90{
91 struct RequestHandle *handle = cls;
92 struct MHD_Response *resp;
93
94 resp = GNUNET_REST_create_response (NULL);
95 handle->proc (handle->proc_cls, resp, handle->response_code);
96 cleanup_handle (handle);
97}
98
99
100/**
101 * Handle rest request
102 *
103 * @param handle the lookup handle
104 */
105static void
106get_cont (struct GNUNET_REST_RequestHandle *con_handle,
107 const char* url,
108 void *cls)
109{
110 struct MHD_Response *resp;
111 struct RequestHandle *handle = cls;
112
113 resp = GNUNET_REST_create_response (GNUNET_REST_COPYING_TEXT);
114 handle->proc (handle->proc_cls,
115 resp,
116 MHD_HTTP_OK);
117 cleanup_handle (handle);
118}
119
120
121
122/**
123 * Handle rest request
124 *
125 * @param handle the lookup handle
126 */
127static void
128options_cont (struct GNUNET_REST_RequestHandle *con_handle,
129 const char* url,
130 void *cls)
131{
132 struct MHD_Response *resp;
133 struct RequestHandle *handle = cls;
134
135 resp = GNUNET_REST_create_response (NULL);
136 MHD_add_response_header (resp,
137 "Access-Control-Allow-Methods",
138 MHD_HTTP_METHOD_GET);
139 handle->proc (handle->proc_cls,
140 resp,
141 MHD_HTTP_OK);
142 cleanup_handle (handle);
143}
144
145
146/**
147 * Function processing the REST call
148 *
149 * @param method HTTP method
150 * @param url URL of the HTTP request
151 * @param data body of the HTTP request (optional)
152 * @param data_size length of the body
153 * @param proc callback function for the result
154 * @param proc_cls closure for @a proc
155 * @return #GNUNET_OK if request accepted
156 */
157static void
158rest_copying_process_request (struct GNUNET_REST_RequestHandle *conndata_handle,
159 GNUNET_REST_ResultProcessor proc,
160 void *proc_cls)
161{
162 static const struct GNUNET_REST_RequestHandler handlers[] = {
163 {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_COPYING, &get_cont},
164 {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_COPYING, &options_cont},
165 GNUNET_REST_HANDLER_END
166 };
167 struct RequestHandle *handle = GNUNET_new (struct RequestHandle);
168 struct GNUNET_REST_RequestHandlerError err;
169
170 handle->proc_cls = proc_cls;
171 handle->proc = proc;
172 handle->rest_handle = conndata_handle;
173
174 if (GNUNET_NO == GNUNET_REST_handle_request (conndata_handle,
175 handlers,
176 &err,
177 handle))
178 {
179 handle->response_code = err.error_code;
180 GNUNET_SCHEDULER_add_now (&do_error, handle);
181 }
182}
183
184
185/**
186 * Entry point for the plugin.
187 *
188 * @param cls the "struct GNUNET_NAMESTORE_PluginEnvironment*"
189 * @return NULL on error, otherwise the plugin context
190 */
191void *
192libgnunet_plugin_rest_copying_init (void *cls)
193{
194 static struct Plugin plugin;
195 cfg = cls;
196 struct GNUNET_REST_Plugin *api;
197
198 if (NULL != plugin.cfg)
199 return NULL; /* can only initialize once! */
200 memset (&plugin, 0, sizeof (struct Plugin));
201 plugin.cfg = cfg;
202 api = GNUNET_new (struct GNUNET_REST_Plugin);
203 api->cls = &plugin;
204 api->name = GNUNET_REST_API_NS_COPYING;
205 api->process_request = &rest_copying_process_request;
206 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
207 _("COPYING REST API initialized\n"));
208 return api;
209}
210
211
212/**
213 * Exit point from the plugin.
214 *
215 * @param cls the plugin context (as returned by "init")
216 * @return always NULL
217 */
218void *
219libgnunet_plugin_rest_copying_done (void *cls)
220{
221 struct GNUNET_REST_Plugin *api = cls;
222 struct Plugin *plugin = api->cls;
223
224 plugin->cfg = NULL;
225 GNUNET_free (api);
226 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
227 "COPYING REST plugin is finished\n");
228 return NULL;
229}
230
231/* end of plugin_rest_copying.c */
diff --git a/src/rps/gnunet-rps-profiler.c b/src/rps/gnunet-rps-profiler.c
index 16f23e86c..49714872f 100644
--- a/src/rps/gnunet-rps-profiler.c
+++ b/src/rps/gnunet-rps-profiler.c
@@ -49,7 +49,11 @@ static unsigned bits_needed;
49/** 49/**
50 * How long do we run the test? 50 * How long do we run the test?
51 */ 51 */
52//#define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 30) 52static struct GNUNET_TIME_Relative duration;
53
54/**
55 * When do we do a hard shutdown?
56 */
53static struct GNUNET_TIME_Relative timeout; 57static struct GNUNET_TIME_Relative timeout;
54 58
55 59
@@ -446,6 +450,10 @@ struct RPSPeer
446 * @brief statistics values 450 * @brief statistics values
447 */ 451 */
448 uint64_t stats[STAT_TYPE_MAX]; 452 uint64_t stats[STAT_TYPE_MAX];
453 /**
454 * @brief Handle for the statistics get request
455 */
456 struct GNUNET_STATISTICS_GetHandle *h_stat_get[STAT_TYPE_MAX];
449}; 457};
450 458
451/** 459/**
@@ -489,15 +497,16 @@ static unsigned int view_sizes;
489static int ok; 497static int ok;
490 498
491/** 499/**
492 * Identifier for the churn task that runs periodically 500 * Identifier for the task that runs after the test to collect results
493 */ 501 */
494static struct GNUNET_SCHEDULER_Task *post_test_task; 502static struct GNUNET_SCHEDULER_Task *post_test_task;
495 503
496/** 504/**
497 * Identifier for the churn task that runs periodically 505 * Identifier for the shutdown task
498 */ 506 */
499static struct GNUNET_SCHEDULER_Task *shutdown_task; 507static struct GNUNET_SCHEDULER_Task *shutdown_task;
500 508
509
501/** 510/**
502 * Identifier for the churn task that runs periodically 511 * Identifier for the churn task that runs periodically
503 */ 512 */
@@ -874,6 +883,75 @@ static int check_statistics_collect_completed ()
874 return GNUNET_YES; 883 return GNUNET_YES;
875} 884}
876 885
886static void
887rps_disconnect_adapter (void *cls,
888 void *op_result);
889
890static void
891cancel_pending_req (struct PendingRequest *pending_req)
892{
893 struct RPSPeer *rps_peer;
894
895 rps_peer = pending_req->rps_peer;
896 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_req_head,
897 rps_peer->pending_req_tail,
898 pending_req);
899 rps_peer->num_pending_reqs--;
900 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
901 "Cancelling pending rps get request\n");
902 GNUNET_SCHEDULER_cancel (pending_req->request_task);
903 GNUNET_free (pending_req);
904}
905
906static void
907cancel_request (struct PendingReply *pending_rep)
908{
909 struct RPSPeer *rps_peer;
910
911 rps_peer = pending_rep->rps_peer;
912 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_rep_head,
913 rps_peer->pending_rep_tail,
914 pending_rep);
915 rps_peer->num_pending_reps--;
916 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
917 "Cancelling rps get reply\n");
918 GNUNET_RPS_request_cancel (pending_rep->req_handle);
919 GNUNET_free (pending_rep);
920}
921
922void
923clean_peer (unsigned peer_index)
924{
925 struct PendingRequest *pending_req;
926
927 while (NULL != (pending_req = rps_peers[peer_index].pending_req_head))
928 {
929 cancel_pending_req (pending_req);
930 }
931 pending_req = rps_peers[peer_index].pending_req_head;
932 rps_disconnect_adapter (&rps_peers[peer_index],
933 &rps_peers[peer_index].rps_handle);
934 for (unsigned stat_type = STAT_TYPE_ROUNDS;
935 stat_type < STAT_TYPE_MAX;
936 stat_type++)
937 {
938 if (NULL != rps_peers[peer_index].h_stat_get[stat_type])
939 {
940 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
941 "(%u) did not yet receive stat value for `%s'\n",
942 rps_peers[peer_index].index,
943 stat_type_2_str (stat_type));
944 GNUNET_STATISTICS_get_cancel (
945 rps_peers[peer_index].h_stat_get[stat_type]);
946 }
947 }
948 if (NULL != rps_peers[peer_index].op)
949 {
950 GNUNET_TESTBED_operation_done (rps_peers[peer_index].op);
951 rps_peers[peer_index].op = NULL;
952 }
953}
954
877/** 955/**
878 * Task run on timeout to shut everything down. 956 * Task run on timeout to shut everything down.
879 */ 957 */
@@ -881,35 +959,55 @@ static void
881shutdown_op (void *cls) 959shutdown_op (void *cls)
882{ 960{
883 unsigned int i; 961 unsigned int i;
962 struct OpListEntry *entry;
884 963
885 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 964 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
886 "Shutdown task scheduled, going down.\n"); 965 "Shutdown task scheduled, going down.\n");
887 in_shutdown = GNUNET_YES; 966 in_shutdown = GNUNET_YES;
967
968 if (NULL != shutdown_task)
969 {
970 GNUNET_SCHEDULER_cancel (shutdown_task);
971 shutdown_task = NULL;
972 }
888 if (NULL != post_test_task) 973 if (NULL != post_test_task)
889 { 974 {
890 GNUNET_SCHEDULER_cancel (post_test_task); 975 GNUNET_SCHEDULER_cancel (post_test_task);
976 post_test_task = NULL;
891 } 977 }
892 if (NULL != churn_task) 978 if (NULL != churn_task)
893 { 979 {
894 GNUNET_SCHEDULER_cancel (churn_task); 980 GNUNET_SCHEDULER_cancel (churn_task);
895 churn_task = NULL; 981 churn_task = NULL;
896 } 982 }
983 entry = oplist_head;
984 while (NULL != (entry = oplist_head))
985 {
986 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
987 "Operation still pending on shutdown (%u)\n",
988 entry->index);
989 GNUNET_TESTBED_operation_done (entry->op);
990 GNUNET_CONTAINER_DLL_remove (oplist_head, oplist_tail, entry);
991 GNUNET_free (entry);
992 }
897 for (i = 0; i < num_peers; i++) 993 for (i = 0; i < num_peers; i++)
898 { 994 {
899 if (NULL != rps_peers[i].rps_handle) 995 clean_peer (i);
900 {
901 GNUNET_RPS_disconnect (rps_peers[i].rps_handle);
902 }
903 if (NULL != rps_peers[i].op)
904 {
905 GNUNET_TESTBED_operation_done (rps_peers[i].op);
906 }
907 } 996 }
908} 997}
909 998
999static void
1000trigger_shutdown (void *cls)
1001{
1002 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
1003 "Shutdown was triggerd by timeout, going down.\n");
1004 shutdown_task = NULL;
1005 GNUNET_SCHEDULER_shutdown ();
1006}
1007
910 1008
911/** 1009/**
912 * Task run on timeout to collect statistics and potentially shut down. 1010 * Task run after #duration to collect statistics and potentially shut down.
913 */ 1011 */
914static void 1012static void
915post_test_op (void *cls) 1013post_test_op (void *cls)
@@ -919,7 +1017,7 @@ post_test_op (void *cls)
919 post_test_task = NULL; 1017 post_test_task = NULL;
920 post_test = GNUNET_YES; 1018 post_test = GNUNET_YES;
921 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1019 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
922 "Post test task scheduled, going down.\n"); 1020 "Post test task scheduled.\n");
923 if (NULL != churn_task) 1021 if (NULL != churn_task)
924 { 1022 {
925 GNUNET_SCHEDULER_cancel (churn_task); 1023 GNUNET_SCHEDULER_cancel (churn_task);
@@ -943,7 +1041,7 @@ post_test_op (void *cls)
943 GNUNET_YES == check_statistics_collect_completed()) 1041 GNUNET_YES == check_statistics_collect_completed())
944 { 1042 {
945 GNUNET_SCHEDULER_cancel (shutdown_task); 1043 GNUNET_SCHEDULER_cancel (shutdown_task);
946 shutdown_task = GNUNET_SCHEDULER_add_now (&shutdown_op, NULL); 1044 shutdown_task = NULL;
947 GNUNET_SCHEDULER_shutdown (); 1045 GNUNET_SCHEDULER_shutdown ();
948 } 1046 }
949} 1047}
@@ -1030,9 +1128,9 @@ info_cb (void *cb_cls,
1030 */ 1128 */
1031static void 1129static void
1032rps_connect_complete_cb (void *cls, 1130rps_connect_complete_cb (void *cls,
1033 struct GNUNET_TESTBED_Operation *op, 1131 struct GNUNET_TESTBED_Operation *op,
1034 void *ca_result, 1132 void *ca_result,
1035 const char *emsg) 1133 const char *emsg)
1036{ 1134{
1037 struct RPSPeer *rps_peer = cls; 1135 struct RPSPeer *rps_peer = cls;
1038 struct GNUNET_RPS_Handle *rps = ca_result; 1136 struct GNUNET_RPS_Handle *rps = ca_result;
@@ -1057,7 +1155,9 @@ rps_connect_complete_cb (void *cls,
1057 return; 1155 return;
1058 } 1156 }
1059 1157
1060 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Started client successfully\n"); 1158 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1159 "Started client successfully (%u)\n",
1160 rps_peer->index);
1061 1161
1062 cur_test_run.main_test (rps_peer); 1162 cur_test_run.main_test (rps_peer);
1063} 1163}
@@ -1075,7 +1175,7 @@ rps_connect_complete_cb (void *cls,
1075 */ 1175 */
1076static void * 1176static void *
1077rps_connect_adapter (void *cls, 1177rps_connect_adapter (void *cls,
1078 const struct GNUNET_CONFIGURATION_Handle *cfg) 1178 const struct GNUNET_CONFIGURATION_Handle *cfg)
1079{ 1179{
1080 struct GNUNET_RPS_Handle *h; 1180 struct GNUNET_RPS_Handle *h;
1081 1181
@@ -1167,15 +1267,26 @@ stat_complete_cb (void *cls, struct GNUNET_TESTBED_Operation *op,
1167 */ 1267 */
1168static void 1268static void
1169rps_disconnect_adapter (void *cls, 1269rps_disconnect_adapter (void *cls,
1170 void *op_result) 1270 void *op_result)
1171{ 1271{
1172 struct RPSPeer *peer = cls; 1272 struct RPSPeer *peer = cls;
1173 struct GNUNET_RPS_Handle *h = op_result; 1273 struct GNUNET_RPS_Handle *h = op_result;
1274 struct PendingReply *pending_rep;
1174 1275
1175 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "disconnect_adapter()\n"); 1276 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1277 "disconnect_adapter (%u)\n",
1278 peer->index);
1176 GNUNET_assert (NULL != peer); 1279 GNUNET_assert (NULL != peer);
1177 GNUNET_RPS_disconnect (h); 1280 if (NULL != peer->rps_handle)
1178 peer->rps_handle = NULL; 1281 {
1282 while (NULL != (pending_rep = peer->pending_rep_head))
1283 {
1284 cancel_request (pending_rep);
1285 }
1286 GNUNET_assert (h == peer->rps_handle);
1287 GNUNET_RPS_disconnect (h);
1288 peer->rps_handle = NULL;
1289 }
1179} 1290}
1180 1291
1181 1292
@@ -1219,13 +1330,15 @@ default_reply_handle (void *cls,
1219 rps_peer->num_recv_ids++; 1330 rps_peer->num_recv_ids++;
1220 } 1331 }
1221 1332
1222 if (0 == evaluate () && HAVE_QUICK_QUIT == cur_test_run.have_quick_quit) 1333 if (GNUNET_YES != post_test) return;
1334 if (HAVE_QUICK_QUIT != cur_test_run.have_quick_quit) return;
1335 if (0 == evaluate())
1223 { 1336 {
1224 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test succeeded before timeout\n"); 1337 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1225 GNUNET_assert (NULL != post_test_task); 1338 "Test succeeded before end of duration\n");
1226 GNUNET_SCHEDULER_cancel (post_test_task); 1339 if (NULL != post_test_task) GNUNET_SCHEDULER_cancel (post_test_task);
1227 post_test_task = GNUNET_SCHEDULER_add_now (&post_test_op, NULL); 1340 post_test_task = GNUNET_SCHEDULER_add_now (&post_test_op, NULL);
1228 GNUNET_assert (NULL!= post_test_task); 1341 GNUNET_assert (NULL != post_test_task);
1229 } 1342 }
1230} 1343}
1231 1344
@@ -1239,13 +1352,13 @@ request_peers (void *cls)
1239 struct RPSPeer *rps_peer; 1352 struct RPSPeer *rps_peer;
1240 struct PendingReply *pending_rep; 1353 struct PendingReply *pending_rep;
1241 1354
1242 if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test)
1243 return;
1244 rps_peer = pending_req->rps_peer; 1355 rps_peer = pending_req->rps_peer;
1245 GNUNET_assert (1 <= rps_peer->num_pending_reqs); 1356 GNUNET_assert (1 <= rps_peer->num_pending_reqs);
1246 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_req_head, 1357 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_req_head,
1247 rps_peer->pending_req_tail, 1358 rps_peer->pending_req_tail,
1248 pending_req); 1359 pending_req);
1360 rps_peer->num_pending_reqs--;
1361 if (GNUNET_YES == in_shutdown || GNUNET_YES == post_test) return;
1249 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1362 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1250 "Requesting one peer\n"); 1363 "Requesting one peer\n");
1251 pending_rep = GNUNET_new (struct PendingReply); 1364 pending_rep = GNUNET_new (struct PendingReply);
@@ -1258,39 +1371,6 @@ request_peers (void *cls)
1258 rps_peer->pending_rep_tail, 1371 rps_peer->pending_rep_tail,
1259 pending_rep); 1372 pending_rep);
1260 rps_peer->num_pending_reps++; 1373 rps_peer->num_pending_reps++;
1261 rps_peer->num_pending_reqs--;
1262}
1263
1264static void
1265cancel_pending_req (struct PendingRequest *pending_req)
1266{
1267 struct RPSPeer *rps_peer;
1268
1269 rps_peer = pending_req->rps_peer;
1270 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_req_head,
1271 rps_peer->pending_req_tail,
1272 pending_req);
1273 rps_peer->num_pending_reqs--;
1274 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1275 "Cancelling pending request\n");
1276 GNUNET_SCHEDULER_cancel (pending_req->request_task);
1277 GNUNET_free (pending_req);
1278}
1279
1280static void
1281cancel_request (struct PendingReply *pending_rep)
1282{
1283 struct RPSPeer *rps_peer;
1284
1285 rps_peer = pending_rep->rps_peer;
1286 GNUNET_CONTAINER_DLL_remove (rps_peer->pending_rep_head,
1287 rps_peer->pending_rep_tail,
1288 pending_rep);
1289 rps_peer->num_pending_reps--;
1290 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1291 "Cancelling request\n");
1292 GNUNET_RPS_request_cancel (pending_rep->req_handle);
1293 GNUNET_free (pending_rep);
1294} 1374}
1295 1375
1296 1376
@@ -2261,12 +2341,6 @@ void write_final_stats (void){
2261 stat_type < STAT_TYPE_MAX; 2341 stat_type < STAT_TYPE_MAX;
2262 stat_type++) 2342 stat_type++)
2263 { 2343 {
2264 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2265 "Add to sum (%" PRIu64 ") %" PRIu64 " of stat type %u - %s\n",
2266 sums[stat_type],
2267 rps_peers[i].stats[stat_type],
2268 stat_type,
2269 stat_type_2_str (stat_type));
2270 sums[stat_type] += rps_peers[i].stats[stat_type]; 2344 sums[stat_type] += rps_peers[i].stats[stat_type];
2271 } 2345 }
2272 } 2346 }
@@ -2312,6 +2386,8 @@ post_test_shutdown_ready_cb (void *cls,
2312{ 2386{
2313 struct STATcls *stat_cls = (struct STATcls *) cls; 2387 struct STATcls *stat_cls = (struct STATcls *) cls;
2314 struct RPSPeer *rps_peer = stat_cls->rps_peer; 2388 struct RPSPeer *rps_peer = stat_cls->rps_peer;
2389
2390 rps_peer->h_stat_get[stat_cls->stat_type] = NULL;
2315 if (GNUNET_OK == success) 2391 if (GNUNET_OK == success)
2316 { 2392 {
2317 /* set flag that we we got the value */ 2393 /* set flag that we we got the value */
@@ -2363,6 +2439,7 @@ stat_iterator (void *cls,
2363{ 2439{
2364 const struct STATcls *stat_cls = (const struct STATcls *) cls; 2440 const struct STATcls *stat_cls = (const struct STATcls *) cls;
2365 struct RPSPeer *rps_peer = (struct RPSPeer *) stat_cls->rps_peer; 2441 struct RPSPeer *rps_peer = (struct RPSPeer *) stat_cls->rps_peer;
2442
2366 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got stat value: %s - %" PRIu64 "\n", 2443 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Got stat value: %s - %" PRIu64 "\n",
2367 //stat_type_2_str (stat_cls->stat_type), 2444 //stat_type_2_str (stat_cls->stat_type),
2368 name, 2445 name,
@@ -2455,12 +2532,13 @@ void post_profiler (struct RPSPeer *rps_peer)
2455 stat_cls->stat_type = stat_type; 2532 stat_cls->stat_type = stat_type;
2456 rps_peer->file_name_stats = 2533 rps_peer->file_name_stats =
2457 store_prefix_file_name (rps_peer->peer_id, "stats"); 2534 store_prefix_file_name (rps_peer->peer_id, "stats");
2458 GNUNET_STATISTICS_get (rps_peer->stats_h, 2535 rps_peer->h_stat_get[stat_type] = GNUNET_STATISTICS_get (
2459 "rps", 2536 rps_peer->stats_h,
2460 stat_type_2_str (stat_type), 2537 "rps",
2461 post_test_shutdown_ready_cb, 2538 stat_type_2_str (stat_type),
2462 stat_iterator, 2539 post_test_shutdown_ready_cb,
2463 (struct STATcls *) stat_cls); 2540 stat_iterator,
2541 (struct STATcls *) stat_cls);
2464 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2542 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2465 "Requested statistics for %s (peer %" PRIu32 ")\n", 2543 "Requested statistics for %s (peer %" PRIu32 ")\n",
2466 stat_type_2_str (stat_type), 2544 stat_type_2_str (stat_type),
@@ -2555,6 +2633,8 @@ test_run (void *cls,
2555 /* Connect all peers to statistics service */ 2633 /* Connect all peers to statistics service */
2556 if (COLLECT_STATISTICS == cur_test_run.have_collect_statistics) 2634 if (COLLECT_STATISTICS == cur_test_run.have_collect_statistics)
2557 { 2635 {
2636 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2637 "Connecting to statistics service\n");
2558 rps_peers[i].stat_op = 2638 rps_peers[i].stat_op =
2559 GNUNET_TESTBED_service_connect (NULL, 2639 GNUNET_TESTBED_service_connect (NULL,
2560 peers[i], 2640 peers[i],
@@ -2569,11 +2649,12 @@ test_run (void *cls,
2569 2649
2570 if (NULL != churn_task) 2650 if (NULL != churn_task)
2571 GNUNET_SCHEDULER_cancel (churn_task); 2651 GNUNET_SCHEDULER_cancel (churn_task);
2572 post_test_task = GNUNET_SCHEDULER_add_delayed (timeout, &post_test_op, NULL); 2652 post_test_task = GNUNET_SCHEDULER_add_delayed (duration, &post_test_op, NULL);
2573 timeout = GNUNET_TIME_relative_multiply (timeout, 1 + (0.1 * num_peers)); 2653 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "timeout for shutdown is %lu\n", timeout.rel_value_us/1000000);
2574 shutdown_task = GNUNET_SCHEDULER_add_shutdown (shutdown_op, NULL); 2654 shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout,
2575 shutdown_task = GNUNET_SCHEDULER_add_delayed (timeout, &shutdown_op, NULL); 2655 &trigger_shutdown,
2576 2656 NULL);
2657 GNUNET_SCHEDULER_add_shutdown (shutdown_op, NULL);
2577} 2658}
2578 2659
2579 2660
@@ -2609,7 +2690,7 @@ run (void *cls,
2609 if (0 == cur_test_run.num_requests) cur_test_run.num_requests = 5; 2690 if (0 == cur_test_run.num_requests) cur_test_run.num_requests = 5;
2610 //cur_test_run.have_churn = HAVE_CHURN; 2691 //cur_test_run.have_churn = HAVE_CHURN;
2611 cur_test_run.have_churn = HAVE_NO_CHURN; 2692 cur_test_run.have_churn = HAVE_NO_CHURN;
2612 cur_test_run.have_quick_quit = HAVE_NO_QUICK_QUIT; 2693 cur_test_run.have_quick_quit = HAVE_QUICK_QUIT;
2613 cur_test_run.have_collect_statistics = COLLECT_STATISTICS; 2694 cur_test_run.have_collect_statistics = COLLECT_STATISTICS;
2614 cur_test_run.stat_collect_flags = BIT(STAT_TYPE_ROUNDS) | 2695 cur_test_run.stat_collect_flags = BIT(STAT_TYPE_ROUNDS) |
2615 BIT(STAT_TYPE_BLOCKS) | 2696 BIT(STAT_TYPE_BLOCKS) |
@@ -2632,10 +2713,38 @@ run (void *cls,
2632 /* 'Clean' directory */ 2713 /* 'Clean' directory */
2633 (void) GNUNET_DISK_directory_remove ("/tmp/rps/"); 2714 (void) GNUNET_DISK_directory_remove ("/tmp/rps/");
2634 GNUNET_DISK_directory_create ("/tmp/rps/"); 2715 GNUNET_DISK_directory_create ("/tmp/rps/");
2635 if (0 == timeout.rel_value_us) 2716 if (0 == duration.rel_value_us)
2636 { 2717 {
2637 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90); 2718 if (0 == timeout.rel_value_us)
2719 {
2720 duration = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 90);
2721 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
2722 (90 * 1.2) +
2723 (0.01 * num_peers));
2724 }
2725 else
2726 {
2727 duration = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
2728 (timeout.rel_value_us/1000000)
2729 * 0.75);
2730 }
2638 } 2731 }
2732 else
2733 {
2734 if (0 == timeout.rel_value_us)
2735 {
2736 timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS,
2737 ((duration.rel_value_us/1000000)
2738 * 1.2) + (0.01 * num_peers));
2739 }
2740 }
2741 GNUNET_assert (duration.rel_value_us < timeout.rel_value_us);
2742 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2743 "duration is %lus\n",
2744 duration.rel_value_us/1000000);
2745 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2746 "timeout is %lus\n",
2747 timeout.rel_value_us/1000000);
2639 2748
2640 /* Compute number of bits for representing largest peer id */ 2749 /* Compute number of bits for representing largest peer id */
2641 for (bits_needed = 1; (1 << bits_needed) < num_peers; bits_needed++) 2750 for (bits_needed = 1; (1 << bits_needed) < num_peers; bits_needed++)
@@ -2685,6 +2794,12 @@ main (int argc, char *argv[])
2685 gettext_noop ("number of peers to start"), 2794 gettext_noop ("number of peers to start"),
2686 &num_peers), 2795 &num_peers),
2687 2796
2797 GNUNET_GETOPT_option_relative_time ('d',
2798 "duration",
2799 "DURATION",
2800 gettext_noop ("duration of the profiling"),
2801 &duration),
2802
2688 GNUNET_GETOPT_option_relative_time ('t', 2803 GNUNET_GETOPT_option_relative_time ('t',
2689 "timeout", 2804 "timeout",
2690 "TIMEOUT", 2805 "TIMEOUT",
@@ -2732,7 +2847,6 @@ main (int argc, char *argv[])
2732 GNUNET_free (rps_peers); 2847 GNUNET_free (rps_peers);
2733 GNUNET_free (rps_peer_ids); 2848 GNUNET_free (rps_peer_ids);
2734 GNUNET_CONTAINER_multipeermap_destroy (peer_map); 2849 GNUNET_CONTAINER_multipeermap_destroy (peer_map);
2735 printf ("test -1\n");
2736 return ret_value; 2850 return ret_value;
2737} 2851}
2738 2852
diff --git a/src/rps/gnunet-service-rps.c b/src/rps/gnunet-service-rps.c
index 84fb33be2..d601ac7d4 100644
--- a/src/rps/gnunet-service-rps.c
+++ b/src/rps/gnunet-service-rps.c
@@ -68,6 +68,7 @@ static struct GNUNET_STATISTICS_Handle *stats;
68 */ 68 */
69static struct GNUNET_PeerIdentity own_identity; 69static struct GNUNET_PeerIdentity own_identity;
70 70
71static int in_shutdown = GNUNET_NO;
71 72
72/** 73/**
73 * @brief Port used for cadet. 74 * @brief Port used for cadet.
@@ -97,11 +98,6 @@ static struct GNUNET_HashCode port;
97#define unset_peer_flag(peer_ctx, mask) ((peer_ctx->peer_flags) &= ~(mask)) 98#define unset_peer_flag(peer_ctx, mask) ((peer_ctx->peer_flags) &= ~(mask))
98 99
99/** 100/**
100 * Set a channel flag of given channel context.
101 */
102#define set_channel_flag(channel_flags, mask) ((*channel_flags) |= (mask))
103
104/**
105 * Get channel flag of given channel context. 101 * Get channel flag of given channel context.
106 */ 102 */
107#define check_channel_flag_set(channel_flags, mask)\ 103#define check_channel_flag_set(channel_flags, mask)\
@@ -164,6 +160,11 @@ struct PendingMessage
164}; 160};
165 161
166/** 162/**
163 * @brief Context for a channel
164 */
165struct ChannelCtx;
166
167/**
167 * Struct used to keep track of other peer's status 168 * Struct used to keep track of other peer's status
168 * 169 *
169 * This is stored in a multipeermap. 170 * This is stored in a multipeermap.
@@ -181,22 +182,12 @@ struct PeerContext
181 /** 182 /**
182 * Channel open to client. 183 * Channel open to client.
183 */ 184 */
184 struct GNUNET_CADET_Channel *send_channel; 185 struct ChannelCtx *send_channel_ctx;
185
186 /**
187 * Flags to the sending channel
188 */
189 uint32_t *send_channel_flags;
190 186
191 /** 187 /**
192 * Channel open from client. 188 * Channel open from client.
193 */ 189 */
194 struct GNUNET_CADET_Channel *recv_channel; // unneeded? 190 struct ChannelCtx *recv_channel_ctx;
195
196 /**
197 * Flags to the receiving channel
198 */
199 uint32_t *recv_channel_flags;
200 191
201 /** 192 /**
202 * Array of pending operations on this peer. 193 * Array of pending operations on this peer.
@@ -242,6 +233,11 @@ struct PeerContext
242 struct PendingMessage *pending_messages_tail; 233 struct PendingMessage *pending_messages_tail;
243 234
244 /** 235 /**
236 * @brief Task to destroy this context.
237 */
238 struct GNUNET_SCHEDULER_Task *destruction_task;
239
240 /**
245 * This is pobably followed by 'statistical' data (when we first saw 241 * This is pobably followed by 'statistical' data (when we first saw
246 * it, how did we get its ID, how many pushes (in a timeinterval), 242 * it, how did we get its ID, how many pushes (in a timeinterval),
247 * ...) 243 * ...)
@@ -265,6 +261,33 @@ struct PeersIteratorCls
265}; 261};
266 262
267/** 263/**
264 * @brief Context for a channel
265 */
266struct ChannelCtx
267{
268 /**
269 * @brief Meant to be used in a DLL
270 */
271 struct ChannelCtx *next;
272 struct ChannelCtx *prev;
273
274 /**
275 * @brief The channel itself
276 */
277 struct GNUNET_CADET_Channel *channel;
278
279 /**
280 * @brief The peer context associated with the channel
281 */
282 struct PeerContext *peer_ctx;
283
284 /**
285 * @brief Scheduled task that will destroy this context
286 */
287 struct GNUNET_SCHEDULER_Task *destruction_task;
288};
289
290/**
268 * @brief Hashmap of valid peers. 291 * @brief Hashmap of valid peers.
269 */ 292 */
270static struct GNUNET_CONTAINER_MultiPeerMap *valid_peers; 293static struct GNUNET_CONTAINER_MultiPeerMap *valid_peers;
@@ -332,8 +355,6 @@ create_peer_ctx (const struct GNUNET_PeerIdentity *peer)
332 355
333 ctx = GNUNET_new (struct PeerContext); 356 ctx = GNUNET_new (struct PeerContext);
334 ctx->peer_id = *peer; 357 ctx->peer_id = *peer;
335 ctx->send_channel_flags = GNUNET_new (uint32_t);
336 ctx->recv_channel_flags = GNUNET_new (uint32_t);
337 ret = GNUNET_CONTAINER_multipeermap_put (peer_map, peer, ctx, 358 ret = GNUNET_CONTAINER_multipeermap_put (peer_map, peer, ctx,
338 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); 359 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
339 GNUNET_assert (GNUNET_OK == ret); 360 GNUNET_assert (GNUNET_OK == ret);
@@ -387,8 +408,8 @@ Peers_check_connected (const struct GNUNET_PeerIdentity *peer)
387 /* Get the context */ 408 /* Get the context */
388 peer_ctx = get_peer_ctx (peer); 409 peer_ctx = get_peer_ctx (peer);
389 /* If we have no channel to this peer we don't know whether it's online */ 410 /* If we have no channel to this peer we don't know whether it's online */
390 if ( (NULL == peer_ctx->send_channel) && 411 if ( (NULL == peer_ctx->send_channel_ctx) &&
391 (NULL == peer_ctx->recv_channel) ) 412 (NULL == peer_ctx->recv_channel_ctx) )
392 { 413 {
393 Peers_unset_peer_flag (peer, Peers_ONLINE); 414 Peers_unset_peer_flag (peer, Peers_ONLINE);
394 return GNUNET_NO; 415 return GNUNET_NO;
@@ -575,6 +596,24 @@ handle_peer_pull_reply (void *cls,
575 596
576/* End declaration of handlers */ 597/* End declaration of handlers */
577 598
599/**
600 * @brief Allocate memory for a new channel context and insert it into DLL
601 *
602 * @param peer_ctx context of the according peer
603 *
604 * @return The channel context
605 */
606static struct ChannelCtx *
607add_channel_ctx (struct PeerContext *peer_ctx);
608
609/**
610 * @brief Remove the channel context from the DLL and free the memory.
611 *
612 * @param channel_ctx The channel context.
613 */
614static void
615remove_channel_ctx (struct ChannelCtx *channel_ctx);
616
578 617
579/** 618/**
580 * @brief Get the channel of a peer. If not existing, create. 619 * @brief Get the channel of a peer. If not existing, create.
@@ -610,16 +649,17 @@ get_channel (const struct GNUNET_PeerIdentity *peer)
610 649
611 650
612 peer_ctx = get_peer_ctx (peer); 651 peer_ctx = get_peer_ctx (peer);
613 if (NULL == peer_ctx->send_channel) 652 if (NULL == peer_ctx->send_channel_ctx)
614 { 653 {
615 LOG (GNUNET_ERROR_TYPE_DEBUG, 654 LOG (GNUNET_ERROR_TYPE_DEBUG,
616 "Trying to establish channel to peer %s\n", 655 "Trying to establish channel to peer %s\n",
617 GNUNET_i2s (peer)); 656 GNUNET_i2s (peer));
618 ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity); 657 ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity);
619 *ctx_peer = *peer; 658 *ctx_peer = *peer;
620 peer_ctx->send_channel = 659 peer_ctx->send_channel_ctx = add_channel_ctx (peer_ctx);
660 peer_ctx->send_channel_ctx->channel =
621 GNUNET_CADET_channel_create (cadet_handle, 661 GNUNET_CADET_channel_create (cadet_handle,
622 (struct GNUNET_PeerIdentity *) ctx_peer, /* context */ 662 peer_ctx->send_channel_ctx, /* context */
623 peer, 663 peer,
624 &port, 664 &port,
625 GNUNET_CADET_OPTION_RELIABLE, 665 GNUNET_CADET_OPTION_RELIABLE,
@@ -627,8 +667,9 @@ get_channel (const struct GNUNET_PeerIdentity *peer)
627 cleanup_destroyed_channel, /* Disconnect handler */ 667 cleanup_destroyed_channel, /* Disconnect handler */
628 cadet_handlers); 668 cadet_handlers);
629 } 669 }
630 GNUNET_assert (NULL != peer_ctx->send_channel); 670 GNUNET_assert (NULL != peer_ctx->send_channel_ctx);
631 return peer_ctx->send_channel; 671 GNUNET_assert (NULL != peer_ctx->send_channel_ctx->channel);
672 return peer_ctx->send_channel_ctx->channel;
632} 673}
633 674
634 675
@@ -1045,12 +1086,10 @@ restore_valid_peers ()
1045 */ 1086 */
1046void 1087void
1047Peers_initialise (char* fn_valid_peers, 1088Peers_initialise (char* fn_valid_peers,
1048 struct GNUNET_CADET_Handle *cadet_h, 1089 struct GNUNET_CADET_Handle *cadet_h)
1049 const struct GNUNET_PeerIdentity *own_id)
1050{ 1090{
1051 filename_valid_peers = GNUNET_strdup (fn_valid_peers); 1091 filename_valid_peers = GNUNET_strdup (fn_valid_peers);
1052 cadet_handle = cadet_h; 1092 cadet_handle = cadet_h;
1053 own_identity = *own_id;
1054 peer_map = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO); 1093 peer_map = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO);
1055 valid_peers = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO); 1094 valid_peers = GNUNET_CONTAINER_multipeermap_create (4, GNUNET_NO);
1056 restore_valid_peers (); 1095 restore_valid_peers ();
@@ -1136,14 +1175,12 @@ Peers_get_valid_peers (PeersIterator iterator,
1136 * @param peer the new #GNUNET_PeerIdentity 1175 * @param peer the new #GNUNET_PeerIdentity
1137 * 1176 *
1138 * @return #GNUNET_YES if peer was inserted 1177 * @return #GNUNET_YES if peer was inserted
1139 * #GNUNET_NO otherwise (if peer was already known or 1178 * #GNUNET_NO otherwise
1140 * peer was #own_identity)
1141 */ 1179 */
1142int 1180int
1143Peers_insert_peer (const struct GNUNET_PeerIdentity *peer) 1181Peers_insert_peer (const struct GNUNET_PeerIdentity *peer)
1144{ 1182{
1145 if ( (GNUNET_YES == Peers_check_peer_known (peer)) || 1183 if (GNUNET_YES == Peers_check_peer_known (peer))
1146 (0 == GNUNET_CRYPTO_cmp_peer_identity (peer, &own_identity)) )
1147 { 1184 {
1148 return GNUNET_NO; /* We already know this peer - nothing to do */ 1185 return GNUNET_NO; /* We already know this peer - nothing to do */
1149 } 1186 }
@@ -1161,8 +1198,7 @@ Peers_check_peer_flag (const struct GNUNET_PeerIdentity *peer, enum Peers_PeerFl
1161 * 1198 *
1162 * @param peer the peer whose liveliness is to be checked 1199 * @param peer the peer whose liveliness is to be checked
1163 * @return #GNUNET_YES if peer had to be inserted 1200 * @return #GNUNET_YES if peer had to be inserted
1164 * #GNUNET_NO otherwise (if peer was already known or 1201 * #GNUNET_NO otherwise
1165 * peer was #own_identity)
1166 */ 1202 */
1167int 1203int
1168Peers_issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer) 1204Peers_issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer)
@@ -1170,13 +1206,10 @@ Peers_issue_peer_liveliness_check (const struct GNUNET_PeerIdentity *peer)
1170 struct PeerContext *peer_ctx; 1206 struct PeerContext *peer_ctx;
1171 int ret; 1207 int ret;
1172 1208
1173 if (0 == GNUNET_CRYPTO_cmp_peer_identity (peer, &own_identity))
1174 {
1175 return GNUNET_NO;
1176 }
1177 ret = Peers_insert_peer (peer); 1209 ret = Peers_insert_peer (peer);
1178 peer_ctx = get_peer_ctx (peer); 1210 peer_ctx = get_peer_ctx (peer);
1179 if (GNUNET_NO == Peers_check_peer_flag (peer, Peers_ONLINE)) 1211 if ( (GNUNET_NO == Peers_check_peer_flag (peer, Peers_ONLINE)) &&
1212 (NULL == peer_ctx->liveliness_check_pending) )
1180 { 1213 {
1181 check_peer_live (peer_ctx); 1214 check_peer_live (peer_ctx);
1182 } 1215 }
@@ -1208,7 +1241,7 @@ Peers_check_removable (const struct GNUNET_PeerIdentity *peer)
1208 } 1241 }
1209 1242
1210 peer_ctx = get_peer_ctx (peer); 1243 peer_ctx = get_peer_ctx (peer);
1211 if ( (NULL != peer_ctx->recv_channel) || 1244 if ( (NULL != peer_ctx->recv_channel_ctx) ||
1212 (NULL != peer_ctx->pending_messages_head) || 1245 (NULL != peer_ctx->pending_messages_head) ||
1213 (GNUNET_NO == check_peer_flag_set (peer_ctx, Peers_PULL_REPLY_PENDING)) ) 1246 (GNUNET_NO == check_peer_flag_set (peer_ctx, Peers_PULL_REPLY_PENDING)) )
1214 { 1247 {
@@ -1225,6 +1258,65 @@ int
1225Peers_check_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags); 1258Peers_check_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags);
1226 1259
1227/** 1260/**
1261 * @brief Callback for the scheduler to destroy the knowledge of a peer.
1262 *
1263 * @param cls Context of the peer
1264 */
1265static void
1266destroy_peer (void *cls)
1267{
1268 struct PeerContext *peer_ctx = cls;
1269
1270 GNUNET_assert (NULL != peer_ctx);
1271 peer_ctx->destruction_task = NULL;
1272 Peers_remove_peer (&peer_ctx->peer_id);
1273}
1274
1275static void
1276destroy_channel (void *cls);
1277
1278
1279/**
1280 * @brief Schedule the destruction of the given channel.
1281 *
1282 * Do so only if it was not already scheduled and not during shutdown.
1283 *
1284 * @param channel_ctx The context of the channel to destroy.
1285 */
1286static void
1287schedule_channel_destruction (struct ChannelCtx *channel_ctx)
1288{
1289 GNUNET_assert (NULL != channel_ctx);
1290 if (NULL != channel_ctx->destruction_task &&
1291 GNUNET_NO == in_shutdown)
1292 {
1293 channel_ctx->destruction_task =
1294 GNUNET_SCHEDULER_add_now (destroy_channel, channel_ctx);
1295 }
1296}
1297
1298
1299/**
1300 * @brief Schedule the destruction of the given peer.
1301 *
1302 * Do so only if it was not already scheduled and not during shutdown.
1303 *
1304 * @param peer_ctx The context of the peer to destroy.
1305 */
1306static void
1307schedule_peer_destruction (struct PeerContext *peer_ctx)
1308{
1309 GNUNET_assert (NULL != peer_ctx);
1310 if (NULL != peer_ctx->destruction_task &&
1311 GNUNET_NO == in_shutdown)
1312 {
1313 peer_ctx->destruction_task =
1314 GNUNET_SCHEDULER_add_now (destroy_peer, peer_ctx);
1315 }
1316}
1317
1318
1319/**
1228 * @brief Remove peer 1320 * @brief Remove peer
1229 * 1321 *
1230 * @param peer the peer to clean 1322 * @param peer the peer to clean
@@ -1235,7 +1327,8 @@ int
1235Peers_remove_peer (const struct GNUNET_PeerIdentity *peer) 1327Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1236{ 1328{
1237 struct PeerContext *peer_ctx; 1329 struct PeerContext *peer_ctx;
1238 uint32_t *channel_flag; 1330
1331 GNUNET_assert (NULL != peer_map);
1239 1332
1240 if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer)) 1333 if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (peer_map, peer))
1241 { 1334 {
@@ -1249,7 +1342,12 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1249 GNUNET_i2s (&peer_ctx->peer_id)); 1342 GNUNET_i2s (&peer_ctx->peer_id));
1250 Peers_unset_peer_flag (peer, Peers_ONLINE); 1343 Peers_unset_peer_flag (peer, Peers_ONLINE);
1251 1344
1345 /* Clear list of pending operations */
1346 // TODO this probably leaks memory
1347 // ('only' the cls to the function. Not sure what to do with it)
1252 GNUNET_array_grow (peer_ctx->pending_ops, peer_ctx->num_pending_ops, 0); 1348 GNUNET_array_grow (peer_ctx->pending_ops, peer_ctx->num_pending_ops, 0);
1349
1350 /* Remove all pending messages */
1253 while (NULL != peer_ctx->pending_messages_head) 1351 while (NULL != peer_ctx->pending_messages_head)
1254 { 1352 {
1255 LOG (GNUNET_ERROR_TYPE_DEBUG, 1353 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1261,10 +1359,12 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1261 peer_ctx->liveliness_check_pending, 1359 peer_ctx->liveliness_check_pending,
1262 sizeof (struct PendingMessage))) ) 1360 sizeof (struct PendingMessage))) )
1263 { 1361 {
1362 // TODO this may leak memory
1264 peer_ctx->liveliness_check_pending = NULL; 1363 peer_ctx->liveliness_check_pending = NULL;
1265 } 1364 }
1266 remove_pending_message (peer_ctx->pending_messages_head, GNUNET_YES); 1365 remove_pending_message (peer_ctx->pending_messages_head, GNUNET_YES);
1267 } 1366 }
1367
1268 /* If we are still waiting for notification whether this peer is live 1368 /* If we are still waiting for notification whether this peer is live
1269 * cancel the according task */ 1369 * cancel the according task */
1270 if (NULL != peer_ctx->liveliness_check_pending) 1370 if (NULL != peer_ctx->liveliness_check_pending)
@@ -1277,28 +1377,40 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1277 remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES); 1377 remove_pending_message (peer_ctx->liveliness_check_pending, GNUNET_YES);
1278 peer_ctx->liveliness_check_pending = NULL; 1378 peer_ctx->liveliness_check_pending = NULL;
1279 } 1379 }
1280 channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_SENDING); 1380
1281 if (NULL != peer_ctx->send_channel && 1381
1282 GNUNET_YES != Peers_check_channel_flag (channel_flag, Peers_CHANNEL_DESTROING)) 1382 /* Do we still have to wait for destruction of channels
1383 * or issue the destruction? */
1384 if (NULL != peer_ctx->send_channel_ctx &&
1385 NULL != peer_ctx->send_channel_ctx->destruction_task
1386 )
1283 { 1387 {
1284 LOG (GNUNET_ERROR_TYPE_DEBUG, 1388 schedule_peer_destruction (peer_ctx);
1285 "Destroying send channel\n"); 1389 return GNUNET_NO;
1286 GNUNET_CADET_channel_destroy (peer_ctx->send_channel);
1287 peer_ctx->send_channel = NULL;
1288 peer_ctx->mq = NULL;
1289 } 1390 }
1290 channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_RECEIVING); 1391 if (NULL != peer_ctx->recv_channel_ctx &&
1291 if (NULL != peer_ctx->recv_channel && 1392 NULL != peer_ctx->recv_channel_ctx->destruction_task)
1292 GNUNET_YES != Peers_check_channel_flag (channel_flag, Peers_CHANNEL_DESTROING))
1293 { 1393 {
1294 LOG (GNUNET_ERROR_TYPE_DEBUG, 1394 schedule_peer_destruction (peer_ctx);
1295 "Destroying recv channel\n"); 1395 return GNUNET_NO;
1296 GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); 1396 }
1297 peer_ctx->recv_channel = NULL; 1397 if (NULL != peer_ctx->recv_channel_ctx)
1398 {
1399 schedule_channel_destruction (peer_ctx->recv_channel_ctx);
1400 schedule_peer_destruction (peer_ctx);
1401 return GNUNET_NO;
1402 }
1403 if (NULL != peer_ctx->send_channel_ctx)
1404 {
1405 schedule_channel_destruction (peer_ctx->send_channel_ctx);
1406 schedule_peer_destruction (peer_ctx);
1407 return GNUNET_NO;
1298 } 1408 }
1299 1409
1300 GNUNET_free (peer_ctx->send_channel_flags); 1410 if (NULL != peer_ctx->destruction_task)
1301 GNUNET_free (peer_ctx->recv_channel_flags); 1411 {
1412 GNUNET_SCHEDULER_cancel (peer_ctx->destruction_task);
1413 }
1302 1414
1303 if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove_all (peer_map, &peer_ctx->peer_id)) 1415 if (GNUNET_YES != GNUNET_CONTAINER_multipeermap_remove_all (peer_map, &peer_ctx->peer_id))
1304 { 1416 {
@@ -1308,7 +1420,6 @@ Peers_remove_peer (const struct GNUNET_PeerIdentity *peer)
1308 return GNUNET_YES; 1420 return GNUNET_YES;
1309} 1421}
1310 1422
1311
1312/** 1423/**
1313 * @brief set flags on a given peer. 1424 * @brief set flags on a given peer.
1314 * 1425 *
@@ -1364,77 +1475,6 @@ Peers_check_peer_flag (const struct GNUNET_PeerIdentity *peer, enum Peers_PeerFl
1364 return check_peer_flag_set (peer_ctx, flags); 1475 return check_peer_flag_set (peer_ctx, flags);
1365} 1476}
1366 1477
1367
1368/**
1369 * @brief set flags on a given channel.
1370 *
1371 * @param channel the channel to set flags on
1372 * @param flags the flags
1373 */
1374void
1375Peers_set_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags)
1376{
1377 set_channel_flag (channel_flags, flags);
1378}
1379
1380
1381/**
1382 * @brief unset flags on a given channel.
1383 *
1384 * @param channel the channel to unset flags on
1385 * @param flags the flags
1386 */
1387void
1388Peers_unset_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags)
1389{
1390 unset_channel_flag (channel_flags, flags);
1391}
1392
1393
1394/**
1395 * @brief Check whether flags on a channel are set.
1396 *
1397 * @param channel the channel to check the flag of
1398 * @param flags the flags to check
1399 *
1400 * @return #GNUNET_YES if all given flags are set
1401 * #GNUNET_NO otherwise
1402 */
1403int
1404Peers_check_channel_flag (uint32_t *channel_flags, enum Peers_ChannelFlags flags)
1405{
1406 return check_channel_flag_set (channel_flags, flags);
1407}
1408
1409/**
1410 * @brief Get the flags for the channel in @a role for @a peer.
1411 *
1412 * @param peer Peer to get the channel flags for.
1413 * @param role Role of channel to get flags for
1414 *
1415 * @return The flags.
1416 */
1417uint32_t *
1418Peers_get_channel_flag (const struct GNUNET_PeerIdentity *peer,
1419 enum Peers_ChannelRole role)
1420{
1421 const struct PeerContext *peer_ctx;
1422
1423 peer_ctx = get_peer_ctx (peer);
1424 if (Peers_CHANNEL_ROLE_SENDING == role)
1425 {
1426 return peer_ctx->send_channel_flags;
1427 }
1428 else if (Peers_CHANNEL_ROLE_RECEIVING == role)
1429 {
1430 return peer_ctx->recv_channel_flags;
1431 }
1432 else
1433 {
1434 GNUNET_assert (0);
1435 }
1436}
1437
1438/** 1478/**
1439 * @brief Check whether we have information about the given peer. 1479 * @brief Check whether we have information about the given peer.
1440 * 1480 *
@@ -1505,7 +1545,7 @@ Peers_check_peer_send_intention (const struct GNUNET_PeerIdentity *peer)
1505 const struct PeerContext *peer_ctx; 1545 const struct PeerContext *peer_ctx;
1506 1546
1507 peer_ctx = get_peer_ctx (peer); 1547 peer_ctx = get_peer_ctx (peer);
1508 if (NULL != peer_ctx->recv_channel) 1548 if (NULL != peer_ctx->recv_channel_ctx)
1509 { 1549 {
1510 return GNUNET_YES; 1550 return GNUNET_YES;
1511 } 1551 }
@@ -1530,6 +1570,7 @@ Peers_handle_inbound_channel (void *cls,
1530{ 1570{
1531 struct PeerContext *peer_ctx; 1571 struct PeerContext *peer_ctx;
1532 struct GNUNET_PeerIdentity *ctx_peer; 1572 struct GNUNET_PeerIdentity *ctx_peer;
1573 struct ChannelCtx *channel_ctx;
1533 1574
1534 LOG (GNUNET_ERROR_TYPE_DEBUG, 1575 LOG (GNUNET_ERROR_TYPE_DEBUG,
1535 "New channel was established to us (Peer %s).\n", 1576 "New channel was established to us (Peer %s).\n",
@@ -1540,19 +1581,22 @@ Peers_handle_inbound_channel (void *cls,
1540 set_peer_live (peer_ctx); 1581 set_peer_live (peer_ctx);
1541 ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity); 1582 ctx_peer = GNUNET_new (struct GNUNET_PeerIdentity);
1542 *ctx_peer = *initiator; 1583 *ctx_peer = *initiator;
1584 channel_ctx = add_channel_ctx (peer_ctx);
1585 channel_ctx->channel = channel;
1543 /* We only accept one incoming channel per peer */ 1586 /* We only accept one incoming channel per peer */
1544 if (GNUNET_YES == Peers_check_peer_send_intention (initiator)) 1587 if (GNUNET_YES == Peers_check_peer_send_intention (initiator))
1545 { 1588 {
1546 set_channel_flag (peer_ctx->recv_channel_flags, 1589 LOG (GNUNET_ERROR_TYPE_WARNING,
1547 Peers_CHANNEL_ESTABLISHED_TWICE); 1590 "Already got one receive channel. Destroying old one.\n");
1548 //GNUNET_CADET_channel_destroy (channel); 1591 GNUNET_break_op (0);
1549 GNUNET_CADET_channel_destroy (peer_ctx->recv_channel); 1592 GNUNET_CADET_channel_destroy (peer_ctx->recv_channel_ctx->channel);
1550 peer_ctx->recv_channel = channel; 1593 remove_channel_ctx (peer_ctx->recv_channel_ctx);
1594 peer_ctx->recv_channel_ctx = channel_ctx;
1551 /* return the channel context */ 1595 /* return the channel context */
1552 return ctx_peer; 1596 return channel_ctx;
1553 } 1597 }
1554 peer_ctx->recv_channel = channel; 1598 peer_ctx->recv_channel_ctx = channel_ctx;
1555 return ctx_peer; 1599 return channel_ctx;
1556} 1600}
1557 1601
1558 1602
@@ -1574,7 +1618,7 @@ Peers_check_sending_channel_exists (const struct GNUNET_PeerIdentity *peer)
1574 return GNUNET_NO; 1618 return GNUNET_NO;
1575 } 1619 }
1576 peer_ctx = get_peer_ctx (peer); 1620 peer_ctx = get_peer_ctx (peer);
1577 if (NULL == peer_ctx->send_channel) 1621 if (NULL == peer_ctx->send_channel_ctx)
1578 { 1622 {
1579 return GNUNET_NO; 1623 return GNUNET_NO;
1580 } 1624 }
@@ -1607,12 +1651,14 @@ Peers_check_channel_role (const struct GNUNET_PeerIdentity *peer,
1607 } 1651 }
1608 peer_ctx = get_peer_ctx (peer); 1652 peer_ctx = get_peer_ctx (peer);
1609 if ( (Peers_CHANNEL_ROLE_SENDING == role) && 1653 if ( (Peers_CHANNEL_ROLE_SENDING == role) &&
1610 (channel == peer_ctx->send_channel) ) 1654 (NULL != peer_ctx->send_channel_ctx) &&
1655 (channel == peer_ctx->send_channel_ctx->channel) )
1611 { 1656 {
1612 return GNUNET_YES; 1657 return GNUNET_YES;
1613 } 1658 }
1614 if ( (Peers_CHANNEL_ROLE_RECEIVING == role) && 1659 if ( (Peers_CHANNEL_ROLE_RECEIVING == role) &&
1615 (channel == peer_ctx->recv_channel) ) 1660 (NULL != peer_ctx->recv_channel_ctx) &&
1661 (channel == peer_ctx->recv_channel_ctx->channel) )
1616 { 1662 {
1617 return GNUNET_YES; 1663 return GNUNET_YES;
1618 } 1664 }
@@ -1642,12 +1688,9 @@ Peers_destroy_sending_channel (const struct GNUNET_PeerIdentity *peer)
1642 return GNUNET_NO; 1688 return GNUNET_NO;
1643 } 1689 }
1644 peer_ctx = get_peer_ctx (peer); 1690 peer_ctx = get_peer_ctx (peer);
1645 if (NULL != peer_ctx->send_channel) 1691 if (NULL != peer_ctx->send_channel_ctx)
1646 { 1692 {
1647 set_channel_flag (peer_ctx->send_channel_flags, Peers_CHANNEL_CLEAN); 1693 schedule_channel_destruction (peer_ctx->send_channel_ctx);
1648 GNUNET_CADET_channel_destroy (peer_ctx->send_channel);
1649 peer_ctx->send_channel = NULL;
1650 peer_ctx->mq = NULL;
1651 (void) Peers_check_connected (peer); 1694 (void) Peers_check_connected (peer);
1652 return GNUNET_YES; 1695 return GNUNET_YES;
1653 } 1696 }
@@ -1655,6 +1698,25 @@ Peers_destroy_sending_channel (const struct GNUNET_PeerIdentity *peer)
1655} 1698}
1656 1699
1657/** 1700/**
1701 * @brief Callback for scheduler to destroy a channel
1702 *
1703 * @param cls Context of the channel
1704 */
1705static void
1706destroy_channel (void *cls)
1707{
1708 struct ChannelCtx *channel_ctx = cls;
1709 struct PeerContext *peer_ctx = channel_ctx->peer_ctx;
1710
1711 GNUNET_assert (channel_ctx == peer_ctx->send_channel_ctx ||
1712 channel_ctx == peer_ctx->recv_channel_ctx);
1713
1714 channel_ctx->destruction_task = NULL;
1715 GNUNET_CADET_channel_destroy (channel_ctx->channel);
1716 remove_channel_ctx (peer_ctx->send_channel_ctx);
1717}
1718
1719/**
1658 * This is called when a channel is destroyed. 1720 * This is called when a channel is destroyed.
1659 * 1721 *
1660 * @param cls The closure 1722 * @param cls The closure
@@ -1664,77 +1726,45 @@ void
1664Peers_cleanup_destroyed_channel (void *cls, 1726Peers_cleanup_destroyed_channel (void *cls,
1665 const struct GNUNET_CADET_Channel *channel) 1727 const struct GNUNET_CADET_Channel *channel)
1666{ 1728{
1667 struct GNUNET_PeerIdentity *peer = cls; 1729 struct ChannelCtx *channel_ctx = cls;
1668 struct PeerContext *peer_ctx; 1730 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id;
1731 struct PeerContext *peer_ctx = channel_ctx->peer_ctx;
1669 1732
1670 if (GNUNET_NO == Peers_check_peer_known (peer)) 1733 if (GNUNET_NO == Peers_check_peer_known (peer))
1671 {/* We don't want to implicitly create a context that we're about to kill */ 1734 {/* We don't want to implicitly create a context that we're about to kill */
1672 LOG (GNUNET_ERROR_TYPE_DEBUG, 1735 LOG (GNUNET_ERROR_TYPE_WARNING,
1673 "channel (%s) without associated context was destroyed\n", 1736 "channel (%s) without associated context was destroyed\n",
1674 GNUNET_i2s (peer)); 1737 GNUNET_i2s (peer));
1675 return; 1738 return;
1676 } 1739 }
1677 peer_ctx = get_peer_ctx (peer);
1678 1740
1679 /* If our peer issued the destruction of the channel, the #Peers_TO_DESTROY 1741 /* If our peer issued the destruction of the channel, the #Peers_TO_DESTROY
1680 * flag will be set. In this case simply make sure that the channels are 1742 * flag will be set. In this case simply make sure that the channels are
1681 * cleaned. */ 1743 * cleaned. */
1682 /* FIXME This distinction seems to be redundant */ 1744 /* The distinction seems to be redundant */
1683 if (Peers_check_peer_flag (peer, Peers_TO_DESTROY)) 1745 LOG (GNUNET_ERROR_TYPE_DEBUG,
1684 {/* We initiatad the destruction of this particular peer */ 1746 "Peer is NOT in the process of being destroyed\n");
1747 if ( (NULL != peer_ctx->send_channel_ctx) &&
1748 (channel == peer_ctx->send_channel_ctx->channel) )
1749 { /* Something (but us) killd the channel - clean up peer */
1685 LOG (GNUNET_ERROR_TYPE_DEBUG, 1750 LOG (GNUNET_ERROR_TYPE_DEBUG,
1686 "Peer is in the process of being destroyed\n"); 1751 "send channel (%s) was destroyed - cleaning up\n",
1687 if (channel == peer_ctx->send_channel) 1752 GNUNET_i2s (peer));
1688 { 1753 remove_channel_ctx (peer_ctx->send_channel_ctx);
1689 peer_ctx->send_channel = NULL;
1690 peer_ctx->mq = NULL;
1691 }
1692 else if (channel == peer_ctx->recv_channel)
1693 {
1694 peer_ctx->recv_channel = NULL;
1695 }
1696
1697 if (NULL != peer_ctx->send_channel)
1698 {
1699 GNUNET_CADET_channel_destroy (peer_ctx->send_channel);
1700 peer_ctx->send_channel = NULL;
1701 peer_ctx->mq = NULL;
1702 }
1703 if (NULL != peer_ctx->recv_channel)
1704 {
1705 GNUNET_CADET_channel_destroy (peer_ctx->recv_channel);
1706 peer_ctx->recv_channel = NULL;
1707 }
1708 /* Set the #Peers_ONLINE flag accordingly */
1709 (void) Peers_check_connected (peer);
1710 return;
1711 } 1754 }
1712 1755 else if ( (NULL != peer_ctx->recv_channel_ctx) &&
1713 else 1756 (channel == peer_ctx->recv_channel_ctx->channel) )
1714 { /* We did not initiate the destruction of this peer */ 1757 { /* Other peer doesn't want to send us messages anymore */
1715 LOG (GNUNET_ERROR_TYPE_DEBUG, 1758 LOG (GNUNET_ERROR_TYPE_DEBUG,
1716 "Peer is NOT in the process of being destroyed\n"); 1759 "Peer %s destroyed recv channel - cleaning up channel\n",
1717 if (channel == peer_ctx->send_channel) 1760 GNUNET_i2s (peer));
1718 { /* Something (but us) killd the channel - clean up peer */ 1761 remove_channel_ctx (peer_ctx->send_channel_ctx);
1719 LOG (GNUNET_ERROR_TYPE_DEBUG, 1762 }
1720 "send channel (%s) was destroyed - cleaning up\n", 1763 else
1721 GNUNET_i2s (peer)); 1764 {
1722 peer_ctx->send_channel = NULL; 1765 LOG (GNUNET_ERROR_TYPE_WARNING,
1723 peer_ctx->mq = NULL; 1766 "unknown channel (%s) was destroyed\n",
1724 } 1767 GNUNET_i2s (peer));
1725 else if (channel == peer_ctx->recv_channel)
1726 { /* Other peer doesn't want to send us messages anymore */
1727 LOG (GNUNET_ERROR_TYPE_DEBUG,
1728 "Peer %s destroyed recv channel - cleaning up channel\n",
1729 GNUNET_i2s (peer));
1730 peer_ctx->recv_channel = NULL;
1731 }
1732 else
1733 {
1734 LOG (GNUNET_ERROR_TYPE_WARNING,
1735 "unknown channel (%s) was destroyed\n",
1736 GNUNET_i2s (peer));
1737 }
1738 } 1768 }
1739 (void) Peers_check_connected (peer); 1769 (void) Peers_check_connected (peer);
1740} 1770}
@@ -1786,10 +1816,6 @@ Peers_schedule_operation (const struct GNUNET_PeerIdentity *peer,
1786 struct PeerPendingOp pending_op; 1816 struct PeerPendingOp pending_op;
1787 struct PeerContext *peer_ctx; 1817 struct PeerContext *peer_ctx;
1788 1818
1789 if (0 == GNUNET_CRYPTO_cmp_peer_identity (peer, &own_identity))
1790 {
1791 return GNUNET_NO;
1792 }
1793 GNUNET_assert (GNUNET_YES == Peers_check_peer_known (peer)); 1819 GNUNET_assert (GNUNET_YES == Peers_check_peer_known (peer));
1794 1820
1795 //TODO if LIVE/ONLINE execute immediately 1821 //TODO if LIVE/ONLINE execute immediately
@@ -1823,7 +1849,7 @@ Peers_get_recv_channel (const struct GNUNET_PeerIdentity *peer)
1823 1849
1824 GNUNET_assert (GNUNET_YES == Peers_check_peer_known (peer)); 1850 GNUNET_assert (GNUNET_YES == Peers_check_peer_known (peer));
1825 peer_ctx = get_peer_ctx (peer); 1851 peer_ctx = get_peer_ctx (peer);
1826 return peer_ctx->recv_channel; 1852 return peer_ctx->recv_channel_ctx->channel;
1827} 1853}
1828/*********************************************************************** 1854/***********************************************************************
1829 * /Old gnunet-service-rps_peers.c 1855 * /Old gnunet-service-rps_peers.c
@@ -2484,6 +2510,9 @@ send_pull_reply (const struct GNUNET_PeerIdentity *peer_id,
2484 2510
2485 Peers_send_message (peer_id, ev, "PULL REPLY"); 2511 Peers_send_message (peer_id, ev, "PULL REPLY");
2486 GNUNET_STATISTICS_update(stats, "# pull reply send issued", 1, GNUNET_NO); 2512 GNUNET_STATISTICS_update(stats, "# pull reply send issued", 1, GNUNET_NO);
2513 // TODO check with send intention: as send_channel is used/opened we indicate
2514 // a sending intention without intending it.
2515 // -> clean peer afterwards?
2487} 2516}
2488 2517
2489 2518
@@ -2616,7 +2645,7 @@ remove_peer (const struct GNUNET_PeerIdentity *peer)
2616 CustomPeerMap_remove_peer (push_map, peer); 2645 CustomPeerMap_remove_peer (push_map, peer);
2617 RPS_sampler_reinitialise_by_value (prot_sampler, peer); 2646 RPS_sampler_reinitialise_by_value (prot_sampler, peer);
2618 RPS_sampler_reinitialise_by_value (client_sampler, peer); 2647 RPS_sampler_reinitialise_by_value (client_sampler, peer);
2619 Peers_remove_peer (peer); 2648 schedule_peer_destruction (get_peer_ctx (peer));
2620} 2649}
2621 2650
2622 2651
@@ -2660,6 +2689,58 @@ clean_peer (const struct GNUNET_PeerIdentity *peer)
2660} 2689}
2661 2690
2662/** 2691/**
2692 * @brief Allocate memory for a new channel context and insert it into DLL
2693 *
2694 * @param peer_ctx context of the according peer
2695 *
2696 * @return The channel context
2697 */
2698static struct ChannelCtx *
2699add_channel_ctx (struct PeerContext *peer_ctx)
2700{
2701 struct ChannelCtx *channel_ctx;
2702 channel_ctx = GNUNET_new (struct ChannelCtx);
2703 channel_ctx->peer_ctx = peer_ctx;
2704 return channel_ctx;
2705}
2706
2707/**
2708 * @brief Remove the channel context from the DLL and free the memory.
2709 *
2710 * @param channel_ctx The channel context.
2711 */
2712static void
2713remove_channel_ctx (struct ChannelCtx *channel_ctx)
2714{
2715 struct PeerContext *peer_ctx = channel_ctx->peer_ctx;
2716 if (NULL != channel_ctx->destruction_task)
2717 {
2718 GNUNET_SCHEDULER_cancel (channel_ctx->destruction_task);
2719 }
2720 GNUNET_free (channel_ctx);
2721
2722 if (channel_ctx == peer_ctx->send_channel_ctx)
2723 {
2724 peer_ctx->send_channel_ctx = NULL;
2725 peer_ctx->mq = NULL;
2726 }
2727 else if (channel_ctx == peer_ctx->recv_channel_ctx)
2728 {
2729 peer_ctx->recv_channel_ctx = NULL;
2730 }
2731 else
2732 {
2733 LOG (GNUNET_ERROR_TYPE_ERROR,
2734 "Trying to remove channel_ctx that is not associated with a peer\n");
2735 LOG (GNUNET_ERROR_TYPE_ERROR,
2736 "\trecv: %p\n", peer_ctx->recv_channel_ctx);
2737 LOG (GNUNET_ERROR_TYPE_ERROR,
2738 "\tsend: %p\n", peer_ctx->send_channel_ctx);
2739 GNUNET_assert (0);
2740 }
2741}
2742
2743/**
2663 * @brief This is called when a channel is destroyed. 2744 * @brief This is called when a channel is destroyed.
2664 * 2745 *
2665 * Removes peer completely from our knowledge if the send_channel was destroyed 2746 * Removes peer completely from our knowledge if the send_channel was destroyed
@@ -2675,8 +2756,8 @@ static void
2675cleanup_destroyed_channel (void *cls, 2756cleanup_destroyed_channel (void *cls,
2676 const struct GNUNET_CADET_Channel *channel) 2757 const struct GNUNET_CADET_Channel *channel)
2677{ 2758{
2678 struct GNUNET_PeerIdentity *peer = cls; 2759 struct ChannelCtx *channel_ctx = cls;
2679 uint32_t *channel_flag; 2760 struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id;
2680 struct PeerContext *peer_ctx; 2761 struct PeerContext *peer_ctx;
2681 2762
2682 GNUNET_assert (NULL != peer); 2763 GNUNET_assert (NULL != peer);
@@ -2686,94 +2767,26 @@ cleanup_destroyed_channel (void *cls,
2686 LOG (GNUNET_ERROR_TYPE_WARNING, 2767 LOG (GNUNET_ERROR_TYPE_WARNING,
2687 "channel (%s) without associated context was destroyed\n", 2768 "channel (%s) without associated context was destroyed\n",
2688 GNUNET_i2s (peer)); 2769 GNUNET_i2s (peer));
2689 GNUNET_free (peer); 2770 remove_channel_ctx (channel_ctx);
2690 return; 2771 return;
2691 } 2772 }
2692 2773
2693 peer_ctx = get_peer_ctx (peer); 2774 peer_ctx = get_peer_ctx (peer);
2694 if (GNUNET_YES == Peers_check_channel_role (peer, channel, Peers_CHANNEL_ROLE_RECEIVING))
2695 {
2696 LOG (GNUNET_ERROR_TYPE_DEBUG,
2697 "Callback on destruction of recv-channel was called (%s)\n",
2698 GNUNET_i2s (peer));
2699 set_channel_flag (peer_ctx->recv_channel_flags, Peers_CHANNEL_DESTROING);
2700 } else if (GNUNET_YES == Peers_check_channel_role (peer, channel, Peers_CHANNEL_ROLE_SENDING))
2701 {
2702 LOG (GNUNET_ERROR_TYPE_DEBUG,
2703 "Callback on destruction of send-channel was called (%s)\n",
2704 GNUNET_i2s (peer));
2705 set_channel_flag (peer_ctx->send_channel_flags, Peers_CHANNEL_DESTROING);
2706 } else {
2707 LOG (GNUNET_ERROR_TYPE_ERROR,
2708 "Channel to be destroyed has is neither sending nor receiving role\n");
2709 }
2710 2775
2711 if (GNUNET_YES == Peers_check_peer_flag (peer, Peers_TO_DESTROY)) 2776 // What should be done here:
2712 { /* We are in the middle of removing that peer from our knowledge. In this 2777 // * cleanup everything related to the channel
2713 case simply make sure that the channels are cleaned. */ 2778 // * memory
2714 Peers_cleanup_destroyed_channel (cls, channel); 2779 // * remove peer if necessary
2715 to_file (file_name_view_log,
2716 "-%s\t(cleanup channel, ourself)",
2717 GNUNET_i2s_full (peer));
2718 GNUNET_free (peer);
2719 return;
2720 }
2721 2780
2722 if (GNUNET_YES == 2781 if (peer_ctx->recv_channel_ctx == channel_ctx)
2723 Peers_check_channel_role (peer, channel, Peers_CHANNEL_ROLE_SENDING)) 2782 {
2724 { /* Channel used for sending was destroyed */ 2783 remove_channel_ctx (channel_ctx);
2725 /* Possible causes of channel destruction:
2726 * - ourselves -> cleaning send channel -> clean context
2727 * - other peer -> peer probably went down -> remove
2728 */
2729 channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_SENDING);
2730 if (GNUNET_YES == Peers_check_channel_flag (channel_flag, Peers_CHANNEL_CLEAN))
2731 { /* We are about to clean the sending channel. Clean the respective
2732 * context */
2733 Peers_cleanup_destroyed_channel (cls, channel);
2734 GNUNET_free (peer);
2735 return;
2736 }
2737 else
2738 { /* Other peer destroyed our sending channel that it is supposed to keep
2739 * open. It probably went down. Remove it from our knowledge. */
2740 Peers_cleanup_destroyed_channel (cls, channel);
2741 remove_peer (peer);
2742 GNUNET_free (peer);
2743 return;
2744 }
2745 }
2746 else if (GNUNET_YES ==
2747 Peers_check_channel_role (peer, channel, Peers_CHANNEL_ROLE_RECEIVING))
2748 { /* Channel used for receiving was destroyed */
2749 /* Possible causes of channel destruction:
2750 * - ourselves -> peer tried to establish channel twice -> clean context
2751 * - other peer -> peer doesn't want to send us data -> clean
2752 */
2753 channel_flag = Peers_get_channel_flag (peer, Peers_CHANNEL_ROLE_RECEIVING);
2754 if (GNUNET_YES ==
2755 Peers_check_channel_flag (channel_flag, Peers_CHANNEL_ESTABLISHED_TWICE))
2756 { /* Other peer tried to establish a channel to us twice. We do not accept
2757 * that. Clean the context. */
2758 Peers_cleanup_destroyed_channel (cls, channel);
2759 GNUNET_free (peer);
2760 return;
2761 }
2762 else
2763 { /* Other peer doesn't want to send us data anymore. We are free to clean
2764 * it. */
2765 Peers_cleanup_destroyed_channel (cls, channel);
2766 clean_peer (peer);
2767 GNUNET_free (peer);
2768 return;
2769 }
2770 } 2784 }
2771 else 2785 else if (peer_ctx->send_channel_ctx == channel_ctx)
2772 { 2786 {
2773 LOG (GNUNET_ERROR_TYPE_WARNING, 2787 remove_channel_ctx (channel_ctx);
2774 "Destroyed channel is neither sending nor receiving channel\n"); 2788 remove_peer (&peer_ctx->peer_id);
2775 } 2789 }
2776 GNUNET_free (peer);
2777} 2790}
2778 2791
2779/*********************************************************************** 2792/***********************************************************************
@@ -3032,8 +3045,6 @@ handle_client_seed (void *cls,
3032 3045
3033 num_peers = ntohl (msg->num_peers); 3046 num_peers = ntohl (msg->num_peers);
3034 peers = (struct GNUNET_PeerIdentity *) &msg[1]; 3047 peers = (struct GNUNET_PeerIdentity *) &msg[1];
3035 //peers = GNUNET_new_array (num_peers, struct GNUNET_PeerIdentity);
3036 //GNUNET_memcpy (peers, &msg[1], num_peers * sizeof (struct GNUNET_PeerIdentity));
3037 3048
3038 LOG (GNUNET_ERROR_TYPE_DEBUG, 3049 LOG (GNUNET_ERROR_TYPE_DEBUG,
3039 "Client seeded peers:\n"); 3050 "Client seeded peers:\n");
@@ -3048,9 +3059,6 @@ handle_client_seed (void *cls,
3048 3059
3049 got_peer (&peers[i]); 3060 got_peer (&peers[i]);
3050 } 3061 }
3051
3052 ////GNUNET_free (peers);
3053
3054 GNUNET_SERVICE_client_continue (cli_ctx->client); 3062 GNUNET_SERVICE_client_continue (cli_ctx->client);
3055} 3063}
3056 3064
@@ -3168,11 +3176,12 @@ static void
3168handle_peer_check (void *cls, 3176handle_peer_check (void *cls,
3169 const struct GNUNET_MessageHeader *msg) 3177 const struct GNUNET_MessageHeader *msg)
3170{ 3178{
3171 const struct GNUNET_PeerIdentity *peer = cls; 3179 const struct ChannelCtx *channel_ctx = cls;
3180 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id;
3172 LOG (GNUNET_ERROR_TYPE_DEBUG, 3181 LOG (GNUNET_ERROR_TYPE_DEBUG,
3173 "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer)); 3182 "Received CHECK_LIVE (%s)\n", GNUNET_i2s (peer));
3174 3183
3175 GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); 3184 GNUNET_CADET_receive_done (channel_ctx->channel);
3176} 3185}
3177 3186
3178/** 3187/**
@@ -3188,7 +3197,8 @@ static void
3188handle_peer_push (void *cls, 3197handle_peer_push (void *cls,
3189 const struct GNUNET_MessageHeader *msg) 3198 const struct GNUNET_MessageHeader *msg)
3190{ 3199{
3191 const struct GNUNET_PeerIdentity *peer = cls; 3200 const struct ChannelCtx *channel_ctx = cls;
3201 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id;
3192 3202
3193 // (check the proof of work (?)) 3203 // (check the proof of work (?))
3194 3204
@@ -3233,7 +3243,7 @@ handle_peer_push (void *cls,
3233 CustomPeerMap_put (push_map, peer); 3243 CustomPeerMap_put (push_map, peer);
3234 3244
3235 GNUNET_break_op (Peers_check_peer_known (peer)); 3245 GNUNET_break_op (Peers_check_peer_known (peer));
3236 GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); 3246 GNUNET_CADET_receive_done (channel_ctx->channel);
3237} 3247}
3238 3248
3239 3249
@@ -3249,7 +3259,8 @@ static void
3249handle_peer_pull_request (void *cls, 3259handle_peer_pull_request (void *cls,
3250 const struct GNUNET_MessageHeader *msg) 3260 const struct GNUNET_MessageHeader *msg)
3251{ 3261{
3252 struct GNUNET_PeerIdentity *peer = cls; 3262 const struct ChannelCtx *channel_ctx = cls;
3263 const struct GNUNET_PeerIdentity *peer = &channel_ctx->peer_ctx->peer_id;
3253 const struct GNUNET_PeerIdentity *view_array; 3264 const struct GNUNET_PeerIdentity *view_array;
3254 3265
3255 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer)); 3266 LOG (GNUNET_ERROR_TYPE_DEBUG, "Received PULL REQUEST (%s)\n", GNUNET_i2s (peer));
@@ -3272,7 +3283,7 @@ handle_peer_pull_request (void *cls,
3272 #endif /* ENABLE_MALICIOUS */ 3283 #endif /* ENABLE_MALICIOUS */
3273 3284
3274 GNUNET_break_op (Peers_check_peer_known (peer)); 3285 GNUNET_break_op (Peers_check_peer_known (peer));
3275 GNUNET_CADET_receive_done (Peers_get_recv_channel (peer)); 3286 GNUNET_CADET_receive_done (channel_ctx->channel);
3276 view_array = View_get_as_array (); 3287 view_array = View_get_as_array ();
3277 send_pull_reply (peer, view_array, View_size ()); 3288 send_pull_reply (peer, view_array, View_size ());
3278} 3289}
@@ -3312,7 +3323,8 @@ check_peer_pull_reply (void *cls,
3312 if (GNUNET_YES != Peers_check_peer_flag (sender, Peers_PULL_REPLY_PENDING)) 3323 if (GNUNET_YES != Peers_check_peer_flag (sender, Peers_PULL_REPLY_PENDING))
3313 { 3324 {
3314 LOG (GNUNET_ERROR_TYPE_WARNING, 3325 LOG (GNUNET_ERROR_TYPE_WARNING,
3315 "Received a pull reply from a peer we didn't request one from!\n"); 3326 "Received a pull reply from a peer (%s) we didn't request one from!\n",
3327 GNUNET_i2s (sender));
3316 GNUNET_break_op (0); 3328 GNUNET_break_op (0);
3317 return GNUNET_SYSERR; 3329 return GNUNET_SYSERR;
3318 } 3330 }
@@ -3329,8 +3341,9 @@ static void
3329handle_peer_pull_reply (void *cls, 3341handle_peer_pull_reply (void *cls,
3330 const struct GNUNET_RPS_P2P_PullReplyMessage *msg) 3342 const struct GNUNET_RPS_P2P_PullReplyMessage *msg)
3331{ 3343{
3344 const struct ChannelCtx *channel_ctx = cls;
3345 const struct GNUNET_PeerIdentity *sender = &channel_ctx->peer_ctx->peer_id;
3332 const struct GNUNET_PeerIdentity *peers; 3346 const struct GNUNET_PeerIdentity *peers;
3333 struct GNUNET_PeerIdentity *sender = cls;
3334 uint32_t i; 3347 uint32_t i;
3335#ifdef ENABLE_MALICIOUS 3348#ifdef ENABLE_MALICIOUS
3336 struct AttackedPeer *tmp_att_peer; 3349 struct AttackedPeer *tmp_att_peer;
@@ -3368,9 +3381,7 @@ handle_peer_pull_reply (void *cls,
3368 if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (att_peer_set, 3381 if (GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (att_peer_set,
3369 &peers[i]) 3382 &peers[i])
3370 && GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mal_peer_set, 3383 && GNUNET_NO == GNUNET_CONTAINER_multipeermap_contains (mal_peer_set,
3371 &peers[i]) 3384 &peers[i]))
3372 && 0 != GNUNET_CRYPTO_cmp_peer_identity (&peers[i],
3373 &own_identity))
3374 { 3385 {
3375 tmp_att_peer = GNUNET_new (struct AttackedPeer); 3386 tmp_att_peer = GNUNET_new (struct AttackedPeer);
3376 tmp_att_peer->peer_id = peers[i]; 3387 tmp_att_peer->peer_id = peers[i];
@@ -3382,21 +3393,17 @@ handle_peer_pull_reply (void *cls,
3382 continue; 3393 continue;
3383 } 3394 }
3384 #endif /* ENABLE_MALICIOUS */ 3395 #endif /* ENABLE_MALICIOUS */
3385 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, 3396 /* Make sure we 'know' about this peer */
3386 &peers[i])) 3397 (void) Peers_insert_peer (&peers[i]);
3387 {
3388 /* Make sure we 'know' about this peer */
3389 (void) Peers_insert_peer (&peers[i]);
3390 3398
3391 if (GNUNET_YES == Peers_check_peer_valid (&peers[i])) 3399 if (GNUNET_YES == Peers_check_peer_valid (&peers[i]))
3392 { 3400 {
3393 CustomPeerMap_put (pull_map, &peers[i]); 3401 CustomPeerMap_put (pull_map, &peers[i]);
3394 } 3402 }
3395 else 3403 else
3396 { 3404 {
3397 Peers_schedule_operation (&peers[i], insert_in_pull_map); 3405 Peers_schedule_operation (&peers[i], insert_in_pull_map);
3398 (void) Peers_issue_peer_liveliness_check (&peers[i]); 3406 (void) Peers_issue_peer_liveliness_check (&peers[i]);
3399 }
3400 } 3407 }
3401 } 3408 }
3402 3409
@@ -3404,7 +3411,7 @@ handle_peer_pull_reply (void *cls,
3404 clean_peer (sender); 3411 clean_peer (sender);
3405 3412
3406 GNUNET_break_op (Peers_check_peer_known (sender)); 3413 GNUNET_break_op (Peers_check_peer_known (sender));
3407 GNUNET_CADET_receive_done (Peers_get_recv_channel (sender)); 3414 GNUNET_CADET_receive_done (channel_ctx->channel);
3408} 3415}
3409 3416
3410 3417
@@ -3831,10 +3838,8 @@ do_round (void *cls)
3831 for (i = 0; i < a_peers; i++) 3838 for (i = 0; i < a_peers; i++)
3832 { 3839 {
3833 peer = view_array[permut[i]]; 3840 peer = view_array[permut[i]];
3834 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peer)) // TODO 3841 // FIXME if this fails schedule/loop this for later
3835 { // FIXME if this fails schedule/loop this for later 3842 send_push (&peer);
3836 send_push (&peer);
3837 }
3838 } 3843 }
3839 3844
3840 /* Send PULL requests */ 3845 /* Send PULL requests */
@@ -3852,8 +3857,7 @@ do_round (void *cls)
3852 for (i = first_border; i < second_border; i++) 3857 for (i = first_border; i < second_border; i++)
3853 { 3858 {
3854 peer = view_array[permut[i]]; 3859 peer = view_array[permut[i]];
3855 if (0 != GNUNET_CRYPTO_cmp_peer_identity (&own_identity, &peer) && 3860 if ( GNUNET_NO == Peers_check_peer_flag (&peer, Peers_PULL_REPLY_PENDING))
3856 GNUNET_NO == Peers_check_peer_flag (&peer, Peers_PULL_REPLY_PENDING)) // TODO
3857 { // FIXME if this fails schedule/loop this for later 3861 { // FIXME if this fails schedule/loop this for later
3858 send_pull_request (&peer); 3862 send_pull_request (&peer);
3859 } 3863 }
@@ -3950,7 +3954,6 @@ do_round (void *cls)
3950 "-%s", 3954 "-%s",
3951 GNUNET_i2s_full (&peers_to_clean[i])); 3955 GNUNET_i2s_full (&peers_to_clean[i]));
3952 clean_peer (&peers_to_clean[i]); 3956 clean_peer (&peers_to_clean[i]);
3953 //peer_destroy_channel_send (sender);
3954 } 3957 }
3955 3958
3956 GNUNET_array_grow (peers_to_clean, peers_to_clean_size, 0); 3959 GNUNET_array_grow (peers_to_clean, peers_to_clean_size, 0);
@@ -4006,7 +4009,6 @@ do_round (void *cls)
4006 GNUNET_i2s (update_peer)); 4009 GNUNET_i2s (update_peer));
4007 insert_in_sampler (NULL, update_peer); 4010 insert_in_sampler (NULL, update_peer);
4008 clean_peer (update_peer); /* This cleans only if it is not in the view */ 4011 clean_peer (update_peer); /* This cleans only if it is not in the view */
4009 //peer_destroy_channel_send (sender);
4010 } 4012 }
4011 4013
4012 for (i = 0; i < CustomPeerMap_size (pull_map); i++) 4014 for (i = 0; i < CustomPeerMap_size (pull_map); i++)
@@ -4017,7 +4019,6 @@ do_round (void *cls)
4017 insert_in_sampler (NULL, CustomPeerMap_get_peer_by_index (pull_map, i)); 4019 insert_in_sampler (NULL, CustomPeerMap_get_peer_by_index (pull_map, i));
4018 /* This cleans only if it is not in the view */ 4020 /* This cleans only if it is not in the view */
4019 clean_peer (CustomPeerMap_get_peer_by_index (pull_map, i)); 4021 clean_peer (CustomPeerMap_get_peer_by_index (pull_map, i));
4020 //peer_destroy_channel_send (sender);
4021 } 4022 }
4022 4023
4023 4024
@@ -4120,6 +4121,8 @@ shutdown_task (void *cls)
4120 struct ClientContext *client_ctx; 4121 struct ClientContext *client_ctx;
4121 struct ReplyCls *reply_cls; 4122 struct ReplyCls *reply_cls;
4122 4123
4124 in_shutdown = GNUNET_YES;
4125
4123 LOG (GNUNET_ERROR_TYPE_DEBUG, 4126 LOG (GNUNET_ERROR_TYPE_DEBUG,
4124 "RPS is going down\n"); 4127 "RPS is going down\n");
4125 4128
@@ -4364,10 +4367,17 @@ run (void *cls,
4364 NULL, /* WindowSize handler */ 4367 NULL, /* WindowSize handler */
4365 cleanup_destroyed_channel, /* Disconnect handler */ 4368 cleanup_destroyed_channel, /* Disconnect handler */
4366 cadet_handlers); 4369 cadet_handlers);
4370 if (NULL == cadet_port)
4371 {
4372 LOG (GNUNET_ERROR_TYPE_ERROR,
4373 "Cadet port `%s' is already in use.\n",
4374 GNUNET_APPLICATION_PORT_RPS);
4375 GNUNET_assert (0);
4376 }
4367 4377
4368 4378
4369 peerinfo_handle = GNUNET_PEERINFO_connect (cfg); 4379 peerinfo_handle = GNUNET_PEERINFO_connect (cfg);
4370 Peers_initialise (fn_valid_peers, cadet_handle, &own_identity); 4380 Peers_initialise (fn_valid_peers, cadet_handle);
4371 GNUNET_free (fn_valid_peers); 4381 GNUNET_free (fn_valid_peers);
4372 4382
4373 /* Initialise sampler */ 4383 /* Initialise sampler */
diff --git a/src/rps/gnunet-service-rps_custommap.c b/src/rps/gnunet-service-rps_custommap.c
index 42507655b..9e003eb39 100644
--- a/src/rps/gnunet-service-rps_custommap.c
+++ b/src/rps/gnunet-service-rps_custommap.c
@@ -213,7 +213,7 @@ CustomPeerMap_remove_peer (const struct CustomPeerMap *c_peer_map,
213 GNUNET_assert (NULL != last_index); 213 GNUNET_assert (NULL != last_index);
214 GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index); 214 GNUNET_assert (CustomPeerMap_size (c_peer_map) == *last_index);
215 GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map, *index, last_p, 215 GNUNET_CONTAINER_multihashmap32_put (c_peer_map->hash_map, *index, last_p,
216 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_FAST); 216 GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
217 GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, *last_index); 217 GNUNET_CONTAINER_multihashmap32_remove_all (c_peer_map->hash_map, *last_index);
218 *last_index = *index; 218 *last_index = *index;
219 } 219 }
diff --git a/src/rps/rps-test_util.c b/src/rps/rps-test_util.c
index d47e4952f..08fe96097 100644
--- a/src/rps/rps-test_util.c
+++ b/src/rps/rps-test_util.c
@@ -31,6 +31,17 @@
31 31
32#define LOG(kind, ...) GNUNET_log_from(kind,"rps-test_util",__VA_ARGS__) 32#define LOG(kind, ...) GNUNET_log_from(kind,"rps-test_util",__VA_ARGS__)
33 33
34#define B2B_PAT "%c%c%c%c%c%c%c%c"
35#define B2B(byte) \
36 (byte & 0x80 ? '1' : '0'), \
37 (byte & 0x40 ? '1' : '0'), \
38 (byte & 0x20 ? '1' : '0'), \
39 (byte & 0x10 ? '1' : '0'), \
40 (byte & 0x08 ? '1' : '0'), \
41 (byte & 0x04 ? '1' : '0'), \
42 (byte & 0x02 ? '1' : '0'), \
43 (byte & 0x01 ? '1' : '0')
44
34#ifndef TO_FILE 45#ifndef TO_FILE
35#define TO_FILE 46#define TO_FILE
36#endif /* TO_FILE */ 47#endif /* TO_FILE */
@@ -155,6 +166,9 @@ to_file_raw (const char *file_name, const char *buf, size_t size_buf)
155 166
156 return; 167 return;
157 } 168 }
169 LOG (GNUNET_ERROR_TYPE_WARNING,
170 "Wrote %u bytes raw.\n",
171 size_written);
158 if (GNUNET_YES != GNUNET_DISK_file_close (f)) 172 if (GNUNET_YES != GNUNET_DISK_file_close (f))
159 LOG (GNUNET_ERROR_TYPE_WARNING, 173 LOG (GNUNET_ERROR_TYPE_WARNING,
160 "Unable to close file\n"); 174 "Unable to close file\n");
@@ -180,6 +194,8 @@ to_file_raw_unaligned (const char *file_name,
180 // num_bits_buf_unaligned = bits_needed % 8; 194 // num_bits_buf_unaligned = bits_needed % 8;
181 // return; 195 // return;
182 //} 196 //}
197 LOG (GNUNET_ERROR_TYPE_DEBUG,
198 "Was asked to write %u bits\n", bits_needed);
183 199
184 char buf_write[size_buf + 1]; 200 char buf_write[size_buf + 1];
185 const unsigned bytes_iter = (0 != bits_needed % 8? 201 const unsigned bytes_iter = (0 != bits_needed % 8?
@@ -187,6 +203,14 @@ to_file_raw_unaligned (const char *file_name,
187 bits_needed/8); 203 bits_needed/8);
188 // TODO what if no iteration happens? 204 // TODO what if no iteration happens?
189 unsigned size_buf_write = 0; 205 unsigned size_buf_write = 0;
206 LOG (GNUNET_ERROR_TYPE_DEBUG,
207 "num_bits_buf_unaligned: %u\n",
208 num_bits_buf_unaligned);
209 LOG (GNUNET_ERROR_TYPE_DEBUG,
210 "ua args: size_buf: %u, bits_needed: %u -> iter: %u\n",
211 size_buf,
212 bits_needed,
213 bytes_iter);
190 buf_write[0] = buf_unaligned; 214 buf_write[0] = buf_unaligned;
191 /* Iterate over input bytes */ 215 /* Iterate over input bytes */
192 for (unsigned i = 0; i < bytes_iter; i++) 216 for (unsigned i = 0; i < bytes_iter; i++)
@@ -227,17 +251,57 @@ to_file_raw_unaligned (const char *file_name,
227 { 251 {
228 num_bits_needed_iter = 8; 252 num_bits_needed_iter = 8;
229 } 253 }
254 LOG (GNUNET_ERROR_TYPE_DEBUG,
255 "number of bits needed in this iteration: %u\n",
256 num_bits_needed_iter);
230 mask_bits_needed_iter = ((char) 1 << num_bits_needed_iter) - 1; 257 mask_bits_needed_iter = ((char) 1 << num_bits_needed_iter) - 1;
258 LOG (GNUNET_ERROR_TYPE_DEBUG,
259 "mask needed bits (current iter): "B2B_PAT"\n",
260 B2B(mask_bits_needed_iter));
261 LOG (GNUNET_ERROR_TYPE_DEBUG,
262 "Unaligned byte: "B2B_PAT" (%u bits)\n",
263 B2B(buf_unaligned),
264 num_bits_buf_unaligned);
231 byte_input = buf[i]; 265 byte_input = buf[i];
266 LOG (GNUNET_ERROR_TYPE_DEBUG,
267 "next whole input byte: "B2B_PAT"\n",
268 B2B(byte_input));
232 byte_input &= mask_bits_needed_iter; 269 byte_input &= mask_bits_needed_iter;
233 num_bits_to_align = 8 - num_bits_buf_unaligned; 270 num_bits_to_align = 8 - num_bits_buf_unaligned;
271 LOG (GNUNET_ERROR_TYPE_DEBUG,
272 "input byte, needed bits: "B2B_PAT"\n",
273 B2B(byte_input));
274 LOG (GNUNET_ERROR_TYPE_DEBUG,
275 "number of bits needed to align unaligned bit: %u\n",
276 num_bits_to_align);
234 num_bits_to_move = min (num_bits_to_align, num_bits_needed_iter); 277 num_bits_to_move = min (num_bits_to_align, num_bits_needed_iter);
278 LOG (GNUNET_ERROR_TYPE_DEBUG,
279 "number of bits of new byte to move: %u\n",
280 num_bits_to_move);
235 mask_input_to_move = ((char) 1 << num_bits_to_move) - 1; 281 mask_input_to_move = ((char) 1 << num_bits_to_move) - 1;
282 LOG (GNUNET_ERROR_TYPE_DEBUG,
283 "mask of bits of new byte to take for moving: "B2B_PAT"\n",
284 B2B(mask_input_to_move));
236 bits_to_move = byte_input & mask_input_to_move; 285 bits_to_move = byte_input & mask_input_to_move;
286 LOG (GNUNET_ERROR_TYPE_DEBUG,
287 "masked bits of new byte to take for moving: "B2B_PAT"\n",
288 B2B(bits_to_move));
237 distance_shift_bits = num_bits_buf_unaligned; 289 distance_shift_bits = num_bits_buf_unaligned;
290 LOG (GNUNET_ERROR_TYPE_DEBUG,
291 "distance needed to shift bits to their correct spot: %u\n",
292 distance_shift_bits);
238 bits_moving = bits_to_move << distance_shift_bits; 293 bits_moving = bits_to_move << distance_shift_bits;
294 LOG (GNUNET_ERROR_TYPE_DEBUG,
295 "shifted, masked bits of new byte being moved: "B2B_PAT"\n",
296 B2B(bits_moving));
239 byte_to_fill = buf_unaligned | bits_moving; 297 byte_to_fill = buf_unaligned | bits_moving;
240 if (num_bits_buf_unaligned + num_bits_needed_iter > 8) 298 LOG (GNUNET_ERROR_TYPE_DEBUG,
299 "byte being filled: "B2B_PAT"\n",
300 B2B(byte_to_fill));
301 LOG (GNUNET_ERROR_TYPE_DEBUG,
302 "pending bytes: %u\n",
303 num_bits_buf_unaligned + num_bits_needed_iter);
304 if (num_bits_buf_unaligned + num_bits_needed_iter >= 8)
241 { 305 {
242 /* buf_unaligned was aligned by filling 306 /* buf_unaligned was aligned by filling
243 * -> can be written to storage */ 307 * -> can be written to storage */
@@ -246,10 +310,22 @@ to_file_raw_unaligned (const char *file_name,
246 310
247 /* store the leftover, unaligned bits in buffer */ 311 /* store the leftover, unaligned bits in buffer */
248 mask_input_leftover = mask_bits_needed_iter & (~ mask_input_to_move); 312 mask_input_leftover = mask_bits_needed_iter & (~ mask_input_to_move);
313 LOG (GNUNET_ERROR_TYPE_DEBUG,
314 "mask of leftover bits of new byte: "B2B_PAT"\n",
315 B2B(mask_input_leftover));
249 byte_input_leftover = byte_input & mask_input_leftover; 316 byte_input_leftover = byte_input & mask_input_leftover;
317 LOG (GNUNET_ERROR_TYPE_DEBUG,
318 "masked, leftover bits of new byte: "B2B_PAT"\n",
319 B2B(byte_input_leftover));
250 num_bits_leftover = num_bits_needed_iter - num_bits_to_move; 320 num_bits_leftover = num_bits_needed_iter - num_bits_to_move;
251 num_bits_discard = 8 - num_bits_needed_iter; 321 LOG (GNUNET_ERROR_TYPE_DEBUG,
322 "number of unaligned bits left: %u\n",
323 num_bits_leftover);
324 //num_bits_discard = 8 - num_bits_needed_iter;
252 byte_unaligned_new = byte_input_leftover >> num_bits_to_move; 325 byte_unaligned_new = byte_input_leftover >> num_bits_to_move;
326 LOG (GNUNET_ERROR_TYPE_DEBUG,
327 "new unaligned byte: "B2B_PAT"\n",
328 B2B(byte_unaligned_new));
253 buf_unaligned = byte_unaligned_new; 329 buf_unaligned = byte_unaligned_new;
254 num_bits_buf_unaligned = num_bits_leftover % 8; 330 num_bits_buf_unaligned = num_bits_leftover % 8;
255 } 331 }
diff --git a/src/set/gnunet-service-set_intersection.c b/src/set/gnunet-service-set_intersection.c
index 254763b45..1083384f5 100644
--- a/src/set/gnunet-service-set_intersection.c
+++ b/src/set/gnunet-service-set_intersection.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -23,6 +23,7 @@
23 */ 23 */
24#include "platform.h" 24#include "platform.h"
25#include "gnunet_util_lib.h" 25#include "gnunet_util_lib.h"
26#include "gnunet_statistics_service.h"
26#include "gnunet-service-set.h" 27#include "gnunet-service-set.h"
27#include "gnunet_block_lib.h" 28#include "gnunet_block_lib.h"
28#include "gnunet-service-set_protocol.h" 29#include "gnunet-service-set_protocol.h"
@@ -215,6 +216,10 @@ send_client_removed_element (struct Operation *op,
215 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 216 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
216 "Sending removed element (size %u) to client\n", 217 "Sending removed element (size %u) to client\n",
217 element->size); 218 element->size);
219 GNUNET_STATISTICS_update (_GSS_statistics,
220 "# Element removed messages sent",
221 1,
222 GNUNET_NO);
218 GNUNET_assert (0 != op->client_request_id); 223 GNUNET_assert (0 != op->client_request_id);
219 ev = GNUNET_MQ_msg_extra (rm, 224 ev = GNUNET_MQ_msg_extra (rm,
220 element->size, 225 element->size,
@@ -406,6 +411,10 @@ fail_intersection_operation (struct Operation *op)
406 411
407 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 412 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
408 "Intersection operation failed\n"); 413 "Intersection operation failed\n");
414 GNUNET_STATISTICS_update (_GSS_statistics,
415 "# Intersection operations failed",
416 1,
417 GNUNET_NO);
409 if (NULL != op->state->my_elements) 418 if (NULL != op->state->my_elements)
410 { 419 {
411 GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements); 420 GNUNET_CONTAINER_multihashmap_destroy (op->state->my_elements);
@@ -466,6 +475,10 @@ send_bloomfilter (struct Operation *op)
466 op); 475 op);
467 476
468 /* send our Bloom filter */ 477 /* send our Bloom filter */
478 GNUNET_STATISTICS_update (_GSS_statistics,
479 "# Intersection Bloom filters sent",
480 1,
481 GNUNET_NO);
469 chunk_size = 60 * 1024 - sizeof (struct BFMessage); 482 chunk_size = 60 * 1024 - sizeof (struct BFMessage);
470 if (bf_size <= chunk_size) 483 if (bf_size <= chunk_size)
471 { 484 {
@@ -534,6 +547,10 @@ send_client_done_and_destroy (void *cls)
534 547
535 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 548 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
536 "Intersection succeeded, sending DONE to local client\n"); 549 "Intersection succeeded, sending DONE to local client\n");
550 GNUNET_STATISTICS_update (_GSS_statistics,
551 "# Intersection operations succeeded",
552 1,
553 GNUNET_NO);
537 ev = GNUNET_MQ_msg (rm, 554 ev = GNUNET_MQ_msg (rm,
538 GNUNET_MESSAGE_TYPE_SET_RESULT); 555 GNUNET_MESSAGE_TYPE_SET_RESULT);
539 rm->request_id = htonl (op->client_request_id); 556 rm->request_id = htonl (op->client_request_id);
diff --git a/src/set/gnunet-service-set_union.c b/src/set/gnunet-service-set_union.c
index 8c0c52d64..73d3f5c83 100644
--- a/src/set/gnunet-service-set_union.c
+++ b/src/set/gnunet-service-set_union.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -758,8 +758,8 @@ get_order_from_difference (unsigned int diff)
758 */ 758 */
759static int 759static int
760send_full_element_iterator (void *cls, 760send_full_element_iterator (void *cls,
761 const struct GNUNET_HashCode *key, 761 const struct GNUNET_HashCode *key,
762 void *value) 762 void *value)
763{ 763{
764 struct Operation *op = cls; 764 struct Operation *op = cls;
765 struct GNUNET_SET_ElementMessage *emsg; 765 struct GNUNET_SET_ElementMessage *emsg;
@@ -1367,6 +1367,26 @@ send_client_element (struct Operation *op,
1367 1367
1368 1368
1369/** 1369/**
1370 * Destroy remote channel.
1371 *
1372 * @param op operation
1373 */
1374static void
1375destroy_channel (struct Operation *op)
1376{
1377 struct GNUNET_CADET_Channel *channel;
1378
1379 if (NULL != (channel = op->channel))
1380 {
1381 /* This will free op; called conditionally as this helper function
1382 is also called from within the channel disconnect handler. */
1383 op->channel = NULL;
1384 GNUNET_CADET_channel_destroy (channel);
1385 }
1386}
1387
1388
1389/**
1370 * Signal to the client that the operation has finished and 1390 * Signal to the client that the operation has finished and
1371 * destroy the operation. 1391 * destroy the operation.
1372 * 1392 *
@@ -1379,13 +1399,18 @@ send_client_done (void *cls)
1379 struct GNUNET_MQ_Envelope *ev; 1399 struct GNUNET_MQ_Envelope *ev;
1380 struct GNUNET_SET_ResultMessage *rm; 1400 struct GNUNET_SET_ResultMessage *rm;
1381 1401
1382 if (GNUNET_YES == op->state->client_done_sent) { 1402 if (GNUNET_YES == op->state->client_done_sent)
1403 {
1383 return; 1404 return;
1384 } 1405 }
1385 1406
1386 if (PHASE_DONE != op->state->phase) { 1407 if (PHASE_DONE != op->state->phase) {
1387 LOG (GNUNET_ERROR_TYPE_WARNING, 1408 LOG (GNUNET_ERROR_TYPE_WARNING,
1388 "union operation failed\n"); 1409 "Union operation failed\n");
1410 GNUNET_STATISTICS_update (_GSS_statistics,
1411 "# Union operations failed",
1412 1,
1413 GNUNET_NO);
1389 ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT); 1414 ev = GNUNET_MQ_msg (rm, GNUNET_MESSAGE_TYPE_SET_RESULT);
1390 rm->result_status = htons (GNUNET_SET_STATUS_FAILURE); 1415 rm->result_status = htons (GNUNET_SET_STATUS_FAILURE);
1391 rm->request_id = htonl (op->client_request_id); 1416 rm->request_id = htonl (op->client_request_id);
@@ -1397,6 +1422,10 @@ send_client_done (void *cls)
1397 1422
1398 op->state->client_done_sent = GNUNET_YES; 1423 op->state->client_done_sent = GNUNET_YES;
1399 1424
1425 GNUNET_STATISTICS_update (_GSS_statistics,
1426 "# Union operations succeeded",
1427 1,
1428 GNUNET_NO);
1400 LOG (GNUNET_ERROR_TYPE_INFO, 1429 LOG (GNUNET_ERROR_TYPE_INFO,
1401 "Signalling client that union operation is done\n"); 1430 "Signalling client that union operation is done\n");
1402 ev = GNUNET_MQ_msg (rm, 1431 ev = GNUNET_MQ_msg (rm,
diff --git a/src/transport/test_quota_compliance.c b/src/transport/test_quota_compliance.c
index 0ef3c864a..cd93ff855 100644
--- a/src/transport/test_quota_compliance.c
+++ b/src/transport/test_quota_compliance.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -65,6 +65,8 @@ report ()
65 unsigned long long datarate; 65 unsigned long long datarate;
66 66
67 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; 67 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
68 if (0 == delta)
69 delta = 1;
68 datarate = (total_bytes_recv * 1000 * 1000) / delta; 70 datarate = (total_bytes_recv * 1000 * 1000) / delta;
69 71
70 FPRINTF (stderr, 72 FPRINTF (stderr,
diff --git a/src/transport/test_transport_api_reliability.c b/src/transport/test_transport_api_reliability.c
index 86e2a7e9d..c6e77bae0 100644
--- a/src/transport/test_transport_api_reliability.c
+++ b/src/transport/test_transport_api_reliability.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -174,6 +174,8 @@ custom_shutdown (void *cls)
174 174
175 /* Calculcate statistics */ 175 /* Calculcate statistics */
176 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us; 176 delta = GNUNET_TIME_absolute_get_duration (start_time).rel_value_us;
177 if (0 == delta)
178 delta = 1;
177 rate = (1000LL* 1000ll * total_bytes) / (1024 * delta); 179 rate = (1000LL* 1000ll * total_bytes) / (1024 * delta);
178 FPRINTF (stderr, 180 FPRINTF (stderr,
179 "\nThroughput was %llu KiBytes/s\n", 181 "\nThroughput was %llu KiBytes/s\n",
diff --git a/src/util/.gitignore b/src/util/.gitignore
index 23139a1ab..7b190ca76 100644
--- a/src/util/.gitignore
+++ b/src/util/.gitignore
@@ -69,3 +69,7 @@ perf_crypto_hash
69perf_crypto_symmetric 69perf_crypto_symmetric
70perf_crypto_rsa 70perf_crypto_rsa
71perf_crypto_ecc_dlog 71perf_crypto_ecc_dlog
72test_hexcoder
73test_regex
74test_tun
75gnunet-timeout
diff --git a/src/util/Makefile.am b/src/util/Makefile.am
index ec7bcb016..4ae073c2c 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -166,6 +166,7 @@ lib_LTLIBRARIES = libgnunetutil.la
166 166
167libexec_PROGRAMS = \ 167libexec_PROGRAMS = \
168 gnunet-service-resolver \ 168 gnunet-service-resolver \
169 gnunet-timeout \
169 $(W32CONSOLEHELPER) 170 $(W32CONSOLEHELPER)
170 171
171bin_SCRIPTS =\ 172bin_SCRIPTS =\
@@ -192,6 +193,15 @@ endif
192endif 193endif
193 194
194 195
196if !MINGW
197gnunet_timeout_SOURCES = \
198 gnunet-timeout.c
199else
200gnunet_timeout_SOURCES = \
201 gnunet-timeout-w32.c
202endif
203
204
195do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' 205do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
196 206
197gnunet-qr: gnunet-qr.py.in Makefile 207gnunet-qr: gnunet-qr.py.in Makefile
@@ -334,12 +344,12 @@ test_hexcoder_LDADD = \
334test_tun_SOURCES = \ 344test_tun_SOURCES = \
335 test_tun.c 345 test_tun.c
336test_tun_LDADD = \ 346test_tun_LDADD = \
337 libgnunetutil.la 347 libgnunetutil.la
338 348
339test_regex_SOURCES = \ 349test_regex_SOURCES = \
340 test_regex.c 350 test_regex.c
341test_regex_LDADD = \ 351test_regex_LDADD = \
342 libgnunetutil.la 352 libgnunetutil.la
343 353
344test_os_start_process_SOURCES = \ 354test_os_start_process_SOURCES = \
345 test_os_start_process.c 355 test_os_start_process.c
@@ -622,4 +632,4 @@ EXTRA_DIST = \
622 test_resolver_api_data.conf \ 632 test_resolver_api_data.conf \
623 test_service_data.conf \ 633 test_service_data.conf \
624 test_speedup_data.conf \ 634 test_speedup_data.conf \
625 gnunet-qr.py.in 635 gnunet-qr.py.in
diff --git a/src/util/client.c b/src/util/client.c
index 44e326eab..1f569255a 100644
--- a/src/util/client.c
+++ b/src/util/client.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -721,6 +721,17 @@ test_service_configuration (const char *service_name,
721 &unixpath)) && 721 &unixpath)) &&
722 (0 < strlen (unixpath))) 722 (0 < strlen (unixpath)))
723 ret = GNUNET_OK; 723 ret = GNUNET_OK;
724 else if ((GNUNET_OK ==
725 GNUNET_CONFIGURATION_have_value (cfg,
726 service_name,
727 "UNIXPATH")))
728 {
729 GNUNET_log_config_invalid (GNUNET_ERROR_TYPE_ERROR,
730 service_name,
731 "UNIXPATH",
732 _("not a valid filename"));
733 return GNUNET_SYSERR; /* UNIXPATH specified but invalid! */
734 }
724 GNUNET_free_non_null (unixpath); 735 GNUNET_free_non_null (unixpath);
725#endif 736#endif
726 737
diff --git a/src/util/crypto_hash.c b/src/util/crypto_hash.c
index 8410b7835..fe1f58df7 100644
--- a/src/util/crypto_hash.c
+++ b/src/util/crypto_hash.c
@@ -365,14 +365,17 @@ GNUNET_CRYPTO_hmac_derive_key_v (struct GNUNET_CRYPTO_AuthKey *key,
365 365
366/** 366/**
367 * Calculate HMAC of a message (RFC 2104) 367 * Calculate HMAC of a message (RFC 2104)
368 * TODO: Shouldn' this be the standard hmac function and
369 * the above be renamed?
368 * 370 *
369 * @param key secret key 371 * @param key secret key
372 * @param key_len secret key length
370 * @param plaintext input plaintext 373 * @param plaintext input plaintext
371 * @param plaintext_len length of @a plaintext 374 * @param plaintext_len length of @a plaintext
372 * @param hmac where to store the hmac 375 * @param hmac where to store the hmac
373 */ 376 */
374void 377void
375GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key, 378GNUNET_CRYPTO_hmac_raw (const void *key, size_t key_len,
376 const void *plaintext, size_t plaintext_len, 379 const void *plaintext, size_t plaintext_len,
377 struct GNUNET_HashCode *hmac) 380 struct GNUNET_HashCode *hmac)
378{ 381{
@@ -390,7 +393,7 @@ GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
390 { 393 {
391 gcry_md_reset (md); 394 gcry_md_reset (md);
392 } 395 }
393 gcry_md_setkey (md, key->key, sizeof (key->key)); 396 gcry_md_setkey (md, key, key_len);
394 gcry_md_write (md, plaintext, plaintext_len); 397 gcry_md_write (md, plaintext, plaintext_len);
395 mc = gcry_md_read (md, GCRY_MD_SHA512); 398 mc = gcry_md_read (md, GCRY_MD_SHA512);
396 GNUNET_assert (NULL != mc); 399 GNUNET_assert (NULL != mc);
@@ -399,6 +402,25 @@ GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
399 402
400 403
401/** 404/**
405 * Calculate HMAC of a message (RFC 2104)
406 *
407 * @param key secret key
408 * @param plaintext input plaintext
409 * @param plaintext_len length of @a plaintext
410 * @param hmac where to store the hmac
411 */
412void
413GNUNET_CRYPTO_hmac (const struct GNUNET_CRYPTO_AuthKey *key,
414 const void *plaintext, size_t plaintext_len,
415 struct GNUNET_HashCode *hmac)
416{
417 GNUNET_CRYPTO_hmac_raw ((void*) key->key, sizeof (key->key),
418 plaintext, plaintext_len,
419 hmac);
420}
421
422
423/**
402 * Context for cummulative hashing. 424 * Context for cummulative hashing.
403 */ 425 */
404struct GNUNET_HashContext 426struct GNUNET_HashContext
diff --git a/src/util/dnsparser.c b/src/util/dnsparser.c
index cce68f2ee..24f1b18cf 100644
--- a/src/util/dnsparser.c
+++ b/src/util/dnsparser.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
@@ -759,6 +759,122 @@ GNUNET_DNSPARSER_parse (const char *udp_payload,
759 759
760 760
761/** 761/**
762 * Duplicate (deep-copy) the given DNS record
763 *
764 * @param r the record
765 * @return the newly allocated record
766 */
767struct GNUNET_DNSPARSER_Record *
768GNUNET_DNSPARSER_duplicate_record (const struct GNUNET_DNSPARSER_Record *r)
769{
770 struct GNUNET_DNSPARSER_Record *dup = GNUNET_memdup (r, sizeof (*r));
771
772 dup->name = GNUNET_strdup (r->name);
773 switch (r->type)
774 {
775 case GNUNET_DNSPARSER_TYPE_NS:
776 case GNUNET_DNSPARSER_TYPE_CNAME:
777 case GNUNET_DNSPARSER_TYPE_PTR:
778 {
779 dup->data.hostname = GNUNET_strdup (r->data.hostname);
780 break;
781 }
782 case GNUNET_DNSPARSER_TYPE_SOA:
783 {
784 dup->data.soa = GNUNET_DNSPARSER_duplicate_soa_record (r->data.soa);
785 break;
786 }
787 case GNUNET_DNSPARSER_TYPE_CERT:
788 {
789 dup->data.cert = GNUNET_DNSPARSER_duplicate_cert_record (r->data.cert);
790 break;
791 }
792 case GNUNET_DNSPARSER_TYPE_MX:
793 {
794 dup->data.mx = GNUNET_DNSPARSER_duplicate_mx_record (r->data.mx);
795 break;
796 }
797 case GNUNET_DNSPARSER_TYPE_SRV:
798 {
799 dup->data.srv = GNUNET_DNSPARSER_duplicate_srv_record (r->data.srv);
800 break;
801 }
802 default:
803 {
804 dup->data.raw.data = GNUNET_memdup (r->data.raw.data,
805 r->data.raw.data_len);
806 }
807 }
808 return dup;
809}
810
811
812/**
813 * Duplicate (deep-copy) the given DNS record
814 *
815 * @param r the record
816 * @return the newly allocated record
817 */
818struct GNUNET_DNSPARSER_SoaRecord *
819GNUNET_DNSPARSER_duplicate_soa_record (const struct GNUNET_DNSPARSER_SoaRecord *r)
820{
821 struct GNUNET_DNSPARSER_SoaRecord *dup = GNUNET_memdup (r, sizeof (*r));
822
823 dup->mname = GNUNET_strdup (r->mname);
824 dup->rname = GNUNET_strdup (r->rname);
825 return dup;
826}
827
828
829/**
830 * Duplicate (deep-copy) the given DNS record
831 *
832 * @param r the record
833 * @return the newly allocated record
834 */
835struct GNUNET_DNSPARSER_CertRecord *
836GNUNET_DNSPARSER_duplicate_cert_record (const struct GNUNET_DNSPARSER_CertRecord *r)
837{
838 struct GNUNET_DNSPARSER_CertRecord *dup = GNUNET_memdup (r, sizeof (*r));
839
840 dup->certificate_data = GNUNET_strdup (r->certificate_data);
841 return dup;
842}
843
844
845/**
846 * Duplicate (deep-copy) the given DNS record
847 *
848 * @param r the record
849 * @return the newly allocated record
850 */
851struct GNUNET_DNSPARSER_MxRecord *
852GNUNET_DNSPARSER_duplicate_mx_record (const struct GNUNET_DNSPARSER_MxRecord *r)
853{
854 struct GNUNET_DNSPARSER_MxRecord *dup = GNUNET_memdup (r, sizeof (*r));
855
856 dup->mxhost = GNUNET_strdup (r->mxhost);
857 return dup;
858}
859
860
861/**
862 * Duplicate (deep-copy) the given DNS record
863 *
864 * @param r the record
865 * @return the newly allocated record
866 */
867struct GNUNET_DNSPARSER_SrvRecord *
868GNUNET_DNSPARSER_duplicate_srv_record (const struct GNUNET_DNSPARSER_SrvRecord *r)
869{
870 struct GNUNET_DNSPARSER_SrvRecord *dup = GNUNET_memdup (r, sizeof (*r));
871
872 dup->target = GNUNET_strdup (r->target);
873 return dup;
874}
875
876
877/**
762 * Free memory taken by a packet. 878 * Free memory taken by a packet.
763 * 879 *
764 * @param p packet to free 880 * @param p packet to free
@@ -840,8 +956,11 @@ GNUNET_DNSPARSER_builder_add_name (char *dst,
840 len = dot - idna_name; 956 len = dot - idna_name;
841 if ( (len >= 64) || (0 == len) ) 957 if ( (len >= 64) || (0 == len) )
842 { 958 {
843 GNUNET_break (0); 959 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
844 goto fail; /* segment too long or empty */ 960 "Invalid DNS name `%s': label with %u characters encountered\n",
961 name,
962 (unsigned int) len);
963 goto fail; /* label too long or empty */
845 } 964 }
846 dst[pos++] = (char) (uint8_t) len; 965 dst[pos++] = (char) (uint8_t) len;
847 GNUNET_memcpy (&dst[pos], 966 GNUNET_memcpy (&dst[pos],
diff --git a/src/util/gnunet-service-resolver.c b/src/util/gnunet-service-resolver.c
index d90d8ec10..5b890261b 100644
--- a/src/util/gnunet-service-resolver.c
+++ b/src/util/gnunet-service-resolver.c
@@ -27,721 +27,559 @@
27#include "gnunet_statistics_service.h" 27#include "gnunet_statistics_service.h"
28#include "resolver.h" 28#include "resolver.h"
29 29
30
31struct Record
32{
33 struct Record *next;
34
35 struct Record *prev;
36
37 struct GNUNET_DNSPARSER_Record *record;
38};
39
30/** 40/**
31 * A cached DNS lookup result (for reverse lookup). 41 * A cached DNS lookup result.
32 */ 42 */
33struct IPCache 43struct ResolveCache
34{ 44{
35 /** 45 /**
36 * This is a doubly linked list. 46 * This is a doubly linked list.
37 */ 47 */
38 struct IPCache *next; 48 struct ResolveCache *next;
39 49
40 /** 50 /**
41 * This is a doubly linked list. 51 * This is a doubly linked list.
42 */ 52 */
43 struct IPCache *prev; 53 struct ResolveCache *prev;
44 54
45 /** 55 /**
46 * Hostname in human-readable form. 56 * type of queried DNS record
47 */ 57 */
48 char *addr; 58 uint16_t record_type;
49 59
50 /** 60 /**
51 * Binary IP address, allocated at the end of this struct. 61 * a pointer to the request_id if a query for this hostname/record_type
62 * is currently pending, NULL otherwise.
52 */ 63 */
53 const void *ip; 64 int16_t *request_id;
54 65
55 /** 66 /**
56 * Last time this entry was updated. 67 * The client that queried the records contained in this cache entry.
57 */ 68 */
58 struct GNUNET_TIME_Absolute last_refresh; 69 struct GNUNET_SERVICE_Client *client;
59 70
60 /** 71 /**
61 * Last time this entry was requested. 72 * head of a double linked list containing the lookup results
62 */ 73 */
63 struct GNUNET_TIME_Absolute last_request; 74 struct Record *records_head;
64 75
65 /** 76 /**
66 * Number of bytes in ip. 77 * tail of a double linked list containing the lookup results
67 */ 78 */
68 size_t ip_len; 79 struct Record *records_tail;
69 80
70 /** 81 /**
71 * Address family of the IP. 82 * handle for cancelling a request
72 */ 83 */
73 int af; 84 struct GNUNET_DNSSTUB_RequestSocket *resolve_handle;
85
86 /**
87 * handle for the resolution timeout task
88 */
89 struct GNUNET_SCHEDULER_Task *timeout_task;
90
74}; 91};
75 92
76 93
77/** 94/**
78 * Start of the linked list of cached DNS lookup results. 95 * Start of the linked list of cached DNS lookup results.
79 */ 96 */
80static struct IPCache *cache_head; 97static struct ResolveCache *cache_head;
81 98
82/** 99/**
83 * Tail of the linked list of cached DNS lookup results. 100 * Tail of the linked list of cached DNS lookup results.
84 */ 101 */
85static struct IPCache *cache_tail; 102static struct ResolveCache *cache_tail;
86 103
87/** 104/**
88 * Pipe for asynchronously notifying about resolve result 105 * context of dnsstub library
89 */ 106 */
90static struct GNUNET_DISK_PipeHandle *resolve_result_pipe; 107static struct GNUNET_DNSSTUB_Context *dnsstub_ctx;
91 108
92/**
93 * Task for reading from resolve_result_pipe
94 */
95static struct GNUNET_SCHEDULER_Task *resolve_result_pipe_task;
96 109
97 110void free_cache_entry (struct ResolveCache *entry)
98#if HAVE_GETNAMEINFO
99/**
100 * Resolve the given request using getnameinfo
101 *
102 * @param cache the request to resolve (and where to store the result)
103 */
104static void
105getnameinfo_resolve (struct IPCache *cache)
106{ 111{
107 char hostname[256]; 112 struct Record *pos;
108 const struct sockaddr *sa; 113 struct Record *next;
109 struct sockaddr_in v4; 114
110 struct sockaddr_in6 v6; 115 next = entry->records_head;
111 size_t salen; 116 while (NULL != (pos = next))
112 int ret;
113
114 switch (cache->af)
115 { 117 {
116 case AF_INET: 118 next = pos->next;
117 GNUNET_assert (cache->ip_len == sizeof (struct in_addr)); 119 GNUNET_CONTAINER_DLL_remove (entry->records_head,
118 sa = (const struct sockaddr*) &v4; 120 entry->records_tail,
119 memset (&v4, 0, sizeof (v4)); 121 pos);
120 v4.sin_addr = * (const struct in_addr*) cache->ip; 122 if (NULL != pos->record)
121 v4.sin_family = AF_INET; 123 {
122#if HAVE_SOCKADDR_IN_SIN_LEN 124 GNUNET_DNSPARSER_free_record (pos->record);
123 v4.sin_len = sizeof (v4); 125 GNUNET_free (pos->record);
124#endif 126 }
125 salen = sizeof (v4); 127 GNUNET_free (pos);
126 break;
127 case AF_INET6:
128 GNUNET_assert (cache->ip_len == sizeof (struct in6_addr));
129 sa = (const struct sockaddr*) &v6;
130 memset (&v6, 0, sizeof (v6));
131 v6.sin6_addr = * (const struct in6_addr*) cache->ip;
132 v6.sin6_family = AF_INET6;
133#if HAVE_SOCKADDR_IN_SIN_LEN
134 v6.sin6_len = sizeof (v6);
135#endif
136 salen = sizeof (v6);
137 break;
138 default:
139 GNUNET_assert (0);
140 } 128 }
141 129 if (NULL != entry->resolve_handle)
142 if (0 ==
143 (ret = getnameinfo (sa, salen,
144 hostname, sizeof (hostname),
145 NULL,
146 0, 0)))
147 { 130 {
148 cache->addr = GNUNET_strdup (hostname); 131 GNUNET_DNSSTUB_resolve_cancel (entry->resolve_handle);
132 entry->resolve_handle = NULL;
149 } 133 }
150 else 134 if (NULL != entry->timeout_task)
151 { 135 {
152 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 136 GNUNET_SCHEDULER_cancel (entry->timeout_task);
153 "getnameinfo failed: %s\n", 137 entry->timeout_task = NULL;
154 gai_strerror (ret));
155 } 138 }
139 GNUNET_free_non_null (entry->request_id);
140 GNUNET_free (entry);
156} 141}
157#endif
158 142
159 143
160#if HAVE_GETHOSTBYADDR 144static char*
145extract_dns_server (const char* line, size_t line_len)
146{
147 if (0 == strncmp (line, "nameserver ", 11))
148 return GNUNET_strndup (line + 11, line_len - 11);
149 return NULL;
150}
151
152
161/** 153/**
162 * Resolve the given request using gethostbyaddr 154 * reads the list of nameservers from /etc/resolve.conf
163 * 155 *
164 * @param cache the request to resolve (and where to store the result) 156 * @param server_addrs[out] a list of null-terminated server address strings
157 * @return the number of server addresses in @server_addrs, -1 on error
165 */ 158 */
166static void 159static ssize_t
167gethostbyaddr_resolve (struct IPCache *cache) 160lookup_dns_servers (char ***server_addrs)
168{ 161{
169 struct hostent *ent; 162 struct GNUNET_DISK_FileHandle *fh;
170 163 char buf[2048];
171 ent = gethostbyaddr (cache->ip, 164 ssize_t bytes_read;
172 cache->ip_len, 165 size_t read_offset = 0;
173 cache->af); 166 unsigned int num_dns_servers = 0;
174 if (NULL != ent) 167
168 fh = GNUNET_DISK_file_open ("/etc/resolv.conf",
169 GNUNET_DISK_OPEN_READ,
170 GNUNET_DISK_PERM_NONE);
171 if (NULL == fh)
175 { 172 {
176 cache->addr = GNUNET_strdup (ent->h_name); 173 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
174 "Could not open /etc/resolv.conf. "
175 "DNS resolution will not be possible.\n");
176 return -1;
177 } 177 }
178 else 178 bytes_read = GNUNET_DISK_file_read (fh,
179 buf,
180 sizeof (buf));
181 *server_addrs = NULL;
182 while (read_offset < bytes_read)
179 { 183 {
180 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 184 char *newline;
181 "gethostbyaddr failed: %s\n", 185 size_t line_len;
182 hstrerror (h_errno)); 186 char *dns_server;
187
188 newline = strchr (buf + read_offset, '\n');
189 if (NULL == newline)
190 {
191 break;
192 }
193 line_len = newline - buf - read_offset;
194 dns_server = extract_dns_server (buf + read_offset, line_len);
195 if (NULL != dns_server)
196 {
197 GNUNET_array_append (*server_addrs,
198 num_dns_servers,
199 dns_server);
200 }
201 read_offset += line_len + 1;
183 } 202 }
203 GNUNET_DISK_file_close (fh);
204 return num_dns_servers;
184} 205}
185#endif
186 206
187 207
188/** 208static char *
189 * Resolve the given request using the available methods. 209make_reverse_hostname (const void *ip, int af)
190 *
191 * @param cache the request to resolve (and where to store the result)
192 */
193static void
194cache_resolve (struct IPCache *cache)
195{ 210{
196#if HAVE_GETNAMEINFO 211 char *buf = GNUNET_new_array (80, char);
197 if (NULL == cache->addr) 212 int pos = 0;
198 getnameinfo_resolve (cache); 213 if (AF_INET == af)
199#endif 214 {
200#if HAVE_GETHOSTBYADDR 215 struct in_addr *addr = (struct in_addr *)ip;
201 if (NULL == cache->addr) 216 uint32_t ip_int = addr->s_addr;
202 gethostbyaddr_resolve (cache); 217 for (int i = 3; i >= 0; i--)
203#endif 218 {
219 int n = GNUNET_snprintf (buf + pos,
220 80 - pos,
221 "%u.",
222 ((uint8_t *)&ip_int)[i]);
223 if (n < 0)
224 {
225 GNUNET_free (buf);
226 return NULL;
227 }
228 pos += n;
229 }
230 pos += GNUNET_snprintf (buf + pos, 80 - pos, "in-addr.arpa");
231 }
232 else if (AF_INET6 == af)
233 {
234 struct in6_addr *addr = (struct in6_addr *)ip;
235 for (int i = 15; i >= 0; i--)
236 {
237 int n = GNUNET_snprintf (buf + pos, 80 - pos, "%x.", addr->s6_addr[i] & 0xf);
238 if (n < 0)
239 {
240 GNUNET_free (buf);
241 return NULL;
242 }
243 pos += n;
244 n = GNUNET_snprintf (buf + pos, 80 - pos, "%x.", addr->s6_addr[i] >> 4);
245 if (n < 0)
246 {
247 GNUNET_free (buf);
248 return NULL;
249 }
250 pos += n;
251 }
252 pos += GNUNET_snprintf (buf + pos, 80 - pos, "ip6.arpa");
253 }
254 buf[pos] = '\0';
255 return buf;
204} 256}
205 257
206 258
207/**
208 * Function called after the replies for the request have all
209 * been transmitted to the client, and we can now read the next
210 * request from the client.
211 *
212 * @param cls the `struct GNUNET_SERVICE_Client` to continue with
213 */
214static void 259static void
215notify_service_client_done (void *cls) 260send_reply (struct GNUNET_DNSPARSER_Record *record,
261 uint16_t request_id,
262 struct GNUNET_SERVICE_Client *client)
216{ 263{
217 struct GNUNET_SERVICE_Client *client = cls;
218
219 GNUNET_SERVICE_client_continue (client);
220}
221
222
223/**
224 * Get an IP address as a string (works for both IPv4 and IPv6). Note
225 * that the resolution happens asynchronously and that the first call
226 * may not immediately result in the FQN (but instead in a
227 * human-readable IP address).
228 *
229 * @param client handle to the client making the request (for sending the reply)
230 * @param af AF_INET or AF_INET6
231 * @param ip `struct in_addr` or `struct in6_addr`
232 */
233static void
234get_ip_as_string (struct GNUNET_SERVICE_Client *client,
235 int af,
236 const void *ip,
237 uint32_t request_id)
238{
239 struct IPCache *pos;
240 struct IPCache *next;
241 struct GNUNET_TIME_Absolute now;
242 struct GNUNET_MQ_Envelope *env;
243 struct GNUNET_MQ_Handle *mq;
244 struct GNUNET_RESOLVER_ResponseMessage *msg; 264 struct GNUNET_RESOLVER_ResponseMessage *msg;
245 size_t ip_len; 265 struct GNUNET_MQ_Envelope *env;
246 struct in6_addr ix; 266 void *payload;
247 size_t alen; 267 size_t payload_len;
248 268
249 switch (af) 269 switch (record->type)
250 {
251 case AF_INET:
252 ip_len = sizeof (struct in_addr);
253 break;
254 case AF_INET6:
255 ip_len = sizeof (struct in6_addr);
256 break;
257 default:
258 GNUNET_assert (0);
259 }
260 now = GNUNET_TIME_absolute_get ();
261 next = cache_head;
262 while ( (NULL != (pos = next)) &&
263 ( (pos->af != af) ||
264 (pos->ip_len != ip_len) ||
265 (0 != memcmp (pos->ip, ip, ip_len))) )
266 { 270 {
267 next = pos->next; 271 case GNUNET_DNSPARSER_TYPE_PTR:
268 if (GNUNET_TIME_absolute_get_duration (pos->last_request).rel_value_us <
269 60 * 60 * 1000 * 1000LL)
270 { 272 {
271 GNUNET_CONTAINER_DLL_remove (cache_head, 273 char *hostname = record->data.hostname;
272 cache_tail, 274 payload = hostname;
273 pos); 275 payload_len = strlen (hostname) + 1;
274 GNUNET_free_non_null (pos->addr); 276 break;
275 GNUNET_free (pos);
276 continue;
277 } 277 }
278 } 278 case GNUNET_DNSPARSER_TYPE_A:
279 if (NULL != pos) 279 case GNUNET_DNSPARSER_TYPE_AAAA:
280 {
281 if ( (1 == inet_pton (af,
282 pos->ip,
283 &ix)) &&
284 (GNUNET_TIME_absolute_get_duration (pos->last_request).rel_value_us >
285 120 * 1000 * 1000LL) )
286 { 280 {
287 /* try again if still numeric AND 2 minutes have expired */ 281 payload = record->data.raw.data;
288 GNUNET_free_non_null (pos->addr); 282 payload_len = record->data.raw.data_len;
289 pos->addr = NULL; 283 break;
290 cache_resolve (pos); 284 }
291 pos->last_request = now; 285 default:
286 {
287 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
288 "Cannot handle DNS response type: unimplemented\n");
289 return;
292 } 290 }
293 } 291 }
294 else
295 {
296 pos = GNUNET_malloc (sizeof (struct IPCache) + ip_len);
297 pos->ip = &pos[1];
298 GNUNET_memcpy (&pos[1],
299 ip,
300 ip_len);
301 pos->last_request = now;
302 pos->last_refresh = now;
303 pos->ip_len = ip_len;
304 pos->af = af;
305 GNUNET_CONTAINER_DLL_insert (cache_head,
306 cache_tail,
307 pos);
308 cache_resolve (pos);
309 }
310 if (NULL != pos->addr)
311 alen = strlen (pos->addr) + 1;
312 else
313 alen = 0;
314 mq = GNUNET_SERVICE_client_get_mq (client);
315 env = GNUNET_MQ_msg_extra (msg, 292 env = GNUNET_MQ_msg_extra (msg,
316 alen, 293 payload_len,
317 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); 294 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
318 msg->id = request_id; 295 msg->id = request_id;
319 GNUNET_memcpy (&msg[1], 296 GNUNET_memcpy (&msg[1],
320 pos->addr, 297 payload,
321 alen); 298 payload_len);
322 GNUNET_MQ_send (mq, 299 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client),
323 env); 300 env);
324 // send end message
325 env = GNUNET_MQ_msg (msg,
326 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
327 msg->id = request_id;
328 GNUNET_MQ_notify_sent (env,
329 &notify_service_client_done,
330 client);
331 GNUNET_MQ_send (mq,
332 env);
333} 301}
334 302
335 303
336#if HAVE_GETADDRINFO_A
337struct AsyncCls
338{
339 struct gaicb *host;
340 struct sigevent *sig;
341 struct GNUNET_MQ_Handle *mq;
342 uint32_t request_id;
343};
344
345
346static void 304static void
347resolve_result_pipe_cb (void *cls) 305send_end_msg (uint16_t request_id,
306 struct GNUNET_SERVICE_Client *client)
348{ 307{
349 struct AsyncCls *async_cls;
350 struct gaicb *host;
351 struct GNUNET_RESOLVER_ResponseMessage *msg; 308 struct GNUNET_RESOLVER_ResponseMessage *msg;
352 struct GNUNET_MQ_Envelope *env; 309 struct GNUNET_MQ_Envelope *env;
353 310
354 GNUNET_DISK_file_read (GNUNET_DISK_pipe_handle (resolve_result_pipe, 311 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
355 GNUNET_DISK_PIPE_END_READ), 312 "Sending end message\n");
356 &async_cls, 313 env = GNUNET_MQ_msg (msg,
357 sizeof (struct AsyncCls *)); 314 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
358 resolve_result_pipe_task = 315 msg->id = request_id;
359 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL, 316 GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (client),
360 GNUNET_DISK_pipe_handle (resolve_result_pipe, 317 env);
361 GNUNET_DISK_PIPE_END_READ), 318}
362 &resolve_result_pipe_cb, 319
363 NULL); 320
364 host = async_cls->host; 321static void
365 for (struct addrinfo *pos = host->ar_result; pos != NULL; pos = pos->ai_next) 322handle_resolve_result (void *cls,
323 const struct GNUNET_TUN_DnsHeader *dns,
324 size_t dns_len)
325{
326 struct ResolveCache *cache = cls;
327 struct GNUNET_DNSPARSER_Packet *parsed;
328 uint16_t request_id = *cache->request_id;
329 struct GNUNET_SERVICE_Client *client = cache->client;
330
331 parsed = GNUNET_DNSPARSER_parse ((const char *)dns,
332 dns_len);
333 if (NULL == parsed)
334 {
335 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
336 "Failed to parse DNS reply (request ID %u\n",
337 request_id);
338 return;
339 }
340 if (request_id != ntohs (parsed->id))
341 {
342 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
343 "Request ID in DNS reply does not match\n");
344 return;
345 }
346 else if (0 == parsed->num_answers)
347 {
348 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
349 "DNS reply (request ID %u) contains no answers\n",
350 request_id);
351 GNUNET_CONTAINER_DLL_remove (cache_head,
352 cache_tail,
353 cache);
354 free_cache_entry (cache);
355 cache = NULL;
356 }
357 else
366 { 358 {
367 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 359 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
368 "Lookup result for hostname %s: %s (request ID %u)\n", 360 "Got reply for request ID %u\n",
369 host->ar_name, 361 request_id);
370 GNUNET_a2s (pos->ai_addr, pos->ai_addrlen), 362 for (unsigned int i = 0; i != parsed->num_answers; i++)
371 async_cls->request_id);
372 switch (pos->ai_family)
373 { 363 {
374 case AF_INET: 364 struct Record *cache_entry = GNUNET_new (struct Record);
375 env = GNUNET_MQ_msg_extra (msg, 365 struct GNUNET_DNSPARSER_Record *record = &parsed->answers[i];
376 sizeof (struct in_addr), 366 cache_entry->record = GNUNET_DNSPARSER_duplicate_record (record);
377 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); 367 GNUNET_CONTAINER_DLL_insert (cache->records_head,
378 msg->id = async_cls->request_id; 368 cache->records_tail,
379 GNUNET_memcpy (&msg[1], 369 cache_entry);
380 &((struct sockaddr_in*) pos->ai_addr)->sin_addr, 370 send_reply (cache_entry->record,
381 sizeof (struct in_addr)); 371 request_id,
382 GNUNET_MQ_send (async_cls->mq, 372 cache->client);
383 env);
384 break;
385 case AF_INET6:
386 env = GNUNET_MQ_msg_extra (msg,
387 sizeof (struct in6_addr),
388 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
389 msg->id = async_cls->request_id;
390 GNUNET_memcpy (&msg[1],
391 &((struct sockaddr_in6*) pos->ai_addr)->sin6_addr,
392 sizeof (struct in6_addr));
393 GNUNET_MQ_send (async_cls->mq,
394 env);
395 break;
396 default:
397 /* unsupported, skip */
398 break;
399 } 373 }
374 GNUNET_free_non_null (cache->request_id);
375 cache->request_id = NULL;
400 } 376 }
401 // send end message 377 send_end_msg (request_id,
402 env = GNUNET_MQ_msg (msg, 378 client);
403 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); 379 if (NULL != cache)
404 msg->id = async_cls->request_id; 380 cache->client = NULL;
405 GNUNET_MQ_send (async_cls->mq, 381 if (NULL != cache)
406 env); 382 {
407 freeaddrinfo (host->ar_result); 383 if (NULL != cache->timeout_task)
408 GNUNET_free ((struct gaicb *)host->ar_request); // free hints 384 {
409 GNUNET_free (host); 385 GNUNET_SCHEDULER_cancel (cache->timeout_task);
410 GNUNET_free (async_cls->sig); 386 cache->timeout_task = NULL;
411 GNUNET_free (async_cls); 387 }
388 if (NULL != cache->resolve_handle)
389 {
390 GNUNET_DNSSTUB_resolve_cancel (cache->resolve_handle);
391 cache->resolve_handle = NULL;
392 }
393 }
394 GNUNET_DNSPARSER_free_packet (parsed);
412} 395}
413 396
414 397
415static void 398static void
416handle_async_result (union sigval val) 399handle_resolve_timeout (void *cls)
417{ 400{
418 GNUNET_DISK_file_write (GNUNET_DISK_pipe_handle (resolve_result_pipe, 401 struct ResolveCache *cache = cls;
419 GNUNET_DISK_PIPE_END_WRITE), 402
420 &val.sival_ptr, 403 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
421 sizeof (val.sival_ptr)); 404 "timeout!\n");
405 if (NULL != cache->resolve_handle)
406 {
407 GNUNET_DNSSTUB_resolve_cancel (cache->resolve_handle);
408 cache->resolve_handle = NULL;
409 }
410 GNUNET_CONTAINER_DLL_remove (cache_head,
411 cache_tail,
412 cache);
413 free_cache_entry (cache);
422} 414}
423 415
424 416
425static int 417static int
426getaddrinfo_a_resolve (struct GNUNET_MQ_Handle *mq, 418resolve_and_cache (const char* hostname,
427 const char *hostname, 419 uint16_t record_type,
428 int af, 420 uint16_t request_id,
429 uint32_t request_id) 421 struct GNUNET_SERVICE_Client *client)
430{ 422{
431 int ret; 423 char *packet_buf;
432 struct gaicb *host; 424 size_t packet_size;
433 struct addrinfo *hints; 425 struct GNUNET_DNSPARSER_Query query;
434 struct sigevent *sig; 426 struct GNUNET_DNSPARSER_Packet packet;
435 struct AsyncCls *async_cls; 427 struct ResolveCache *cache;
436 428 struct GNUNET_TIME_Relative timeout =
437 host = GNUNET_new (struct gaicb); 429 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5);
438 hints = GNUNET_new (struct addrinfo); 430
439 sig = GNUNET_new (struct sigevent); 431 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
440 async_cls = GNUNET_new (struct AsyncCls); 432 "resolve_and_cache\n");
441 memset (hints, 433 query.name = (char *)hostname;
434 query.type = record_type;
435 query.dns_traffic_class = GNUNET_TUN_DNS_CLASS_INTERNET;
436 memset (&packet,
442 0, 437 0,
443 sizeof (struct addrinfo)); 438 sizeof (packet));
444 memset (sig, 439 packet.num_queries = 1;
445 0, 440 packet.queries = &query;
446 sizeof (struct sigevent)); 441 packet.id = htons (request_id);
447 hints->ai_family = af; 442 packet.flags.recursion_desired = 1;
448 hints->ai_socktype = SOCK_STREAM; /* go for TCP */ 443 if (GNUNET_OK !=
449 host->ar_name = hostname; 444 GNUNET_DNSPARSER_pack (&packet,
450 host->ar_service = NULL; 445 UINT16_MAX,
451 host->ar_request = hints; 446 &packet_buf,
452 host->ar_result = NULL; 447 &packet_size))
453 sig->sigev_notify = SIGEV_THREAD; 448 {
454 sig->sigev_value.sival_ptr = async_cls; 449 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
455 sig->sigev_notify_function = &handle_async_result; 450 "Failed to pack query for hostname `%s'\n",
456 async_cls->host = host; 451 hostname);
457 async_cls->sig = sig;
458 async_cls->mq = mq;
459 async_cls->request_id = request_id;
460 ret = getaddrinfo_a (GAI_NOWAIT,
461 &host,
462 1,
463 sig);
464 if (0 != ret)
465 return GNUNET_SYSERR; 452 return GNUNET_SYSERR;
453
454 }
455 cache = GNUNET_malloc (sizeof (struct ResolveCache));
456 cache->record_type = record_type;
457 cache->request_id = GNUNET_memdup (&request_id, sizeof (request_id));
458 cache->client = client;
459 cache->timeout_task = GNUNET_SCHEDULER_add_delayed (timeout,
460 &handle_resolve_timeout,
461 cache);
462 cache->resolve_handle =
463 GNUNET_DNSSTUB_resolve (dnsstub_ctx,
464 packet_buf,
465 packet_size,
466 &handle_resolve_result,
467 cache);
468 GNUNET_CONTAINER_DLL_insert (cache_head,
469 cache_tail,
470 cache);
471 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
472 "resolve %s, request_id = %u\n",
473 hostname,
474 request_id);
475 GNUNET_free (packet_buf);
466 return GNUNET_OK; 476 return GNUNET_OK;
467} 477}
468 478
469 479
470#elif HAVE_GETADDRINFO 480static const char *
471static int 481get_hostname (struct ResolveCache *cache_entry)
472getaddrinfo_resolve (struct GNUNET_MQ_Handle *mq,
473 const char *hostname,
474 int af,
475 uint32_t request_id)
476{ 482{
477 int s; 483 if (NULL != cache_entry->records_head)
478 struct addrinfo hints;
479 struct addrinfo *result;
480 struct addrinfo *pos;
481 struct GNUNET_RESOLVER_ResponseMessage *msg;
482 struct GNUNET_MQ_Envelope *env;
483
484#ifdef WINDOWS
485 /* Due to a bug, getaddrinfo will not return a mix of different families */
486 if (AF_UNSPEC == af)
487 { 484 {
488 int ret1; 485 GNUNET_assert (NULL != cache_entry->records_head);
489 int ret2; 486 GNUNET_assert (NULL != cache_entry->records_head->record);
490 ret1 = getaddrinfo_resolve (mq, 487 GNUNET_assert (NULL != cache_entry->records_head->record->name);
491 hostname, 488 return cache_entry->records_head->record->name;
492 AF_INET,
493 request_id);
494 ret2 = getaddrinfo_resolve (mq,
495 hostname,
496 AF_INET6,
497 request_id);
498 if ( (ret1 == GNUNET_OK) ||
499 (ret2 == GNUNET_OK) )
500 return GNUNET_OK;
501 if ( (ret1 == GNUNET_SYSERR) ||
502 (ret2 == GNUNET_SYSERR) )
503 return GNUNET_SYSERR;
504 return GNUNET_NO;
505 } 489 }
506#endif 490 return NULL;
507
508 memset (&hints,
509 0,
510 sizeof (struct addrinfo));
511 hints.ai_family = af;
512 hints.ai_socktype = SOCK_STREAM; /* go for TCP */
513
514 if (0 != (s = getaddrinfo (hostname,
515 NULL,
516 &hints,
517 &result)))
518 {
519 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
520 _("Could not resolve `%s' (%s): %s\n"),
521 hostname,
522 (af ==
523 AF_INET) ? "IPv4" : ((af == AF_INET6) ? "IPv6" : "any"),
524 gai_strerror (s));
525 if ( (s == EAI_BADFLAGS) ||
526#ifndef WINDOWS
527 (s == EAI_SYSTEM) ||
528#endif
529 (s == EAI_MEMORY) )
530 return GNUNET_NO; /* other function may still succeed */
531 return GNUNET_SYSERR;
532 }
533 if (NULL == result)
534 return GNUNET_SYSERR;
535 for (pos = result; pos != NULL; pos = pos->ai_next)
536 {
537 switch (pos->ai_family)
538 {
539 case AF_INET:
540 env = GNUNET_MQ_msg_extra (msg,
541 sizeof (struct in_addr),
542 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
543 msg->id = request_id;
544 GNUNET_memcpy (&msg[1],
545 &((struct sockaddr_in*) pos->ai_addr)->sin_addr,
546 sizeof (struct in_addr));
547 GNUNET_MQ_send (mq,
548 env);
549 break;
550 case AF_INET6:
551 env = GNUNET_MQ_msg_extra (msg,
552 sizeof (struct in6_addr),
553 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
554 msg->id = request_id;
555 GNUNET_memcpy (&msg[1],
556 &((struct sockaddr_in6*) pos->ai_addr)->sin6_addr,
557 sizeof (struct in6_addr));
558 GNUNET_MQ_send (mq,
559 env);
560 break;
561 default:
562 /* unsupported, skip */
563 break;
564 }
565 }
566 freeaddrinfo (result);
567 return GNUNET_OK;
568} 491}
569 492
570 493
571#elif HAVE_GETHOSTBYNAME2 494static const uint16_t *
572 495get_record_type (struct ResolveCache *cache_entry)
573
574static int
575gethostbyname2_resolve (struct GNUNET_MQ_Handle *mq,
576 const char *hostname,
577 int af,
578 uint32_t request_id)
579{ 496{
580 struct hostent *hp; 497 if (NULL != cache_entry->records_head)
581 int ret1; 498 return &cache_entry->record_type;
582 int ret2; 499 return NULL;
583 struct GNUNET_MQ_Envelope *env; 500}
584 struct GNUNET_RESOLVER_ResponseMessage *msg;
585 501
586#ifdef WINDOWS
587 /* gethostbyname2() in plibc is a compat dummy that calls gethostbyname(). */
588 return GNUNET_NO;
589#endif
590 502
591 if (af == AF_UNSPEC) 503static const struct GNUNET_TIME_Absolute *
592 { 504get_expiration_time (struct ResolveCache *cache_entry)
593 ret1 = gethostbyname2_resolve (mq, 505{
594 hostname, 506 if (NULL != cache_entry->records_head)
595 AF_INET, 507 return &cache_entry->records_head->record->expiration_time;
596 request_id); 508 return NULL;
597 ret2 = gethostbyname2_resolve (mq,
598 hostname,
599 AF_INET6,
600 request_id);
601 if ( (ret1 == GNUNET_OK) ||
602 (ret2 == GNUNET_OK) )
603 return GNUNET_OK;
604 if ( (ret1 == GNUNET_SYSERR) ||
605 (ret2 == GNUNET_SYSERR) )
606 return GNUNET_SYSERR;
607 return GNUNET_NO;
608 }
609 hp = gethostbyname2 (hostname,
610 af);
611 if (hp == NULL)
612 {
613 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
614 _("Could not find IP of host `%s': %s\n"),
615 hostname,
616 hstrerror (h_errno));
617 return GNUNET_SYSERR;
618 }
619 GNUNET_assert (hp->h_addrtype == af);
620 switch (af)
621 {
622 case AF_INET:
623 GNUNET_assert (hp->h_length == sizeof (struct in_addr));
624 env = GNUNET_MQ_msg_extra (msg,
625 hp->h_length,
626 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
627 msg->id = request_id;
628 GNUNET_memcpy (&msg[1],
629 hp->h_addr_list[0],
630 hp->h_length);
631 GNUNET_MQ_send (mq,
632 env);
633 break;
634 case AF_INET6:
635 GNUNET_assert (hp->h_length == sizeof (struct in6_addr));
636 env = GNUNET_MQ_msg_extra (msg,
637 hp->h_length,
638 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
639 msg->id = request_id;
640 GNUNET_memcpy (&msg[1],
641 hp->h_addr_list[0],
642 hp->h_length);
643 GNUNET_MQ_send (mq,
644 env);
645 break;
646 default:
647 GNUNET_break (0);
648 return GNUNET_SYSERR;
649 }
650 return GNUNET_OK;
651} 509}
652 510
653#elif HAVE_GETHOSTBYNAME
654
655 511
656static int 512static int
657gethostbyname_resolve (struct GNUNET_MQ_Handle *mq, 513remove_if_expired (struct ResolveCache *cache_entry)
658 const char *hostname,
659 uint32_t request_id)
660{ 514{
661 struct hostent *hp; 515 struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
662 struct GNUNET_RESOLVER_ResponseMessage *msg;
663 struct GNUNET_MQ_Envelope *env;
664 516
665 hp = GETHOSTBYNAME (hostname); 517 if ( (NULL != cache_entry->records_head) &&
666 if (NULL == hp) 518 (now.abs_value_us > get_expiration_time (cache_entry)->abs_value_us) )
667 { 519 {
668 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 520 GNUNET_CONTAINER_DLL_remove (cache_head,
669 _("Could not find IP of host `%s': %s\n"), 521 cache_tail,
670 hostname, 522 cache_entry);
671 hstrerror (h_errno)); 523 free_cache_entry (cache_entry);
672 return GNUNET_SYSERR; 524 return GNUNET_YES;
673 }
674 if (hp->h_addrtype != AF_INET)
675 {
676 GNUNET_break (0);
677 return GNUNET_SYSERR;
678 } 525 }
679 GNUNET_assert (hp->h_length == sizeof (struct in_addr)); 526 return GNUNET_NO;
680 env = GNUNET_MQ_msg_extra (msg,
681 hp->h_length,
682 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE);
683 msg->id = request_id;
684 GNUNET_memcpy (&msg[1],
685 hp->h_addr_list[0],
686 hp->h_length);
687 GNUNET_MQ_send (mq,
688 env);
689 return GNUNET_OK;
690} 527}
691#endif
692 528
693 529
694/** 530/**
695 * Convert a string to an IP address. 531 * Get an IP address as a string (works for both IPv4 and IPv6). Note
532 * that the resolution happens asynchronously and that the first call
533 * may not immediately result in the FQN (but instead in a
534 * human-readable IP address).
696 * 535 *
697 * @param client where to send the IP address 536 * @param client handle to the client making the request (for sending the reply)
698 * @param hostname the hostname to resolve 537 * @param af AF_INET or AF_INET6
699 * @param af AF_INET or AF_INET6; use AF_UNSPEC for "any" 538 * @param ip `struct in_addr` or `struct in6_addr`
700 */ 539 */
701static void 540static int
702get_ip_from_hostname (struct GNUNET_SERVICE_Client *client, 541try_cache (const char *hostname,
703 const char *hostname, 542 uint16_t record_type,
704 int af, 543 uint16_t request_id,
705 uint32_t request_id) 544 struct GNUNET_SERVICE_Client *client)
706{ 545{
707 struct GNUNET_MQ_Envelope *env; 546 struct ResolveCache *pos;
708 struct GNUNET_RESOLVER_ResponseMessage *msg; 547 struct ResolveCache *next;
709 struct GNUNET_MQ_Handle *mq; 548
710 549 next = cache_head;
711 mq = GNUNET_SERVICE_client_get_mq (client); 550 while ( (NULL != (pos = next)) &&
712#if HAVE_GETADDRINFO_A 551 ( (NULL == pos->records_head) ||
713 getaddrinfo_a_resolve (mq, 552 (0 != strcmp (get_hostname (pos), hostname)) ||
714 hostname, 553 (*get_record_type (pos) != record_type) ) )
715 af, 554 {
716 request_id); 555 next = pos->next;
717 GNUNET_SERVICE_client_continue (client); 556 remove_if_expired (pos);
718 return; 557 }
719#elif HAVE_GETADDRINFO 558 if (NULL != pos)
720 getaddrinfo_resolve (mq, 559 {
721 hostname, 560 if (GNUNET_NO == remove_if_expired (pos))
722 af, 561 {
723 request_id); 562 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
724#elif HAVE_GETHOSTBYNAME2 563 "found cache entry for '%s', record type '%u'\n",
725 gethostbyname2_resolve (mq, 564 hostname,
726 hostname, 565 record_type);
727 af, 566 struct Record *cache_pos = pos->records_head;
728 request_id); 567 while (NULL != cache_pos)
729#elif HAVE_GETHOSTBYNAME 568 {
730 if ( ( (af == AF_UNSPEC) || 569 send_reply (cache_pos->record,
731 (af == PF_INET) ) ) 570 request_id,
732 gethostbyname_resolve (mq, 571 client);
733 hostname, 572 cache_pos = cache_pos->next;
734 request_id); 573 }
735#endif 574 send_end_msg (request_id,
736 // send end message 575 client);
737 env = GNUNET_MQ_msg (msg, 576 return GNUNET_YES;
738 GNUNET_MESSAGE_TYPE_RESOLVER_RESPONSE); 577 }
739 msg->id = request_id; 578 }
740 GNUNET_MQ_notify_sent (env, 579 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
741 &notify_service_client_done, 580 "no cache entry for '%s'\n",
742 client); 581 hostname);
743 GNUNET_MQ_send (mq, 582 return GNUNET_NO;
744 env);
745} 583}
746 584
747 585
@@ -801,6 +639,23 @@ check_get (void *cls,
801} 639}
802 640
803 641
642static void
643process_get (const char *hostname,
644 uint16_t record_type,
645 uint16_t request_id,
646 struct GNUNET_SERVICE_Client *client)
647{
648 if (GNUNET_NO == try_cache (hostname, record_type, request_id, client))
649 {
650 int result = resolve_and_cache (hostname,
651 record_type,
652 request_id,
653 client);
654 GNUNET_assert (GNUNET_OK == result);
655 }
656}
657
658
804/** 659/**
805 * Handle GET-message. 660 * Handle GET-message.
806 * 661 *
@@ -812,45 +667,100 @@ handle_get (void *cls,
812 const struct GNUNET_RESOLVER_GetMessage *msg) 667 const struct GNUNET_RESOLVER_GetMessage *msg)
813{ 668{
814 struct GNUNET_SERVICE_Client *client = cls; 669 struct GNUNET_SERVICE_Client *client = cls;
815 const void *ip;
816 int direction; 670 int direction;
817 int af; 671 int af;
818 uint32_t id; 672 uint16_t request_id;
673 const char *hostname;
819 674
820 direction = ntohl (msg->direction); 675 direction = ntohl (msg->direction);
821 af = ntohl (msg->af); 676 af = ntohl (msg->af);
822 id = ntohl (msg->id); 677 request_id = ntohs (msg->id);
823 if (GNUNET_NO == direction) 678 if (GNUNET_NO == direction)
824 { 679 {
825 /* IP from hostname */ 680 /* IP from hostname */
826 const char *hostname; 681 hostname = GNUNET_strdup ((const char *) &msg[1]);
827 682 switch (af)
828 hostname = (const char *) &msg[1]; 683 {
829 get_ip_from_hostname (client, 684 case AF_UNSPEC:
830 hostname, 685 {
831 af, 686 process_get (hostname, GNUNET_DNSPARSER_TYPE_ALL, request_id, client);
832 id); 687 break;
833 return; 688 }
689 case AF_INET:
690 {
691 process_get (hostname, GNUNET_DNSPARSER_TYPE_A, request_id, client);
692 break;
693 }
694 case AF_INET6:
695 {
696 process_get (hostname, GNUNET_DNSPARSER_TYPE_AAAA, request_id, client);
697 break;
698 }
699 default:
700 {
701 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
702 "got invalid af: %d\n",
703 af);
704 GNUNET_assert (0);
705 }
706 }
707 }
708 else
709 {
710 /* hostname from IP */
711 hostname = make_reverse_hostname (&msg[1], af);
712 process_get (hostname, GNUNET_DNSPARSER_TYPE_PTR, request_id, client);
834 } 713 }
835 ip = &msg[1]; 714 GNUNET_free_non_null ((char *)hostname);
715 GNUNET_SERVICE_client_continue (client);
716}
836 717
837#if !defined(GNUNET_CULL_LOGGING) 718
719static void
720shutdown_task (void *cls)
721{
722 (void) cls;
723 struct ResolveCache *pos;
724
725 while (NULL != (pos = cache_head))
838 { 726 {
839 char buf[INET6_ADDRSTRLEN]; 727 GNUNET_CONTAINER_DLL_remove (cache_head,
728 cache_tail,
729 pos);
730 free_cache_entry (pos);
731 }
732 GNUNET_DNSSTUB_stop (dnsstub_ctx);
733}
734
840 735
736static void
737init_cb (void *cls,
738 const struct GNUNET_CONFIGURATION_Handle *cfg,
739 struct GNUNET_SERVICE_Handle *sh)
740{
741 (void) cfg;
742 (void) sh;
743
744 GNUNET_SCHEDULER_add_shutdown (&shutdown_task,
745 cls);
746 dnsstub_ctx = GNUNET_DNSSTUB_start (128);
747 char **dns_servers;
748 ssize_t num_dns_servers = lookup_dns_servers (&dns_servers);
749 if (0 == num_dns_servers)
750 {
751 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
752 "no DNS server available. DNS resolution will not be possible.\n");
753 }
754 for (int i = 0; i != num_dns_servers; i++)
755 {
756 int result = GNUNET_DNSSTUB_add_dns_ip (dnsstub_ctx, dns_servers[i]);
841 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 757 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
842 "Resolver asked to look up IP address `%s (request ID %u)'.\n", 758 "Adding DNS server '%s': %s\n",
843 inet_ntop (af, 759 dns_servers[i],
844 ip, 760 GNUNET_OK == result ? "success" : "failure");
845 buf, 761 GNUNET_free (dns_servers[i]);
846 sizeof (buf)),
847 id);
848 } 762 }
849#endif 763 GNUNET_free_non_null (dns_servers);
850 get_ip_as_string (client,
851 af,
852 ip,
853 id);
854} 764}
855 765
856 766
@@ -870,19 +780,6 @@ connect_cb (void *cls,
870 (void) cls; 780 (void) cls;
871 (void) mq; 781 (void) mq;
872 782
873#if HAVE_GETADDRINFO_A
874 resolve_result_pipe = GNUNET_DISK_pipe (GNUNET_NO,
875 GNUNET_NO,
876 GNUNET_NO,
877 GNUNET_NO);
878 GNUNET_assert (NULL != resolve_result_pipe);
879 resolve_result_pipe_task =
880 GNUNET_SCHEDULER_add_read_file (GNUNET_TIME_UNIT_FOREVER_REL,
881 GNUNET_DISK_pipe_handle (resolve_result_pipe,
882 GNUNET_DISK_PIPE_END_READ),
883 &resolve_result_pipe_cb,
884 NULL);
885#endif
886 return c; 783 return c;
887} 784}
888 785
@@ -900,19 +797,16 @@ disconnect_cb (void *cls,
900 void *internal_cls) 797 void *internal_cls)
901{ 798{
902 (void) cls; 799 (void) cls;
800 struct ResolveCache *pos = cache_head;
903 801
904#if HAVE_GETADDRINFO_A 802 while (NULL != pos)
905 if (NULL != resolve_result_pipe_task)
906 {
907 GNUNET_SCHEDULER_cancel (resolve_result_pipe_task);
908 resolve_result_pipe_task = NULL;
909 }
910 if (NULL != resolve_result_pipe)
911 { 803 {
912 GNUNET_DISK_pipe_close (resolve_result_pipe); 804 if (pos->client == c)
913 resolve_result_pipe = NULL; 805 {
806 pos->client = NULL;
807 }
808 pos = pos->next;
914 } 809 }
915#endif
916 GNUNET_assert (c == internal_cls); 810 GNUNET_assert (c == internal_cls);
917} 811}
918 812
@@ -923,7 +817,7 @@ disconnect_cb (void *cls,
923GNUNET_SERVICE_MAIN 817GNUNET_SERVICE_MAIN
924("resolver", 818("resolver",
925 GNUNET_SERVICE_OPTION_NONE, 819 GNUNET_SERVICE_OPTION_NONE,
926 NULL, 820 &init_cb,
927 &connect_cb, 821 &connect_cb,
928 &disconnect_cb, 822 &disconnect_cb,
929 NULL, 823 NULL,
@@ -950,23 +844,4 @@ GNUNET_RESOLVER_memory_init ()
950#endif 844#endif
951 845
952 846
953/**
954 * Free globals on exit.
955 */
956void __attribute__ ((destructor))
957GNUNET_RESOLVER_memory_done ()
958{
959 struct IPCache *pos;
960
961 while (NULL != (pos = cache_head))
962 {
963 GNUNET_CONTAINER_DLL_remove (cache_head,
964 cache_tail,
965 pos);
966 GNUNET_free_non_null (pos->addr);
967 GNUNET_free (pos);
968 }
969}
970
971
972/* end of gnunet-service-resolver.c */ 847/* end of gnunet-service-resolver.c */
diff --git a/contrib/timeout_watchdog_w32.c b/src/util/gnunet-timeout-w32.c
index 901eb6207..78b268fe2 100644
--- a/contrib/timeout_watchdog_w32.c
+++ b/src/util/gnunet-timeout-w32.c
@@ -11,13 +11,13 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19/** 19/**
20 * @file contrib/timeout_watchdog_w32.c 20 * @file src/util/gnunet-timeout-w32.c
21 * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period 21 * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period
22 * @author LRN 22 * @author LRN
23 */ 23 */
@@ -182,7 +182,7 @@ main (int argc, char *argv[])
182 exit (0); 182 exit (0);
183 } 183 }
184 printf ("Child processes were killed after timeout of %u seconds\n", 184 printf ("Child processes were killed after timeout of %u seconds\n",
185 timeout); 185 timeout);
186 TerminateJobObject (job, 1); 186 TerminateJobObject (job, 1);
187 CloseHandle (proc.hProcess); 187 CloseHandle (proc.hProcess);
188 exit (1); 188 exit (1);
diff --git a/contrib/timeout_watchdog.c b/src/util/gnunet-timeout.c
index 70e840d55..8dfb6ad17 100644
--- a/contrib/timeout_watchdog.c
+++ b/src/util/gnunet-timeout.c
@@ -11,13 +11,13 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
18 18
19/** 19/**
20 * @file contrib/timeout_watchdog.c 20 * @file src/util/gnunet-timeout.c
21 * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period 21 * @brief small tool starting a child process, waiting that it terminates or killing it after a given timeout period
22 * @author Matthias Wachs 22 * @author Matthias Wachs
23 */ 23 */
@@ -39,25 +39,35 @@ sigchld_handler (int val)
39 int ret = 0; 39 int ret = 0;
40 40
41 (void) val; 41 (void) val;
42 waitpid (child, &status, 0); 42 waitpid (child,
43 &status,
44 0);
43 if (WIFEXITED (status) != 0) 45 if (WIFEXITED (status) != 0)
44 { 46 {
45 ret = WEXITSTATUS (status); 47 ret = WEXITSTATUS (status);
46 printf ("Test process exited with result %u\n", ret); 48 fprintf (stderr,
47 } 49 "Process exited with result %u\n",
50 ret);
51 exit (ret); /* return same status code */
52 }
48 if (WIFSIGNALED (status) != 0) 53 if (WIFSIGNALED (status) != 0)
49 { 54 {
50 ret = WTERMSIG (status); 55 ret = WTERMSIG (status);
51 printf ("Test process was signaled %u\n", ret); 56 fprintf (stderr,
52 } 57 "Process received signal %u\n",
53 exit (ret); 58 ret);
59 kill (getpid (),
60 ret); /* kill self with the same signal */
61 }
62 exit (-1);
54} 63}
55 64
56 65
57static void 66static void
58sigint_handler (int val) 67sigint_handler (int val)
59{ 68{
60 kill (0, val); 69 kill (0,
70 val);
61 exit (val); 71 exit (val);
62} 72}
63 73
@@ -70,18 +80,18 @@ main (int argc,
70 pid_t gpid = 0; 80 pid_t gpid = 0;
71 81
72 if (argc < 3) 82 if (argc < 3)
73 { 83 {
74 printf 84 fprintf (stderr,
75 ("arg 1: timeout in sec., arg 2: executable, arg<n> arguments\n"); 85 "arg 1: timeout in sec., arg 2: executable, arg<n> arguments\n");
76 exit (1); 86 exit (-1);
77 } 87 }
78 88
79 timeout = atoi (argv[1]); 89 timeout = atoi (argv[1]);
80 90
81 if (timeout == 0) 91 if (timeout == 0)
82 timeout = 600; 92 timeout = 600;
83 93
84/* with getpgid() it does not compile, but getpgrp is the BSD version and working */ 94 /* with getpgid() it does not compile, but getpgrp is the BSD version and working */
85 gpid = getpgrp (); 95 gpid = getpgrp ();
86 96
87 signal (SIGCHLD, sigchld_handler); 97 signal (SIGCHLD, sigchld_handler);
@@ -94,23 +104,25 @@ main (int argc,
94 104
95 child = fork (); 105 child = fork ();
96 if (child == 0) 106 if (child == 0)
97 { 107 {
98 /* int setpgrp(pid_t pid, pid_t pgid); is not working on this machine */ 108 /* int setpgrp(pid_t pid, pid_t pgid); is not working on this machine */
99 //setpgrp (0, pid_t gpid); 109 //setpgrp (0, pid_t gpid);
100 if (-1 != gpid) 110 if (-1 != gpid)
101 setpgid (0, gpid); 111 setpgid (0, gpid);
102 execvp (argv[2], &argv[2]); 112 execvp (argv[2],
103 exit (1); 113 &argv[2]);
104 } 114 exit (-1);
115 }
105 if (child > 0) 116 if (child > 0)
106 { 117 {
107 sleep (timeout); 118 sleep (timeout);
108 printf ("Child processes were killed after timeout of %u seconds\n", 119 printf ("Child processes were killed after timeout of %u seconds\n",
109 timeout); 120 timeout);
110 kill (0, SIGTERM); 121 kill (0,
111 exit (1); 122 SIGTERM);
112 } 123 exit (3);
113 exit (1); 124 }
125 exit (-1);
114} 126}
115 127
116/* end of timeout_watchdog.c */ 128/* end of timeout_watchdog.c */
diff --git a/src/util/resolver.h b/src/util/resolver.h
index a0f105afa..07851d052 100644
--- a/src/util/resolver.h
+++ b/src/util/resolver.h
@@ -60,7 +60,7 @@ struct GNUNET_RESOLVER_GetMessage
60 * identifies the request and is contained in the response message. The 60 * identifies the request and is contained in the response message. The
61 * client has to match response to request by this identifier. 61 * client has to match response to request by this identifier.
62 */ 62 */
63 uint32_t id GNUNET_PACKED; 63 uint16_t id GNUNET_PACKED;
64 64
65 /* followed by 0-terminated string for A/AAAA-lookup or 65 /* followed by 0-terminated string for A/AAAA-lookup or
66 by 'struct in_addr' / 'struct in6_addr' for reverse lookup */ 66 by 'struct in_addr' / 'struct in6_addr' for reverse lookup */
@@ -79,7 +79,7 @@ struct GNUNET_RESOLVER_ResponseMessage
79 * identifies the request this message responds to. The client 79 * identifies the request this message responds to. The client
80 * has to match response to request by this identifier. 80 * has to match response to request by this identifier.
81 */ 81 */
82 uint32_t id GNUNET_PACKED; 82 uint16_t id GNUNET_PACKED;
83 83
84 /* followed by 0-terminated string for response to a reverse lookup 84 /* followed by 0-terminated string for response to a reverse lookup
85 * or by 'struct in_addr' / 'struct in6_addr' for response to 85 * or by 'struct in_addr' / 'struct in6_addr' for response to
diff --git a/src/util/resolver_api.c b/src/util/resolver_api.c
index b94819f06..8a054327b 100644
--- a/src/util/resolver_api.c
+++ b/src/util/resolver_api.c
@@ -68,10 +68,10 @@ static struct GNUNET_RESOLVER_RequestHandle *req_head;
68 */ 68 */
69static struct GNUNET_RESOLVER_RequestHandle *req_tail; 69static struct GNUNET_RESOLVER_RequestHandle *req_tail;
70 70
71/** 71///**
72 * ID of the last request we sent to the service 72// * ID of the last request we sent to the service
73 */ 73// */
74static uint32_t last_request_id; 74//static uint16_t last_request_id;
75 75
76/** 76/**
77 * How long should we wait to reconnect? 77 * How long should we wait to reconnect?
@@ -445,7 +445,7 @@ process_requests ()
445 GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST); 445 GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST);
446 msg->direction = htonl (rh->direction); 446 msg->direction = htonl (rh->direction);
447 msg->af = htonl (rh->af); 447 msg->af = htonl (rh->af);
448 msg->id = htonl (rh->id); 448 msg->id = htons (rh->id);
449 GNUNET_memcpy (&msg[1], 449 GNUNET_memcpy (&msg[1],
450 &rh[1], 450 &rh[1],
451 rh->data_len); 451 rh->data_len);
@@ -491,7 +491,7 @@ handle_response (void *cls,
491 struct GNUNET_RESOLVER_RequestHandle *rh = req_head; 491 struct GNUNET_RESOLVER_RequestHandle *rh = req_head;
492 uint16_t size; 492 uint16_t size;
493 char *nret; 493 char *nret;
494 uint32_t request_id = msg->id; 494 uint16_t request_id = msg->id;
495 495
496 for (; rh != NULL; rh = rh->next) 496 for (; rh != NULL; rh = rh->next)
497 { 497 {
@@ -911,6 +911,14 @@ handle_lookup_timeout (void *cls)
911} 911}
912 912
913 913
914static uint16_t
915get_request_id ()
916{
917 return (uint16_t) GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE,
918 UINT16_MAX);
919}
920
921
914/** 922/**
915 * Convert a string to one or more IP addresses. 923 * Convert a string to one or more IP addresses.
916 * 924 *
@@ -945,7 +953,8 @@ GNUNET_RESOLVER_ip_get (const char *hostname,
945 hostname); 953 hostname);
946 rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + slen); 954 rh = GNUNET_malloc (sizeof (struct GNUNET_RESOLVER_RequestHandle) + slen);
947 rh->af = af; 955 rh->af = af;
948 rh->id = ++last_request_id; 956 //rh->id = ++last_request_id;
957 rh->id = get_request_id ();
949 rh->addr_callback = callback; 958 rh->addr_callback = callback;
950 rh->cls = callback_cls; 959 rh->cls = callback_cls;
951 GNUNET_memcpy (&rh[1], 960 GNUNET_memcpy (&rh[1],
@@ -1092,7 +1101,8 @@ GNUNET_RESOLVER_hostname_get (const struct sockaddr *sa,
1092 rh->name_callback = callback; 1101 rh->name_callback = callback;
1093 rh->cls = cls; 1102 rh->cls = cls;
1094 rh->af = sa->sa_family; 1103 rh->af = sa->sa_family;
1095 rh->id = ++last_request_id; 1104 //rh->id = ++last_request_id;
1105 rh->id = get_request_id ();
1096 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout); 1106 rh->timeout = GNUNET_TIME_relative_to_absolute (timeout);
1097 GNUNET_memcpy (&rh[1], 1107 GNUNET_memcpy (&rh[1],
1098 ip, 1108 ip,
diff --git a/src/util/scheduler.c b/src/util/scheduler.c
index 93d133d1b..5d3836639 100644
--- a/src/util/scheduler.c
+++ b/src/util/scheduler.c
@@ -965,8 +965,6 @@ GNUNET_SCHEDULER_cancel (struct GNUNET_SCHEDULER_Task *task)
965 965
966 /* scheduler must be running */ 966 /* scheduler must be running */
967 GNUNET_assert (NULL != scheduler_driver); 967 GNUNET_assert (NULL != scheduler_driver);
968 GNUNET_assert ( (NULL != active_task) ||
969 (GNUNET_NO == task->lifeness) );
970 is_fd_task = (NULL != task->fds); 968 is_fd_task = (NULL != task->fds);
971 if (is_fd_task) 969 if (is_fd_task)
972 { 970 {
@@ -1056,9 +1054,9 @@ GNUNET_SCHEDULER_add_with_reason_and_priority (GNUNET_SCHEDULER_TaskCallback tas
1056{ 1054{
1057 struct GNUNET_SCHEDULER_Task *t; 1055 struct GNUNET_SCHEDULER_Task *t;
1058 1056
1057 /* scheduler must be running */
1058 GNUNET_assert (NULL != scheduler_driver);
1059 GNUNET_assert (NULL != task); 1059 GNUNET_assert (NULL != task);
1060 GNUNET_assert ((NULL != active_task) ||
1061 (GNUNET_SCHEDULER_REASON_STARTUP == reason));
1062 t = GNUNET_new (struct GNUNET_SCHEDULER_Task); 1060 t = GNUNET_new (struct GNUNET_SCHEDULER_Task);
1063 t->read_fd = -1; 1061 t->read_fd = -1;
1064 t->write_fd = -1; 1062 t->write_fd = -1;
@@ -1099,7 +1097,8 @@ GNUNET_SCHEDULER_add_at_with_priority (struct GNUNET_TIME_Absolute at,
1099 struct GNUNET_SCHEDULER_Task *pos; 1097 struct GNUNET_SCHEDULER_Task *pos;
1100 struct GNUNET_SCHEDULER_Task *prev; 1098 struct GNUNET_SCHEDULER_Task *prev;
1101 1099
1102 GNUNET_assert (NULL != active_task); 1100 /* scheduler must be running */
1101 GNUNET_assert (NULL != scheduler_driver);
1103 GNUNET_assert (NULL != task); 1102 GNUNET_assert (NULL != task);
1104 t = GNUNET_new (struct GNUNET_SCHEDULER_Task); 1103 t = GNUNET_new (struct GNUNET_SCHEDULER_Task);
1105 t->callback = task; 1104 t->callback = task;
@@ -1286,7 +1285,8 @@ GNUNET_SCHEDULER_add_shutdown (GNUNET_SCHEDULER_TaskCallback task,
1286{ 1285{
1287 struct GNUNET_SCHEDULER_Task *t; 1286 struct GNUNET_SCHEDULER_Task *t;
1288 1287
1289 GNUNET_assert (NULL != active_task); 1288 /* scheduler must be running */
1289 GNUNET_assert (NULL != scheduler_driver);
1290 GNUNET_assert (NULL != task); 1290 GNUNET_assert (NULL != task);
1291 t = GNUNET_new (struct GNUNET_SCHEDULER_Task); 1291 t = GNUNET_new (struct GNUNET_SCHEDULER_Task);
1292 t->callback = task; 1292 t->callback = task;
@@ -1403,7 +1403,8 @@ add_without_sets (struct GNUNET_TIME_Relative delay,
1403{ 1403{
1404 struct GNUNET_SCHEDULER_Task *t; 1404 struct GNUNET_SCHEDULER_Task *t;
1405 1405
1406 GNUNET_assert (NULL != active_task); 1406 /* scheduler must be running */
1407 GNUNET_assert (NULL != scheduler_driver);
1407 GNUNET_assert (NULL != task); 1408 GNUNET_assert (NULL != task);
1408 t = GNUNET_new (struct GNUNET_SCHEDULER_Task); 1409 t = GNUNET_new (struct GNUNET_SCHEDULER_Task);
1409 init_fd_info (t, 1410 init_fd_info (t,
@@ -1832,7 +1833,6 @@ GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
1832 1833
1833 /* scheduler must be running */ 1834 /* scheduler must be running */
1834 GNUNET_assert (NULL != scheduler_driver); 1835 GNUNET_assert (NULL != scheduler_driver);
1835 GNUNET_assert (NULL != active_task);
1836 GNUNET_assert (NULL != task); 1836 GNUNET_assert (NULL != task);
1837 int no_rs = (NULL == rs); 1837 int no_rs = (NULL == rs);
1838 int no_ws = (NULL == ws); 1838 int no_ws = (NULL == ws);
@@ -2022,99 +2022,109 @@ GNUNET_SCHEDULER_do_work (struct GNUNET_SCHEDULER_Handle *sh)
2022 if (timeout.abs_value_us > now.abs_value_us) 2022 if (timeout.abs_value_us > now.abs_value_us)
2023 { 2023 {
2024 /** 2024 /**
2025 * The driver called this function before the current timeout was 2025 * The event loop called this function before the current timeout was
2026 * reached (and no FD tasks are ready). This can happen in the 2026 * reached (and no FD tasks are ready). This is acceptable if
2027 * rare case when the system time is changed while the driver is 2027 *
2028 * waiting for the timeout, so we handle this gracefully. It might 2028 * - the system time was changed while the driver was waiting for
2029 * also be a programming error in the driver though. 2029 * the timeout
2030 * - an external event loop called GNUnet API functions outside of
2031 * the callbacks called in GNUNET_SCHEDULER_do_work and thus
2032 * wasn't notified about the new timeout
2033 *
2034 * It might also mean we are busy-waiting because of a programming
2035 * error in the external event loop.
2030 */ 2036 */
2031 LOG (GNUNET_ERROR_TYPE_DEBUG, 2037 LOG (GNUNET_ERROR_TYPE_DEBUG,
2032 "GNUNET_SCHEDULER_do_work did not find any ready " 2038 "GNUNET_SCHEDULER_do_work did not find any ready "
2033 "tasks and timeout has not been reached yet.\n"); 2039 "tasks and timeout has not been reached yet.\n");
2034 return GNUNET_NO;
2035 } 2040 }
2036 /** 2041 else
2037 * the current timeout was reached but no ready tasks were found, 2042 {
2038 * internal scheduler error! 2043 /**
2039 */ 2044 * the current timeout was reached but no ready tasks were found,
2040 GNUNET_assert (0); 2045 * internal scheduler error!
2041 } 2046 */
2042 2047 GNUNET_assert (0);
2043 /* find out which task priority level we are going to 2048 }
2044 process this time */
2045 max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP;
2046 GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]);
2047 /* yes, p>0 is correct, 0 is "KEEP" which should
2048 * always be an empty queue (see assertion)! */
2049 for (p = GNUNET_SCHEDULER_PRIORITY_COUNT - 1; p > 0; p--)
2050 {
2051 pos = ready_head[p];
2052 if (NULL != pos)
2053 break;
2054 } 2049 }
2055 GNUNET_assert (NULL != pos); /* ready_count wrong? */ 2050 else
2056
2057 /* process all tasks at this priority level, then yield */
2058 while (NULL != (pos = ready_head[p]))
2059 { 2051 {
2060 GNUNET_CONTAINER_DLL_remove (ready_head[p], 2052 /* find out which task priority level we are going to
2061 ready_tail[p], 2053 process this time */
2062 pos); 2054 max_priority_added = GNUNET_SCHEDULER_PRIORITY_KEEP;
2063 ready_count--; 2055 GNUNET_assert (NULL == ready_head[GNUNET_SCHEDULER_PRIORITY_KEEP]);
2064 current_priority = pos->priority; 2056 /* yes, p>0 is correct, 0 is "KEEP" which should
2065 current_lifeness = pos->lifeness; 2057 * always be an empty queue (see assertion)! */
2066 active_task = pos; 2058 for (p = GNUNET_SCHEDULER_PRIORITY_COUNT - 1; p > 0; p--)
2067#if PROFILE_DELAYS
2068 if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us >
2069 DELAY_THRESHOLD.rel_value_us)
2070 { 2059 {
2071 LOG (GNUNET_ERROR_TYPE_DEBUG, 2060 pos = ready_head[p];
2072 "Task %p took %s to be scheduled\n", 2061 if (NULL != pos)
2073 pos, 2062 break;
2074 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time),
2075 GNUNET_YES));
2076 } 2063 }
2077#endif 2064 GNUNET_assert (NULL != pos); /* ready_count wrong? */
2078 tc.reason = pos->reason; 2065
2079 GNUNET_NETWORK_fdset_zero (sh->rs); 2066 /* process all tasks at this priority level, then yield */
2080 GNUNET_NETWORK_fdset_zero (sh->ws); 2067 while (NULL != (pos = ready_head[p]))
2081 // FIXME: do we have to remove FdInfos from fds if they are not ready?
2082 tc.fds_len = pos->fds_len;
2083 tc.fds = pos->fds;
2084 for (unsigned int i = 0; i != pos->fds_len; ++i)
2085 { 2068 {
2086 struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i]; 2069 GNUNET_CONTAINER_DLL_remove (ready_head[p],
2087 if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et)) 2070 ready_tail[p],
2071 pos);
2072 ready_count--;
2073 current_priority = pos->priority;
2074 current_lifeness = pos->lifeness;
2075 active_task = pos;
2076#if PROFILE_DELAYS
2077 if (GNUNET_TIME_absolute_get_duration (pos->start_time).rel_value_us >
2078 DELAY_THRESHOLD.rel_value_us)
2088 { 2079 {
2089 GNUNET_NETWORK_fdset_set_native (sh->rs, 2080 LOG (GNUNET_ERROR_TYPE_DEBUG,
2090 fdi->sock); 2081 "Task %p took %s to be scheduled\n",
2082 pos,
2083 GNUNET_STRINGS_relative_time_to_string (GNUNET_TIME_absolute_get_duration (pos->start_time),
2084 GNUNET_YES));
2091 } 2085 }
2092 if (0 != (GNUNET_SCHEDULER_ET_OUT & fdi->et)) 2086#endif
2087 tc.reason = pos->reason;
2088 GNUNET_NETWORK_fdset_zero (sh->rs);
2089 GNUNET_NETWORK_fdset_zero (sh->ws);
2090 // FIXME: do we have to remove FdInfos from fds if they are not ready?
2091 tc.fds_len = pos->fds_len;
2092 tc.fds = pos->fds;
2093 for (unsigned int i = 0; i != pos->fds_len; ++i)
2093 { 2094 {
2094 GNUNET_NETWORK_fdset_set_native (sh->ws, 2095 struct GNUNET_SCHEDULER_FdInfo *fdi = &pos->fds[i];
2095 fdi->sock); 2096 if (0 != (GNUNET_SCHEDULER_ET_IN & fdi->et))
2097 {
2098 GNUNET_NETWORK_fdset_set_native (sh->rs,
2099 fdi->sock);
2100 }
2101 if (0 != (GNUNET_SCHEDULER_ET_OUT & fdi->et))
2102 {
2103 GNUNET_NETWORK_fdset_set_native (sh->ws,
2104 fdi->sock);
2105 }
2096 } 2106 }
2097 } 2107 tc.read_ready = sh->rs;
2098 tc.read_ready = sh->rs; 2108 tc.write_ready = sh->ws;
2099 tc.write_ready = sh->ws; 2109 LOG (GNUNET_ERROR_TYPE_DEBUG,
2100 LOG (GNUNET_ERROR_TYPE_DEBUG, 2110 "Running task %p\n",
2101 "Running task %p\n", 2111 pos);
2102 pos); 2112 GNUNET_assert (NULL != pos->callback);
2103 GNUNET_assert (NULL != pos->callback); 2113 pos->callback (pos->callback_cls);
2104 pos->callback (pos->callback_cls); 2114 if (NULL != pos->fds)
2105 if (NULL != pos->fds)
2106 {
2107 int del_result = scheduler_driver->del (scheduler_driver->cls, pos);
2108 if (GNUNET_OK != del_result)
2109 { 2115 {
2110 LOG (GNUNET_ERROR_TYPE_ERROR, 2116 int del_result = scheduler_driver->del (scheduler_driver->cls, pos);
2111 "driver could not delete task %p\n", pos); 2117 if (GNUNET_OK != del_result)
2112 GNUNET_assert (0); 2118 {
2119 LOG (GNUNET_ERROR_TYPE_ERROR,
2120 "driver could not delete task %p\n", pos);
2121 GNUNET_assert (0);
2122 }
2113 } 2123 }
2124 active_task = NULL;
2125 dump_backtrace (pos);
2126 destroy_task (pos);
2114 } 2127 }
2115 active_task = NULL;
2116 dump_backtrace (pos);
2117 destroy_task (pos);
2118 } 2128 }
2119 shutdown_if_no_lifeness (); 2129 shutdown_if_no_lifeness ();
2120 if (0 == ready_count) 2130 if (0 == ready_count)
@@ -2164,12 +2174,12 @@ struct GNUNET_SCHEDULER_Handle *
2164GNUNET_SCHEDULER_driver_init (const struct GNUNET_SCHEDULER_Driver *driver) 2174GNUNET_SCHEDULER_driver_init (const struct GNUNET_SCHEDULER_Driver *driver)
2165{ 2175{
2166 struct GNUNET_SCHEDULER_Handle *sh; 2176 struct GNUNET_SCHEDULER_Handle *sh;
2167 struct GNUNET_SCHEDULER_Task tsk;
2168 const struct GNUNET_DISK_FileHandle *pr; 2177 const struct GNUNET_DISK_FileHandle *pr;
2169 2178
2170 /* general set-up */ 2179 /* scheduler must not be running */
2171 GNUNET_assert (NULL == active_task); 2180 GNUNET_assert (NULL == scheduler_driver);
2172 GNUNET_assert (NULL == shutdown_pipe_handle); 2181 GNUNET_assert (NULL == shutdown_pipe_handle);
2182 /* general set-up */
2173 sh = GNUNET_new (struct GNUNET_SCHEDULER_Handle); 2183 sh = GNUNET_new (struct GNUNET_SCHEDULER_Handle);
2174 shutdown_pipe_handle = GNUNET_DISK_pipe (GNUNET_NO, 2184 shutdown_pipe_handle = GNUNET_DISK_pipe (GNUNET_NO,
2175 GNUNET_NO, 2185 GNUNET_NO,
@@ -2204,10 +2214,6 @@ GNUNET_SCHEDULER_driver_init (const struct GNUNET_SCHEDULER_Driver *driver)
2204 /* Setup initial tasks */ 2214 /* Setup initial tasks */
2205 current_priority = GNUNET_SCHEDULER_PRIORITY_DEFAULT; 2215 current_priority = GNUNET_SCHEDULER_PRIORITY_DEFAULT;
2206 current_lifeness = GNUNET_NO; 2216 current_lifeness = GNUNET_NO;
2207 memset (&tsk,
2208 0,
2209 sizeof (tsk));
2210 active_task = &tsk;
2211 install_parent_control_task = 2217 install_parent_control_task =
2212 GNUNET_SCHEDULER_add_now (&install_parent_control_handler, 2218 GNUNET_SCHEDULER_add_now (&install_parent_control_handler,
2213 NULL); 2219 NULL);
@@ -2217,7 +2223,6 @@ GNUNET_SCHEDULER_driver_init (const struct GNUNET_SCHEDULER_Driver *driver)
2217 &shutdown_pipe_cb, 2223 &shutdown_pipe_cb,
2218 NULL); 2224 NULL);
2219 current_lifeness = GNUNET_YES; 2225 current_lifeness = GNUNET_YES;
2220 active_task = NULL;
2221 scheduler_driver->set_wakeup (scheduler_driver->cls, 2226 scheduler_driver->set_wakeup (scheduler_driver->cls,
2222 get_timeout ()); 2227 get_timeout ());
2223 /* begin main event loop */ 2228 /* begin main event loop */
diff --git a/src/util/strings.c b/src/util/strings.c
index 5ed195933..ea3c8cfb9 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -11,7 +11,7 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 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/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/ 17*/
@@ -1947,27 +1947,27 @@ static char *cvt =
1947/** 1947/**
1948 * Encode into Base64. 1948 * Encode into Base64.
1949 * 1949 *
1950 * @param data the data to encode 1950 * @param in the data to encode
1951 * @param len the length of the input 1951 * @param len the length of the input
1952 * @param output where to write the output (*output should be NULL, 1952 * @param output where to write the output (*output should be NULL,
1953 * is allocated) 1953 * is allocated)
1954 * @return the size of the output 1954 * @return the size of the output
1955 */ 1955 */
1956size_t 1956size_t
1957GNUNET_STRINGS_base64_encode (const char *data, 1957GNUNET_STRINGS_base64_encode (const void *in,
1958 size_t len, 1958 size_t len,
1959 char **output) 1959 char **output)
1960{ 1960{
1961 size_t i; 1961 const char *data = in;
1962 char c;
1963 size_t ret; 1962 size_t ret;
1964 char *opt; 1963 char *opt;
1965 1964
1966 ret = 0; 1965 ret = 0;
1967 opt = GNUNET_malloc (2 + (len * 4 / 3) + 8); 1966 opt = GNUNET_malloc (2 + (len * 4 / 3) + 8);
1968 *output = opt; 1967 for (size_t i = 0; i < len; ++i)
1969 for (i = 0; i < len; ++i)
1970 { 1968 {
1969 char c;
1970
1971 c = (data[i] >> 2) & 0x3f; 1971 c = (data[i] >> 2) & 0x3f;
1972 opt[ret++] = cvt[(int) c]; 1972 opt[ret++] = cvt[(int) c];
1973 c = (data[i] << 4) & 0x3f; 1973 c = (data[i] << 4) & 0x3f;
@@ -1997,6 +1997,7 @@ GNUNET_STRINGS_base64_encode (const char *data,
1997 } 1997 }
1998 } 1998 }
1999 opt[ret++] = FILLCHAR; 1999 opt[ret++] = FILLCHAR;
2000 *output = opt;
2000 return ret; 2001 return ret;
2001} 2002}
2002 2003
@@ -2018,11 +2019,10 @@ GNUNET_STRINGS_base64_encode (const char *data,
2018 */ 2019 */
2019size_t 2020size_t
2020GNUNET_STRINGS_base64_decode (const char *data, 2021GNUNET_STRINGS_base64_decode (const char *data,
2021 size_t len, char **output) 2022 size_t len,
2023 void **out)
2022{ 2024{
2023 size_t i; 2025 char *output;
2024 char c;
2025 char c1;
2026 size_t ret = 0; 2026 size_t ret = 0;
2027 2027
2028#define CHECK_CRLF while (data[i] == '\r' || data[i] == '\n') {\ 2028#define CHECK_CRLF while (data[i] == '\r' || data[i] == '\n') {\
@@ -2031,12 +2031,15 @@ GNUNET_STRINGS_base64_decode (const char *data,
2031 if (i >= len) goto END; \ 2031 if (i >= len) goto END; \
2032 } 2032 }
2033 2033
2034 *output = GNUNET_malloc ((len * 3 / 4) + 8); 2034 output = GNUNET_malloc ((len * 3 / 4) + 8);
2035 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2035 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2036 "base64_decode decoding len=%d\n", 2036 "base64_decode decoding len=%d\n",
2037 (int) len); 2037 (int) len);
2038 for (i = 0; i < len; ++i) 2038 for (size_t i = 0; i < len; ++i)
2039 { 2039 {
2040 char c;
2041 char c1;
2042
2040 CHECK_CRLF; 2043 CHECK_CRLF;
2041 if (FILLCHAR == data[i]) 2044 if (FILLCHAR == data[i])
2042 break; 2045 break;
@@ -2045,7 +2048,7 @@ GNUNET_STRINGS_base64_decode (const char *data,
2045 CHECK_CRLF; 2048 CHECK_CRLF;
2046 c1 = (char) cvtfind (data[i]); 2049 c1 = (char) cvtfind (data[i]);
2047 c = (c << 2) | ((c1 >> 4) & 0x3); 2050 c = (c << 2) | ((c1 >> 4) & 0x3);
2048 (*output)[ret++] = c; 2051 output[ret++] = c;
2049 if (++i < len) 2052 if (++i < len)
2050 { 2053 {
2051 CHECK_CRLF; 2054 CHECK_CRLF;
@@ -2054,7 +2057,7 @@ GNUNET_STRINGS_base64_decode (const char *data,
2054 break; 2057 break;
2055 c = (char) cvtfind (c); 2058 c = (char) cvtfind (c);
2056 c1 = ((c1 << 4) & 0xf0) | ((c >> 2) & 0xf); 2059 c1 = ((c1 << 4) & 0xf0) | ((c >> 2) & 0xf);
2057 (*output)[ret++] = c1; 2060 output[ret++] = c1;
2058 } 2061 }
2059 if (++i < len) 2062 if (++i < len)
2060 { 2063 {
@@ -2065,15 +2068,13 @@ GNUNET_STRINGS_base64_decode (const char *data,
2065 2068
2066 c1 = (char) cvtfind (c1); 2069 c1 = (char) cvtfind (c1);
2067 c = ((c << 6) & 0xc0) | c1; 2070 c = ((c << 6) & 0xc0) | c1;
2068 (*output)[ret++] = c; 2071 output[ret++] = c;
2069 } 2072 }
2070 } 2073 }
2071END: 2074END:
2075 *out = output;
2072 return ret; 2076 return ret;
2073} 2077}
2074 2078
2075 2079
2076
2077
2078
2079/* end of strings.c */ 2080/* end of strings.c */