aboutsummaryrefslogtreecommitdiff
path: root/doc/documentation
diff options
context:
space:
mode:
Diffstat (limited to 'doc/documentation')
-rw-r--r--doc/documentation/.gitignore9
-rw-r--r--doc/documentation/Makefile.am245
-rw-r--r--doc/documentation/TODO106
-rw-r--r--doc/documentation/agpl-3.0.texi698
-rw-r--r--doc/documentation/chapters/configuration.texi5
-rw-r--r--doc/documentation/chapters/contributing.texi117
-rw-r--r--doc/documentation/chapters/developer.texi8817
-rw-r--r--doc/documentation/chapters/installation.texi2233
-rw-r--r--doc/documentation/chapters/keyconcepts.texi317
-rw-r--r--doc/documentation/chapters/philosophy.texi81
-rw-r--r--doc/documentation/chapters/preface.texi173
-rw-r--r--doc/documentation/chapters/user.texi2293
-rw-r--r--doc/documentation/chapters/vocabulary.texi72
-rw-r--r--doc/documentation/docstyle.css76
-rw-r--r--doc/documentation/fdl-1.3.texi505
-rwxr-xr-xdoc/documentation/gendocs.sh504
-rw-r--r--doc/documentation/gendocs_template91
-rw-r--r--doc/documentation/gendocs_template_min93
-rw-r--r--doc/documentation/gnunet-c-tutorial.texi1559
-rw-r--r--doc/documentation/gnunet.texi247
-rw-r--r--doc/documentation/gpl-3.0.texi717
-rw-r--r--doc/documentation/htmlxref.cnf668
-rw-r--r--doc/documentation/images/daemon_lego_block.pngbin7636 -> 0 bytes
-rw-r--r--doc/documentation/images/daemon_lego_block.svg126
-rw-r--r--doc/documentation/images/gns.dot42
-rw-r--r--doc/documentation/images/gns.eps585
-rw-r--r--doc/documentation/images/gns.jpgbin41765 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-0-10-peerinfo.pngbin80127 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-fs-gtk-0-10-star-tab.pngbin63464 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-download-area.pngbin7634 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs-menu.pngbin8614 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs-publish-editing.pngbin55507 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs-publish-select.pngbin43448 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs-publish-with-file.pngbin27371 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs-publish-with-file_0.pngbin27371 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs-publish.pngbin26496 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs-published.pngbin59635 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs-search.pngbin72151 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-fs.pngbin55706 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-gns-a-done.pngbin30880 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-gns-a.pngbin29895 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-gns.pngbin63783 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-identity.pngbin62404 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-search-selected.pngbin104599 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-gtk-0-10-traffic.pngbin68515 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-namestore-gtk-phone.pngbin32631 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-namestore-gtk-vpn.pngbin35836 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-setup-exit.pngbin30062 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-tutorial-service.pngbin40142 -> 0 bytes
-rw-r--r--doc/documentation/images/gnunet-tutorial-system.pngbin46982 -> 0 bytes
-rw-r--r--doc/documentation/images/iceweasel-preferences.pngbin57047 -> 0 bytes
-rw-r--r--doc/documentation/images/iceweasel-proxy.pngbin38773 -> 0 bytes
-rw-r--r--doc/documentation/images/lego_stack.svg737
-rw-r--r--doc/documentation/images/service_lego_block.pngbin15157 -> 0 bytes
-rw-r--r--doc/documentation/images/service_lego_block.svg345
-rw-r--r--doc/documentation/images/service_stack.pngbin18862 -> 0 bytes
-rw-r--r--doc/documentation/images/structure.dot124
-rw-r--r--doc/documentation/index.html58
-rwxr-xr-xdoc/documentation/run-gendocs.sh18
-rw-r--r--doc/documentation/testbed_test.c99
-rw-r--r--doc/documentation/tutorial-examples/001.c29
-rw-r--r--doc/documentation/tutorial-examples/002.c17
-rw-r--r--doc/documentation/tutorial-examples/003.c11
-rw-r--r--doc/documentation/tutorial-examples/004.c5
-rw-r--r--doc/documentation/tutorial-examples/005.c9
-rw-r--r--doc/documentation/tutorial-examples/006.c31
-rw-r--r--doc/documentation/tutorial-examples/007.c10
-rw-r--r--doc/documentation/tutorial-examples/008.c22
-rw-r--r--doc/documentation/tutorial-examples/009.c9
-rw-r--r--doc/documentation/tutorial-examples/010.c8
-rw-r--r--doc/documentation/tutorial-examples/011.c8
-rw-r--r--doc/documentation/tutorial-examples/012.c4
-rw-r--r--doc/documentation/tutorial-examples/013.1.c3
-rw-r--r--doc/documentation/tutorial-examples/013.c12
-rw-r--r--doc/documentation/tutorial-examples/014.c9
-rw-r--r--doc/documentation/tutorial-examples/015.c8
-rw-r--r--doc/documentation/tutorial-examples/016.c4
-rw-r--r--doc/documentation/tutorial-examples/017.c4
-rw-r--r--doc/documentation/tutorial-examples/018.c2
-rw-r--r--doc/documentation/tutorial-examples/019.c18
-rw-r--r--doc/documentation/tutorial-examples/020.c25
-rw-r--r--doc/documentation/tutorial-examples/021.c13
-rw-r--r--doc/documentation/tutorial-examples/022.c8
-rw-r--r--doc/documentation/tutorial-examples/023.c17
-rw-r--r--doc/documentation/tutorial-examples/024.c9
-rw-r--r--doc/documentation/tutorial-examples/025.Makefile.am15
-rw-r--r--doc/documentation/tutorial-examples/026.c52
87 files changed, 0 insertions, 22122 deletions
diff --git a/doc/documentation/.gitignore b/doc/documentation/.gitignore
deleted file mode 100644
index f490c3412..000000000
--- a/doc/documentation/.gitignore
+++ /dev/null
@@ -1,9 +0,0 @@
1stamp-1
2version2.texi
3manual
4*.fn
5*.fns
6*.ky
7*.pg
8*.tp
9*.vr
diff --git a/doc/documentation/Makefile.am b/doc/documentation/Makefile.am
deleted file mode 100644
index cd3fca854..000000000
--- a/doc/documentation/Makefile.am
+++ /dev/null
@@ -1,245 +0,0 @@
1# This Makefile.am is in the public domain
2docdir = $(datadir)/doc/gnunet/
3
4infoimagedir = $(infodir)/images
5
6#DOT_FILES = images/$(wildcard *.dot)
7
8#DOT_VECTOR_GRAPHICS = \
9# $(DOT_FILES:%.dot=%.eps) \
10# $(DOT_FILES:%.dot=%.pdf)
11
12AM_MAKEINFOHTMLFLAGS = --no-split --css-ref=docstyle.css
13
14dist_infoimage_DATA = \
15 images/gnunet-gtk-0-10-gns-a-done.png \
16 images/gnunet-gtk-0-10-gns-a.png \
17 images/daemon_lego_block.png \
18 images/gnunet-gtk-0-10-gns.png \
19 images/gnunet-0-10-peerinfo.png \
20 images/gnunet-gtk-0-10-identity.png \
21 images/gnunet-fs-gtk-0-10-star-tab.png \
22 images/gnunet-gtk-0-10-download-area.png \
23 images/gnunet-gtk-0-10-search-selected.png \
24 images/gnunet-gtk-0-10-fs-menu.png \
25 images/gnunet-gtk-0-10-traffic.png \
26 images/gnunet-gtk-0-10-fs.png \
27 images/gnunet-namestore-gtk-phone.png \
28 images/gnunet-gtk-0-10-fs-publish-editing.png \
29 images/gnunet-namestore-gtk-vpn.png \
30 images/gnunet-gtk-0-10-fs-published.png \
31 images/gnunet-setup-exit.png \
32 images/gnunet-gtk-0-10-fs-publish.png \
33 images/iceweasel-preferences.png \
34 images/gnunet-gtk-0-10-fs-publish-select.png \
35 images/iceweasel-proxy.png \
36 images/gnunet-gtk-0-10-fs-publish-with-file_0.png \
37 images/service_lego_block.png \
38 images/gnunet-gtk-0-10-fs-publish-with-file.png \
39 images/service_stack.png \
40 images/gnunet-gtk-0-10-fs-search.png \
41 images/gnunet-tutorial-service.png \
42 images/gnunet-tutorial-system.png \
43 images/daemon_lego_block.svg \
44 images/lego_stack.svg \
45 images/service_lego_block.svg \
46 images/structure.dot \
47 images/gns.dot
48
49# images/$(wildcard *.png) \
50# images/$(wildcard *.svg)
51# $(DOT_FILES:%.dot=%.png)
52
53#DOT_OPTIONS = \
54# -Gratio=.9 -Gnodesep=.005 -Granksep=.00005 \
55# -Nfontsite=9 -Nheight=.1 -Nwidth=.1
56
57# .dot.png:
58# $(AM_V_DOT)$(DOT) -Tpng $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
59# mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
60
61# .dot.pdf:
62# $(AM_V_DOT)$(DOT) -Tpdf $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
63# mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
64
65# .dot.eps:
66# $(AM_V_DOT)$(DOT) -Teps $(DOT_OPTIONS) < "$<" > "$(srcdir)/$@.tmp"; \
67# mv "$(srcdir)/$@.tmp" "$(srcdir)/$@"
68
69# .png.eps:
70# $(AM_V_GEN)convert "$<" "$@-tmp.eps"; \
71# mv "$@-tmp.eps" "$@"
72
73# pdf-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.pdf)
74# info-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.png)
75# ps-local: $(DOT_FILES=%.dot=$(top_srcdir)/%.eps) \
76# $(top_srcdir)/%D%/images/coreutils-size-map.eps
77# dvi-local: ps-local
78
79
80gnunet_tutorial_examples = \
81 tutorial-examples/001.c \
82 tutorial-examples/002.c \
83 tutorial-examples/003.c \
84 tutorial-examples/004.c \
85 tutorial-examples/005.c \
86 tutorial-examples/006.c \
87 tutorial-examples/007.c \
88 tutorial-examples/008.c \
89 tutorial-examples/009.c \
90 tutorial-examples/010.c \
91 tutorial-examples/011.c \
92 tutorial-examples/012.c \
93 tutorial-examples/013.c \
94 tutorial-examples/013.1.c \
95 tutorial-examples/014.c \
96 tutorial-examples/015.c \
97 tutorial-examples/016.c \
98 tutorial-examples/017.c \
99 tutorial-examples/018.c \
100 tutorial-examples/019.c \
101 tutorial-examples/020.c \
102 tutorial-examples/021.c \
103 tutorial-examples/022.c \
104 tutorial-examples/023.c \
105 tutorial-examples/024.c \
106 tutorial-examples/025.Makefile.am \
107 tutorial-examples/026.c
108
109info_TEXINFOS = \
110 gnunet.texi \
111 gnunet-c-tutorial.texi
112
113gnunet_TEXINFOS = \
114 chapters/developer.texi \
115 chapters/preface.texi \
116 chapters/philosophy.texi \
117 chapters/installation.texi \
118 chapters/user.texi \
119 chapters/vocabulary.texi \
120 chapters/configuration.texi \
121 chapters/contributing.texi \
122 fdl-1.3.texi \
123 gpl-3.0.texi
124
125EXTRA_DIST = \
126 $(gnunet_TEXINFOS) \
127 $(gnunet_tutorial_examples) \
128 htmlxref.cnf \
129 gversion.texi
130 run-gendocs.sh \
131 docstyle.css
132
133
134# $(DOT_FILES) \
135# $(DOT_VECTOR_GRAPHICS)
136
137DISTCLEANFILES = \
138 gnunet.cps \
139 gnunet-c-tutorial.cps \
140 chapters/developer.cps \
141 chapters/installation.cps \
142 chapter/philosophy.cps \
143 chapters/user.cps \
144 chapters/configuration.cps \
145 chapters/terminology.cps \
146 chapters/vocabulary.cps \
147 fdl-1.3.cps \
148 agpl-3.0.cps \
149 gpl-3.0.cps
150
151# if HAVE_EXTENDED_DOCUMENTATION_BUILDING
152daemon_lego_block.png: images/daemon_lego_block.svg
153 convert images/daemon_lego_block.svg images/daemon_lego_block.png &&
154 pngcrush images/daemon_lego_block.png images/daemon_lego_block.png
155
156service_lego_block.png: images/service_lego_block.svg
157 convert images/service_lego_block.svg images/service_lego_block.png &&
158 pngcrush images/service_lego_block.png images/serivce_lego_block.png
159
160lego_stack.png: images/lego_stack.svg
161 convert images/lego_stack.svg images/lego_stack.png &&
162 pngcrush images/lego_stack.png images/lego_stack.png
163
164# XXX: is this sed invocation portable enough? otherwise try tr(1).
165version.texi/replacement: version.texi/replacement/revert
166 @sed -i "s/GPACKAGE_VERSION/$(PACKAGE_VERSION)/g" gversion.texi
167
168version.texi/replacement/revert:
169 @echo "@set VERSION GPACKAGE_VERSION" > gversion.texi
170 @echo "@set EDITION GPACKAGE_VERSION" >> gversion.texi
171
172if SECTION7
173gnunet-c-tutorial.7: version.texi/replacement
174 @echo Attempting to output an mdoc formatted section 7 document
175 @texi2mdoc -I$(pwd):$(pwd)/chapters gnunet-c-tutorial.texi > ../man/gnunet-c-tutorial.7
176
177gnunet-documentation.7: version.texi/replacement
178 @echo Attempting to output an mdoc formatted section 7 document
179 @texi2mdoc -I$(pwd):$(pwd)/chapters gnunet.texi > ../man/gnunet-documentation.7
180
181# TODO: (Maybe) other outputs resulting from this.
182endif
183
184# FIXME: rm *.html and *.pdf
185#doc-clean:
186# @rm *.aux *.log *.toc *.cp *.cps
187
188all: version.texi/replacement
189
190doc-all-install:
191 @mkdir -p $(DESTDIR)/$(docdir)
192 @mkdir -p $(DESTDIR)/$(infoimagedir)
193 @mkdir -p $(DESTDIR)/$(infodir)
194 @install -m 0755 gnunet.pdf $(DESTDIR)/$(docdir)
195 @install -m 0755 gnunet-c-tutorial.pdf $(DESTDIR)/$(docdir)
196 @install -m 0755 gnunet-c-tutorial.info $(DESTDIR)/$(infodir)
197 @install -m 0755 gnunet.info $(DESTDIR)/$(infodir)
198 @install gnunet.html $(DESTDIR)/$(docdir)
199 @install gnunet-c-tutorial.html $(DESTDIR)/$(docdir)
200
201doc-gendoc-install:
202 @mkdir -p $(DESTDIR)/$(docdir)
203 @cp -r manual $(DESTDIR)/$(docdir)
204
205# @cp -r images $(DESTDIR)/$(infoimagedir)
206
207dev-build: version.texi/replacement
208 @makeinfo --pdf gnunet.texi
209 @makeinfo --pdf gnunet-c-tutorial.texi
210 @makeinfo --html gnunet.texi
211 @makeinfo --html gnunet-c-tutorial.texi
212 @makeinfo --no-split gnunet.texi
213 @makeinfo --no-split gnunet-c-tutorial.texi
214
215# TODO: Add more to clean.
216clean: version.texi/replacement/revert
217 @rm -f gnunet.pdf
218 @rm -f gnunet.html
219 @rm -f gnunet.info
220 @rm -f gnunet.info-1
221 @rm -f gnunet.info-2
222 @rm -f gnunet.info-3
223 @rm -f gnunet-c-tutorial.pdf
224 @rm -f gnunet-c-tutorial.info
225 @rm -f gnunet-c-tutorial.html
226 @rm -fr gnunet.t2p
227 @rm -fr gnunet-c-tutorial.t2p
228 @rm -fr manual
229
230# CLEANFILES = \
231# gnunet.log \
232# gnunet-c-tutorial.log \
233# $(wildcard *.aux) \
234# $(wildcard *.toc) \
235# $(wildcard *.cp) \
236# $(wildcard *.cps)
237
238#.PHONY: version.texi
239# if HAVE_EXTENDED_DOCUMENTATION_BUILDING_PDF
240
241# if HAVE_EXTENDED_DOCUMENTATION_BUILDING_HTML
242
243# endif
244# endif
245# endif
diff --git a/doc/documentation/TODO b/doc/documentation/TODO
deleted file mode 100644
index fa1ce7a23..000000000
--- a/doc/documentation/TODO
+++ /dev/null
@@ -1,106 +0,0 @@
1-*- mode: org -*-
2
3TODO - or: the Documentation Masterplan.
4
5To some extent this duplicates the Mantis tickets on this topic.
6
7* Motivation
8My motivation is to read into good documentations and create a self-contained collection of books,
9which can be understood without expecting too much background knowledge in every topic.
10** User Handbook:
11The content of the User book should be mostly concerned with our current and future graphical (gtk
12as well as terminal user interface) applications. After reading Preface and maybe Philosophy, the
13person reading the User Handbook should understand with the least possible strugle the application
14they intend to use. Examples should be given and concepts explained.
15** Installation Handbook:
16As seen with requests on the mailinglist, we will have to pick up people where they are, similar
17to the User Handbook. People already used to compiling and installing should have the chance to
18skip to the end, everyone else should: have step-by-step instructions, which will either already
19include OS specific notes or will be followed by OS specific instructions. It is up for discussion
20if configuring GNUnet is 'User Handbook' or 'Installation Handbook', the current mixture in
21the Installation Handbook is not good.
22** Contributors Handbook:
23This chapter could either be reduced to a couple of sections following the theme of 'contributing
24to GNUnet' or the chapter could be extended. If we extend it, we should explain a range of topics
25that can be useful for contributors. It can be understood as a recommended reading in addition to
26the Developer Handbook then, and the Developer Handbook could simply become a better commented
27reference for the code-base.
28** Developer Handbook:
29As outlined in the last sentences, the Developer Handbook could be reduced to the necessary bits
30with enough comments to be understood without reading into the papers published over the years.
31
32
33* DONE 1. Drupal books export to LaTeX.
34* DONE 2. LaTeX conversion to Texinfo.
35* DONE 3. (initial) Fixup of syntax errors introduced in conversion chain.
36* TODO 4. Update content.
37* TODO 5. Create API Reference or similar
38* TODO 6. Create Concept Index
39* TODO 7. Create Procedure Index
40* TODO 8. Create Type Index
41* TODO 9. Create Functions Index
42* TODO 10. Properly address concerns and criticism people had/have on the old and current documentation.
43* TODO 11. Reorder structure
44* TODO more TODO.
45
46
47* Status Progress / Completion Levels
48
49** chapters/philosophy: around 100% fixed after initial export.
50
51* System Integration Tasks
52
53* Which Texlive modules are needed for every output we generate?
54* Generate the images from their dot sources.
55
56* How to use (hack) on this
57
58This section will find its way into the documentation sooner or later.
59Potentially outdated or inaccurate bits.
60
61** with guix
62
63Adjust accordingly, ie read the Guix Documentation:
64guix environment gnunet-doc
65and
66guix build -f contrib/packages/guix/gnunet-doc.scm
67
68** without guix
69
70You need to have Texinfo and Texlive in your path.
71sh bootstrap
72./configure --enable-documentation
73cd doc
74make (format you want)
75
76for example: make html, make info, make pdf
77
78* structure (relations) (old!)
79
80** gnunet.texi
81 -> chapters/developer.texi
82 -> chapters/installation.texi
83 -> chapters/philosophy.texi
84 -> chapters/user.texi
85 -> chapters/vocabulary.texi
86 -> images/*
87 -> gpl-3.0.texi
88 -> fdl-1.3.texi
89
90** gnunet-c-tutorial.texi
91 -> figs/Service.pdf
92 -> figs/System.pdf
93 -> tutorial-examples/*.c
94 -> gpl-3.0.texi
95 -> fdl-1.3.texi
96
97- gnunet-c-tutorial-v1.pdf: original LaTeX "gnunet-c-tutorial.pdf".
98- man folder: the man pages.
99- doxygen folder
100- outdated-and-old-installation-instructions.txt: self described within the file.
101
102
103Use `gendocs', add to the manual/ directory of the web site.
104
105 $ cd doc
106 $ gendocs.sh gnunet "GNUnet 0.10.X Reference Manual"
diff --git a/doc/documentation/agpl-3.0.texi b/doc/documentation/agpl-3.0.texi
deleted file mode 100644
index eabb0c6df..000000000
--- a/doc/documentation/agpl-3.0.texi
+++ /dev/null
@@ -1,698 +0,0 @@
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/configuration.texi b/doc/documentation/chapters/configuration.texi
deleted file mode 100644
index 286c72e7a..000000000
--- a/doc/documentation/chapters/configuration.texi
+++ /dev/null
@@ -1,5 +0,0 @@
1@node Configuration Handbook
2@chapter Configuration Handbook
3
4This chapter has yet to be written. It is intended to be about in-depth
5configuration of GNUnet.
diff --git a/doc/documentation/chapters/contributing.texi b/doc/documentation/chapters/contributing.texi
deleted file mode 100644
index f4493e6c1..000000000
--- a/doc/documentation/chapters/contributing.texi
+++ /dev/null
@@ -1,117 +0,0 @@
1@node GNUnet Contributors Handbook
2@chapter GNUnet Contributors Handbook
3
4@menu
5* Contributing to GNUnet::
6* Licenses of contributions::
7* Copyright Assignment::
8* Contributing to the Reference Manual::
9* Contributing testcases::
10@end menu
11
12@node Contributing to GNUnet
13@section Contributing to GNUnet
14
15@cindex licenses
16@cindex licenses of contributions
17@node Licenses of contributions
18@section Licenses of contributions
19
20GNUnet is a @uref{https://www.gnu.org/, GNU} package.
21All code contributions must thus be put under the
22@uref{https://www.gnu.org/licenses/agpl.html, GNU Affero Public License (AGPL)}.
23All documentation should be put under FSF approved licenses
24(see @uref{https://www.gnu.org/copyleft/fdl.html, fdl}).
25
26By submitting documentation, translations, and other content to GNUnet
27you automatically grant the right to publish code under the
28GNU Public License and documentation under either or both the
29GNU Public License or the GNU Free Documentation License.
30When contributing to the GNUnet project, GNU standards and the
31@uref{https://www.gnu.org/philosophy/philosophy.html, GNU philosophy}
32should be adhered to.
33
34@cindex copyright assignment
35@node Copyright Assignment
36@section Copyright Assignment
37We require a formal copyright assignment for GNUnet contributors
38to GNUnet e.V.; nevertheless, we do allow pseudonymous contributions.
39By signing the copyright agreement and submitting your code (or
40documentation) to us, you agree to share the rights to your code
41with GNUnet e.V.; GNUnet e.V. receives non-exclusive ownership
42rights, and in particular is allowed to dual-license the code. You
43retain non-exclusive rights to your contributions, so you can also
44share your contributions freely with other projects.
45
46GNUnet e.V. will publish all accepted contributions under the AGPLv3
47or any later version. The association may decide to publish
48contributions under additional licenses (dual-licensing).
49
50We do not intentionally remove your name from your contributions;
51however, due to extensive editing it is not always trivial to
52attribute contributors properly. If you find that you significantly
53contributed to a file (or the project as a whole) and are not listed
54in the respective authors file or section, please do let us know.
55
56@node Contributing to the Reference Manual
57@section Contributing to the Reference Manual
58
59@itemize @bullet
60
61@item When writing documentation, please use
62@uref{https://en.wikipedia.org/wiki/Singular_they, gender-neutral wording}
63when referring to people, such as singular “they”, “their”, “them”, and so
64forth.
65
66@item Keep line length below 74 characters, except for URLs.
67URLs break in the PDF output when they contain linebreaks.
68
69@item Do not use tab characters (see chapter 2.1 texinfo manual)
70
71@item Write texts in the third person perspective.
72
73@c FIXME: This is questionable, it feels like bike shed painging to do
74@c this for several k lines. It only helps to jump between sentences in
75@c editors afaik.
76@c @item Use 2 spaces between sentences, so instead of:
77
78@c @example
79@c We do this and the other thing. This is done by foo.
80@c @end example
81
82@c Write:
83
84@c @example
85@c We do this and the other thing. This is done by foo.
86@c @end example
87
88@end itemize
89
90@node Contributing testcases
91@section Contributing testcases
92
93In the core of gnunet, we restrict new testcases to a small subset
94of languages, in order of preference:
95@enumerate
96@item C
97@item Portable Shell Scripts
98@item Python (@geq{}3.6)
99@end enumerate
100
101We welcome efforts to remove our existing python-2.7 scripts to
102replace them either with portable shell scripts or,
103at your choice, python-3.6+.
104
105If you contribute new python based testcases, we advise you to
106not repeat our past misfortunes and write the tests in a standard
107test framework like for example pytest.
108
109For writing portable shell scripts, these tools are useful:
110@uref{https://github.com/koalaman/shellcheck, Shellcheck},
111@uref{https://salsa.debian.org/debian/devscripts/blob/master/scripts/checkbashisms.pl, checkbashisms},
112@uref{http://www.etalabs.net/sh_tricks.html},
113@uref{https://wiki.ubuntu.com/DashAsBinSh},
114and @uref{https://mywiki.wooledge.org/Bashism}
115
116@c You could also run "bin/check_shell_script" (which we still have
117@c to write).
diff --git a/doc/documentation/chapters/developer.texi b/doc/documentation/chapters/developer.texi
deleted file mode 100644
index d9c92247b..000000000
--- a/doc/documentation/chapters/developer.texi
+++ /dev/null
@@ -1,8817 +0,0 @@
1@c ***********************************************************************
2@node GNUnet Developer Handbook
3@chapter GNUnet Developer Handbook
4
5This book is intended to be an introduction for programmers that want to
6extend the GNUnet framework. GNUnet is more than a simple peer-to-peer
7application.
8
9For developers, GNUnet is:
10
11@itemize @bullet
12@item developed by a community that believes in the GNU philosophy
13@item Free Software (Free as in Freedom), licensed under the
14GNU Affero General Public License
15(@uref{https://www.gnu.org/licenses/licenses.html#AGPL})
16@item A set of standards, including coding conventions and
17architectural rules
18@item A set of layered protocols, both specifying the communication
19between peers as well as the communication between components
20of a single peer
21@item A set of libraries with well-defined APIs suitable for
22writing extensions
23@end itemize
24
25In particular, the architecture specifies that a peer consists of many
26processes communicating via protocols. Processes can be written in almost
27any language.
28@code{C}, @code{Java} and @code{Guile} APIs exist for accessing existing
29services and for writing extensions.
30It is possible to write extensions in other languages by
31implementing the necessary IPC protocols.
32
33GNUnet can be extended and improved along many possible dimensions, and
34anyone interested in Free Software and Freedom-enhancing Networking is
35welcome to join the effort. This Developer Handbook attempts to provide
36an initial introduction to some of the key design choices and central
37components of the system.
38This part of the GNUNet documentation is far from complete,
39and we welcome informed contributions, be it in the form of
40new chapters, sections or insightful comments.
41
42@menu
43* Developer Introduction::
44* Internal dependencies::
45* Code overview::
46* System Architecture::
47* Subsystem stability::
48* Naming conventions and coding style guide::
49* Build-system::
50* Developing extensions for GNUnet using the gnunet-ext template::
51* Writing testcases::
52* Building GNUnet and its dependencies::
53* TESTING library::
54* Performance regression analysis with Gauger::
55* TESTBED Subsystem::
56* libgnunetutil::
57* Automatic Restart Manager (ARM)::
58* TRANSPORT Subsystem::
59* NAT library::
60* Distance-Vector plugin::
61* SMTP plugin::
62* Bluetooth plugin::
63* WLAN plugin::
64* ATS Subsystem::
65* CORE Subsystem::
66* CADET Subsystem::
67* NSE Subsystem::
68* HOSTLIST Subsystem::
69* IDENTITY Subsystem::
70* NAMESTORE Subsystem::
71* PEERINFO Subsystem::
72* PEERSTORE Subsystem::
73* SET Subsystem::
74* STATISTICS Subsystem::
75* Distributed Hash Table (DHT)::
76* GNU Name System (GNS)::
77* GNS Namecache::
78* REVOCATION Subsystem::
79* File-sharing (FS) Subsystem::
80* REGEX Subsystem::
81* REST Subsystem::
82@end menu
83
84@node Developer Introduction
85@section Developer Introduction
86
87This Developer Handbook is intended as first introduction to GNUnet for
88new developers that want to extend the GNUnet framework. After the
89introduction, each of the GNUnet subsystems (directories in the
90@file{src/} tree) is (supposed to be) covered in its own chapter. In
91addition to this documentation, GNUnet developers should be aware of the
92services available on the GNUnet server to them.
93
94New developers can have a look a the GNUnet tutorials for C and java
95available in the @file{src/} directory of the repository or under the
96following links:
97
98@c ** FIXME: Link to files in source, not online.
99@c ** FIXME: Where is the Java tutorial?
100@itemize @bullet
101@item @xref{Top, Introduction,, gnunet-c-tutorial, The GNUnet C Tutorial}.
102@c broken link
103@c @item @uref{https://gnunet.org/git/gnunet.git/plain/doc/gnunet-c-tutorial.pdf, GNUnet C tutorial}
104@item GNUnet Java tutorial
105@end itemize
106
107In addition to the GNUnet Reference Documentation you are reading,
108the GNUnet server at @uref{https://gnunet.org} contains
109various resources for GNUnet developers and those
110who aspire to become regular contributors.
111They are all conveniently reachable via the "Developer"
112entry in the navigation menu. Some additional tools (such as static
113analysis reports) require a special developer access to perform certain
114operations. If you want (or require) access, you should contact
115@uref{http://grothoff.org/christian/, Christian Grothoff},
116GNUnet's maintainer.
117
118@c FIXME: A good part of this belongs on the website or should be
119@c extended in subsections explaining usage of this. A simple list
120@c is just taking space people have to read.
121The public subsystems on the GNUnet server that help developers are:
122
123@itemize @bullet
124
125@item The version control system (git) keeps our code and enables
126distributed development.
127It is publicly accessible at @uref{https://gnunet.org/git/}.
128Only developers with write access can commit code, everyone else is
129encouraged to submit patches to the GNUnet-developers mailinglist:
130@uref{https://lists.gnu.org/mailman/listinfo/gnunet-developers, https://lists.gnu.org/mailman/listinfo/gnunet-developers}
131
132@item The bugtracking system (Mantis).
133We use it to track feature requests, open bug reports and their
134resolutions.
135It can be accessed at
136@uref{https://gnunet.org/bugs/, https://gnunet.org/bugs/}.
137Anyone can report bugs.
138
139@item Our site installation of the
140Continuous Integration (CI) system @code{Buildbot} is used
141to check GNUnet builds automatically on a range of platforms.
142The web interface of this CI is exposed at
143@uref{https://gnunet.org/buildbot/, https://gnunet.org/buildbot/}.
144Builds are triggered automatically 30 minutes after the last commit to
145our repository was made.
146
147@item The current quality of our automated test suite is assessed using
148Code coverage analysis. This analysis is run daily; however the webpage
149is only updated if all automated tests pass at that time. Testcases that
150improve our code coverage are always welcome.
151
152@item We try to automatically find bugs using a static analysis scan.
153This scan is run daily; however the webpage is only updated if all
154automated tests pass at the time. Note that not everything that is
155flagged by the analysis is a bug, sometimes even good code can be marked
156as possibly problematic. Nevertheless, developers are encouraged to at
157least be aware of all issues in their code that are listed.
158
159@item We use Gauger for automatic performance regression visualization.
160@c FIXME: LINK!
161Details on how to use Gauger are here.
162
163@item We use @uref{http://junit.org/, junit} to automatically test
164@command{gnunet-java}.
165Automatically generated, current reports on the test suite are here.
166@c FIXME: Likewise.
167
168@item We use Cobertura to generate test coverage reports for gnunet-java.
169Current reports on test coverage are here.
170@c FIXME: Likewise.
171
172@end itemize
173
174
175
176@c ***********************************************************************
177@menu
178* Project overview::
179@end menu
180
181@node Project overview
182@subsection Project overview
183
184The GNUnet project consists at this point of several sub-projects. This
185section is supposed to give an initial overview about the various
186sub-projects. Note that this description also lists projects that are far
187from complete, including even those that have literally not a single line
188of code in them yet.
189
190GNUnet sub-projects in order of likely relevance are currently:
191
192@table @asis
193
194@item @command{gnunet}
195Core of the P2P framework, including file-sharing, VPN and
196chat applications; this is what the Developer Handbook covers mostly
197@item @command{gnunet-gtk}
198Gtk+-based user interfaces, including:
199
200@itemize @bullet
201@item @command{gnunet-fs-gtk} (file-sharing),
202@item @command{gnunet-statistics-gtk} (statistics over time),
203@item @command{gnunet-peerinfo-gtk}
204(information about current connections and known peers),
205@item @command{gnunet-chat-gtk} (chat GUI) and
206@item @command{gnunet-setup} (setup tool for "everything")
207@end itemize
208
209@item @command{gnunet-fuse}
210Mounting directories shared via GNUnet's file-sharing
211on GNU/Linux distributions
212@item @command{gnunet-update}
213Installation and update tool
214@item @command{gnunet-ext}
215Template for starting 'external' GNUnet projects
216@item @command{gnunet-java}
217Java APIs for writing GNUnet services and applications
218@item @command{gnunet-java-ext}
219@item @command{eclectic}
220Code to run GNUnet nodes on testbeds for research, development,
221testing and evaluation
222@c ** FIXME: Solve the status and location of gnunet-qt
223@item @command{gnunet-qt}
224Qt-based GNUnet GUI (is it deprecated?)
225@item @command{gnunet-cocoa}
226cocoa-based GNUnet GUI (is it deprecated?)
227@item @command{gnunet-guile}
228Guile bindings for GNUnet
229@item @command{gnunet-python}
230Python bindings for GNUnet
231
232@end table
233
234We are also working on various supporting libraries and tools:
235@c ** FIXME: What about gauger, and what about libmwmodem?
236
237@table @asis
238@item @command{libextractor}
239GNU libextractor (meta data extraction)
240@item @command{libmicrohttpd}
241GNU libmicrohttpd (embedded HTTP(S) server library)
242@item @command{gauger}
243Tool for performance regression analysis
244@item @command{monkey}
245Tool for automated debugging of distributed systems
246@item @command{libmwmodem}
247Library for accessing satellite connection quality reports
248@item @command{libgnurl}
249gnURL (feature-restricted variant of cURL/libcurl)
250@item @command{www}
251work in progress of the new gnunet.org website (Jinja2 framework based to
252replace our current Drupal website)
253@item @command{bibliography}
254Our collected bibliography, papers, references, and so forth
255@item @command{gnunet-videos-}
256Videos about and around gnunet activities
257@end table
258
259Finally, there are various external projects (see links for a list of
260those that have a public website) which build on top of the GNUnet
261framework.
262
263@c ***********************************************************************
264@node Internal dependencies
265@section Internal dependencies
266
267This section tries to give an overview of what processes a typical GNUnet
268peer running a particular application would consist of. All of the
269processes listed here should be automatically started by
270@command{gnunet-arm -s}.
271The list is given as a rough first guide to users for failure diagnostics.
272Ideally, end-users should never have to worry about these internal
273dependencies.
274
275In terms of internal dependencies, a minimum file-sharing system consists
276of the following GNUnet processes (in order of dependency):
277
278@itemize @bullet
279@item gnunet-service-arm
280@item gnunet-service-resolver (required by all)
281@item gnunet-service-statistics (required by all)
282@item gnunet-service-peerinfo
283@item gnunet-service-transport (requires peerinfo)
284@item gnunet-service-core (requires transport)
285@item gnunet-daemon-hostlist (requires core)
286@item gnunet-daemon-topology (requires hostlist, peerinfo)
287@item gnunet-service-datastore
288@item gnunet-service-dht (requires core)
289@item gnunet-service-identity
290@item gnunet-service-fs (requires identity, mesh, dht, datastore, core)
291@end itemize
292
293@noindent
294A minimum VPN system consists of the following GNUnet processes (in
295order of dependency):
296
297@itemize @bullet
298@item gnunet-service-arm
299@item gnunet-service-resolver (required by all)
300@item gnunet-service-statistics (required by all)
301@item gnunet-service-peerinfo
302@item gnunet-service-transport (requires peerinfo)
303@item gnunet-service-core (requires transport)
304@item gnunet-daemon-hostlist (requires core)
305@item gnunet-service-dht (requires core)
306@item gnunet-service-mesh (requires dht, core)
307@item gnunet-service-dns (requires dht)
308@item gnunet-service-regex (requires dht)
309@item gnunet-service-vpn (requires regex, dns, mesh, dht)
310@end itemize
311
312@noindent
313A minimum GNS system consists of the following GNUnet processes (in
314order of dependency):
315
316@itemize @bullet
317@item gnunet-service-arm
318@item gnunet-service-resolver (required by all)
319@item gnunet-service-statistics (required by all)
320@item gnunet-service-peerinfo
321@item gnunet-service-transport (requires peerinfo)
322@item gnunet-service-core (requires transport)
323@item gnunet-daemon-hostlist (requires core)
324@item gnunet-service-dht (requires core)
325@item gnunet-service-mesh (requires dht, core)
326@item gnunet-service-dns (requires dht)
327@item gnunet-service-regex (requires dht)
328@item gnunet-service-vpn (requires regex, dns, mesh, dht)
329@item gnunet-service-identity
330@item gnunet-service-namestore (requires identity)
331@item gnunet-service-gns (requires vpn, dns, dht, namestore, identity)
332@end itemize
333
334@c ***********************************************************************
335@node Code overview
336@section Code overview
337
338This section gives a brief overview of the GNUnet source code.
339Specifically, we sketch the function of each of the subdirectories in
340the @file{gnunet/src/} directory. The order given is roughly bottom-up
341(in terms of the layers of the system).
342
343@table @asis
344@item @file{util/} --- libgnunetutil
345Library with general utility functions, all
346GNUnet binaries link against this library. Anything from memory
347allocation and data structures to cryptography and inter-process
348communication. The goal is to provide an OS-independent interface and
349more 'secure' or convenient implementations of commonly used primitives.
350The API is spread over more than a dozen headers, developers should study
351those closely to avoid duplicating existing functions.
352@pxref{libgnunetutil}.
353@item @file{hello/} --- libgnunethello
354HELLO messages are used to
355describe under which addresses a peer can be reached (for example,
356protocol, IP, port). This library manages parsing and generating of HELLO
357messages.
358@item @file{block/} --- libgnunetblock
359The DHT and other components of GNUnet
360store information in units called 'blocks'. Each block has a type and the
361type defines a particular format and how that binary format is to be
362linked to a hash code (the key for the DHT and for databases). The block
363library is a wrapper around block plugins which provide the necessary
364functions for each block type.
365@item @file{statistics/} --- statistics service
366The statistics service enables associating
367values (of type uint64_t) with a component name and a string. The main
368uses is debugging (counting events), performance tracking and user
369entertainment (what did my peer do today?).
370@item @file{arm/} --- Automatic Restart Manager (ARM)
371The automatic-restart-manager (ARM) service
372is the GNUnet master service. Its role is to start gnunet-services, to
373re-start them when they crashed and finally to shut down the system when
374requested.
375@item @file{peerinfo/} --- peerinfo service
376The peerinfo service keeps track of which peers are known
377to the local peer and also tracks the validated addresses for each peer
378(in the form of a HELLO message) for each of those peers. The peer is not
379necessarily connected to all peers known to the peerinfo service.
380Peerinfo provides persistent storage for peer identities --- peers are
381not forgotten just because of a system restart.
382@item @file{datacache/} --- libgnunetdatacache
383The datacache library provides (temporary) block storage for the DHT.
384Existing plugins can store blocks in Sqlite, Postgres or MySQL databases.
385All data stored in the cache is lost when the peer is stopped or
386restarted (datacache uses temporary tables).
387@item @file{datastore/} --- datastore service
388The datastore service stores file-sharing blocks in
389databases for extended periods of time. In contrast to the datacache, data
390is not lost when peers restart. However, quota restrictions may still
391cause old, expired or low-priority data to be eventually discarded.
392Existing plugins can store blocks in Sqlite, Postgres or MySQL databases.
393@item @file{template/} --- service template
394Template for writing a new service. Does nothing.
395@item @file{ats/} --- Automatic Transport Selection
396The automatic transport selection (ATS) service
397is responsible for deciding which address (i.e.
398which transport plugin) should be used for communication with other peers,
399and at what bandwidth.
400@item @file{nat/} --- libgnunetnat
401Library that provides basic functions for NAT traversal.
402The library supports NAT traversal with
403manual hole-punching by the user, UPnP and ICMP-based autonomous NAT
404traversal. The library also includes an API for testing if the current
405configuration works and the @code{gnunet-nat-server} which provides an
406external service to test the local configuration.
407@item @file{fragmentation/} --- libgnunetfragmentation
408Some transports (UDP and WLAN, mostly) have restrictions on the maximum
409transfer unit (MTU) for packets. The fragmentation library can be used to
410break larger packets into chunks of at most 1k and transmit the resulting
411fragments reliably (with acknowledgment, retransmission, timeouts,
412etc.).
413@item @file{transport/} --- transport service
414The transport service is responsible for managing the
415basic P2P communication. It uses plugins to support P2P communication
416over TCP, UDP, HTTP, HTTPS and other protocols.The transport service
417validates peer addresses, enforces bandwidth restrictions, limits the
418total number of connections and enforces connectivity restrictions (i.e.
419friends-only).
420@item @file{peerinfo-tool/} --- gnunet-peerinfo
421This directory contains the gnunet-peerinfo binary which can be used to
422inspect the peers and HELLOs known to the peerinfo service.
423@item @file{core/}
424The core service is responsible for establishing encrypted, authenticated
425connections with other peers, encrypting and decrypting messages and
426forwarding messages to higher-level services that are interested in them.
427@item @file{testing/} --- libgnunettesting
428The testing library allows starting (and stopping) peers
429for writing testcases.
430It also supports automatic generation of configurations for peers
431ensuring that the ports and paths are disjoint. libgnunettesting is also
432the foundation for the testbed service
433@item @file{testbed/} --- testbed service
434The testbed service is used for creating small or large scale deployments
435of GNUnet peers for evaluation of protocols.
436It facilitates peer deployments on multiple
437hosts (for example, in a cluster) and establishing various network
438topologies (both underlay and overlay).
439@item @file{nse/} --- Network Size Estimation
440The network size estimation (NSE) service
441implements a protocol for (securely) estimating the current size of the
442P2P network.
443@item @file{dht/} --- distributed hash table
444The distributed hash table (DHT) service provides a
445distributed implementation of a hash table to store blocks under hash
446keys in the P2P network.
447@item @file{hostlist/} --- hostlist service
448The hostlist service allows learning about
449other peers in the network by downloading HELLO messages from an HTTP
450server, can be configured to run such an HTTP server and also implements
451a P2P protocol to advertise and automatically learn about other peers
452that offer a public hostlist server.
453@item @file{topology/} --- topology service
454The topology service is responsible for
455maintaining the mesh topology. It tries to maintain connections to friends
456(depending on the configuration) and also tries to ensure that the peer
457has a decent number of active connections at all times. If necessary, new
458connections are added. All peers should run the topology service,
459otherwise they may end up not being connected to any other peer (unless
460some other service ensures that core establishes the required
461connections). The topology service also tells the transport service which
462connections are permitted (for friend-to-friend networking)
463@item @file{fs/} --- file-sharing
464The file-sharing (FS) service implements GNUnet's
465file-sharing application. Both anonymous file-sharing (using gap) and
466non-anonymous file-sharing (using dht) are supported.
467@item @file{cadet/} --- cadet service
468The CADET service provides a general-purpose routing abstraction to create
469end-to-end encrypted tunnels in mesh networks. We wrote a paper
470documenting key aspects of the design.
471@item @file{tun/} --- libgnunettun
472Library for building IPv4, IPv6 packets and creating
473checksums for UDP, TCP and ICMP packets. The header
474defines C structs for common Internet packet formats and in particular
475structs for interacting with TUN (virtual network) interfaces.
476@item @file{mysql/} --- libgnunetmysql
477Library for creating and executing prepared MySQL
478statements and to manage the connection to the MySQL database.
479Essentially a lightweight wrapper for the interaction between GNUnet
480components and libmysqlclient.
481@item @file{dns/}
482Service that allows intercepting and modifying DNS requests of
483the local machine. Currently used for IPv4-IPv6 protocol translation
484(DNS-ALG) as implemented by "pt/" and for the GNUnet naming system. The
485service can also be configured to offer an exit service for DNS traffic.
486@item @file{vpn/} --- VPN service
487The virtual public network (VPN) service provides a virtual
488tunnel interface (VTUN) for IP routing over GNUnet.
489Needs some other peers to run an "exit" service to work.
490Can be activated using the "gnunet-vpn" tool or integrated with DNS using
491the "pt" daemon.
492@item @file{exit/}
493Daemon to allow traffic from the VPN to exit this
494peer to the Internet or to specific IP-based services of the local peer.
495Currently, an exit service can only be restricted to IPv4 or IPv6, not to
496specific ports and or IP address ranges. If this is not acceptable,
497additional firewall rules must be added manually. exit currently only
498works for normal UDP, TCP and ICMP traffic; DNS queries need to leave the
499system via a DNS service.
500@item @file{pt/}
501protocol translation daemon. This daemon enables 4-to-6,
5026-to-4, 4-over-6 or 6-over-4 transitions for the local system. It
503essentially uses "DNS" to intercept DNS replies and then maps results to
504those offered by the VPN, which then sends them using mesh to some daemon
505offering an appropriate exit service.
506@item @file{identity/}
507Management of egos (alter egos) of a user; identities are
508essentially named ECC private keys and used for zones in the GNU name
509system and for namespaces in file-sharing, but might find other uses later
510@item @file{revocation/}
511Key revocation service, can be used to revoke the
512private key of an identity if it has been compromised
513@item @file{namecache/}
514Cache for resolution results for the GNU name system;
515data is encrypted and can be shared among users,
516loss of the data should ideally only result in a
517performance degradation (persistence not required)
518@item @file{namestore/}
519Database for the GNU name system with per-user private information,
520persistence required
521@item @file{gns/}
522GNU name system, a GNU approach to DNS and PKI.
523@item @file{dv/}
524A plugin for distance-vector (DV)-based routing.
525DV consists of a service and a transport plugin to provide peers
526with the illusion of a direct P2P connection for connections
527that use multiple (typically up to 3) hops in the actual underlay network.
528@item @file{regex/}
529Service for the (distributed) evaluation of regular expressions.
530@item @file{scalarproduct/}
531The scalar product service offers an API to perform a secure multiparty
532computation which calculates a scalar product between two peers
533without exposing the private input vectors of the peers to each other.
534@item @file{consensus/}
535The consensus service will allow a set of peers to agree
536on a set of values via a distributed set union computation.
537@item @file{rest/}
538The rest API allows access to GNUnet services using RESTful interaction.
539The services provide plugins that can exposed by the rest server.
540@c FIXME: Where did this disappear to?
541@c @item @file{experimentation/}
542@c The experimentation daemon coordinates distributed
543@c experimentation to evaluate transport and ATS properties.
544@end table
545
546@c ***********************************************************************
547@node System Architecture
548@section System Architecture
549
550@c FIXME: For those irritated by the textflow, we are missing images here,
551@c in the short term we should add them back, in the long term this should
552@c work without images or have images with alt-text.
553
554GNUnet developers like LEGOs. The blocks are indestructible, can be
555stacked together to construct complex buildings and it is generally easy
556to swap one block for a different one that has the same shape. GNUnet's
557architecture is based on LEGOs:
558
559@c @image{images/service_lego_block,5in,,picture of a LEGO block stack - 3 APIs as connectors upon Network Protocol on top of a Service}
560
561This chapter documents the GNUnet LEGO system, also known as GNUnet's
562system architecture.
563
564The most common GNUnet component is a service. Services offer an API (or
565several, depending on what you count as "an API") which is implemented as
566a library. The library communicates with the main process of the service
567using a service-specific network protocol. The main process of the service
568typically doesn't fully provide everything that is needed --- it has holes
569to be filled by APIs to other services.
570
571A special kind of component in GNUnet are user interfaces and daemons.
572Like services, they have holes to be filled by APIs of other services.
573Unlike services, daemons do not implement their own network protocol and
574they have no API:
575
576The GNUnet system provides a range of services, daemons and user
577interfaces, which are then combined into a layered GNUnet instance (also
578known as a peer).
579
580Note that while it is generally possible to swap one service for another
581compatible service, there is often only one implementation. However,
582during development we often have a "new" version of a service in parallel
583with an "old" version. While the "new" version is not working, developers
584working on other parts of the service can continue their development by
585simply using the "old" service. Alternative design ideas can also be
586easily investigated by swapping out individual components. This is
587typically achieved by simply changing the name of the "BINARY" in the
588respective configuration section.
589
590Key properties of GNUnet services are that they must be separate
591processes and that they must protect themselves by applying tight error
592checking against the network protocol they implement (thereby achieving a
593certain degree of robustness).
594
595On the other hand, the APIs are implemented to tolerate failures of the
596service, isolating their host process from errors by the service. If the
597service process crashes, other services and daemons around it should not
598also fail, but instead wait for the service process to be restarted by
599ARM.
600
601
602@c ***********************************************************************
603@node Subsystem stability
604@section Subsystem stability
605
606This section documents the current stability of the various GNUnet
607subsystems. Stability here describes the expected degree of compatibility
608with future versions of GNUnet. For each subsystem we distinguish between
609compatibility on the P2P network level (communication protocol between
610peers), the IPC level (communication between the service and the service
611library) and the API level (stability of the API). P2P compatibility is
612relevant in terms of which applications are likely going to be able to
613communicate with future versions of the network. IPC communication is
614relevant for the implementation of language bindings that re-implement the
615IPC messages. Finally, API compatibility is relevant to developers that
616hope to be able to avoid changes to applications build on top of the APIs
617of the framework.
618
619The following table summarizes our current view of the stability of the
620respective protocols or APIs:
621
622@multitable @columnfractions .20 .20 .20 .20
623@headitem Subsystem @tab P2P @tab IPC @tab C API
624@item util @tab n/a @tab n/a @tab stable
625@item arm @tab n/a @tab stable @tab stable
626@item ats @tab n/a @tab unstable @tab testing
627@item block @tab n/a @tab n/a @tab stable
628@item cadet @tab testing @tab testing @tab testing
629@item consensus @tab experimental @tab experimental @tab experimental
630@item core @tab stable @tab stable @tab stable
631@item datacache @tab n/a @tab n/a @tab stable
632@item datastore @tab n/a @tab stable @tab stable
633@item dht @tab stable @tab stable @tab stable
634@item dns @tab stable @tab stable @tab stable
635@item dv @tab testing @tab testing @tab n/a
636@item exit @tab testing @tab n/a @tab n/a
637@item fragmentation @tab stable @tab n/a @tab stable
638@item fs @tab stable @tab stable @tab stable
639@item gns @tab stable @tab stable @tab stable
640@item hello @tab n/a @tab n/a @tab testing
641@item hostlist @tab stable @tab stable @tab n/a
642@item identity @tab stable @tab stable @tab n/a
643@item multicast @tab experimental @tab experimental @tab experimental
644@item mysql @tab stable @tab n/a @tab stable
645@item namestore @tab n/a @tab stable @tab stable
646@item nat @tab n/a @tab n/a @tab stable
647@item nse @tab stable @tab stable @tab stable
648@item peerinfo @tab n/a @tab stable @tab stable
649@item psyc @tab experimental @tab experimental @tab experimental
650@item pt @tab n/a @tab n/a @tab n/a
651@item regex @tab stable @tab stable @tab stable
652@item revocation @tab stable @tab stable @tab stable
653@item social @tab experimental @tab experimental @tab experimental
654@item statistics @tab n/a @tab stable @tab stable
655@item testbed @tab n/a @tab testing @tab testing
656@item testing @tab n/a @tab n/a @tab testing
657@item topology @tab n/a @tab n/a @tab n/a
658@item transport @tab stable @tab stable @tab stable
659@item tun @tab n/a @tab n/a @tab stable
660@item vpn @tab testing @tab n/a @tab n/a
661@end multitable
662
663Here is a rough explanation of the values:
664
665@table @samp
666@item stable
667No incompatible changes are planned at this time; for IPC/APIs, if
668there are incompatible changes, they will be minor and might only require
669minimal changes to existing code; for P2P, changes will be avoided if at
670all possible for the 0.10.x-series
671
672@item testing
673No incompatible changes are
674planned at this time, but the code is still known to be in flux; so while
675we have no concrete plans, our expectation is that there will still be
676minor modifications; for P2P, changes will likely be extensions that
677should not break existing code
678
679@item unstable
680Changes are planned and will happen; however, they
681will not be totally radical and the result should still resemble what is
682there now; nevertheless, anticipated changes will break protocol/API
683compatibility
684
685@item experimental
686Changes are planned and the result may look nothing like
687what the API/protocol looks like today
688
689@item unknown
690Someone should think about where this subsystem headed
691
692@item n/a
693This subsystem does not have an API/IPC-protocol/P2P-protocol
694@end table
695
696@c ***********************************************************************
697@node Naming conventions and coding style guide
698@section Naming conventions and coding style guide
699
700Here you can find some rules to help you write code for GNUnet.
701
702@c ***********************************************************************
703@menu
704* Naming conventions::
705* Coding style::
706@end menu
707
708@node Naming conventions
709@subsection Naming conventions
710
711
712@c ***********************************************************************
713@menu
714* include files::
715* binaries::
716* logging::
717* configuration::
718* exported symbols::
719* private (library-internal) symbols (including structs and macros)::
720* testcases::
721* performance tests::
722* src/ directories::
723@end menu
724
725@node include files
726@subsubsection include files
727
728@itemize @bullet
729@item _lib: library without need for a process
730@item _service: library that needs a service process
731@item _plugin: plugin definition
732@item _protocol: structs used in network protocol
733@item exceptions:
734@itemize @bullet
735@item gnunet_config.h --- generated
736@item platform.h --- first included
737@item plibc.h --- external library
738@item gnunet_common.h --- fundamental routines
739@item gnunet_directories.h --- generated
740@item gettext.h --- external library
741@end itemize
742@end itemize
743
744@c ***********************************************************************
745@node binaries
746@subsubsection binaries
747
748@itemize @bullet
749@item gnunet-service-xxx: service process (has listen socket)
750@item gnunet-daemon-xxx: daemon process (no listen socket)
751@item gnunet-helper-xxx[-yyy]: SUID helper for module xxx
752@item gnunet-yyy: command-line tool for end-users
753@item libgnunet_plugin_xxx_yyy.so: plugin for API xxx
754@item libgnunetxxx.so: library for API xxx
755@end itemize
756
757@c ***********************************************************************
758@node logging
759@subsubsection logging
760
761@itemize @bullet
762@item services and daemons use their directory name in
763@code{GNUNET_log_setup} (i.e. 'core') and log using
764plain 'GNUNET_log'.
765@item command-line tools use their full name in
766@code{GNUNET_log_setup} (i.e. 'gnunet-publish') and log using
767plain 'GNUNET_log'.
768@item service access libraries log using
769'@code{GNUNET_log_from}' and use '@code{DIRNAME-api}' for the
770component (i.e. 'core-api')
771@item pure libraries (without associated service) use
772'@code{GNUNET_log_from}' with the component set to their
773library name (without lib or '@file{.so}'),
774which should also be their directory name (i.e. '@file{nat}')
775@item plugins should use '@code{GNUNET_log_from}'
776with the directory name and the plugin name combined to produce
777the component name (i.e. 'transport-tcp').
778@item logging should be unified per-file by defining a
779@code{LOG} macro with the appropriate arguments,
780along these lines:
781
782@example
783#define LOG(kind,...)
784GNUNET_log_from (kind, "example-api",__VA_ARGS__)
785@end example
786
787@end itemize
788
789@c ***********************************************************************
790@node configuration
791@subsubsection configuration
792
793@itemize @bullet
794@item paths (that are substituted in all filenames) are in PATHS
795(have as few as possible)
796@item all options for a particular module (@file{src/MODULE})
797are under @code{[MODULE]}
798@item options for a plugin of a module
799are under @code{[MODULE-PLUGINNAME]}
800@end itemize
801
802@c ***********************************************************************
803@node exported symbols
804@subsubsection exported symbols
805
806@itemize @bullet
807@item must start with @code{GNUNET_modulename_} and be defined in
808@file{modulename.c}
809@item exceptions: those defined in @file{gnunet_common.h}
810@end itemize
811
812@c ***********************************************************************
813@node private (library-internal) symbols (including structs and macros)
814@subsubsection private (library-internal) symbols (including structs and macros)
815
816@itemize @bullet
817@item must NOT start with any prefix
818@item must not be exported in a way that linkers could use them or@ other
819libraries might see them via headers; they must be either
820declared/defined in C source files or in headers that are in the
821respective directory under @file{src/modulename/} and NEVER be declared
822in @file{src/include/}.
823@end itemize
824
825@node testcases
826@subsubsection testcases
827
828@itemize @bullet
829@item must be called @file{test_module-under-test_case-description.c}
830@item "case-description" maybe omitted if there is only one test
831@end itemize
832
833@c ***********************************************************************
834@node performance tests
835@subsubsection performance tests
836
837@itemize @bullet
838@item must be called @file{perf_module-under-test_case-description.c}
839@item "case-description" maybe omitted if there is only one performance
840test
841@item Must only be run if @code{HAVE_BENCHMARKS} is satisfied
842@end itemize
843
844@c ***********************************************************************
845@node src/ directories
846@subsubsection src/ directories
847
848@itemize @bullet
849@item gnunet-NAME: end-user applications (i.e., gnunet-search, gnunet-arm)
850@item gnunet-service-NAME: service processes with accessor library (i.e.,
851gnunet-service-arm)
852@item libgnunetNAME: accessor library (_service.h-header) or standalone
853library (_lib.h-header)
854@item gnunet-daemon-NAME: daemon process without accessor library (i.e.,
855gnunet-daemon-hostlist) and no GNUnet management port
856@item libgnunet_plugin_DIR_NAME: loadable plugins (i.e.,
857libgnunet_plugin_transport_tcp)
858@end itemize
859
860@cindex Coding style
861@node Coding style
862@subsection Coding style
863
864@c XXX: Adjust examples to GNU Standards!
865@itemize @bullet
866@item We follow the GNU Coding Standards (@pxref{Top, The GNU Coding Standards,, standards, The GNU Coding Standards});
867@item Indentation is done with spaces, two per level, no tabs;
868@item C99 struct initialization is fine;
869@item declare only one variable per line, for example:
870
871@noindent
872instead of
873
874@example
875int i,j;
876@end example
877
878@noindent
879write:
880
881@example
882int i;
883int j;
884@end example
885
886@c TODO: include actual example from a file in source
887
888@noindent
889This helps keep diffs small and forces developers to think precisely about
890the type of every variable.
891Note that @code{char *} is different from @code{const char*} and
892@code{int} is different from @code{unsigned int} or @code{uint32_t}.
893Each variable type should be chosen with care.
894
895@item While @code{goto} should generally be avoided, having a
896@code{goto} to the end of a function to a block of clean up
897statements (free, close, etc.) can be acceptable.
898
899@item Conditions should be written with constants on the left (to avoid
900accidental assignment) and with the @code{true} target being either the
901@code{error} case or the significantly simpler continuation. For example:
902
903@example
904if (0 != stat ("filename," &sbuf)) @{
905 error();
906 @}
907 else @{
908 /* handle normal case here */
909 @}
910@end example
911
912@noindent
913instead of
914
915@example
916if (stat ("filename," &sbuf) == 0) @{
917 /* handle normal case here */
918 @} else @{
919 error();
920 @}
921@end example
922
923@noindent
924If possible, the error clause should be terminated with a @code{return} (or
925@code{goto} to some cleanup routine) and in this case, the @code{else} clause
926should be omitted:
927
928@example
929if (0 != stat ("filename," &sbuf)) @{
930 error();
931 return;
932 @}
933/* handle normal case here */
934@end example
935
936This serves to avoid deep nesting. The 'constants on the left' rule
937applies to all constants (including. @code{GNUNET_SCHEDULER_NO_TASK}),
938NULL, and enums). With the two above rules (constants on left, errors in
939'true' branch), there is only one way to write most branches correctly.
940
941@item Combined assignments and tests are allowed if they do not hinder
942code clarity. For example, one can write:
943
944@example
945if (NULL == (value = lookup_function())) @{
946 error();
947 return;
948 @}
949@end example
950
951@item Use @code{break} and @code{continue} wherever possible to avoid
952deep(er) nesting. Thus, we would write:
953
954@example
955next = head;
956while (NULL != (pos = next)) @{
957 next = pos->next;
958 if (! should_free (pos))
959 continue;
960 GNUNET_CONTAINER_DLL_remove (head, tail, pos);
961 GNUNET_free (pos);
962 @}
963@end example
964
965instead of
966
967@example
968next = head; while (NULL != (pos = next)) @{
969 next = pos->next;
970 if (should_free (pos)) @{
971 /* unnecessary nesting! */
972 GNUNET_CONTAINER_DLL_remove (head, tail, pos);
973 GNUNET_free (pos);
974 @}
975 @}
976@end example
977
978@item We primarily use @code{for} and @code{while} loops.
979A @code{while} loop is used if the method for advancing in the loop is
980not a straightforward increment operation. In particular, we use:
981
982@example
983next = head;
984while (NULL != (pos = next))
985@{
986 next = pos->next;
987 if (! should_free (pos))
988 continue;
989 GNUNET_CONTAINER_DLL_remove (head, tail, pos);
990 GNUNET_free (pos);
991@}
992@end example
993
994to free entries in a list (as the iteration changes the structure of the
995list due to the free; the equivalent @code{for} loop does no longer
996follow the simple @code{for} paradigm of @code{for(INIT;TEST;INC)}).
997However, for loops that do follow the simple @code{for} paradigm we do
998use @code{for}, even if it involves linked lists:
999
1000@example
1001/* simple iteration over a linked list */
1002for (pos = head;
1003 NULL != pos;
1004 pos = pos->next)
1005@{
1006 use (pos);
1007@}
1008@end example
1009
1010
1011@item The first argument to all higher-order functions in GNUnet must be
1012declared to be of type @code{void *} and is reserved for a closure. We do
1013not use inner functions, as trampolines would conflict with setups that
1014use non-executable stacks.
1015The first statement in a higher-order function, which unusually should
1016be part of the variable declarations, should assign the
1017@code{cls} argument to the precise expected type. For example:
1018
1019@example
1020int callback (void *cls, char *args) @{
1021 struct Foo *foo = cls;
1022 int other_variables;
1023
1024 /* rest of function */
1025@}
1026@end example
1027
1028
1029@item It is good practice to write complex @code{if} expressions instead
1030of using deeply nested @code{if} statements. However, except for addition
1031and multiplication, all operators should use parens. This is fine:
1032
1033@example
1034if ( (1 == foo) || ((0 == bar) && (x != y)) )
1035 return x;
1036@end example
1037
1038
1039However, this is not:
1040
1041@example
1042if (1 == foo)
1043 return x;
1044if (0 == bar && x != y)
1045 return x;
1046@end example
1047
1048@noindent
1049Note that splitting the @code{if} statement above is debatable as the
1050@code{return x} is a very trivial statement. However, once the logic after
1051the branch becomes more complicated (and is still identical), the "or"
1052formulation should be used for sure.
1053
1054@item There should be two empty lines between the end of the function and
1055the comments describing the following function. There should be a single
1056empty line after the initial variable declarations of a function. If a
1057function has no local variables, there should be no initial empty line. If
1058a long function consists of several complex steps, those steps might be
1059separated by an empty line (possibly followed by a comment describing the
1060following step). The code should not contain empty lines in arbitrary
1061places; if in doubt, it is likely better to NOT have an empty line (this
1062way, more code will fit on the screen).
1063@end itemize
1064
1065@c ***********************************************************************
1066@node Build-system
1067@section Build-system
1068
1069If you have code that is likely not to compile or build rules you might
1070want to not trigger for most developers, use @code{if HAVE_EXPERIMENTAL}
1071in your @file{Makefile.am}.
1072Then it is OK to (temporarily) add non-compiling (or known-to-not-port)
1073code.
1074
1075If you want to compile all testcases but NOT run them, run configure with
1076the @code{--enable-test-suppression} option.
1077
1078If you want to run all testcases, including those that take a while, run
1079configure with the @code{--enable-expensive-testcases} option.
1080
1081If you want to compile and run benchmarks, run configure with the
1082@code{--enable-benchmarks} option.
1083
1084If you want to obtain code coverage results, run configure with the
1085@code{--enable-coverage} option and run the @file{coverage.sh} script in
1086the @file{contrib/} directory.
1087
1088@cindex gnunet-ext
1089@node Developing extensions for GNUnet using the gnunet-ext template
1090@section Developing extensions for GNUnet using the gnunet-ext template
1091
1092For developers who want to write extensions for GNUnet we provide the
1093gnunet-ext template to provide an easy to use skeleton.
1094
1095gnunet-ext contains the build environment and template files for the
1096development of GNUnet services, command line tools, APIs and tests.
1097
1098First of all you have to obtain gnunet-ext from git:
1099
1100@example
1101git clone https://gnunet.org/git/gnunet-ext.git
1102@end example
1103
1104The next step is to bootstrap and configure it. For configure you have to
1105provide the path containing GNUnet with
1106@code{--with-gnunet=/path/to/gnunet} and the prefix where you want the
1107install the extension using @code{--prefix=/path/to/install}:
1108
1109@example
1110./bootstrap
1111./configure --prefix=/path/to/install --with-gnunet=/path/to/gnunet
1112@end example
1113
1114When your GNUnet installation is not included in the default linker search
1115path, you have to add @code{/path/to/gnunet} to the file
1116@file{/etc/ld.so.conf} and run @code{ldconfig} or your add it to the
1117environmental variable @code{LD_LIBRARY_PATH} by using
1118
1119@example
1120export LD_LIBRARY_PATH=/path/to/gnunet/lib
1121@end example
1122
1123@cindex writing testcases
1124@node Writing testcases
1125@section Writing testcases
1126
1127Ideally, any non-trivial GNUnet code should be covered by automated
1128testcases. Testcases should reside in the same place as the code that is
1129being tested. The name of source files implementing tests should begin
1130with @code{test_} followed by the name of the file that contains
1131the code that is being tested.
1132
1133Testcases in GNUnet should be integrated with the autotools build system.
1134This way, developers and anyone building binary packages will be able to
1135run all testcases simply by running @code{make check}. The final
1136testcases shipped with the distribution should output at most some brief
1137progress information and not display debug messages by default. The
1138success or failure of a testcase must be indicated by returning zero
1139(success) or non-zero (failure) from the main method of the testcase.
1140The integration with the autotools is relatively straightforward and only
1141requires modifications to the @file{Makefile.am} in the directory
1142containing the testcase. For a testcase testing the code in @file{foo.c}
1143the @file{Makefile.am} would contain the following lines:
1144
1145@example
1146check_PROGRAMS = test_foo
1147TESTS = $(check_PROGRAMS)
1148test_foo_SOURCES = test_foo.c
1149test_foo_LDADD = $(top_builddir)/src/util/libgnunetutil.la
1150@end example
1151
1152Naturally, other libraries used by the testcase may be specified in the
1153@code{LDADD} directive as necessary.
1154
1155Often testcases depend on additional input files, such as a configuration
1156file. These support files have to be listed using the @code{EXTRA_DIST}
1157directive in order to ensure that they are included in the distribution.
1158
1159Example:
1160
1161@example
1162EXTRA_DIST = test_foo_data.conf
1163@end example
1164
1165Executing @code{make check} will run all testcases in the current
1166directory and all subdirectories. Testcases can be compiled individually
1167by running @code{make test_foo} and then invoked directly using
1168@code{./test_foo}. Note that due to the use of plugins in GNUnet, it is
1169typically necessary to run @code{make install} before running any
1170testcases. Thus the canonical command @code{make check install} has to be
1171changed to @code{make install check} for GNUnet.
1172
1173@c ***********************************************************************
1174@cindex Building GNUnet
1175@node Building GNUnet and its dependencies
1176@section Building GNUnet and its dependencies
1177
1178In the following section we will outline how to build GNUnet and
1179some of its dependencies. We will assume a fair amount of knowledge
1180for building applications under UNIX-like systems. Furthermore we
1181assume that the build environment is sane and that you are aware of
1182any implications actions in this process could have.
1183Instructions here can be seen as notes for developers (an extension to
1184the 'HACKING' section in README) as well as package maintainers.
1185@b{Users should rely on the available binary packages.}
1186We will use Debian as an example Operating System environment. Substitute
1187accordingly with your own Operating System environment.
1188
1189For the full list of dependencies, consult the appropriate, up-to-date
1190section in the @file{README} file.
1191
1192First, we need to build or install (depending on your OS) the following
1193packages. If you build them from source, build them in this exact order:
1194
1195@example
1196libgpgerror, libgcrypt, libnettle, libunbound, GnuTLS (with libunbound
1197support)
1198@end example
1199
1200After we have build and installed those packages, we continue with
1201packages closer to GNUnet in this step: libgnurl (our libcurl fork),
1202GNU libmicrohttpd, and GNU libextractor. Again, if your package manager
1203provides one of these packages, use the packages provided from it
1204unless you have good reasons (package version too old, conflicts, etc).
1205We advise against compiling widely used packages such as GnuTLS
1206yourself if your OS provides a variant already unless you take care
1207of maintenance of the packages then.
1208
1209In the optimistic case, this command will give you all the dependencies:
1210
1211@example
1212sudo apt-get install libgnurl libmicrohttpd libextractor
1213@end example
1214
1215From experience we know that at the very least libgnurl is not
1216available in some environments. You could substitute libgnurl
1217with libcurl, but we recommend to install libgnurl, as it gives
1218you a predefined libcurl with the small set GNUnet requires. In
1219the past namespaces of libcurl and libgnurl were shared, which
1220caused problems when you wanted to integrate both of them in one
1221Operating System. This has been resolved, and they can be installed
1222side by side now.
1223
1224@cindex libgnurl
1225@cindex compiling libgnurl
1226GNUnet and some of its function depend on a limited subset of cURL/libcurl.
1227Rather than trying to enforce a certain configuration on the world, we
1228opted to maintain a microfork of it that ensures we can link against the
1229right set of features. We called this specialized set of libcurl
1230``libgnurl''. It is fully ABI compatible with libcurl and currently used
1231by GNUnet and some of its dependencies.
1232
1233We download libgnurl and its digital signature from the GNU fileserver,
1234assuming @env{TMPDIR} exists.
1235
1236Note: TMPDIR might be @file{/tmp}, @env{TMPDIR}, @env{TMP} or any other
1237location. For consistency we assume @env{TMPDIR} points to @file{/tmp}
1238for the remainder of this section.
1239
1240@example
1241cd \$TMPDIR
1242wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.60.0.tar.Z
1243wget https://ftp.gnu.org/gnu/gnunet/gnurl-7.60.0.tar.Z.sig
1244@end example
1245
1246Next, verify the digital signature of the file:
1247
1248@example
1249gpg --verify gnurl-7.60.0.tar.Z.sig
1250@end example
1251
1252If gpg fails, you might try with @command{gpg2} on your OS. If the error
1253states that ``the key can not be found'' or it is unknown, you have to
1254retrieve the key (A88C8ADD129828D7EAC02E52E22F9BBFEE348588) from a
1255keyserver first:
1256
1257@example
1258gpg --keyserver pgp.mit.edu --recv-keys A88C8ADD129828D7EAC02E52E22F9BBFEE348588
1259@end example
1260
1261and rerun the verification command.
1262
1263libgnurl will require the following packages to be present at runtime:
1264gnutls (with DANE support / libunbound), libidn, zlib and at compile time:
1265libtool, groff, perl, pkg-config, and python 2.7.
1266
1267Once you have verified that all the required packages are present on your
1268system, we can proceed to compile libgnurl:
1269
1270@example
1271tar -xvf gnurl-7.60.0.tar.Z
1272cd gnurl-7.60.0
1273sh configure --disable-ntlm-wb
1274make
1275make -C tests test
1276sudo make install
1277@end example
1278
1279After you've compiled and installed libgnurl, we can proceed to building
1280GNUnet.
1281
1282
1283
1284
1285First, in addition to the GNUnet sources you might require downloading the
1286latest version of various dependencies, depending on how recent the
1287software versions in your distribution of GNU/Linux are.
1288Most distributions do not include sufficiently recent versions of these
1289dependencies.
1290Thus, a typically installation on a "modern" GNU/Linux distribution
1291requires you to install the following dependencies (ideally in this
1292order):
1293
1294@itemize @bullet
1295@item libgpgerror and libgcrypt
1296@item libnettle and libunbound (possibly from distribution), GnuTLS
1297@item libgnurl (read the README)
1298@item GNU libmicrohttpd
1299@item GNU libextractor
1300@end itemize
1301
1302Make sure to first install the various mandatory and optional
1303dependencies including development headers from your distribution.
1304
1305Other dependencies that you should strongly consider to install is a
1306database (MySQL, sqlite or Postgres).
1307The following instructions will assume that you installed at least sqlite.
1308For most distributions you should be able to find pre-build packages for
1309the database. Again, make sure to install the client libraries @b{and} the
1310respective development headers (if they are packaged separately) as well.
1311
1312You can find specific, detailed instructions for installing of the
1313dependencies (and possibly the rest of the GNUnet installation) in the
1314platform-specific descriptions, which can be found in the Index.
1315Please consult them now.
1316If your distribution is not listed, please study the build
1317instructions for Debian stable, carefully as you try to install the
1318dependencies for your own distribution.
1319Contributing additional instructions for further platforms is always
1320appreciated.
1321Please take in mind that operating system development tends to move at
1322a rather fast speed. Due to this you should be aware that some of
1323the instructions could be outdated by the time you are reading this.
1324If you find a mistake, please tell us about it (or even better: send
1325a patch to the documentation to fix it!).
1326
1327Before proceeding further, please double-check the dependency list.
1328Note that in addition to satisfying the dependencies, you might have to
1329make sure that development headers for the various libraries are also
1330installed.
1331There maybe files for other distributions, or you might be able to find
1332equivalent packages for your distribution.
1333
1334While it is possible to build and install GNUnet without having root
1335access, we will assume that you have full control over your system in
1336these instructions.
1337First, you should create a system user @emph{gnunet} and an additional
1338group @emph{gnunetdns}. On the GNU/Linux distributions Debian and Ubuntu,
1339type:
1340
1341@example
1342sudo adduser --system --home /var/lib/gnunet --group \
1343--disabled-password gnunet
1344sudo addgroup --system gnunetdns
1345@end example
1346
1347@noindent
1348On other Unixes and GNU systems, this should have the same effect:
1349
1350@example
1351sudo useradd --system --groups gnunet --home-dir /var/lib/gnunet
1352sudo addgroup --system gnunetdns
1353@end example
1354
1355Now compile and install GNUnet using:
1356
1357@example
1358tar xvf gnunet-@value{VERSION}.tar.gz
1359cd gnunet-@value{VERSION}
1360./configure --with-sudo=sudo --with-nssdir=/lib
1361make
1362sudo make install
1363@end example
1364
1365If you want to be able to enable DEBUG-level log messages, add
1366@code{--enable-logging=verbose} to the end of the
1367@command{./configure} command.
1368@code{DEBUG}-level log messages are in English only and
1369should only be useful for developers (or for filing
1370really detailed bug reports).
1371
1372@noindent
1373Next, edit the file @file{/etc/gnunet.conf} to contain the following:
1374
1375@example
1376[arm]
1377START_SYSTEM_SERVICES = YES
1378START_USER_SERVICES = NO
1379@end example
1380
1381@noindent
1382You may need to update your @code{ld.so} cache to include
1383files installed in @file{/usr/local/lib}:
1384
1385@example
1386# ldconfig
1387@end example
1388
1389@noindent
1390Then, switch from user @code{root} to user @code{gnunet} to start
1391the peer:
1392
1393@example
1394# su -s /bin/sh - gnunet
1395$ gnunet-arm -c /etc/gnunet.conf -s
1396@end example
1397
1398You may also want to add the last line in the gnunet user's @file{crontab}
1399prefixed with @code{@@reboot} so that it is executed whenever the system
1400is booted:
1401
1402@example
1403@@reboot /usr/local/bin/gnunet-arm -c /etc/gnunet.conf -s
1404@end example
1405
1406@noindent
1407This will only start the system-wide GNUnet services.
1408Type @command{exit} to get back your root shell.
1409Now, you need to configure the per-user part. For each
1410user that should get access to GNUnet on the system, run
1411(replace alice with your username):
1412
1413@example
1414sudo adduser alice gnunet
1415@end example
1416
1417@noindent
1418to allow them to access the system-wide GNUnet services. Then, each
1419user should create a configuration file @file{~/.config/gnunet.conf}
1420with the lines:
1421
1422@example
1423[arm]
1424START_SYSTEM_SERVICES = NO
1425START_USER_SERVICES = YES
1426DEFAULTSERVICES = gns
1427@end example
1428
1429@noindent
1430and start the per-user services using
1431
1432@example
1433$ gnunet-arm -c ~/.config/gnunet.conf -s
1434@end example
1435
1436@noindent
1437Again, adding a @code{crontab} entry to autostart the peer is advised:
1438
1439@example
1440@@reboot /usr/local/bin/gnunet-arm -c $HOME/.config/gnunet.conf -s
1441@end example
1442
1443@noindent
1444Note that some GNUnet services (such as SOCKS5 proxies) may need a
1445system-wide TCP port for each user.
1446For those services, systems with more than one user may require each user
1447to specify a different port number in their personal configuration file.
1448
1449Finally, the user should perform the basic initial setup for the GNU Name
1450System (GNS) certificate authority. This is done by running:
1451
1452@example
1453$ gnunet-gns-proxy-setup-ca
1454@end example
1455
1456@noindent
1457The first generates the default zones, whereas the second setups the GNS
1458Certificate Authority with the user's browser. Now, to activate GNS in the
1459normal DNS resolution process, you need to edit your
1460@file{/etc/nsswitch.conf} where you should find a line like this:
1461
1462@example
1463hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
1464@end example
1465
1466@noindent
1467The exact details may differ a bit, which is fine. Add the text
1468@emph{"gns [NOTFOUND=return]"} after @emph{"files"}.
1469Keep in mind that we included a backslash ("\") here just for
1470markup reasons. You should write the text below on @b{one line}
1471and @b{without} the "\":
1472
1473@example
1474hosts: files gns [NOTFOUND=return] mdns4_minimal \
1475[NOTFOUND=return] dns mdns4
1476@end example
1477
1478@c FIXME: Document new behavior.
1479You might want to make sure that @file{/lib/libnss_gns.so.2} exists on
1480your system, it should have been created during the installation.
1481
1482
1483@c **********************************************************************
1484@cindex TESTING library
1485@node TESTING library
1486@section TESTING library
1487
1488The TESTING library is used for writing testcases which involve starting a
1489single or multiple peers. While peers can also be started by testcases
1490using the ARM subsystem, using TESTING library provides an elegant way to
1491do this. The configurations of the peers are auto-generated from a given
1492template to have non-conflicting port numbers ensuring that peers'
1493services do not run into bind errors. This is achieved by testing ports'
1494availability by binding a listening socket to them before allocating them
1495to services in the generated configurations.
1496
1497An another advantage while using TESTING is that it shortens the testcase
1498startup time as the hostkeys for peers are copied from a pre-computed set
1499of hostkeys instead of generating them at peer startup which may take a
1500considerable amount of time when starting multiple peers or on an embedded
1501processor.
1502
1503TESTING also allows for certain services to be shared among peers. This
1504feature is invaluable when testing with multiple peers as it helps to
1505reduce the number of services run per each peer and hence the total
1506number of processes run per testcase.
1507
1508TESTING library only handles creating, starting and stopping peers.
1509Features useful for testcases such as connecting peers in a topology are
1510not available in TESTING but are available in the TESTBED subsystem.
1511Furthermore, TESTING only creates peers on the localhost, however by
1512using TESTBED testcases can benefit from creating peers across multiple
1513hosts.
1514
1515@menu
1516* API::
1517* Finer control over peer stop::
1518* Helper functions::
1519* Testing with multiple processes::
1520@end menu
1521
1522@cindex TESTING API
1523@node API
1524@subsection API
1525
1526TESTING abstracts a group of peers as a TESTING system. All peers in a
1527system have common hostname and no two services of these peers have a
1528same port or a UNIX domain socket path.
1529
1530TESTING system can be created with the function
1531@code{GNUNET_TESTING_system_create()} which returns a handle to the
1532system. This function takes a directory path which is used for generating
1533the configurations of peers, an IP address from which connections to the
1534peers' services should be allowed, the hostname to be used in peers'
1535configuration, and an array of shared service specifications of type
1536@code{struct GNUNET_TESTING_SharedService}.
1537
1538The shared service specification must specify the name of the service to
1539share, the configuration pertaining to that shared service and the
1540maximum number of peers that are allowed to share a single instance of
1541the shared service.
1542
1543TESTING system created with @code{GNUNET_TESTING_system_create()} chooses
1544ports from the default range @code{12000} - @code{56000} while
1545auto-generating configurations for peers.
1546This range can be customised with the function
1547@code{GNUNET_TESTING_system_create_with_portrange()}. This function is
1548similar to @code{GNUNET_TESTING_system_create()} except that it take 2
1549additional parameters --- the start and end of the port range to use.
1550
1551A TESTING system is destroyed with the function
1552@code{GNUNET_TESTING_system_destory()}. This function takes the handle of
1553the system and a flag to remove the files created in the directory used
1554to generate configurations.
1555
1556A peer is created with the function
1557@code{GNUNET_TESTING_peer_configure()}. This functions takes the system
1558handle, a configuration template from which the configuration for the peer
1559is auto-generated and the index from where the hostkey for the peer has to
1560be copied from. When successful, this function returns a handle to the
1561peer which can be used to start and stop it and to obtain the identity of
1562the peer. If unsuccessful, a NULL pointer is returned with an error
1563message. This function handles the generated configuration to have
1564non-conflicting ports and paths.
1565
1566Peers can be started and stopped by calling the functions
1567@code{GNUNET_TESTING_peer_start()} and @code{GNUNET_TESTING_peer_stop()}
1568respectively. A peer can be destroyed by calling the function
1569@code{GNUNET_TESTING_peer_destroy}. When a peer is destroyed, the ports
1570and paths in allocated in its configuration are reclaimed for usage in new
1571peers.
1572
1573@c ***********************************************************************
1574@node Finer control over peer stop
1575@subsection Finer control over peer stop
1576
1577Using @code{GNUNET_TESTING_peer_stop()} is normally fine for testcases.
1578However, calling this function for each peer is inefficient when trying to
1579shutdown multiple peers as this function sends the termination signal to
1580the given peer process and waits for it to terminate. It would be faster
1581in this case to send the termination signals to the peers first and then
1582wait on them. This is accomplished by the functions
1583@code{GNUNET_TESTING_peer_kill()} which sends a termination signal to the
1584peer, and the function @code{GNUNET_TESTING_peer_wait()} which waits on
1585the peer.
1586
1587Further finer control can be achieved by choosing to stop a peer
1588asynchronously with the function @code{GNUNET_TESTING_peer_stop_async()}.
1589This function takes a callback parameter and a closure for it in addition
1590to the handle to the peer to stop. The callback function is called with
1591the given closure when the peer is stopped. Using this function
1592eliminates blocking while waiting for the peer to terminate.
1593
1594An asynchronous peer stop can be canceled by calling the function
1595@code{GNUNET_TESTING_peer_stop_async_cancel()}. Note that calling this
1596function does not prevent the peer from terminating if the termination
1597signal has already been sent to it. It does, however, cancels the
1598callback to be called when the peer is stopped.
1599
1600@c ***********************************************************************
1601@node Helper functions
1602@subsection Helper functions
1603
1604Most of the testcases can benefit from an abstraction which configures a
1605peer and starts it. This is provided by the function
1606@code{GNUNET_TESTING_peer_run()}. This function takes the testing
1607directory pathname, a configuration template, a callback and its closure.
1608This function creates a peer in the given testing directory by using the
1609configuration template, starts the peer and calls the given callback with
1610the given closure.
1611
1612The function @code{GNUNET_TESTING_peer_run()} starts the ARM service of
1613the peer which starts the rest of the configured services. A similar
1614function @code{GNUNET_TESTING_service_run} can be used to just start a
1615single service of a peer. In this case, the peer's ARM service is not
1616started; instead, only the given service is run.
1617
1618@c ***********************************************************************
1619@node Testing with multiple processes
1620@subsection Testing with multiple processes
1621
1622When testing GNUnet, the splitting of the code into a services and clients
1623often complicates testing. The solution to this is to have the testcase
1624fork @code{gnunet-service-arm}, ask it to start the required server and
1625daemon processes and then execute appropriate client actions (to test the
1626client APIs or the core module or both). If necessary, multiple ARM
1627services can be forked using different ports (!) to simulate a network.
1628However, most of the time only one ARM process is needed. Note that on
1629exit, the testcase should shutdown ARM with a @code{TERM} signal (to give
1630it the chance to cleanly stop its child processes).
1631
1632The following code illustrates spawning and killing an ARM process from a
1633testcase:
1634
1635@example
1636static void run (void *cls,
1637 char *const *args,
1638 const char *cfgfile,
1639 const struct GNUNET_CONFIGURATION_Handle *cfg) @{
1640 struct GNUNET_OS_Process *arm_pid;
1641 arm_pid = GNUNET_OS_start_process (NULL,
1642 NULL,
1643 "gnunet-service-arm",
1644 "gnunet-service-arm",
1645 "-c",
1646 cfgname,
1647 NULL);
1648 /* do real test work here */
1649 if (0 != GNUNET_OS_process_kill (arm_pid, SIGTERM))
1650 GNUNET_log_strerror
1651 (GNUNET_ERROR_TYPE_WARNING, "kill");
1652 GNUNET_assert (GNUNET_OK == GNUNET_OS_process_wait (arm_pid));
1653 GNUNET_OS_process_close (arm_pid); @}
1654
1655GNUNET_PROGRAM_run (argc, argv,
1656 "NAME-OF-TEST",
1657 "nohelp",
1658 options,
1659 &run,
1660 cls);
1661@end example
1662
1663
1664An alternative way that works well to test plugins is to implement a
1665mock-version of the environment that the plugin expects and then to
1666simply load the plugin directly.
1667
1668@c ***********************************************************************
1669@node Performance regression analysis with Gauger
1670@section Performance regression analysis with Gauger
1671
1672To help avoid performance regressions, GNUnet uses Gauger. Gauger is a
1673simple logging tool that allows remote hosts to send performance data to
1674a central server, where this data can be analyzed and visualized. Gauger
1675shows graphs of the repository revisions and the performance data recorded
1676for each revision, so sudden performance peaks or drops can be identified
1677and linked to a specific revision number.
1678
1679In the case of GNUnet, the buildbots log the performance data obtained
1680during the tests after each build. The data can be accessed on GNUnet's
1681Gauger page.
1682
1683The menu on the left allows to select either the results of just one
1684build bot (under "Hosts") or review the data from all hosts for a given
1685test result (under "Metrics"). In case of very different absolute value
1686of the results, for instance arm vs. amd64 machines, the option
1687"Normalize" on a metric view can help to get an idea about the
1688performance evolution across all hosts.
1689
1690Using Gauger in GNUnet and having the performance of a module tracked over
1691time is very easy. First of course, the testcase must generate some
1692consistent metric, which makes sense to have logged. Highly volatile or
1693random dependent metrics probably are not ideal candidates for meaningful
1694regression detection.
1695
1696To start logging any value, just include @code{gauger.h} in your testcase
1697code. Then, use the macro @code{GAUGER()} to make the Buildbots log
1698whatever value is of interest for you to @code{gnunet.org}'s Gauger
1699server. No setup is necessary as most Buildbots have already everything
1700in place and new metrics are created on demand. To delete a metric, you
1701need to contact a member of the GNUnet development team (a file will need
1702to be removed manually from the respective directory).
1703
1704The code in the test should look like this:
1705
1706@example
1707[other includes]
1708#include <gauger.h>
1709
1710int main (int argc, char *argv[]) @{
1711
1712 [run test, generate data]
1713 GAUGER("YOUR_MODULE",
1714 "METRIC_NAME",
1715 (float)value,
1716 "UNIT"); @}
1717@end example
1718
1719Where:
1720
1721@table @asis
1722
1723@item @strong{YOUR_MODULE} is a category in the gauger page and should be
1724the name of the module or subsystem like "Core" or "DHT"
1725@item @strong{METRIC} is
1726the name of the metric being collected and should be concise and
1727descriptive, like "PUT operations in sqlite-datastore".
1728@item @strong{value} is the value
1729of the metric that is logged for this run.
1730@item @strong{UNIT} is the unit in
1731which the value is measured, for instance "kb/s" or "kb of RAM/node".
1732@end table
1733
1734If you wish to use Gauger for your own project, you can grab a copy of the
1735latest stable release or check out Gauger's Subversion repository.
1736
1737@cindex TESTBED Subsystem
1738@node TESTBED Subsystem
1739@section TESTBED Subsystem
1740
1741The TESTBED subsystem facilitates testing and measuring of multi-peer
1742deployments on a single host or over multiple hosts.
1743
1744The architecture of the testbed module is divided into the following:
1745@itemize @bullet
1746
1747@item Testbed API: An API which is used by the testing driver programs. It
1748provides with functions for creating, destroying, starting, stopping
1749peers, etc.
1750
1751@item Testbed service (controller): A service which is started through the
1752Testbed API. This service handles operations to create, destroy, start,
1753stop peers, connect them, modify their configurations.
1754
1755@item Testbed helper: When a controller has to be started on a host, the
1756testbed API starts the testbed helper on that host which in turn starts
1757the controller. The testbed helper receives a configuration for the
1758controller through its stdin and changes it to ensure the controller
1759doesn't run into any port conflict on that host.
1760@end itemize
1761
1762
1763The testbed service (controller) is different from the other GNUnet
1764services in that it is not started by ARM and is not supposed to be run
1765as a daemon. It is started by the testbed API through a testbed helper.
1766In a typical scenario involving multiple hosts, a controller is started
1767on each host. Controllers take up the actual task of creating peers,
1768starting and stopping them on the hosts they run.
1769
1770While running deployments on a single localhost the testbed API starts the
1771testbed helper directly as a child process. When running deployments on
1772remote hosts the testbed API starts Testbed Helpers on each remote host
1773through remote shell. By default testbed API uses SSH as a remote shell.
1774This can be changed by setting the environmental variable
1775GNUNET_TESTBED_RSH_CMD to the required remote shell program. This
1776variable can also contain parameters which are to be passed to the remote
1777shell program. For e.g:
1778
1779@example
1780export GNUNET_TESTBED_RSH_CMD="ssh -o BatchMode=yes \
1781-o NoHostAuthenticationForLocalhost=yes %h"
1782@end example
1783
1784Substitutions are allowed in the command string above,
1785this allows for substitutions through placemarks which begin with a `%'.
1786At present the following substitutions are supported
1787
1788@itemize @bullet
1789@item %h: hostname
1790@item %u: username
1791@item %p: port
1792@end itemize
1793
1794Note that the substitution placemark is replaced only when the
1795corresponding field is available and only once. Specifying
1796
1797@example
1798%u@@%h
1799@end example
1800
1801doesn't work either. If you want to user username substitutions for
1802@command{SSH}, use the argument @code{-l} before the
1803username substitution.
1804
1805For example:
1806@example
1807ssh -l %u -p %p %h
1808@end example
1809
1810The testbed API and the helper communicate through the helpers stdin and
1811stdout. As the helper is started through a remote shell on remote hosts
1812any output messages from the remote shell interfere with the communication
1813and results in a failure while starting the helper. For this reason, it is
1814suggested to use flags to make the remote shells produce no output
1815messages and to have password-less logins. The default remote shell, SSH,
1816the default options are:
1817
1818@example
1819-o BatchMode=yes -o NoHostBasedAuthenticationForLocalhost=yes"
1820@end example
1821
1822Password-less logins should be ensured by using SSH keys.
1823
1824Since the testbed API executes the remote shell as a non-interactive
1825shell, certain scripts like .bashrc, .profiler may not be executed. If
1826this is the case testbed API can be forced to execute an interactive
1827shell by setting up the environmental variable
1828@code{GNUNET_TESTBED_RSH_CMD_SUFFIX} to a shell program.
1829
1830An example could be:
1831
1832@example
1833export GNUNET_TESTBED_RSH_CMD_SUFFIX="sh -lc"
1834@end example
1835
1836The testbed API will then execute the remote shell program as:
1837
1838@example
1839$GNUNET_TESTBED_RSH_CMD -p $port $dest $GNUNET_TESTBED_RSH_CMD_SUFFIX \
1840gnunet-helper-testbed
1841@end example
1842
1843On some systems, problems may arise while starting testbed helpers if
1844GNUnet is installed into a custom location since the helper may not be
1845found in the standard path. This can be addressed by setting the variable
1846`@code{HELPER_BINARY_PATH}' to the path of the testbed helper.
1847Testbed API will then use this path to start helper binaries both
1848locally and remotely.
1849
1850Testbed API can accessed by including the
1851@file{gnunet_testbed_service.h} file and linking with
1852@code{-lgnunettestbed}.
1853
1854@c ***********************************************************************
1855@menu
1856* Supported Topologies::
1857* Hosts file format::
1858* Topology file format::
1859* Testbed Barriers::
1860* Automatic large-scale deployment in the PlanetLab testbed::
1861* TESTBED Caveats::
1862@end menu
1863
1864@node Supported Topologies
1865@subsection Supported Topologies
1866
1867While testing multi-peer deployments, it is often needed that the peers
1868are connected in some topology. This requirement is addressed by the
1869function @code{GNUNET_TESTBED_overlay_connect()} which connects any given
1870two peers in the testbed.
1871
1872The API also provides a helper function
1873@code{GNUNET_TESTBED_overlay_configure_topology()} to connect a given set
1874of peers in any of the following supported topologies:
1875
1876@itemize @bullet
1877
1878@item @code{GNUNET_TESTBED_TOPOLOGY_CLIQUE}: All peers are connected with
1879each other
1880
1881@item @code{GNUNET_TESTBED_TOPOLOGY_LINE}: Peers are connected to form a
1882line
1883
1884@item @code{GNUNET_TESTBED_TOPOLOGY_RING}: Peers are connected to form a
1885ring topology
1886
1887@item @code{GNUNET_TESTBED_TOPOLOGY_2D_TORUS}: Peers are connected to
1888form a 2 dimensional torus topology. The number of peers may not be a
1889perfect square, in that case the resulting torus may not have the uniform
1890poloidal and toroidal lengths
1891
1892@item @code{GNUNET_TESTBED_TOPOLOGY_ERDOS_RENYI}: Topology is generated
1893to form a random graph. The number of links to be present should be given
1894
1895@item @code{GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD}: Peers are connected to
1896form a 2D Torus with some random links among them. The number of random
1897links are to be given
1898
1899@item @code{GNUNET_TESTBED_TOPOLOGY_SMALL_WORLD_RING}: Peers are
1900connected to form a ring with some random links among them. The number of
1901random links are to be given
1902
1903@item @code{GNUNET_TESTBED_TOPOLOGY_SCALE_FREE}: Connects peers in a
1904topology where peer connectivity follows power law - new peers are
1905connected with high probability to well connected peers.
1906(See Emergence of Scaling in Random Networks. Science 286,
1907509-512, 1999
1908(@uref{https://gnunet.org/git/bibliography.git/plain/docs/emergence_of_scaling_in_random_networks__barabasi_albert_science_286__1999.pdf, pdf}))
1909
1910@item @code{GNUNET_TESTBED_TOPOLOGY_FROM_FILE}: The topology information
1911is loaded from a file. The path to the file has to be given.
1912@xref{Topology file format}, for the format of this file.
1913
1914@item @code{GNUNET_TESTBED_TOPOLOGY_NONE}: No topology
1915@end itemize
1916
1917
1918The above supported topologies can be specified respectively by setting
1919the variable @code{OVERLAY_TOPOLOGY} to the following values in the
1920configuration passed to Testbed API functions
1921@code{GNUNET_TESTBED_test_run()} and
1922@code{GNUNET_TESTBED_run()}:
1923
1924@itemize @bullet
1925@item @code{CLIQUE}
1926@item @code{RING}
1927@item @code{LINE}
1928@item @code{2D_TORUS}
1929@item @code{RANDOM}
1930@item @code{SMALL_WORLD}
1931@item @code{SMALL_WORLD_RING}
1932@item @code{SCALE_FREE}
1933@item @code{FROM_FILE}
1934@item @code{NONE}
1935@end itemize
1936
1937
1938Topologies @code{RANDOM}, @code{SMALL_WORLD} and @code{SMALL_WORLD_RING}
1939require the option @code{OVERLAY_RANDOM_LINKS} to be set to the number of
1940random links to be generated in the configuration. The option will be
1941ignored for the rest of the topologies.
1942
1943Topology @code{SCALE_FREE} requires the options
1944@code{SCALE_FREE_TOPOLOGY_CAP} to be set to the maximum number of peers
1945which can connect to a peer and @code{SCALE_FREE_TOPOLOGY_M} to be set to
1946how many peers a peer should be at least connected to.
1947
1948Similarly, the topology @code{FROM_FILE} requires the option
1949@code{OVERLAY_TOPOLOGY_FILE} to contain the path of the file containing
1950the topology information. This option is ignored for the rest of the
1951topologies. @xref{Topology file format}, for the format of this file.
1952
1953@c ***********************************************************************
1954@node Hosts file format
1955@subsection Hosts file format
1956
1957The testbed API offers the function
1958@code{GNUNET_TESTBED_hosts_load_from_file()} to load from a given file
1959details about the hosts which testbed can use for deploying peers.
1960This function is useful to keep the data about hosts
1961separate instead of hard coding them in code.
1962
1963Another helper function from testbed API, @code{GNUNET_TESTBED_run()}
1964also takes a hosts file name as its parameter. It uses the above
1965function to populate the hosts data structures and start controllers to
1966deploy peers.
1967
1968These functions require the hosts file to be of the following format:
1969@itemize @bullet
1970@item Each line is interpreted to have details about a host
1971@item Host details should include the username to use for logging into the
1972host, the hostname of the host and the port number to use for the remote
1973shell program. All thee values should be given.
1974@item These details should be given in the following format:
1975@example
1976<username>@@<hostname>:<port>
1977@end example
1978@end itemize
1979
1980Note that having canonical hostnames may cause problems while resolving
1981the IP addresses (See this bug). Hence it is advised to provide the hosts'
1982IP numerical addresses as hostnames whenever possible.
1983
1984@c ***********************************************************************
1985@node Topology file format
1986@subsection Topology file format
1987
1988A topology file describes how peers are to be connected. It should adhere
1989to the following format for testbed to parse it correctly.
1990
1991Each line should begin with the target peer id. This should be followed by
1992a colon(`:') and origin peer ids separated by `|'. All spaces except for
1993newline characters are ignored. The API will then try to connect each
1994origin peer to the target peer.
1995
1996For example, the following file will result in 5 overlay connections:
1997[2->1], [3->1],[4->3], [0->3], [2->0]@
1998@code{@ 1:2|3@ 3:4| 0@ 0: 2@ }
1999
2000@c ***********************************************************************
2001@node Testbed Barriers
2002@subsection Testbed Barriers
2003
2004The testbed subsystem's barriers API facilitates coordination among the
2005peers run by the testbed and the experiment driver. The concept is
2006similar to the barrier synchronisation mechanism found in parallel
2007programming or multi-threading paradigms - a peer waits at a barrier upon
2008reaching it until the barrier is reached by a predefined number of peers.
2009This predefined number of peers required to cross a barrier is also called
2010quorum. We say a peer has reached a barrier if the peer is waiting for the
2011barrier to be crossed. Similarly a barrier is said to be reached if the
2012required quorum of peers reach the barrier. A barrier which is reached is
2013deemed as crossed after all the peers waiting on it are notified.
2014
2015The barriers API provides the following functions:
2016@itemize @bullet
2017@item @strong{@code{GNUNET_TESTBED_barrier_init()}:} function to
2018initialize a barrier in the experiment
2019@item @strong{@code{GNUNET_TESTBED_barrier_cancel()}:} function to cancel
2020a barrier which has been initialized before
2021@item @strong{@code{GNUNET_TESTBED_barrier_wait()}:} function to signal
2022barrier service that the caller has reached a barrier and is waiting for
2023it to be crossed
2024@item @strong{@code{GNUNET_TESTBED_barrier_wait_cancel()}:} function to
2025stop waiting for a barrier to be crossed
2026@end itemize
2027
2028
2029Among the above functions, the first two, namely
2030@code{GNUNET_TESTBED_barrier_init()} and
2031@code{GNUNET_TESTBED_barrier_cancel()} are used by experiment drivers. All
2032barriers should be initialised by the experiment driver by calling
2033@code{GNUNET_TESTBED_barrier_init()}. This function takes a name to
2034identify the barrier, the quorum required for the barrier to be crossed
2035and a notification callback for notifying the experiment driver when the
2036barrier is crossed. @code{GNUNET_TESTBED_barrier_cancel()} cancels an
2037initialised barrier and frees the resources allocated for it. This
2038function can be called upon a initialised barrier before it is crossed.
2039
2040The remaining two functions @code{GNUNET_TESTBED_barrier_wait()} and
2041@code{GNUNET_TESTBED_barrier_wait_cancel()} are used in the peer's
2042processes. @code{GNUNET_TESTBED_barrier_wait()} connects to the local
2043barrier service running on the same host the peer is running on and
2044registers that the caller has reached the barrier and is waiting for the
2045barrier to be crossed. Note that this function can only be used by peers
2046which are started by testbed as this function tries to access the local
2047barrier service which is part of the testbed controller service. Calling
2048@code{GNUNET_TESTBED_barrier_wait()} on an uninitialised barrier results
2049in failure. @code{GNUNET_TESTBED_barrier_wait_cancel()} cancels the
2050notification registered by @code{GNUNET_TESTBED_barrier_wait()}.
2051
2052
2053@c ***********************************************************************
2054@menu
2055* Implementation::
2056@end menu
2057
2058@node Implementation
2059@subsubsection Implementation
2060
2061Since barriers involve coordination between experiment driver and peers,
2062the barrier service in the testbed controller is split into two
2063components. The first component responds to the message generated by the
2064barrier API used by the experiment driver (functions
2065@code{GNUNET_TESTBED_barrier_init()} and
2066@code{GNUNET_TESTBED_barrier_cancel()}) and the second component to the
2067messages generated by barrier API used by peers (functions
2068@code{GNUNET_TESTBED_barrier_wait()} and
2069@code{GNUNET_TESTBED_barrier_wait_cancel()}).
2070
2071Calling @code{GNUNET_TESTBED_barrier_init()} sends a
2072@code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_INIT} message to the master
2073controller. The master controller then registers a barrier and calls
2074@code{GNUNET_TESTBED_barrier_init()} for each its subcontrollers. In this
2075way barrier initialisation is propagated to the controller hierarchy.
2076While propagating initialisation, any errors at a subcontroller such as
2077timeout during further propagation are reported up the hierarchy back to
2078the experiment driver.
2079
2080Similar to @code{GNUNET_TESTBED_barrier_init()},
2081@code{GNUNET_TESTBED_barrier_cancel()} propagates
2082@code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_CANCEL} message which causes
2083controllers to remove an initialised barrier.
2084
2085The second component is implemented as a separate service in the binary
2086`gnunet-service-testbed' which already has the testbed controller service.
2087Although this deviates from the gnunet process architecture of having one
2088service per binary, it is needed in this case as this component needs
2089access to barrier data created by the first component. This component
2090responds to @code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT} messages from
2091local peers when they call @code{GNUNET_TESTBED_barrier_wait()}. Upon
2092receiving @code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT} message, the
2093service checks if the requested barrier has been initialised before and
2094if it was not initialised, an error status is sent through
2095@code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS} message to the local
2096peer and the connection from the peer is terminated. If the barrier is
2097initialised before, the barrier's counter for reached peers is incremented
2098and a notification is registered to notify the peer when the barrier is
2099reached. The connection from the peer is left open.
2100
2101When enough peers required to attain the quorum send
2102@code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_WAIT} messages, the controller
2103sends a @code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS} message to its
2104parent informing that the barrier is crossed. If the controller has
2105started further subcontrollers, it delays this message until it receives
2106a similar notification from each of those subcontrollers. Finally, the
2107barriers API at the experiment driver receives the
2108@code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS} when the barrier is
2109reached at all the controllers.
2110
2111The barriers API at the experiment driver responds to the
2112@code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS} message by echoing it
2113back to the master controller and notifying the experiment controller
2114through the notification callback that a barrier has been crossed. The
2115echoed @code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS} message is
2116propagated by the master controller to the controller hierarchy. This
2117propagation triggers the notifications registered by peers at each of the
2118controllers in the hierarchy. Note the difference between this downward
2119propagation of the @code{GNUNET_MESSAGE_TYPE_TESTBED_BARRIER_STATUS}
2120message from its upward propagation --- the upward propagation is needed
2121for ensuring that the barrier is reached by all the controllers and the
2122downward propagation is for triggering that the barrier is crossed.
2123
2124@cindex PlanetLab testbed
2125@node Automatic large-scale deployment in the PlanetLab testbed
2126@subsection Automatic large-scale deployment in the PlanetLab testbed
2127
2128PlanetLab is a testbed for computer networking and distributed systems
2129research. It was established in 2002 and as of June 2010 was composed of
21301090 nodes at 507 sites worldwide.
2131
2132To automate the GNUnet we created a set of automation tools to simplify
2133the large-scale deployment. We provide you a set of scripts you can use
2134to deploy GNUnet on a set of nodes and manage your installation.
2135
2136Please also check @uref{https://gnunet.org/installation-fedora8-svn} and
2137@uref{https://gnunet.org/installation-fedora12-svn} to find detailed
2138instructions how to install GNUnet on a PlanetLab node.
2139
2140
2141@c ***********************************************************************
2142@menu
2143* PlanetLab Automation for Fedora8 nodes::
2144* Install buildslave on PlanetLab nodes running fedora core 8::
2145* Setup a new PlanetLab testbed using GPLMT::
2146* Why do i get an ssh error when using the regex profiler?::
2147@end menu
2148
2149@node PlanetLab Automation for Fedora8 nodes
2150@subsubsection PlanetLab Automation for Fedora8 nodes
2151
2152@c ***********************************************************************
2153@node Install buildslave on PlanetLab nodes running fedora core 8
2154@subsubsection Install buildslave on PlanetLab nodes running fedora core 8
2155@c ** Actually this is a subsubsubsection, but must be fixed differently
2156@c ** as subsubsection is the lowest.
2157
2158Since most of the PlanetLab nodes are running the very old Fedora core 8
2159image, installing the buildslave software is quite some pain. For our
2160PlanetLab testbed we figured out how to install the buildslave software
2161best.
2162
2163@c This is a very terrible way to suggest installing software.
2164@c FIXME: Is there an official, safer way instead of blind-piping a
2165@c script?
2166@c FIXME: Use newer pypi URLs below.
2167Install Distribute for Python:
2168
2169@example
2170curl http://python-distribute.org/distribute_setup.py | sudo python
2171@end example
2172
2173Install Distribute for zope.interface <= 3.8.0 (4.0 and 4.0.1 will not
2174work):
2175
2176@example
2177export PYPI=@value{PYPI-URL}
2178wget $PYPI/z/zope.interface/zope.interface-3.8.0.tar.gz
2179tar zvfz zope.interface-3.8.0.tar.gz
2180cd zope.interface-3.8.0
2181sudo python setup.py install
2182@end example
2183
2184Install the buildslave software (0.8.6 was the latest version):
2185
2186@example
2187export GCODE="http://buildbot.googlecode.com/files"
2188wget $GCODE/buildbot-slave-0.8.6p1.tar.gz
2189tar xvfz buildbot-slave-0.8.6p1.tar.gz
2190cd buildslave-0.8.6p1
2191sudo python setup.py install
2192@end example
2193
2194The setup will download the matching twisted package and install it.
2195It will also try to install the latest version of zope.interface which
2196will fail to install. Buildslave will work anyway since version 3.8.0
2197was installed before!
2198
2199@c ***********************************************************************
2200@node Setup a new PlanetLab testbed using GPLMT
2201@subsubsection Setup a new PlanetLab testbed using GPLMT
2202
2203@itemize @bullet
2204@item Get a new slice and assign nodes
2205Ask your PlanetLab PI to give you a new slice and assign the nodes you
2206need
2207@item Install a buildmaster
2208You can stick to the buildbot documentation:@
2209@uref{http://buildbot.net/buildbot/docs/current/manual/installation.html}
2210@item Install the buildslave software on all nodes
2211To install the buildslave on all nodes assigned to your slice you can use
2212the tasklist @code{install_buildslave_fc8.xml} provided with GPLMT:
2213
2214@example
2215./gplmt.py -c contrib/tumple_gnunet.conf -t \
2216contrib/tasklists/install_buildslave_fc8.xml -a -p <planetlab password>
2217@end example
2218
2219@item Create the buildmaster configuration and the slave setup commands
2220
2221The master and the and the slaves have need to have credentials and the
2222master has to have all nodes configured. This can be done with the
2223@file{create_buildbot_configuration.py} script in the @file{scripts}
2224directory.
2225
2226This scripts takes a list of nodes retrieved directly from PlanetLab or
2227read from a file and a configuration template and creates:
2228
2229@itemize @bullet
2230@item a tasklist which can be executed with gplmt to setup the slaves
2231@item a master.cfg file containing a PlanetLab nodes
2232@end itemize
2233
2234A configuration template is included in the <contrib>, most important is
2235that the script replaces the following tags in the template:
2236
2237%GPLMT_BUILDER_DEFINITION :@ GPLMT_BUILDER_SUMMARY@ GPLMT_SLAVES@
2238%GPLMT_SCHEDULER_BUILDERS
2239
2240Create configuration for all nodes assigned to a slice:
2241
2242@example
2243./create_buildbot_configuration.py -u <planetlab username> \
2244-p <planetlab password> -s <slice> -m <buildmaster+port> \
2245-t <template>
2246@end example
2247
2248Create configuration for some nodes in a file:
2249
2250@example
2251./create_buildbot_configuration.p -f <node_file> \
2252-m <buildmaster+port> -t <template>
2253@end example
2254
2255@item Copy the @file{master.cfg} to the buildmaster and start it
2256Use @code{buildbot start <basedir>} to start the server
2257@item Setup the buildslaves
2258@end itemize
2259
2260@c ***********************************************************************
2261@node Why do i get an ssh error when using the regex profiler?
2262@subsubsection Why do i get an ssh error when using the regex profiler?
2263
2264Why do i get an ssh error "Permission denied (publickey,password)." when
2265using the regex profiler although passwordless ssh to localhost works
2266using publickey and ssh-agent?
2267
2268You have to generate a public/private-key pair with no password:@
2269@code{ssh-keygen -t rsa -b 4096 -f ~/.ssh/id_localhost}@
2270and then add the following to your ~/.ssh/config file:
2271
2272@code{Host 127.0.0.1@ IdentityFile ~/.ssh/id_localhost}
2273
2274now make sure your hostsfile looks like
2275
2276@example
2277[USERNAME]@@127.0.0.1:22@
2278[USERNAME]@@127.0.0.1:22
2279@end example
2280
2281You can test your setup by running @code{ssh 127.0.0.1} in a
2282terminal and then in the opened session run it again.
2283If you were not asked for a password on either login,
2284then you should be good to go.
2285
2286@cindex TESTBED Caveats
2287@node TESTBED Caveats
2288@subsection TESTBED Caveats
2289
2290This section documents a few caveats when using the GNUnet testbed
2291subsystem.
2292
2293@c ***********************************************************************
2294@menu
2295* CORE must be started::
2296* ATS must want the connections::
2297@end menu
2298
2299@node CORE must be started
2300@subsubsection CORE must be started
2301
2302A uncomplicated issue is bug #3993
2303(@uref{https://gnunet.org/bugs/view.php?id=3993, https://gnunet.org/bugs/view.php?id=3993}):
2304Your configuration MUST somehow ensure that for each peer the
2305@code{CORE} service is started when the peer is setup, otherwise
2306@code{TESTBED} may fail to connect peers when the topology is initialized,
2307as @code{TESTBED} will start some @code{CORE} services but not
2308necessarily all (but it relies on all of them running). The easiest way
2309is to set
2310
2311@example
2312[core]
2313IMMEDIATE_START = YES
2314@end example
2315
2316@noindent
2317in the configuration file.
2318Alternatively, having any service that directly or indirectly depends on
2319@code{CORE} being started with @code{IMMEDIATE_START} will also do.
2320This issue largely arises if users try to over-optimize by not
2321starting any services with @code{IMMEDIATE_START}.
2322
2323@c ***********************************************************************
2324@node ATS must want the connections
2325@subsubsection ATS must want the connections
2326
2327When TESTBED sets up connections, it only offers the respective HELLO
2328information to the TRANSPORT service. It is then up to the ATS service to
2329@strong{decide} to use the connection. The ATS service will typically
2330eagerly establish any connection if the number of total connections is
2331low (relative to bandwidth). Details may further depend on the
2332specific ATS backend that was configured. If ATS decides to NOT establish
2333a connection (even though TESTBED provided the required information), then
2334that connection will count as failed for TESTBED. Note that you can
2335configure TESTBED to tolerate a certain number of connection failures
2336(see '-e' option of gnunet-testbed-profiler). This issue largely arises
2337for dense overlay topologies, especially if you try to create cliques
2338with more than 20 peers.
2339
2340@cindex libgnunetutil
2341@node libgnunetutil
2342@section libgnunetutil
2343
2344libgnunetutil is the fundamental library that all GNUnet code builds upon.
2345Ideally, this library should contain most of the platform dependent code
2346(except for user interfaces and really special needs that only few
2347applications have). It is also supposed to offer basic services that most
2348if not all GNUnet binaries require. The code of libgnunetutil is in the
2349@file{src/util/} directory. The public interface to the library is in the
2350gnunet_util.h header. The functions provided by libgnunetutil fall
2351roughly into the following categories (in roughly the order of importance
2352for new developers):
2353
2354@itemize @bullet
2355@item logging (common_logging.c)
2356@item memory allocation (common_allocation.c)
2357@item endianess conversion (common_endian.c)
2358@item internationalization (common_gettext.c)
2359@item String manipulation (string.c)
2360@item file access (disk.c)
2361@item buffered disk IO (bio.c)
2362@item time manipulation (time.c)
2363@item configuration parsing (configuration.c)
2364@item command-line handling (getopt*.c)
2365@item cryptography (crypto_*.c)
2366@item data structures (container_*.c)
2367@item CPS-style scheduling (scheduler.c)
2368@item Program initialization (program.c)
2369@item Networking (network.c, client.c, server*.c, service.c)
2370@item message queuing (mq.c)
2371@item bandwidth calculations (bandwidth.c)
2372@item Other OS-related (os*.c, plugin.c, signal.c)
2373@item Pseudonym management (pseudonym.c)
2374@end itemize
2375
2376It should be noted that only developers that fully understand this entire
2377API will be able to write good GNUnet code.
2378
2379Ideally, porting GNUnet should only require porting the gnunetutil
2380library. More testcases for the gnunetutil APIs are therefore a great
2381way to make porting of GNUnet easier.
2382
2383@menu
2384* Logging::
2385* Interprocess communication API (IPC)::
2386* Cryptography API::
2387* Message Queue API::
2388* Service API::
2389* Optimizing Memory Consumption of GNUnet's (Multi-) Hash Maps::
2390* CONTAINER_MDLL API::
2391@end menu
2392
2393@cindex Logging
2394@cindex log levels
2395@node Logging
2396@subsection Logging
2397
2398GNUnet is able to log its activity, mostly for the purposes of debugging
2399the program at various levels.
2400
2401@file{gnunet_common.h} defines several @strong{log levels}:
2402@table @asis
2403
2404@item ERROR for errors (really problematic situations, often leading to
2405crashes)
2406@item WARNING for warnings (troubling situations that might have
2407negative consequences, although not fatal)
2408@item INFO for various information.
2409Used somewhat rarely, as GNUnet statistics is used to hold and display
2410most of the information that users might find interesting.
2411@item DEBUG for debugging.
2412Does not produce much output on normal builds, but when extra logging is
2413enabled at compile time, a staggering amount of data is outputted under
2414this log level.
2415@end table
2416
2417
2418Normal builds of GNUnet (configured with @code{--enable-logging[=yes]})
2419are supposed to log nothing under DEBUG level. The
2420@code{--enable-logging=verbose} configure option can be used to create a
2421build with all logging enabled. However, such build will produce large
2422amounts of log data, which is inconvenient when one tries to hunt down a
2423specific problem.
2424
2425To mitigate this problem, GNUnet provides facilities to apply a filter to
2426reduce the logs:
2427@table @asis
2428
2429@item Logging by default When no log levels are configured in any other
2430way (see below), GNUnet will default to the WARNING log level. This
2431mostly applies to GNUnet command line utilities, services and daemons;
2432tests will always set log level to WARNING or, if
2433@code{--enable-logging=verbose} was passed to configure, to DEBUG. The
2434default level is suggested for normal operation.
2435@item The -L option Most GNUnet executables accept an "-L loglevel" or
2436"--log=loglevel" option. If used, it makes the process set a global log
2437level to "loglevel". Thus it is possible to run some processes
2438with -L DEBUG, for example, and others with -L ERROR to enable specific
2439settings to diagnose problems with a particular process.
2440@item Configuration files. Because GNUnet
2441service and daemon processes are usually launched by gnunet-arm, it is not
2442possible to pass different custom command line options directly to every
2443one of them. The options passed to @code{gnunet-arm} only affect
2444gnunet-arm and not the rest of GNUnet. However, one can specify a
2445configuration key "OPTIONS" in the section that corresponds to a service
2446or a daemon, and put a value of "-L loglevel" there. This will make the
2447respective service or daemon set its log level to "loglevel" (as the
2448value of OPTIONS will be passed as a command-line argument).
2449
2450To specify the same log level for all services without creating separate
2451"OPTIONS" entries in the configuration for each one, the user can specify
2452a config key "GLOBAL_POSTFIX" in the [arm] section of the configuration
2453file. The value of GLOBAL_POSTFIX will be appended to all command lines
2454used by the ARM service to run other services. It can contain any option
2455valid for all GNUnet commands, thus in particular the "-L loglevel"
2456option. The ARM service itself is, however, unaffected by GLOBAL_POSTFIX;
2457to set log level for it, one has to specify "OPTIONS" key in the [arm]
2458section.
2459@item Environment variables.
2460Setting global per-process log levels with "-L loglevel" does not offer
2461sufficient log filtering granularity, as one service will call interface
2462libraries and supporting libraries of other GNUnet services, potentially
2463producing lots of debug log messages from these libraries. Also, changing
2464the config file is not always convenient (especially when running the
2465GNUnet test suite).@ To fix that, and to allow GNUnet to use different
2466log filtering at runtime without re-compiling the whole source tree, the
2467log calls were changed to be configurable at run time. To configure them
2468one has to define environment variables "GNUNET_FORCE_LOGFILE",
2469"GNUNET_LOG" and/or "GNUNET_FORCE_LOG":
2470@itemize @bullet
2471
2472@item "GNUNET_LOG" only affects the logging when no global log level is
2473configured by any other means (that is, the process does not explicitly
2474set its own log level, there are no "-L loglevel" options on command line
2475or in configuration files), and can be used to override the default
2476WARNING log level.
2477
2478@item "GNUNET_FORCE_LOG" will completely override any other log
2479configuration options given.
2480
2481@item "GNUNET_FORCE_LOGFILE" will completely override the location of the
2482file to log messages to. It should contain a relative or absolute file
2483name. Setting GNUNET_FORCE_LOGFILE is equivalent to passing
2484"--log-file=logfile" or "-l logfile" option (see below). It supports "[]"
2485format in file names, but not "@{@}" (see below).
2486@end itemize
2487
2488
2489Because environment variables are inherited by child processes when they
2490are launched, starting or re-starting the ARM service with these
2491variables will propagate them to all other services.
2492
2493"GNUNET_LOG" and "GNUNET_FORCE_LOG" variables must contain a specially
2494formatted @strong{logging definition} string, which looks like this:@
2495
2496@c FIXME: Can we close this with [/component] instead?
2497@example
2498[component];[file];[function];[from_line[-to_line]];loglevel[/component...]
2499@end example
2500
2501That is, a logging definition consists of definition entries, separated by
2502slashes ('/'). If only one entry is present, there is no need to add a
2503slash to its end (although it is not forbidden either).@ All definition
2504fields (component, file, function, lines and loglevel) are mandatory, but
2505(except for the loglevel) they can be empty. An empty field means
2506"match anything". Note that even if fields are empty, the semicolon (';')
2507separators must be present.@ The loglevel field is mandatory, and must
2508contain one of the log level names (ERROR, WARNING, INFO or DEBUG).@
2509The lines field might contain one non-negative number, in which case it
2510matches only one line, or a range "from_line-to_line", in which case it
2511matches any line in the interval [from_line;to_line] (that is, including
2512both start and end line).@ GNUnet mostly defaults component name to the
2513name of the service that is implemented in a process ('transport',
2514'core', 'peerinfo', etc), but logging calls can specify custom component
2515names using @code{GNUNET_log_from}.@ File name and function name are
2516provided by the compiler (__FILE__ and __FUNCTION__ built-ins).
2517
2518Component, file and function fields are interpreted as non-extended
2519regular expressions (GNU libc regex functions are used). Matching is
2520case-sensitive, "^" and "$" will match the beginning and the end of the
2521text. If a field is empty, its contents are automatically replaced with
2522a ".*" regular expression, which matches anything. Matching is done in
2523the default way, which means that the expression matches as long as it's
2524contained anywhere in the string. Thus "GNUNET_" will match both
2525"GNUNET_foo" and "BAR_GNUNET_BAZ". Use '^' and/or '$' to make sure that
2526the expression matches at the start and/or at the end of the string.
2527The semicolon (';') can't be escaped, and GNUnet will not use it in
2528component names (it can't be used in function names and file names
2529anyway).
2530
2531@end table
2532
2533
2534Every logging call in GNUnet code will be (at run time) matched against
2535the log definitions passed to the process. If a log definition fields are
2536matching the call arguments, then the call log level is compared the the
2537log level of that definition. If the call log level is less or equal to
2538the definition log level, the call is allowed to proceed. Otherwise the
2539logging call is forbidden, and nothing is logged. If no definitions
2540matched at all, GNUnet will use the global log level or (if a global log
2541level is not specified) will default to WARNING (that is, it will allow
2542the call to proceed, if its level is less or equal to the global log
2543level or to WARNING).
2544
2545That is, definitions are evaluated from left to right, and the first
2546matching definition is used to allow or deny the logging call. Thus it is
2547advised to place narrow definitions at the beginning of the logdef
2548string, and generic definitions - at the end.
2549
2550Whether a call is allowed or not is only decided the first time this
2551particular call is made. The evaluation result is then cached, so that
2552any attempts to make the same call later will be allowed or disallowed
2553right away. Because of that runtime log level evaluation should not
2554significantly affect the process performance.
2555Log definition parsing is only done once, at the first call to
2556@code{GNUNET_log_setup ()} made by the process (which is usually done soon after
2557it starts).
2558
2559At the moment of writing there is no way to specify logging definitions
2560from configuration files, only via environment variables.
2561
2562At the moment GNUnet will stop processing a log definition when it
2563encounters an error in definition formatting or an error in regular
2564expression syntax, and will not report the failure in any way.
2565
2566
2567@c ***********************************************************************
2568@menu
2569* Examples::
2570* Log files::
2571* Updated behavior of GNUNET_log::
2572@end menu
2573
2574@node Examples
2575@subsubsection Examples
2576
2577@table @asis
2578
2579@item @code{GNUNET_FORCE_LOG=";;;;DEBUG" gnunet-arm -s} Start GNUnet
2580process tree, running all processes with DEBUG level (one should be
2581careful with it, as log files will grow at alarming rate!)
2582@item @code{GNUNET_FORCE_LOG="core;;;;DEBUG" gnunet-arm -s} Start GNUnet
2583process tree, running the core service under DEBUG level (everything else
2584will use configured or default level).
2585
2586@item Start GNUnet process tree, allowing any logging calls from
2587gnunet-service-transport_validation.c (everything else will use
2588configured or default level).
2589
2590@example
2591GNUNET_FORCE_LOG=";gnunet-service-transport_validation.c;;; DEBUG" \
2592gnunet-arm -s
2593@end example
2594
2595@item Start GNUnet process tree, allowing any logging calls from
2596gnunet-gnunet-service-fs_push.c (everything else will use configured or
2597default level).
2598
2599@example
2600GNUNET_FORCE_LOG="fs;gnunet-service-fs_push.c;;;DEBUG" gnunet-arm -s
2601@end example
2602
2603@item Start GNUnet process tree, allowing any logging calls from the
2604GNUNET_NETWORK_socket_select function (everything else will use
2605configured or default level).
2606
2607@example
2608GNUNET_FORCE_LOG=";;GNUNET_NETWORK_socket_select;;DEBUG" gnunet-arm -s
2609@end example
2610
2611@item Start GNUnet process tree, allowing any logging calls from the
2612components that have "transport" in their names, and are made from
2613function that have "send" in their names. Everything else will be allowed
2614to be logged only if it has WARNING level.
2615
2616@example
2617GNUNET_FORCE_LOG="transport.*;;.*send.*;;DEBUG/;;;;WARNING" gnunet-arm -s
2618@end example
2619
2620@end table
2621
2622
2623On Windows, one can use batch files to run GNUnet processes with special
2624environment variables, without affecting the whole system. Such batch
2625file will look like this:
2626
2627@example
2628set GNUNET_FORCE_LOG=;;do_transmit;;DEBUG@ gnunet-arm -s
2629@end example
2630
2631(note the absence of double quotes in the environment variable definition,
2632as opposed to earlier examples, which use the shell).
2633Another limitation, on Windows, GNUNET_FORCE_LOGFILE @strong{MUST} be set
2634in order to GNUNET_FORCE_LOG to work.
2635
2636
2637@cindex Log files
2638@node Log files
2639@subsubsection Log files
2640
2641GNUnet can be told to log everything into a file instead of stderr (which
2642is the default) using the "--log-file=logfile" or "-l logfile" option.
2643This option can also be passed via command line, or from the "OPTION" and
2644"GLOBAL_POSTFIX" configuration keys (see above). The file name passed
2645with this option is subject to GNUnet filename expansion. If specified in
2646"GLOBAL_POSTFIX", it is also subject to ARM service filename expansion,
2647in particular, it may contain "@{@}" (left and right curly brace)
2648sequence, which will be replaced by ARM with the name of the service.
2649This is used to keep logs from more than one service separate, while only
2650specifying one template containing "@{@}" in GLOBAL_POSTFIX.
2651
2652As part of a secondary file name expansion, the first occurrence of "[]"
2653sequence ("left square brace" followed by "right square brace") in the
2654file name will be replaced with a process identifier or the process when
2655it initializes its logging subsystem. As a result, all processes will log
2656into different files. This is convenient for isolating messages of a
2657particular process, and prevents I/O races when multiple processes try to
2658write into the file at the same time. This expansion is done
2659independently of "@{@}" expansion that ARM service does (see above).
2660
2661The log file name that is specified via "-l" can contain format characters
2662from the 'strftime' function family. For example, "%Y" will be replaced
2663with the current year. Using "basename-%Y-%m-%d.log" would include the
2664current year, month and day in the log file. If a GNUnet process runs for
2665long enough to need more than one log file, it will eventually clean up
2666old log files. Currently, only the last three log files (plus the current
2667log file) are preserved. So once the fifth log file goes into use (so
2668after 4 days if you use "%Y-%m-%d" as above), the first log file will be
2669automatically deleted. Note that if your log file name only contains "%Y",
2670then log files would be kept for 4 years and the logs from the first year
2671would be deleted once year 5 begins. If you do not use any date-related
2672string format codes, logs would never be automatically deleted by GNUnet.
2673
2674
2675@c ***********************************************************************
2676
2677@node Updated behavior of GNUNET_log
2678@subsubsection Updated behavior of GNUNET_log
2679
2680It's currently quite common to see constructions like this all over the
2681code:
2682
2683@example
2684#if MESH_DEBUG
2685GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "MESH: client disconnected\n");
2686#endif
2687@end example
2688
2689The reason for the #if is not to avoid displaying the message when
2690disabled (GNUNET_ERROR_TYPE takes care of that), but to avoid the
2691compiler including it in the binary at all, when compiling GNUnet for
2692platforms with restricted storage space / memory (MIPS routers,
2693ARM plug computers / dev boards, etc).
2694
2695This presents several problems: the code gets ugly, hard to write and it
2696is very easy to forget to include the #if guards, creating non-consistent
2697code. A new change in GNUNET_log aims to solve these problems.
2698
2699@strong{This change requires to @file{./configure} with at least
2700@code{--enable-logging=verbose} to see debug messages.}
2701
2702Here is an example of code with dense debug statements:
2703
2704@example
2705switch (restrict_topology) @{
2706case GNUNET_TESTING_TOPOLOGY_CLIQUE:#if VERBOSE_TESTING
2707GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, _("Blacklisting all but clique
2708topology\n")); #endif unblacklisted_connections = create_clique (pg,
2709&remove_connections, BLACKLIST, GNUNET_NO); break; case
2710GNUNET_TESTING_TOPOLOGY_SMALL_WORLD_RING: #if VERBOSE_TESTING GNUNET_log
2711(GNUNET_ERROR_TYPE_DEBUG, _("Blacklisting all but small world (ring)
2712topology\n")); #endif unblacklisted_connections = create_small_world_ring
2713(pg,&remove_connections, BLACKLIST); break;
2714@end example
2715
2716
2717Pretty hard to follow, huh?
2718
2719From now on, it is not necessary to include the #if / #endif statements to
2720achieve the same behavior. The @code{GNUNET_log} and @code{GNUNET_log_from}
2721macros take
2722care of it for you, depending on the configure option:
2723
2724@itemize @bullet
2725@item If @code{--enable-logging} is set to @code{no}, the binary will
2726contain no log messages at all.
2727@item If @code{--enable-logging} is set to @code{yes}, the binary will
2728contain no DEBUG messages, and therefore running with @command{-L DEBUG}
2729will have
2730no effect. Other messages (ERROR, WARNING, INFO, etc) will be included.
2731@item If @code{--enable-logging} is set to @code{verbose}, or
2732@code{veryverbose} the binary will contain DEBUG messages (still, it will
2733be necessary to run with @command{-L DEBUG} or set the DEBUG config option
2734to show
2735them).
2736@end itemize
2737
2738
2739If you are a developer:
2740@itemize @bullet
2741@item please make sure that you @code{./configure
2742--enable-logging=@{verbose,veryverbose@}}, so you can see DEBUG messages.
2743@item please remove the @code{#if} statements around @code{GNUNET_log
2744(GNUNET_ERROR_TYPE_DEBUG, ...)} lines, to improve the readability of your
2745code.
2746@end itemize
2747
2748Since now activating DEBUG automatically makes it VERBOSE and activates
2749@strong{all} debug messages by default, you probably want to use the
2750https://gnunet.org/logging functionality to filter only relevant messages.
2751A suitable configuration could be:
2752
2753@example
2754$ export GNUNET_FORCE_LOG="^YOUR_SUBSYSTEM$;;;;DEBUG/;;;;WARNING"
2755@end example
2756
2757Which will behave almost like enabling DEBUG in that subsystem before the
2758change. Of course you can adapt it to your particular needs, this is only
2759a quick example.
2760
2761@cindex Interprocess communication API
2762@cindex ICP
2763@node Interprocess communication API (IPC)
2764@subsection Interprocess communication API (IPC)
2765
2766In GNUnet a variety of new message types might be defined and used in
2767interprocess communication, in this tutorial we use the
2768@code{struct AddressLookupMessage} as a example to introduce how to
2769construct our own message type in GNUnet and how to implement the message
2770communication between service and client.
2771(Here, a client uses the @code{struct AddressLookupMessage} as a request
2772to ask the server to return the address of any other peer connecting to
2773the service.)
2774
2775
2776@c ***********************************************************************
2777@menu
2778* Define new message types::
2779* Define message struct::
2780* Client - Establish connection::
2781* Client - Initialize request message::
2782* Client - Send request and receive response::
2783* Server - Startup service::
2784* Server - Add new handles for specified messages::
2785* Server - Process request message::
2786* Server - Response to client::
2787* Server - Notification of clients::
2788* Conversion between Network Byte Order (Big Endian) and Host Byte Order::
2789@end menu
2790
2791@node Define new message types
2792@subsubsection Define new message types
2793
2794First of all, you should define the new message type in
2795@file{gnunet_protocols.h}:
2796
2797@example
2798 // Request to look addresses of peers in server.
2799#define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP 29
2800 // Response to the address lookup request.
2801#define GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY 30
2802@end example
2803
2804@c ***********************************************************************
2805@node Define message struct
2806@subsubsection Define message struct
2807
2808After the type definition, the specified message structure should also be
2809described in the header file, e.g. transport.h in our case.
2810
2811@example
2812struct AddressLookupMessage @{
2813 struct GNUNET_MessageHeader header;
2814 int32_t numeric_only GNUNET_PACKED;
2815 struct GNUNET_TIME_AbsoluteNBO timeout;
2816 uint32_t addrlen GNUNET_PACKED;
2817 /* followed by 'addrlen' bytes of the actual address, then
2818 followed by the 0-terminated name of the transport */ @};
2819GNUNET_NETWORK_STRUCT_END
2820@end example
2821
2822
2823Please note @code{GNUNET_NETWORK_STRUCT_BEGIN} and @code{GNUNET_PACKED}
2824which both ensure correct alignment when sending structs over the network.
2825
2826@menu
2827@end menu
2828
2829@c ***********************************************************************
2830@node Client - Establish connection
2831@subsubsection Client - Establish connection
2832@c %**end of header
2833
2834
2835At first, on the client side, the underlying API is employed to create a
2836new connection to a service, in our example the transport service would be
2837connected.
2838
2839@example
2840struct GNUNET_CLIENT_Connection *client;
2841client = GNUNET_CLIENT_connect ("transport", cfg);
2842@end example
2843
2844@c ***********************************************************************
2845@node Client - Initialize request message
2846@subsubsection Client - Initialize request message
2847@c %**end of header
2848
2849When the connection is ready, we initialize the message. In this step,
2850all the fields of the message should be properly initialized, namely the
2851size, type, and some extra user-defined data, such as timeout, name of
2852transport, address and name of transport.
2853
2854@example
2855struct AddressLookupMessage *msg;
2856size_t len = sizeof (struct AddressLookupMessage)
2857 + addressLen
2858 + strlen (nameTrans)
2859 + 1;
2860msg->header->size = htons (len);
2861msg->header->type = htons
2862(GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP);
2863msg->timeout = GNUNET_TIME_absolute_hton (abs_timeout);
2864msg->addrlen = htonl (addressLen);
2865char *addrbuf = (char *) &msg[1];
2866memcpy (addrbuf, address, addressLen);
2867char *tbuf = &addrbuf[addressLen];
2868memcpy (tbuf, nameTrans, strlen (nameTrans) + 1);
2869@end example
2870
2871Note that, here the functions @code{htonl}, @code{htons} and
2872@code{GNUNET_TIME_absolute_hton} are applied to convert little endian
2873into big endian, about the usage of the big/small endian order and the
2874corresponding conversion function please refer to Introduction of
2875Big Endian and Little Endian.
2876
2877@c ***********************************************************************
2878@node Client - Send request and receive response
2879@subsubsection Client - Send request and receive response
2880@c %**end of header
2881
2882@b{FIXME: This is very outdated, see the tutorial for the current API!}
2883
2884Next, the client would send the constructed message as a request to the
2885service and wait for the response from the service. To accomplish this
2886goal, there are a number of API calls that can be used. In this example,
2887@code{GNUNET_CLIENT_transmit_and_get_response} is chosen as the most
2888appropriate function to use.
2889
2890@example
2891GNUNET_CLIENT_transmit_and_get_response
2892(client, msg->header, timeout, GNUNET_YES, &address_response_processor,
2893arp_ctx);
2894@end example
2895
2896the argument @code{address_response_processor} is a function with
2897@code{GNUNET_CLIENT_MessageHandler} type, which is used to process the
2898reply message from the service.
2899
2900@node Server - Startup service
2901@subsubsection Server - Startup service
2902
2903After receiving the request message, we run a standard GNUnet service
2904startup sequence using @code{GNUNET_SERVICE_run}, as follows,
2905
2906@example
2907int main(int argc, char**argv) @{
2908 GNUNET_SERVICE_run(argc, argv, "transport"
2909 GNUNET_SERVICE_OPTION_NONE, &run, NULL)); @}
2910@end example
2911
2912@c ***********************************************************************
2913@node Server - Add new handles for specified messages
2914@subsubsection Server - Add new handles for specified messages
2915@c %**end of header
2916
2917in the function above the argument @code{run} is used to initiate
2918transport service,and defined like this:
2919
2920@example
2921static void run (void *cls,
2922struct GNUNET_SERVER_Handle *serv,
2923const struct GNUNET_CONFIGURATION_Handle *cfg) @{
2924 GNUNET_SERVER_add_handlers (serv, handlers); @}
2925@end example
2926
2927
2928Here, @code{GNUNET_SERVER_add_handlers} must be called in the run
2929function to add new handlers in the service. The parameter
2930@code{handlers} is a list of @code{struct GNUNET_SERVER_MessageHandler}
2931to tell the service which function should be called when a particular
2932type of message is received, and should be defined in this way:
2933
2934@example
2935static struct GNUNET_SERVER_MessageHandler handlers[] = @{
2936 @{&handle_start,
2937 NULL,
2938 GNUNET_MESSAGE_TYPE_TRANSPORT_START,
2939 0@},
2940 @{&handle_send,
2941 NULL,
2942 GNUNET_MESSAGE_TYPE_TRANSPORT_SEND,
2943 0@},
2944 @{&handle_try_connect,
2945 NULL,
2946 GNUNET_MESSAGE_TYPE_TRANSPORT_TRY_CONNECT,
2947 sizeof (struct TryConnectMessage)
2948 @},
2949 @{&handle_address_lookup,
2950 NULL,
2951 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP,
2952 0@},
2953 @{NULL,
2954 NULL,
2955 0,
2956 0@}
2957@};
2958@end example
2959
2960
2961As shown, the first member of the struct in the first area is a callback
2962function, which is called to process the specified message types, given
2963as the third member. The second parameter is the closure for the callback
2964function, which is set to @code{NULL} in most cases, and the last
2965parameter is the expected size of the message of this type, usually we
2966set it to 0 to accept variable size, for special cases the exact size of
2967the specified message also can be set. In addition, the terminator sign
2968depicted as @code{@{NULL, NULL, 0, 0@}} is set in the last area.
2969
2970@c ***********************************************************************
2971@node Server - Process request message
2972@subsubsection Server - Process request message
2973@c %**end of header
2974
2975After the initialization of transport service, the request message would
2976be processed. Before handling the main message data, the validity of this
2977message should be checked out, e.g., to check whether the size of message
2978is correct.
2979
2980@example
2981size = ntohs (message->size);
2982if (size < sizeof (struct AddressLookupMessage)) @{
2983 GNUNET_break_op (0);
2984 GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
2985 return; @}
2986@end example
2987
2988
2989Note that, opposite to the construction method of the request message in
2990the client, in the server the function @code{nothl} and @code{ntohs}
2991should be employed during the extraction of the data from the message, so
2992that the data in big endian order can be converted back into little
2993endian order. See more in detail please refer to Introduction of
2994Big Endian and Little Endian.
2995
2996Moreover in this example, the name of the transport stored in the message
2997is a 0-terminated string, so we should also check whether the name of the
2998transport in the received message is 0-terminated:
2999
3000@example
3001nameTransport = (const char *) &address[addressLen];
3002if (nameTransport[size - sizeof
3003 (struct AddressLookupMessage)
3004 - addressLen - 1] != '\0') @{
3005 GNUNET_break_op (0);
3006 GNUNET_SERVER_receive_done (client,
3007 GNUNET_SYSERR);
3008 return; @}
3009@end example
3010
3011Here, @code{GNUNET_SERVER_receive_done} should be called to tell the
3012service that the request is done and can receive the next message. The
3013argument @code{GNUNET_SYSERR} here indicates that the service didn't
3014understand the request message, and the processing of this request would
3015be terminated.
3016
3017In comparison to the aforementioned situation, when the argument is equal
3018to @code{GNUNET_OK}, the service would continue to process the request
3019message.
3020
3021@c ***********************************************************************
3022@node Server - Response to client
3023@subsubsection Server - Response to client
3024@c %**end of header
3025
3026Once the processing of current request is done, the server should give the
3027response to the client. A new @code{struct AddressLookupMessage} would be
3028produced by the server in a similar way as the client did and sent to the
3029client, but here the type should be
3030@code{GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY} rather than
3031@code{GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_LOOKUP} in client.
3032@example
3033struct AddressLookupMessage *msg;
3034size_t len = sizeof (struct AddressLookupMessage)
3035 + addressLen
3036 + strlen (nameTrans) + 1;
3037msg->header->size = htons (len);
3038msg->header->type = htons
3039 (GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY);
3040
3041// ...
3042
3043struct GNUNET_SERVER_TransmitContext *tc;
3044tc = GNUNET_SERVER_transmit_context_create (client);
3045GNUNET_SERVER_transmit_context_append_data
3046(tc,
3047 NULL,
3048 0,
3049 GNUNET_MESSAGE_TYPE_TRANSPORT_ADDRESS_REPLY);
3050GNUNET_SERVER_transmit_context_run (tc, rtimeout);
3051@end example
3052
3053
3054Note that, there are also a number of other APIs provided to the service
3055to send the message.
3056
3057@c ***********************************************************************
3058@node Server - Notification of clients
3059@subsubsection Server - Notification of clients
3060@c %**end of header
3061
3062Often a service needs to (repeatedly) transmit notifications to a client
3063or a group of clients. In these cases, the client typically has once
3064registered for a set of events and then needs to receive a message
3065whenever such an event happens (until the client disconnects). The use of
3066a notification context can help manage message queues to clients and
3067handle disconnects. Notification contexts can be used to send
3068individualized messages to a particular client or to broadcast messages
3069to a group of clients. An individualized notification might look like
3070this:
3071
3072@example
3073GNUNET_SERVER_notification_context_unicast(nc,
3074 client,
3075 msg,
3076 GNUNET_YES);
3077@end example
3078
3079
3080Note that after processing the original registration message for
3081notifications, the server code still typically needs to call
3082@code{GNUNET_SERVER_receive_done} so that the client can transmit further
3083messages to the server.
3084
3085@c ***********************************************************************
3086@node Conversion between Network Byte Order (Big Endian) and Host Byte Order
3087@subsubsection Conversion between Network Byte Order (Big Endian) and Host Byte Order
3088@c %** subsub? it's a referenced page on the ipc document.
3089@c %**end of header
3090
3091Here we can simply comprehend big endian and little endian as Network Byte
3092Order and Host Byte Order respectively. What is the difference between
3093both two?
3094
3095Usually in our host computer we store the data byte as Host Byte Order,
3096for example, we store a integer in the RAM which might occupies 4 Byte,
3097as Host Byte Order the higher Byte would be stored at the lower address
3098of RAM, and the lower Byte would be stored at the higher address of RAM.
3099However, contrast to this, Network Byte Order just take the totally
3100opposite way to store the data, says, it will store the lower Byte at the
3101lower address, and the higher Byte will stay at higher address.
3102
3103For the current communication of network, we normally exchange the
3104information by surveying the data package, every two host wants to
3105communicate with each other must send and receive data package through
3106network. In order to maintain the identity of data through the
3107transmission in the network, the order of the Byte storage must changed
3108before sending and after receiving the data.
3109
3110There ten convenient functions to realize the conversion of Byte Order in
3111GNUnet, as following:
3112
3113@table @asis
3114
3115@item uint16_t htons(uint16_t hostshort) Convert host byte order to net
3116byte order with short int
3117@item uint32_t htonl(uint32_t hostlong) Convert host byte
3118order to net byte order with long int
3119@item uint16_t ntohs(uint16_t netshort)
3120Convert net byte order to host byte order with short int
3121@item uint32_t
3122ntohl(uint32_t netlong) Convert net byte order to host byte order with
3123long int
3124@item unsigned long long GNUNET_ntohll (unsigned long long netlonglong)
3125Convert net byte order to host byte order with long long int
3126@item unsigned long long GNUNET_htonll (unsigned long long hostlonglong)
3127Convert host byte order to net byte order with long long int
3128@item struct GNUNET_TIME_RelativeNBO GNUNET_TIME_relative_hton
3129(struct GNUNET_TIME_Relative a) Convert relative time to network byte
3130order.
3131@item struct GNUNET_TIME_Relative GNUNET_TIME_relative_ntoh
3132(struct GNUNET_TIME_RelativeNBO a) Convert relative time from network
3133byte order.
3134@item struct GNUNET_TIME_AbsoluteNBO GNUNET_TIME_absolute_hton
3135(struct GNUNET_TIME_Absolute a) Convert relative time to network byte
3136order.
3137@item struct GNUNET_TIME_Absolute GNUNET_TIME_absolute_ntoh
3138(struct GNUNET_TIME_AbsoluteNBO a) Convert relative time from network
3139byte order.
3140@end table
3141
3142@cindex Cryptography API
3143@node Cryptography API
3144@subsection Cryptography API
3145@c %**end of header
3146
3147The gnunetutil APIs provides the cryptographic primitives used in GNUnet.
3148GNUnet uses 2048 bit RSA keys for the session key exchange and for signing
3149messages by peers and most other public-key operations. Most researchers
3150in cryptography consider 2048 bit RSA keys as secure and practically
3151unbreakable for a long time. The API provides functions to create a fresh
3152key pair, read a private key from a file (or create a new file if the
3153file does not exist), encrypt, decrypt, sign, verify and extraction of
3154the public key into a format suitable for network transmission.
3155
3156For the encryption of files and the actual data exchanged between peers
3157GNUnet uses 256-bit AES encryption. Fresh, session keys are negotiated
3158for every new connection.@ Again, there is no published technique to
3159break this cipher in any realistic amount of time. The API provides
3160functions for generation of keys, validation of keys (important for
3161checking that decryptions using RSA succeeded), encryption and decryption.
3162
3163GNUnet uses SHA-512 for computing one-way hash codes. The API provides
3164functions to compute a hash over a block in memory or over a file on disk.
3165
3166The crypto API also provides functions for randomizing a block of memory,
3167obtaining a single random number and for generating a permutation of the
3168numbers 0 to n-1. Random number generation distinguishes between WEAK and
3169STRONG random number quality; WEAK random numbers are pseudo-random
3170whereas STRONG random numbers use entropy gathered from the operating
3171system.
3172
3173Finally, the crypto API provides a means to deterministically generate a
31741024-bit RSA key from a hash code. These functions should most likely not
3175be used by most applications; most importantly,
3176GNUNET_CRYPTO_rsa_key_create_from_hash does not create an RSA-key that
3177should be considered secure for traditional applications of RSA.
3178
3179@cindex Message Queue API
3180@node Message Queue API
3181@subsection Message Queue API
3182@c %**end of header
3183
3184@strong{ Introduction }@
3185Often, applications need to queue messages that
3186are to be sent to other GNUnet peers, clients or services. As all of
3187GNUnet's message-based communication APIs, by design, do not allow
3188messages to be queued, it is common to implement custom message queues
3189manually when they are needed. However, writing very similar code in
3190multiple places is tedious and leads to code duplication.
3191
3192MQ (for Message Queue) is an API that provides the functionality to
3193implement and use message queues. We intend to eventually replace all of
3194the custom message queue implementations in GNUnet with MQ.
3195
3196@strong{ Basic Concepts }@
3197The two most important entities in MQ are queues and envelopes.
3198
3199Every queue is backed by a specific implementation (e.g. for mesh, stream,
3200connection, server client, etc.) that will actually deliver the queued
3201messages. For convenience,@ some queues also allow to specify a list of
3202message handlers. The message queue will then also wait for incoming
3203messages and dispatch them appropriately.
3204
3205An envelope holds the the memory for a message, as well as metadata
3206(Where is the envelope queued? What should happen after it has been
3207sent?). Any envelope can only be queued in one message queue.
3208
3209@strong{ Creating Queues }@
3210The following is a list of currently available message queues. Note that
3211to avoid layering issues, message queues for higher level APIs are not
3212part of @code{libgnunetutil}, but@ the respective API itself provides the
3213queue implementation.
3214
3215@table @asis
3216
3217@item @code{GNUNET_MQ_queue_for_connection_client}
3218Transmits queued messages over a @code{GNUNET_CLIENT_Connection} handle.
3219Also supports receiving with message handlers.
3220
3221@item @code{GNUNET_MQ_queue_for_server_client}
3222Transmits queued messages over a @code{GNUNET_SERVER_Client} handle. Does
3223not support incoming message handlers.
3224
3225@item @code{GNUNET_MESH_mq_create} Transmits queued messages over a
3226@code{GNUNET_MESH_Tunnel} handle. Does not support incoming message
3227handlers.
3228
3229@item @code{GNUNET_MQ_queue_for_callbacks} This is the most general
3230implementation. Instead of delivering and receiving messages with one of
3231GNUnet's communication APIs, implementation callbacks are called. Refer to
3232"Implementing Queues" for a more detailed explanation.
3233@end table
3234
3235
3236@strong{ Allocating Envelopes }@
3237A GNUnet message (as defined by the GNUNET_MessageHeader) has three
3238parts: The size, the type, and the body.
3239
3240MQ provides macros to allocate an envelope containing a message
3241conveniently, automatically setting the size and type fields of the
3242message.
3243
3244Consider the following simple message, with the body consisting of a
3245single number value.
3246@c why the empty code function?
3247@code{}
3248
3249@example
3250struct NumberMessage @{
3251 /** Type: GNUNET_MESSAGE_TYPE_EXAMPLE_1 */
3252 struct GNUNET_MessageHeader header;
3253 uint32_t number GNUNET_PACKED;
3254@};
3255@end example
3256
3257An envelope containing an instance of the NumberMessage can be
3258constructed like this:
3259
3260@example
3261struct GNUNET_MQ_Envelope *ev;
3262struct NumberMessage *msg;
3263ev = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_EXAMPLE_1);
3264msg->number = htonl (42);
3265@end example
3266
3267In the above code, @code{GNUNET_MQ_msg} is a macro. The return value is
3268the newly allocated envelope. The first argument must be a pointer to some
3269@code{struct} containing a @code{struct GNUNET_MessageHeader header}
3270field, while the second argument is the desired message type, in host
3271byte order.
3272
3273The @code{msg} pointer now points to an allocated message, where the
3274message type and the message size are already set. The message's size is
3275inferred from the type of the @code{msg} pointer: It will be set to
3276'sizeof(*msg)', properly converted to network byte order.
3277
3278If the message body's size is dynamic, the the macro
3279@code{GNUNET_MQ_msg_extra} can be used to allocate an envelope whose
3280message has additional space allocated after the @code{msg} structure.
3281
3282If no structure has been defined for the message,
3283@code{GNUNET_MQ_msg_header_extra} can be used to allocate additional space
3284after the message header. The first argument then must be a pointer to a
3285@code{GNUNET_MessageHeader}.
3286
3287@strong{Envelope Properties}@
3288A few functions in MQ allow to set additional properties on envelopes:
3289
3290@table @asis
3291
3292@item @code{GNUNET_MQ_notify_sent} Allows to specify a function that will
3293be called once the envelope's message has been sent irrevocably.
3294An envelope can be canceled precisely up to the@ point where the notify
3295sent callback has been called.
3296
3297@item @code{GNUNET_MQ_disable_corking} No corking will be used when
3298sending the message. Not every@ queue supports this flag, per default,
3299envelopes are sent with corking.@
3300
3301@end table
3302
3303
3304@strong{Sending Envelopes}@
3305Once an envelope has been constructed, it can be queued for sending with
3306@code{GNUNET_MQ_send}.
3307
3308Note that in order to avoid memory leaks, an envelope must either be sent
3309(the queue will free it) or destroyed explicitly with
3310@code{GNUNET_MQ_discard}.
3311
3312@strong{Canceling Envelopes}@
3313An envelope queued with @code{GNUNET_MQ_send} can be canceled with
3314@code{GNUNET_MQ_cancel}. Note that after the notify sent callback has
3315been called, canceling a message results in undefined behavior.
3316Thus it is unsafe to cancel an envelope that does not have a notify sent
3317callback. When canceling an envelope, it is not necessary@ to call
3318@code{GNUNET_MQ_discard}, and the envelope can't be sent again.
3319
3320@strong{ Implementing Queues }@
3321@code{TODO}
3322
3323@cindex Service API
3324@node Service API
3325@subsection Service API
3326@c %**end of header
3327
3328Most GNUnet code lives in the form of services. Services are processes
3329that offer an API for other components of the system to build on. Those
3330other components can be command-line tools for users, graphical user
3331interfaces or other services. Services provide their API using an IPC
3332protocol. For this, each service must listen on either a TCP port or a
3333UNIX domain socket; for this, the service implementation uses the server
3334API. This use of server is exposed directly to the users of the service
3335API. Thus, when using the service API, one is usually also often using
3336large parts of the server API. The service API provides various
3337convenience functions, such as parsing command-line arguments and the
3338configuration file, which are not found in the server API.
3339The dual to the service/server API is the client API, which can be used to
3340access services.
3341
3342The most common way to start a service is to use the
3343@code{GNUNET_SERVICE_run} function from the program's main function.
3344@code{GNUNET_SERVICE_run} will then parse the command line and
3345configuration files and, based on the options found there,
3346start the server. It will then give back control to the main
3347program, passing the server and the configuration to the
3348@code{GNUNET_SERVICE_Main} callback. @code{GNUNET_SERVICE_run}
3349will also take care of starting the scheduler loop.
3350If this is inappropriate (for example, because the scheduler loop
3351is already running), @code{GNUNET_SERVICE_start} and
3352related functions provide an alternative to @code{GNUNET_SERVICE_run}.
3353
3354When starting a service, the service_name option is used to determine
3355which sections in the configuration file should be used to configure the
3356service. A typical value here is the name of the @file{src/}
3357sub-directory, for example @file{statistics}.
3358The same string would also be given to
3359@code{GNUNET_CLIENT_connect} to access the service.
3360
3361Once a service has been initialized, the program should use the
3362@code{GNUNET_SERVICE_Main} callback to register message handlers
3363using @code{GNUNET_SERVER_add_handlers}.
3364The service will already have registered a handler for the
3365"TEST" message.
3366
3367@findex GNUNET_SERVICE_Options
3368The option bitfield (@code{enum GNUNET_SERVICE_Options})
3369determines how a service should behave during shutdown.
3370There are three key strategies:
3371
3372@table @asis
3373
3374@item instant (@code{GNUNET_SERVICE_OPTION_NONE})
3375Upon receiving the shutdown
3376signal from the scheduler, the service immediately terminates the server,
3377closing all existing connections with clients.
3378@item manual (@code{GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN})
3379The service does nothing by itself
3380during shutdown. The main program will need to take the appropriate
3381action by calling GNUNET_SERVER_destroy or GNUNET_SERVICE_stop (depending
3382on how the service was initialized) to terminate the service. This method
3383is used by gnunet-service-arm and rather uncommon.
3384@item soft (@code{GNUNET_SERVICE_OPTION_SOFT_SHUTDOWN})
3385Upon receiving the shutdown signal from the scheduler,
3386the service immediately tells the server to stop
3387listening for incoming clients. Requests from normal existing clients are
3388still processed and the server/service terminates once all normal clients
3389have disconnected. Clients that are not expected to ever disconnect (such
3390as clients that monitor performance values) can be marked as 'monitor'
3391clients using GNUNET_SERVER_client_mark_monitor. Those clients will
3392continue to be processed until all 'normal' clients have disconnected.
3393Then, the server will terminate, closing the monitor connections.
3394This mode is for example used by 'statistics', allowing existing 'normal'
3395clients to set (possibly persistent) statistic values before terminating.
3396
3397@end table
3398
3399@c ***********************************************************************
3400@node Optimizing Memory Consumption of GNUnet's (Multi-) Hash Maps
3401@subsection Optimizing Memory Consumption of GNUnet's (Multi-) Hash Maps
3402@c %**end of header
3403
3404A commonly used data structure in GNUnet is a (multi-)hash map. It is most
3405often used to map a peer identity to some data structure, but also to map
3406arbitrary keys to values (for example to track requests in the distributed
3407hash table or in file-sharing). As it is commonly used, the DHT is
3408actually sometimes responsible for a large share of GNUnet's overall
3409memory consumption (for some processes, 30% is not uncommon). The
3410following text documents some API quirks (and their implications for
3411applications) that were recently introduced to minimize the footprint of
3412the hash map.
3413
3414
3415@c ***********************************************************************
3416@menu
3417* Analysis::
3418* Solution::
3419* Migration::
3420* Conclusion::
3421* Availability::
3422@end menu
3423
3424@node Analysis
3425@subsubsection Analysis
3426@c %**end of header
3427
3428The main reason for the "excessive" memory consumption by the hash map is
3429that GNUnet uses 512-bit cryptographic hash codes --- and the
3430(multi-)hash map also uses the same 512-bit 'struct GNUNET_HashCode'. As
3431a result, storing just the keys requires 64 bytes of memory for each key.
3432As some applications like to keep a large number of entries in the hash
3433map (after all, that's what maps are good for), 64 bytes per hash is
3434significant: keeping a pointer to the value and having a linked list for
3435collisions consume between 8 and 16 bytes, and 'malloc' may add about the
3436same overhead per allocation, putting us in the 16 to 32 byte per entry
3437ballpark. Adding a 64-byte key then triples the overall memory
3438requirement for the hash map.
3439
3440To make things "worse", most of the time storing the key in the hash map
3441is not required: it is typically already in memory elsewhere! In most
3442cases, the values stored in the hash map are some application-specific
3443struct that _also_ contains the hash. Here is a simplified example:
3444
3445@example
3446struct MyValue @{
3447struct GNUNET_HashCode key;
3448unsigned int my_data; @};
3449
3450// ...
3451val = GNUNET_malloc (sizeof (struct MyValue));
3452val->key = key;
3453val->my_data = 42;
3454GNUNET_CONTAINER_multihashmap_put (map, &key, val, ...);
3455@end example
3456
3457This is a common pattern as later the entries might need to be removed,
3458and at that time it is convenient to have the key immediately at hand:
3459
3460@example
3461GNUNET_CONTAINER_multihashmap_remove (map, &val->key, val);
3462@end example
3463
3464
3465Note that here we end up with two times 64 bytes for the key, plus maybe
346664 bytes total for the rest of the 'struct MyValue' and the map entry in
3467the hash map. The resulting redundant storage of the key increases
3468overall memory consumption per entry from the "optimal" 128 bytes to 192
3469bytes. This is not just an extreme example: overheads in practice are
3470actually sometimes close to those highlighted in this example. This is
3471especially true for maps with a significant number of entries, as there
3472we tend to really try to keep the entries small.
3473
3474@c ***********************************************************************
3475@node Solution
3476@subsubsection Solution
3477@c %**end of header
3478
3479The solution that has now been implemented is to @strong{optionally}
3480allow the hash map to not make a (deep) copy of the hash but instead have
3481a pointer to the hash/key in the entry. This reduces the memory
3482consumption for the key from 64 bytes to 4 to 8 bytes. However, it can
3483also only work if the key is actually stored in the entry (which is the
3484case most of the time) and if the entry does not modify the key (which in
3485all of the code I'm aware of has been always the case if there key is
3486stored in the entry). Finally, when the client stores an entry in the
3487hash map, it @strong{must} provide a pointer to the key within the entry,
3488not just a pointer to a transient location of the key. If
3489the client code does not meet these requirements, the result is a dangling
3490pointer and undefined behavior of the (multi-)hash map API.
3491
3492@c ***********************************************************************
3493@node Migration
3494@subsubsection Migration
3495@c %**end of header
3496
3497To use the new feature, first check that the values contain the respective
3498key (and never modify it). Then, all calls to
3499@code{GNUNET_CONTAINER_multihashmap_put} on the respective map must be
3500audited and most likely changed to pass a pointer into the value's struct.
3501For the initial example, the new code would look like this:
3502
3503@example
3504struct MyValue @{
3505struct GNUNET_HashCode key;
3506unsigned int my_data; @};
3507
3508// ...
3509val = GNUNET_malloc (sizeof (struct MyValue));
3510val->key = key; val->my_data = 42;
3511GNUNET_CONTAINER_multihashmap_put (map, &val->key, val, ...);
3512@end example
3513
3514
3515Note that @code{&val} was changed to @code{&val->key} in the argument to
3516the @code{put} call. This is critical as often @code{key} is on the stack
3517or in some other transient data structure and thus having the hash map
3518keep a pointer to @code{key} would not work. Only the key inside of
3519@code{val} has the same lifetime as the entry in the map (this must of
3520course be checked as well). Naturally, @code{val->key} must be
3521initialized before the @code{put} call. Once all @code{put} calls have
3522been converted and double-checked, you can change the call to create the
3523hash map from
3524
3525@example
3526map =
3527GNUNET_CONTAINER_multihashmap_create (SIZE, GNUNET_NO);
3528@end example
3529
3530to
3531
3532@example
3533map = GNUNET_CONTAINER_multihashmap_create (SIZE, GNUNET_YES);
3534@end example
3535
3536If everything was done correctly, you now use about 60 bytes less memory
3537per entry in @code{map}. However, if now (or in the future) any call to
3538@code{put} does not ensure that the given key is valid until the entry is
3539removed from the map, undefined behavior is likely to be observed.
3540
3541@c ***********************************************************************
3542@node Conclusion
3543@subsubsection Conclusion
3544@c %**end of header
3545
3546The new optimization can is often applicable and can result in a
3547reduction in memory consumption of up to 30% in practice. However, it
3548makes the code less robust as additional invariants are imposed on the
3549multi hash map client. Thus applications should refrain from enabling the
3550new mode unless the resulting performance increase is deemed significant
3551enough. In particular, it should generally not be used in new code (wait
3552at least until benchmarks exist).
3553
3554@c ***********************************************************************
3555@node Availability
3556@subsubsection Availability
3557@c %**end of header
3558
3559The new multi hash map code was committed in SVN 24319 (will be in GNUnet
35600.9.4). Various subsystems (transport, core, dht, file-sharing) were
3561previously audited and modified to take advantage of the new capability.
3562In particular, memory consumption of the file-sharing service is expected
3563to drop by 20-30% due to this change.
3564
3565
3566@cindex CONTAINER_MDLL API
3567@node CONTAINER_MDLL API
3568@subsection CONTAINER_MDLL API
3569@c %**end of header
3570
3571This text documents the GNUNET_CONTAINER_MDLL API. The
3572GNUNET_CONTAINER_MDLL API is similar to the GNUNET_CONTAINER_DLL API in
3573that it provides operations for the construction and manipulation of
3574doubly-linked lists. The key difference to the (simpler) DLL-API is that
3575the MDLL-version allows a single element (instance of a "struct") to be
3576in multiple linked lists at the same time.
3577
3578Like the DLL API, the MDLL API stores (most of) the data structures for
3579the doubly-linked list with the respective elements; only the 'head' and
3580'tail' pointers are stored "elsewhere" --- and the application needs to
3581provide the locations of head and tail to each of the calls in the
3582MDLL API. The key difference for the MDLL API is that the "next" and
3583"previous" pointers in the struct can no longer be simply called "next"
3584and "prev" --- after all, the element may be in multiple doubly-linked
3585lists, so we cannot just have one "next" and one "prev" pointer!
3586
3587The solution is to have multiple fields that must have a name of the
3588format "next_XX" and "prev_XX" where "XX" is the name of one of the
3589doubly-linked lists. Here is a simple example:
3590
3591@example
3592struct MyMultiListElement @{
3593 struct MyMultiListElement *next_ALIST;
3594 struct MyMultiListElement *prev_ALIST;
3595 struct MyMultiListElement *next_BLIST;
3596 struct MyMultiListElement *prev_BLIST;
3597 void
3598 *data;
3599@};
3600@end example
3601
3602
3603Note that by convention, we use all-uppercase letters for the list names.
3604In addition, the program needs to have a location for the head and tail
3605pointers for both lists, for example:
3606
3607@example
3608static struct MyMultiListElement *head_ALIST;
3609static struct MyMultiListElement *tail_ALIST;
3610static struct MyMultiListElement *head_BLIST;
3611static struct MyMultiListElement *tail_BLIST;
3612@end example
3613
3614
3615Using the MDLL-macros, we can now insert an element into the ALIST:
3616
3617@example
3618GNUNET_CONTAINER_MDLL_insert (ALIST, head_ALIST, tail_ALIST, element);
3619@end example
3620
3621
3622Passing "ALIST" as the first argument to MDLL specifies which of the
3623next/prev fields in the 'struct MyMultiListElement' should be used. The
3624extra "ALIST" argument and the "_ALIST" in the names of the
3625next/prev-members are the only differences between the MDDL and DLL-API.
3626Like the DLL-API, the MDLL-API offers functions for inserting (at head,
3627at tail, after a given element) and removing elements from the list.
3628Iterating over the list should be done by directly accessing the
3629"next_XX" and/or "prev_XX" members.
3630
3631@cindex Automatic Restart Manager
3632@cindex ARM
3633@node Automatic Restart Manager (ARM)
3634@section Automatic Restart Manager (ARM)
3635@c %**end of header
3636
3637GNUnet's Automated Restart Manager (ARM) is the GNUnet service responsible
3638for system initialization and service babysitting. ARM starts and halts
3639services, detects configuration changes and restarts services impacted by
3640the changes as needed. It's also responsible for restarting services in
3641case of crashes and is planned to incorporate automatic debugging for
3642diagnosing service crashes providing developers insights about crash
3643reasons. The purpose of this document is to give GNUnet developer an idea
3644about how ARM works and how to interact with it.
3645
3646@menu
3647* Basic functionality::
3648* Key configuration options::
3649* ARM - Availability::
3650* Reliability::
3651@end menu
3652
3653@c ***********************************************************************
3654@node Basic functionality
3655@subsection Basic functionality
3656@c %**end of header
3657
3658@itemize @bullet
3659@item ARM source code can be found under "src/arm".@ Service processes are
3660managed by the functions in "gnunet-service-arm.c" which is controlled
3661with "gnunet-arm.c" (main function in that file is ARM's entry point).
3662
3663@item The functions responsible for communicating with ARM , starting and
3664stopping services -including ARM service itself- are provided by the
3665ARM API "arm_api.c".@ Function: GNUNET_ARM_connect() returns to the caller
3666an ARM handle after setting it to the caller's context (configuration and
3667scheduler in use). This handle can be used afterwards by the caller to
3668communicate with ARM. Functions GNUNET_ARM_start_service() and
3669GNUNET_ARM_stop_service() are used for starting and stopping services
3670respectively.
3671
3672@item A typical example of using these basic ARM services can be found in
3673file test_arm_api.c. The test case connects to ARM, starts it, then uses
3674it to start a service "resolver", stops the "resolver" then stops "ARM".
3675@end itemize
3676
3677@c ***********************************************************************
3678@node Key configuration options
3679@subsection Key configuration options
3680@c %**end of header
3681
3682Configurations for ARM and services should be available in a .conf file
3683(As an example, see test_arm_api_data.conf). When running ARM, the
3684configuration file to use should be passed to the command:
3685
3686@example
3687$ gnunet-arm -s -c configuration_to_use.conf
3688@end example
3689
3690If no configuration is passed, the default configuration file will be used
3691(see GNUNET_PREFIX/share/gnunet/defaults.conf which is created from
3692contrib/defaults.conf).@ Each of the services is having a section starting
3693by the service name between square brackets, for example: "[arm]".
3694The following options configure how ARM configures or interacts with the
3695various services:
3696
3697@table @asis
3698
3699@item PORT Port number on which the service is listening for incoming TCP
3700connections. ARM will start the services should it notice a request at
3701this port.
3702
3703@item HOSTNAME Specifies on which host the service is deployed. Note
3704that ARM can only start services that are running on the local system
3705(but will not check that the hostname matches the local machine name).
3706This option is used by the @code{gnunet_client_lib.h} implementation to
3707determine which system to connect to. The default is "localhost".
3708
3709@item BINARY The name of the service binary file.
3710
3711@item OPTIONS To be passed to the service.
3712
3713@item PREFIX A command to pre-pend to the actual command, for example,
3714running a service with "valgrind" or "gdb"
3715
3716@item DEBUG Run in debug mode (much verbosity).
3717
3718@item START_ON_DEMAND ARM will listen to UNIX domain socket and/or TCP port of
3719the service and start the service on-demand.
3720
3721@item IMMEDIATE_START ARM will always start this service when the peer
3722is started.
3723
3724@item ACCEPT_FROM IPv4 addresses the service accepts connections from.
3725
3726@item ACCEPT_FROM6 IPv6 addresses the service accepts connections from.
3727
3728@end table
3729
3730
3731Options that impact the operation of ARM overall are in the "[arm]"
3732section. ARM is a normal service and has (except for START_ON_DEMAND) all of the
3733options that other services do. In addition, ARM has the
3734following options:
3735
3736@table @asis
3737
3738@item GLOBAL_PREFIX Command to be pre-pended to all services that are
3739going to run.
3740
3741@item GLOBAL_POSTFIX Global option that will be supplied to all the
3742services that are going to run.
3743
3744@end table
3745
3746@c ***********************************************************************
3747@node ARM - Availability
3748@subsection ARM - Availability
3749@c %**end of header
3750
3751As mentioned before, one of the features provided by ARM is starting
3752services on demand. Consider the example of one service "client" that
3753wants to connect to another service a "server". The "client" will ask ARM
3754to run the "server". ARM starts the "server". The "server" starts
3755listening to incoming connections. The "client" will establish a
3756connection with the "server". And then, they will start to communicate
3757together.@ One problem with that scheme is that it's slow!@
3758The "client" service wants to communicate with the "server" service at
3759once and is not willing wait for it to be started and listening to
3760incoming connections before serving its request.@ One solution for that
3761problem will be that ARM starts all services as default services. That
3762solution will solve the problem, yet, it's not quite practical, for some
3763services that are going to be started can never be used or are going to
3764be used after a relatively long time.@
3765The approach followed by ARM to solve this problem is as follows:
3766
3767@itemize @bullet
3768
3769@item For each service having a PORT field in the configuration file and
3770that is not one of the default services ( a service that accepts incoming
3771connections from clients), ARM creates listening sockets for all addresses
3772associated with that service.
3773
3774@item The "client" will immediately establish a connection with
3775the "server".
3776
3777@item ARM --- pretending to be the "server" --- will listen on the
3778respective port and notice the incoming connection from the "client"
3779(but not accept it), instead
3780
3781@item Once there is an incoming connection, ARM will start the "server",
3782passing on the listen sockets (now, the service is started and can do its
3783work).
3784
3785@item Other client services now can directly connect directly to the
3786"server".
3787
3788@end itemize
3789
3790@c ***********************************************************************
3791@node Reliability
3792@subsection Reliability
3793
3794One of the features provided by ARM, is the automatic restart of crashed
3795services.@ ARM needs to know which of the running services died. Function
3796"gnunet-service-arm.c/maint_child_death()" is responsible for that. The
3797function is scheduled to run upon receiving a SIGCHLD signal. The
3798function, then, iterates ARM's list of services running and monitors
3799which service has died (crashed). For all crashing services, ARM restarts
3800them.@
3801Now, considering the case of a service having a serious problem causing it
3802to crash each time it's started by ARM. If ARM keeps blindly restarting
3803such a service, we are going to have the pattern:
3804start-crash-restart-crash-restart-crash and so forth!! Which is of course
3805not practical.@
3806For that reason, ARM schedules the service to be restarted after waiting
3807for some delay that grows exponentially with each crash/restart of that
3808service.@ To clarify the idea, considering the following example:
3809
3810@itemize @bullet
3811
3812@item Service S crashed.
3813
3814@item ARM receives the SIGCHLD and inspects its list of services to find
3815the dead one(s).
3816
3817@item ARM finds S dead and schedules it for restarting after "backoff"
3818time which is initially set to 1ms. ARM will double the backoff time
3819correspondent to S (now backoff(S) = 2ms)
3820
3821@item Because there is a severe problem with S, it crashed again.
3822
3823@item Again ARM receives the SIGCHLD and detects that it's S again that's
3824crashed. ARM schedules it for restarting but after its new backoff time
3825(which became 2ms), and doubles its backoff time (now backoff(S) = 4).
3826
3827@item and so on, until backoff(S) reaches a certain threshold
3828(@code{EXPONENTIAL_BACKOFF_THRESHOLD} is set to half an hour),
3829after reaching it, backoff(S) will remain half an hour,
3830hence ARM won't be busy for a lot of time trying to restart a
3831problematic service.
3832@end itemize
3833
3834@cindex TRANSPORT Subsystem
3835@node TRANSPORT Subsystem
3836@section TRANSPORT Subsystem
3837@c %**end of header
3838
3839This chapter documents how the GNUnet transport subsystem works. The
3840GNUnet transport subsystem consists of three main components: the
3841transport API (the interface used by the rest of the system to access the
3842transport service), the transport service itself (most of the interesting
3843functions, such as choosing transports, happens here) and the transport
3844plugins. A transport plugin is a concrete implementation for how two
3845GNUnet peers communicate; many plugins exist, for example for
3846communication via TCP, UDP, HTTP, HTTPS and others. Finally, the
3847transport subsystem uses supporting code, especially the NAT/UPnP
3848library to help with tasks such as NAT traversal.
3849
3850Key tasks of the transport service include:
3851
3852@itemize @bullet
3853
3854@item Create our HELLO message, notify clients and neighbours if our HELLO
3855changes (using NAT library as necessary)
3856
3857@item Validate HELLOs from other peers (send PING), allow other peers to
3858validate our HELLO's addresses (send PONG)
3859
3860@item Upon request, establish connections to other peers (using address
3861selection from ATS subsystem) and maintain them (again using PINGs and
3862PONGs) as long as desired
3863
3864@item Accept incoming connections, give ATS service the opportunity to
3865switch communication channels
3866
3867@item Notify clients about peers that have connected to us or that have
3868been disconnected from us
3869
3870@item If a (stateful) connection goes down unexpectedly (without explicit
3871DISCONNECT), quickly attempt to recover (without notifying clients) but do
3872notify clients quickly if reconnecting fails
3873
3874@item Send (payload) messages arriving from clients to other peers via
3875transport plugins and receive messages from other peers, forwarding
3876those to clients
3877
3878@item Enforce inbound traffic limits (using flow-control if it is
3879applicable); outbound traffic limits are enforced by CORE, not by us (!)
3880
3881@item Enforce restrictions on P2P connection as specified by the blacklist
3882configuration and blacklisting clients
3883@end itemize
3884
3885Note that the term "clients" in the list above really refers to the
3886GNUnet-CORE service, as CORE is typically the only client of the
3887transport service.
3888
3889@menu
3890* Address validation protocol::
3891@end menu
3892
3893@node Address validation protocol
3894@subsection Address validation protocol
3895@c %**end of header
3896
3897This section documents how the GNUnet transport service validates
3898connections with other peers. It is a high-level description of the
3899protocol necessary to understand the details of the implementation. It
3900should be noted that when we talk about PING and PONG messages in this
3901section, we refer to transport-level PING and PONG messages, which are
3902different from core-level PING and PONG messages (both in implementation
3903and function).
3904
3905The goal of transport-level address validation is to minimize the chances
3906of a successful man-in-the-middle attack against GNUnet peers on the
3907transport level. Such an attack would not allow the adversary to decrypt
3908the P2P transmissions, but a successful attacker could at least measure
3909traffic volumes and latencies (raising the adversaries capabilities by
3910those of a global passive adversary in the worst case). The scenarios we
3911are concerned about is an attacker, Mallory, giving a @code{HELLO} to
3912Alice that claims to be for Bob, but contains Mallory's IP address
3913instead of Bobs (for some transport).
3914Mallory would then forward the traffic to Bob (by initiating a
3915connection to Bob and claiming to be Alice). As a further
3916complication, the scheme has to work even if say Alice is behind a NAT
3917without traversal support and hence has no address of her own (and thus
3918Alice must always initiate the connection to Bob).
3919
3920An additional constraint is that @code{HELLO} messages do not contain a
3921cryptographic signature since other peers must be able to edit
3922(i.e. remove) addresses from the @code{HELLO} at any time (this was
3923not true in GNUnet 0.8.x). A basic @strong{assumption} is that each peer
3924knows the set of possible network addresses that it @strong{might}
3925be reachable under (so for example, the external IP address of the
3926NAT plus the LAN address(es) with the respective ports).
3927
3928The solution is the following. If Alice wants to validate that a given
3929address for Bob is valid (i.e. is actually established @strong{directly}
3930with the intended target), she sends a PING message over that connection
3931to Bob. Note that in this case, Alice initiated the connection so only
3932Alice knows which address was used for sure (Alice may be behind NAT, so
3933whatever address Bob sees may not be an address Alice knows she has).
3934Bob checks that the address given in the @code{PING} is actually one
3935of Bob's addresses (ie: does not belong to Mallory), and if it is,
3936sends back a @code{PONG} (with a signature that says that Bob
3937owns/uses the address from the @code{PING}).
3938Alice checks the signature and is happy if it is valid and the address
3939in the @code{PONG} is the address Alice used.
3940This is similar to the 0.8.x protocol where the @code{HELLO} contained a
3941signature from Bob for each address used by Bob.
3942Here, the purpose code for the signature is
3943@code{GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN}. After this, Alice will
3944remember Bob's address and consider the address valid for a while (12h in
3945the current implementation). Note that after this exchange, Alice only
3946considers Bob's address to be valid, the connection itself is not
3947considered 'established'. In particular, Alice may have many addresses
3948for Bob that Alice considers valid.
3949
3950The @code{PONG} message is protected with a nonce/challenge against replay
3951attacks (@uref{http://en.wikipedia.org/wiki/Replay_attack, replay})
3952and uses an expiration time for the signature (but those are almost
3953implementation details).
3954
3955@cindex NAT library
3956@node NAT library
3957@section NAT library
3958@c %**end of header
3959
3960The goal of the GNUnet NAT library is to provide a general-purpose API for
3961NAT traversal @strong{without} third-party support. So protocols that
3962involve contacting a third peer to help establish a connection between
3963two peers are outside of the scope of this API. That does not mean that
3964GNUnet doesn't support involving a third peer (we can do this with the
3965distance-vector transport or using application-level protocols), it just
3966means that the NAT API is not concerned with this possibility. The API is
3967written so that it will work for IPv6-NAT in the future as well as
3968current IPv4-NAT. Furthermore, the NAT API is always used, even for peers
3969that are not behind NAT --- in that case, the mapping provided is simply
3970the identity.
3971
3972NAT traversal is initiated by calling @code{GNUNET_NAT_register}. Given a
3973set of addresses that the peer has locally bound to (TCP or UDP), the NAT
3974library will return (via callback) a (possibly longer) list of addresses
3975the peer @strong{might} be reachable under. Internally, depending on the
3976configuration, the NAT library will try to punch a hole (using UPnP) or
3977just "know" that the NAT was manually punched and generate the respective
3978external IP address (the one that should be globally visible) based on
3979the given information.
3980
3981The NAT library also supports ICMP-based NAT traversal. Here, the other
3982peer can request connection-reversal by this peer (in this special case,
3983the peer is even allowed to configure a port number of zero). If the NAT
3984library detects a connection-reversal request, it returns the respective
3985target address to the client as well. It should be noted that
3986connection-reversal is currently only intended for TCP, so other plugins
3987@strong{must} pass @code{NULL} for the reversal callback. Naturally, the
3988NAT library also supports requesting connection reversal from a remote
3989peer (@code{GNUNET_NAT_run_client}).
3990
3991Once initialized, the NAT handle can be used to test if a given address is
3992possibly a valid address for this peer (@code{GNUNET_NAT_test_address}).
3993This is used for validating our addresses when generating PONGs.
3994
3995Finally, the NAT library contains an API to test if our NAT configuration
3996is correct. Using @code{GNUNET_NAT_test_start} @strong{before} binding to
3997the respective port, the NAT library can be used to test if the
3998configuration works. The test function act as a local client, initialize
3999the NAT traversal and then contact a @code{gnunet-nat-server} (running by
4000default on @code{gnunet.org}) and ask for a connection to be established.
4001This way, it is easy to test if the current NAT configuration is valid.
4002
4003@node Distance-Vector plugin
4004@section Distance-Vector plugin
4005@c %**end of header
4006
4007The Distance Vector (DV) transport is a transport mechanism that allows
4008peers to act as relays for each other, thereby connecting peers that would
4009otherwise be unable to connect. This gives a larger connection set to
4010applications that may work better with more peers to choose from (for
4011example, File Sharing and/or DHT).
4012
4013The Distance Vector transport essentially has two functions. The first is
4014"gossiping" connection information about more distant peers to directly
4015connected peers. The second is taking messages intended for non-directly
4016connected peers and encapsulating them in a DV wrapper that contains the
4017required information for routing the message through forwarding peers. Via
4018gossiping, optimal routes through the known DV neighborhood are discovered
4019and utilized and the message encapsulation provides some benefits in
4020addition to simply getting the message from the correct source to the
4021proper destination.
4022
4023The gossiping function of DV provides an up to date routing table of
4024peers that are available up to some number of hops. We call this a
4025fisheye view of the network (like a fish, nearby objects are known while
4026more distant ones unknown). Gossip messages are sent only to directly
4027connected peers, but they are sent about other knowns peers within the
4028"fisheye distance". Whenever two peers connect, they immediately gossip
4029to each other about their appropriate other neighbors. They also gossip
4030about the newly connected peer to previously
4031connected neighbors. In order to keep the routing tables up to date,
4032disconnect notifications are propagated as gossip as well (because
4033disconnects may not be sent/received, timeouts are also used remove
4034stagnant routing table entries).
4035
4036Routing of messages via DV is straightforward. When the DV transport is
4037notified of a message destined for a non-direct neighbor, the appropriate
4038forwarding peer is selected, and the base message is encapsulated in a DV
4039message which contains information about the initial peer and the intended
4040recipient. At each forwarding hop, the initial peer is validated (the
4041forwarding peer ensures that it has the initial peer in its neighborhood,
4042otherwise the message is dropped). Next the base message is
4043re-encapsulated in a new DV message for the next hop in the forwarding
4044chain (or delivered to the current peer, if it has arrived at the
4045destination).
4046
4047Assume a three peer network with peers Alice, Bob and Carol. Assume that
4048
4049@example
4050Alice <-> Bob and Bob <-> Carol
4051@end example
4052
4053@noindent
4054are direct (e.g. over TCP or UDP transports) connections, but that
4055Alice cannot directly connect to Carol.
4056This may be the case due to NAT or firewall restrictions, or perhaps
4057based on one of the peers respective configurations. If the Distance
4058Vector transport is enabled on all three peers, it will automatically
4059discover (from the gossip protocol) that Alice and Carol can connect via
4060Bob and provide a "virtual" Alice <-> Carol connection. Routing between
4061Alice and Carol happens as follows; Alice creates a message destined for
4062Carol and notifies the DV transport about it. The DV transport at Alice
4063looks up Carol in the routing table and finds that the message must be
4064sent through Bob for Carol. The message is encapsulated setting Alice as
4065the initiator and Carol as the destination and sent to Bob. Bob receives
4066the messages, verifies that both Alice and Carol are known to Bob, and
4067re-wraps the message in a new DV message for Carol.
4068The DV transport at Carol receives this message, unwraps the original
4069message, and delivers it to Carol as though it came directly from Alice.
4070
4071@cindex SMTP plugin
4072@node SMTP plugin
4073@section SMTP plugin
4074@c %**end of header
4075
4076This section describes the new SMTP transport plugin for GNUnet as it
4077exists in the 0.7.x and 0.8.x branch. SMTP support is currently not
4078available in GNUnet 0.9.x. This page also describes the transport layer
4079abstraction (as it existed in 0.7.x and 0.8.x) in more detail and gives
4080some benchmarking results. The performance results presented are quite
4081old and maybe outdated at this point.
4082
4083@itemize @bullet
4084@item Why use SMTP for a peer-to-peer transport?
4085@item SMTPHow does it work?
4086@item How do I configure my peer?
4087@item How do I test if it works?
4088@item How fast is it?
4089@item Is there any additional documentation?
4090@end itemize
4091
4092
4093@menu
4094* Why use SMTP for a peer-to-peer transport?::
4095* How does it work?::
4096* How do I configure my peer?::
4097* How do I test if it works?::
4098* How fast is it?::
4099@end menu
4100
4101@node Why use SMTP for a peer-to-peer transport?
4102@subsection Why use SMTP for a peer-to-peer transport?
4103@c %**end of header
4104
4105There are many reasons why one would not want to use SMTP:
4106
4107@itemize @bullet
4108@item SMTP is using more bandwidth than TCP, UDP or HTTP
4109@item SMTP has a much higher latency.
4110@item SMTP requires significantly more computation (encoding and decoding
4111time) for the peers.
4112@item SMTP is significantly more complicated to configure.
4113@item SMTP may be abused by tricking GNUnet into sending mail to@
4114non-participating third parties.
4115@end itemize
4116
4117So why would anybody want to use SMTP?
4118@itemize @bullet
4119@item SMTP can be used to contact peers behind NAT boxes (in virtual
4120private networks).
4121@item SMTP can be used to circumvent policies that limit or prohibit
4122peer-to-peer traffic by masking as "legitimate" traffic.
4123@item SMTP uses E-mail addresses which are independent of a specific IP,
4124which can be useful to address peers that use dynamic IP addresses.
4125@item SMTP can be used to initiate a connection (e.g. initial address
4126exchange) and peers can then negotiate the use of a more efficient
4127protocol (e.g. TCP) for the actual communication.
4128@end itemize
4129
4130In summary, SMTP can for example be used to send a message to a peer
4131behind a NAT box that has a dynamic IP to tell the peer to establish a
4132TCP connection to a peer outside of the private network. Even an
4133extraordinary overhead for this first message would be irrelevant in this
4134type of situation.
4135
4136@node How does it work?
4137@subsection How does it work?
4138@c %**end of header
4139
4140When a GNUnet peer needs to send a message to another GNUnet peer that has
4141advertised (only) an SMTP transport address, GNUnet base64-encodes the
4142message and sends it in an E-mail to the advertised address. The
4143advertisement contains a filter which is placed in the E-mail header,
4144such that the receiving host can filter the tagged E-mails and forward it
4145to the GNUnet peer process. The filter can be specified individually by
4146each peer and be changed over time. This makes it impossible to censor
4147GNUnet E-mail messages by searching for a generic filter.
4148
4149@node How do I configure my peer?
4150@subsection How do I configure my peer?
4151@c %**end of header
4152
4153First, you need to configure @code{procmail} to filter your inbound E-mail
4154for GNUnet traffic. The GNUnet messages must be delivered into a pipe, for
4155example @code{/tmp/gnunet.smtp}. You also need to define a filter that is
4156used by @command{procmail} to detect GNUnet messages. You are free to
4157choose whichever filter you like, but you should make sure that it does
4158not occur in your other E-mail. In our example, we will use
4159@code{X-mailer: GNUnet}. The @code{~/.procmailrc} configuration file then
4160looks like this:
4161
4162@example
4163:0:
4164* ^X-mailer: GNUnet
4165/tmp/gnunet.smtp
4166# where do you want your other e-mail delivered to
4167# (default: /var/spool/mail/)
4168:0: /var/spool/mail/
4169@end example
4170
4171After adding this file, first make sure that your regular E-mail still
4172works (e.g. by sending an E-mail to yourself). Then edit the GNUnet
4173configuration. In the section @code{SMTP} you need to specify your E-mail
4174address under @code{EMAIL}, your mail server (for outgoing mail) under
4175@code{SERVER}, the filter (X-mailer: GNUnet in the example) under
4176@code{FILTER} and the name of the pipe under @code{PIPE}.@ The completed
4177section could then look like this:
4178
4179@example
4180EMAIL = me@@mail.gnu.org MTU = 65000 SERVER = mail.gnu.org:25 FILTER =
4181"X-mailer: GNUnet" PIPE = /tmp/gnunet.smtp
4182@end example
4183
4184Finally, you need to add @code{smtp} to the list of @code{TRANSPORTS} in
4185the @code{GNUNETD} section. GNUnet peers will use the E-mail address that
4186you specified to contact your peer until the advertisement times out.
4187Thus, if you are not sure if everything works properly or if you are not
4188planning to be online for a long time, you may want to configure this
4189timeout to be short, e.g. just one hour. For this, set
4190@code{HELLOEXPIRES} to @code{1} in the @code{GNUNETD} section.
4191
4192This should be it, but you may probably want to test it first.
4193
4194@node How do I test if it works?
4195@subsection How do I test if it works?
4196@c %**end of header
4197
4198Any transport can be subjected to some rudimentary tests using the
4199@code{gnunet-transport-check} tool. The tool sends a message to the local
4200node via the transport and checks that a valid message is received. While
4201this test does not involve other peers and can not check if firewalls or
4202other network obstacles prohibit proper operation, this is a great
4203testcase for the SMTP transport since it tests pretty much nearly all of
4204the functionality.
4205
4206@code{gnunet-transport-check} should only be used without running
4207@code{gnunetd} at the same time. By default, @code{gnunet-transport-check}
4208tests all transports that are specified in the configuration file. But
4209you can specifically test SMTP by giving the option
4210@code{--transport=smtp}.
4211
4212Note that this test always checks if a transport can receive and send.
4213While you can configure most transports to only receive or only send
4214messages, this test will only work if you have configured the transport
4215to send and receive messages.
4216
4217@node How fast is it?
4218@subsection How fast is it?
4219@c %**end of header
4220
4221We have measured the performance of the UDP, TCP and SMTP transport layer
4222directly and when used from an application using the GNUnet core.
4223Measuring just the transport layer gives the better view of the actual
4224overhead of the protocol, whereas evaluating the transport from the
4225application puts the overhead into perspective from a practical point of
4226view.
4227
4228The loopback measurements of the SMTP transport were performed on three
4229different machines spanning a range of modern SMTP configurations. We
4230used a PIII-800 running RedHat 7.3 with the Purdue Computer Science
4231configuration which includes filters for spam. We also used a Xenon 2 GHZ
4232with a vanilla RedHat 8.0 sendmail configuration. Furthermore, we used
4233qmail on a PIII-1000 running Sorcerer GNU Linux (SGL). The numbers for
4234UDP and TCP are provided using the SGL configuration. The qmail benchmark
4235uses qmail's internal filtering whereas the sendmail benchmarks relies on
4236procmail to filter and deliver the mail. We used the transport layer to
4237send a message of b bytes (excluding transport protocol headers) directly
4238to the local machine. This way, network latency and packet loss on the
4239wire have no impact on the timings. n messages were sent sequentially over
4240the transport layer, sending message i+1 after the i-th message was
4241received. All messages were sent over the same connection and the time to
4242establish the connection was not taken into account since this overhead is
4243minuscule in practice --- as long as a connection is used for a
4244significant number of messages.
4245
4246@multitable @columnfractions .20 .15 .15 .15 .15 .15
4247@headitem Transport @tab UDP @tab TCP @tab SMTP (Purdue sendmail)
4248@tab SMTP (RH 8.0) @tab SMTP (SGL qmail)
4249@item 11 bytes @tab 31 ms @tab 55 ms @tab 781 s @tab 77 s @tab 24 s
4250@item 407 bytes @tab 37 ms @tab 62 ms @tab 789 s @tab 78 s @tab 25 s
4251@item 1,221 bytes @tab 46 ms @tab 73 ms @tab 804 s @tab 78 s @tab 25 s
4252@end multitable
4253
4254The benchmarks show that UDP and TCP are, as expected, both significantly
4255faster compared with any of the SMTP services. Among the SMTP
4256implementations, there can be significant differences depending on the
4257SMTP configuration. Filtering with an external tool like procmail that
4258needs to re-parse its configuration for each mail can be very expensive.
4259Applying spam filters can also significantly impact the performance of
4260the underlying SMTP implementation. The microbenchmark shows that SMTP
4261can be a viable solution for initiating peer-to-peer sessions: a couple of
4262seconds to connect to a peer are probably not even going to be noticed by
4263users. The next benchmark measures the possible throughput for a
4264transport. Throughput can be measured by sending multiple messages in
4265parallel and measuring packet loss. Note that not only UDP but also the
4266TCP transport can actually loose messages since the TCP implementation
4267drops messages if the @code{write} to the socket would block. While the
4268SMTP protocol never drops messages itself, it is often so
4269slow that only a fraction of the messages can be sent and received in the
4270given time-bounds. For this benchmark we report the message loss after
4271allowing t time for sending m messages. If messages were not sent (or
4272received) after an overall timeout of t, they were considered lost. The
4273benchmark was performed using two Xeon 2 GHZ machines running RedHat 8.0
4274with sendmail. The machines were connected with a direct 100 MBit Ethernet
4275connection.@ Figures udp1200, tcp1200 and smtp-MTUs show that the
4276throughput for messages of size 1,200 octets is 2,343 kbps, 3,310 kbps
4277and 6 kbps for UDP, TCP and SMTP respectively. The high per-message
4278overhead of SMTP can be improved by increasing the MTU, for example, an
4279MTU of 12,000 octets improves the throughput to 13 kbps as figure
4280smtp-MTUs shows. Our research paper) has some more details on the
4281benchmarking results.
4282
4283@cindex Bluetooth plugin
4284@node Bluetooth plugin
4285@section Bluetooth plugin
4286@c %**end of header
4287
4288This page describes the new Bluetooth transport plugin for GNUnet. The
4289plugin is still in the testing stage so don't expect it to work
4290perfectly. If you have any questions or problems just post them here or
4291ask on the IRC channel.
4292
4293@itemize @bullet
4294@item What do I need to use the Bluetooth plugin transport?
4295@item BluetoothHow does it work?
4296@item What possible errors should I be aware of?
4297@item How do I configure my peer?
4298@item How can I test it?
4299@end itemize
4300
4301@menu
4302* What do I need to use the Bluetooth plugin transport?::
4303* How does it work2?::
4304* What possible errors should I be aware of?::
4305* How do I configure my peer2?::
4306* How can I test it?::
4307* The implementation of the Bluetooth transport plugin::
4308@end menu
4309
4310@node What do I need to use the Bluetooth plugin transport?
4311@subsection What do I need to use the Bluetooth plugin transport?
4312@c %**end of header
4313
4314If you are a GNU/Linux user and you want to use the Bluetooth
4315transport plugin you should install the
4316@command{BlueZ development libraries} (if they aren't already
4317installed).
4318For instructions about how to install the libraries you should
4319check out the BlueZ site
4320(@uref{http://www.bluez.org/, http://www.bluez.org}). If you don't know if
4321you have the necessary libraries, don't worry, just run the GNUnet
4322configure script and you will be able to see a notification at the end
4323which will warn you if you don't have the necessary libraries.
4324
4325If you are a Windows user you should have installed the
4326@emph{MinGW}/@emph{MSys2} with the latest updates (especially the
4327@emph{ws2bth} header). If this is your first build of GNUnet on Windows
4328you should check out the SBuild repository. It will semi-automatically
4329assembles a @emph{MinGW}/@emph{MSys2} installation with a lot of extra
4330packages which are needed for the GNUnet build. So this will ease your
4331work!@ Finally you just have to be sure that you have the correct drivers
4332for your Bluetooth device installed and that your device is on and in a
4333discoverable mode. The Windows Bluetooth Stack supports only the RFCOMM
4334protocol so we cannot turn on your device programatically!
4335
4336@c FIXME: Change to unique title
4337@node How does it work2?
4338@subsection How does it work2?
4339@c %**end of header
4340
4341The Bluetooth transport plugin uses virtually the same code as the WLAN
4342plugin and only the helper binary is different. The helper takes a single
4343argument, which represents the interface name and is specified in the
4344configuration file. Here are the basic steps that are followed by the
4345helper binary used on GNU/Linux:
4346
4347@itemize @bullet
4348@item it verifies if the name corresponds to a Bluetooth interface name
4349@item it verifies if the interface is up (if it is not, it tries to bring
4350it up)
4351@item it tries to enable the page and inquiry scan in order to make the
4352device discoverable and to accept incoming connection requests
4353@emph{The above operations require root access so you should start the
4354transport plugin with root privileges.}
4355@item it finds an available port number and registers a SDP service which
4356will be used to find out on which port number is the server listening on
4357and switch the socket in listening mode
4358@item it sends a HELLO message with its address
4359@item finally it forwards traffic from the reading sockets to the STDOUT
4360and from the STDIN to the writing socket
4361@end itemize
4362
4363Once in a while the device will make an inquiry scan to discover the
4364nearby devices and it will send them randomly HELLO messages for peer
4365discovery.
4366
4367@node What possible errors should I be aware of?
4368@subsection What possible errors should I be aware of?
4369@c %**end of header
4370
4371@emph{This section is dedicated for GNU/Linux users}
4372
4373Well there are many ways in which things could go wrong but I will try to
4374present some tools that you could use to debug and some scenarios.
4375
4376@itemize @bullet
4377
4378@item @code{bluetoothd -n -d} : use this command to enable logging in the
4379foreground and to print the logging messages
4380
4381@item @code{hciconfig}: can be used to configure the Bluetooth devices.
4382If you run it without any arguments it will print information about the
4383state of the interfaces. So if you receive an error that the device
4384couldn't be brought up you should try to bring it manually and to see if
4385it works (use @code{hciconfig -a hciX up}). If you can't and the
4386Bluetooth address has the form 00:00:00:00:00:00 it means that there is
4387something wrong with the D-Bus daemon or with the Bluetooth daemon. Use
4388@code{bluetoothd} tool to see the logs
4389
4390@item @code{sdptool} can be used to control and interrogate SDP servers.
4391If you encounter problems regarding the SDP server (like the SDP server is
4392down) you should check out if the D-Bus daemon is running correctly and to
4393see if the Bluetooth daemon started correctly(use @code{bluetoothd} tool).
4394Also, sometimes the SDP service could work but somehow the device couldn't
4395register its service. Use @code{sdptool browse [dev-address]} to see if
4396the service is registered. There should be a service with the name of the
4397interface and GNUnet as provider.
4398
4399@item @code{hcitool} : another useful tool which can be used to configure
4400the device and to send some particular commands to it.
4401
4402@item @code{hcidump} : could be used for low level debugging
4403@end itemize
4404
4405@c FIXME: A more unique name
4406@node How do I configure my peer2?
4407@subsection How do I configure my peer2?
4408@c %**end of header
4409
4410On GNU/Linux, you just have to be sure that the interface name
4411corresponds to the one that you want to use.
4412Use the @code{hciconfig} tool to check that.
4413By default it is set to hci0 but you can change it.
4414
4415A basic configuration looks like this:
4416
4417@example
4418[transport-bluetooth]
4419# Name of the interface (typically hciX)
4420INTERFACE = hci0
4421# Real hardware, no testing
4422TESTMODE = 0 TESTING_IGNORE_KEYS = ACCEPT_FROM;
4423@end example
4424
4425In order to use the Bluetooth transport plugin when the transport service
4426is started, you must add the plugin name to the default transport service
4427plugins list. For example:
4428
4429@example
4430[transport] ... PLUGINS = dns bluetooth ...
4431@end example
4432
4433If you want to use only the Bluetooth plugin set
4434@emph{PLUGINS = bluetooth}
4435
4436On Windows, you cannot specify which device to use. The only thing that
4437you should do is to add @emph{bluetooth} on the plugins list of the
4438transport service.
4439
4440@node How can I test it?
4441@subsection How can I test it?
4442@c %**end of header
4443
4444If you have two Bluetooth devices on the same machine and you are using
4445GNU/Linux you must:
4446
4447@itemize @bullet
4448
4449@item create two different file configuration (one which will use the
4450first interface (@emph{hci0}) and the other which will use the second
4451interface (@emph{hci1})). Let's name them @emph{peer1.conf} and
4452@emph{peer2.conf}.
4453
4454@item run @emph{gnunet-peerinfo -c peerX.conf -s} in order to generate the
4455peers private keys. The @strong{X} must be replace with 1 or 2.
4456
4457@item run @emph{gnunet-arm -c peerX.conf -s -i=transport} in order to
4458start the transport service. (Make sure that you have "bluetooth" on the
4459transport plugins list if the Bluetooth transport service doesn't start.)
4460
4461@item run @emph{gnunet-peerinfo -c peer1.conf -s} to get the first peer's
4462ID. If you already know your peer ID (you saved it from the first
4463command), this can be skipped.
4464
4465@item run @emph{gnunet-transport -c peer2.conf -p=PEER1_ID -s} to start
4466sending data for benchmarking to the other peer.
4467
4468@end itemize
4469
4470
4471This scenario will try to connect the second peer to the first one and
4472then start sending data for benchmarking.
4473
4474On Windows you cannot test the plugin functionality using two Bluetooth
4475devices from the same machine because after you install the drivers there
4476will occur some conflicts between the Bluetooth stacks. (At least that is
4477what happened on my machine : I wasn't able to use the Bluesoleil stack and
4478the WINDCOMM one in the same time).
4479
4480If you have two different machines and your configuration files are good
4481you can use the same scenario presented on the beginning of this section.
4482
4483Another way to test the plugin functionality is to create your own
4484application which will use the GNUnet framework with the Bluetooth
4485transport service.
4486
4487@node The implementation of the Bluetooth transport plugin
4488@subsection The implementation of the Bluetooth transport plugin
4489@c %**end of header
4490
4491This page describes the implementation of the Bluetooth transport plugin.
4492
4493First I want to remind you that the Bluetooth transport plugin uses
4494virtually the same code as the WLAN plugin and only the helper binary is
4495different. Also the scope of the helper binary from the Bluetooth
4496transport plugin is the same as the one used for the WLAN transport
4497plugin: it accesses the interface and then it forwards traffic in both
4498directions between the Bluetooth interface and stdin/stdout of the
4499process involved.
4500
4501The Bluetooth plugin transport could be used both on GNU/Linux and Windows
4502platforms.
4503
4504@itemize @bullet
4505@item Linux functionality
4506@item Windows functionality
4507@item Pending Features
4508@end itemize
4509
4510
4511
4512@menu
4513* Linux functionality::
4514* THE INITIALIZATION::
4515* THE LOOP::
4516* Details about the broadcast implementation::
4517* Windows functionality::
4518* Pending features::
4519@end menu
4520
4521@node Linux functionality
4522@subsubsection Linux functionality
4523@c %**end of header
4524
4525In order to implement the plugin functionality on GNU/Linux I
4526used the BlueZ stack.
4527For the communication with the other devices I used the RFCOMM
4528protocol. Also I used the HCI protocol to gain some control over the
4529device. The helper binary takes a single argument (the name of the
4530Bluetooth interface) and is separated in two stages:
4531
4532@c %** 'THE INITIALIZATION' should be in bigger letters or stand out, not
4533@c %** starting a new section?
4534@node THE INITIALIZATION
4535@subsubsection THE INITIALIZATION
4536
4537@itemize @bullet
4538@item first, it checks if we have root privileges
4539(@emph{Remember that we need to have root privileges in order to be able
4540to bring the interface up if it is down or to change its state.}).
4541
4542@item second, it verifies if the interface with the given name exists.
4543
4544@strong{If the interface with that name exists and it is a Bluetooth
4545interface:}
4546
4547@item it creates a RFCOMM socket which will be used for listening and call
4548the @emph{open_device} method
4549
4550On the @emph{open_device} method:
4551@itemize @bullet
4552@item creates a HCI socket used to send control events to the the device
4553@item searches for the device ID using the interface name
4554@item saves the device MAC address
4555@item checks if the interface is down and tries to bring it UP
4556@item checks if the interface is in discoverable mode and tries to make it
4557discoverable
4558@item closes the HCI socket and binds the RFCOMM one
4559@item switches the RFCOMM socket in listening mode
4560@item registers the SDP service (the service will be used by the other
4561devices to get the port on which this device is listening on)
4562@end itemize
4563
4564@item drops the root privileges
4565
4566@strong{If the interface is not a Bluetooth interface the helper exits
4567with a suitable error}
4568@end itemize
4569
4570@c %** Same as for @node entry above
4571@node THE LOOP
4572@subsubsection THE LOOP
4573
4574The helper binary uses a list where it saves all the connected neighbour
4575devices (@emph{neighbours.devices}) and two buffers (@emph{write_pout} and
4576@emph{write_std}). The first message which is send is a control message
4577with the device's MAC address in order to announce the peer presence to
4578the neighbours. Here are a short description of what happens in the main
4579loop:
4580
4581@itemize @bullet
4582@item Every time when it receives something from the STDIN it processes
4583the data and saves the message in the first buffer (@emph{write_pout}).
4584When it has something in the buffer, it gets the destination address from
4585the buffer, searches the destination address in the list (if there is no
4586connection with that device, it creates a new one and saves it to the
4587list) and sends the message.
4588@item Every time when it receives something on the listening socket it
4589accepts the connection and saves the socket on a list with the reading
4590sockets. @item Every time when it receives something from a reading
4591socket it parses the message, verifies the CRC and saves it in the
4592@emph{write_std} buffer in order to be sent later to the STDOUT.
4593@end itemize
4594
4595So in the main loop we use the select function to wait until one of the
4596file descriptor saved in one of the two file descriptors sets used is
4597ready to use. The first set (@emph{rfds}) represents the reading set and
4598it could contain the list with the reading sockets, the STDIN file
4599descriptor or the listening socket. The second set (@emph{wfds}) is the
4600writing set and it could contain the sending socket or the STDOUT file
4601descriptor. After the select function returns, we check which file
4602descriptor is ready to use and we do what is supposed to do on that kind
4603of event. @emph{For example:} if it is the listening socket then we
4604accept a new connection and save the socket in the reading list; if it is
4605the STDOUT file descriptor, then we write to STDOUT the message from the
4606@emph{write_std} buffer.
4607
4608To find out on which port a device is listening on we connect to the local
4609SDP server and search the registered service for that device.
4610
4611@emph{You should be aware of the fact that if the device fails to connect
4612to another one when trying to send a message it will attempt one more
4613time. If it fails again, then it skips the message.}
4614@emph{Also you should know that the transport Bluetooth plugin has
4615support for @strong{broadcast messages}.}
4616
4617@node Details about the broadcast implementation
4618@subsubsection Details about the broadcast implementation
4619@c %**end of header
4620
4621First I want to point out that the broadcast functionality for the CONTROL
4622messages is not implemented in a conventional way. Since the inquiry scan
4623time is too big and it will take some time to send a message to all the
4624discoverable devices I decided to tackle the problem in a different way.
4625Here is how I did it:
4626
4627@itemize @bullet
4628@item If it is the first time when I have to broadcast a message I make an
4629inquiry scan and save all the devices' addresses to a vector.
4630@item After the inquiry scan ends I take the first address from the list
4631and I try to connect to it. If it fails, I try to connect to the next one.
4632If it succeeds, I save the socket to a list and send the message to the
4633device.
4634@item When I have to broadcast another message, first I search on the list
4635for a new device which I'm not connected to. If there is no new device on
4636the list I go to the beginning of the list and send the message to the
4637old devices. After 5 cycles I make a new inquiry scan to check out if
4638there are new discoverable devices and save them to the list. If there
4639are no new discoverable devices I reset the cycling counter and go again
4640through the old list and send messages to the devices saved in it.
4641@end itemize
4642
4643@strong{Therefore}:
4644
4645@itemize @bullet
4646@item every time when I have a broadcast message I look up on the list
4647for a new device and send the message to it
4648@item if I reached the end of the list for 5 times and I'm connected to
4649all the devices from the list I make a new inquiry scan.
4650@emph{The number of the list's cycles after an inquiry scan could be
4651increased by redefining the MAX_LOOPS variable}
4652@item when there are no new devices I send messages to the old ones.
4653@end itemize
4654
4655Doing so, the broadcast control messages will reach the devices but with
4656delay.
4657
4658@emph{NOTICE:} When I have to send a message to a certain device first I
4659check on the broadcast list to see if we are connected to that device. If
4660not we try to connect to it and in case of success we save the address and
4661the socket on the list. If we are already connected to that device we
4662simply use the socket.
4663
4664@node Windows functionality
4665@subsubsection Windows functionality
4666@c %**end of header
4667
4668For Windows I decided to use the Microsoft Bluetooth stack which has the
4669advantage of coming standard from Windows XP SP2. The main disadvantage is
4670that it only supports the RFCOMM protocol so we will not be able to have
4671a low level control over the Bluetooth device. Therefore it is the user
4672responsibility to check if the device is up and in the discoverable mode.
4673Also there are no tools which could be used for debugging in order to read
4674the data coming from and going to a Bluetooth device, which obviously
4675hindered my work. Another thing that slowed down the implementation of the
4676plugin (besides that I wasn't too accommodated with the win32 API) was that
4677there were some bugs on MinGW regarding the Bluetooth. Now they are solved
4678but you should keep in mind that you should have the latest updates
4679(especially the @emph{ws2bth} header).
4680
4681Besides the fact that it uses the Windows Sockets, the Windows
4682implementation follows the same principles as the GNU/Linux one:
4683
4684@itemize @bullet
4685@item It has a initalization part where it initializes the
4686Windows Sockets, creates a RFCOMM socket which will be binded and switched
4687to the listening mode and registers a SDP service. In the Microsoft
4688Bluetooth API there are two ways to work with the SDP:
4689@itemize @bullet
4690@item an easy way which works with very simple service records
4691@item a hard way which is useful when you need to update or to delete the
4692record
4693@end itemize
4694@end itemize
4695
4696Since I only needed the SDP service to find out on which port the device
4697is listening on and that did not change, I decided to use the easy way.
4698In order to register the service I used the @emph{WSASetService} function
4699and I generated the @emph{Universally Unique Identifier} with the
4700@emph{guidgen.exe} Windows's tool.
4701
4702In the loop section the only difference from the GNU/Linux implementation
4703is that I used the @code{GNUNET_NETWORK} library for
4704functions like @emph{accept}, @emph{bind}, @emph{connect} or
4705@emph{select}. I decided to use the
4706@code{GNUNET_NETWORK} library because I also needed to interact
4707with the STDIN and STDOUT handles and on Windows
4708the select function is only defined for sockets,
4709and it will not work for arbitrary file handles.
4710
4711Another difference between GNU/Linux and Windows implementation is that in
4712GNU/Linux, the Bluetooth address is represented in 48 bits
4713while in Windows is represented in 64 bits.
4714Therefore I had to do some changes on @emph{plugin_transport_wlan} header.
4715
4716Also, currently on Windows the Bluetooth plugin doesn't have support for
4717broadcast messages. When it receives a broadcast message it will skip it.
4718
4719@node Pending features
4720@subsubsection Pending features
4721@c %**end of header
4722
4723@itemize @bullet
4724@item Implement the broadcast functionality on Windows @emph{(currently
4725working on)}
4726@item Implement a testcase for the helper :@ @emph{The testcase
4727consists of a program which emulates the plugin and uses the helper. It
4728will simulate connections, disconnections and data transfers.}
4729@end itemize
4730
4731If you have a new idea about a feature of the plugin or suggestions about
4732how I could improve the implementation you are welcome to comment or to
4733contact me.
4734
4735@node WLAN plugin
4736@section WLAN plugin
4737@c %**end of header
4738
4739This section documents how the wlan transport plugin works. Parts which
4740are not implemented yet or could be better implemented are described at
4741the end.
4742
4743@cindex ATS Subsystem
4744@node ATS Subsystem
4745@section ATS Subsystem
4746@c %**end of header
4747
4748ATS stands for "automatic transport selection", and the function of ATS in
4749GNUnet is to decide on which address (and thus transport plugin) should
4750be used for two peers to communicate, and what bandwidth limits should be
4751imposed on such an individual connection. To help ATS make an informed
4752decision, higher-level services inform the ATS service about their
4753requirements and the quality of the service rendered. The ATS service
4754also interacts with the transport service to be appraised of working
4755addresses and to communicate its resource allocation decisions. Finally,
4756the ATS service's operation can be observed using a monitoring API.
4757
4758The main logic of the ATS service only collects the available addresses,
4759their performance characteristics and the applications requirements, but
4760does not make the actual allocation decision. This last critical step is
4761left to an ATS plugin, as we have implemented (currently three) different
4762allocation strategies which differ significantly in their performance and
4763maturity, and it is still unclear if any particular plugin is generally
4764superior.
4765
4766@cindex CORE Subsystem
4767@node CORE Subsystem
4768@section CORE Subsystem
4769@c %**end of header
4770
4771The CORE subsystem in GNUnet is responsible for securing link-layer
4772communications between nodes in the GNUnet overlay network. CORE builds
4773on the TRANSPORT subsystem which provides for the actual, insecure,
4774unreliable link-layer communication (for example, via UDP or WLAN), and
4775then adds fundamental security to the connections:
4776
4777@itemize @bullet
4778@item confidentiality with so-called perfect forward secrecy; we use
4779ECDHE
4780(@uref{http://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman, Elliptic-curve Diffie---Hellman})
4781powered by Curve25519
4782(@uref{http://cr.yp.to/ecdh.html, Curve25519}) for the key
4783exchange and then use symmetric encryption, encrypting with both AES-256
4784(@uref{http://en.wikipedia.org/wiki/Rijndael, AES-256}) and
4785Twofish (@uref{http://en.wikipedia.org/wiki/Twofish, Twofish})
4786@item @uref{http://en.wikipedia.org/wiki/Authentication, authentication}
4787is achieved by signing the ephemeral keys using Ed25519
4788(@uref{http://ed25519.cr.yp.to/, Ed25519}), a deterministic
4789variant of ECDSA
4790(@uref{http://en.wikipedia.org/wiki/ECDSA, ECDSA})
4791@item integrity protection (using SHA-512
4792(@uref{http://en.wikipedia.org/wiki/SHA-2, SHA-512}) to do
4793encrypt-then-MAC
4794(@uref{http://en.wikipedia.org/wiki/Authenticated_encryption, encrypt-then-MAC}))
4795@item Replay
4796(@uref{http://en.wikipedia.org/wiki/Replay_attack, replay})
4797protection (using nonces, timestamps, challenge-response,
4798message counters and ephemeral keys)
4799@item liveness (keep-alive messages, timeout)
4800@end itemize
4801
4802@menu
4803* Limitations::
4804* When is a peer "connected"?::
4805* libgnunetcore::
4806* The CORE Client-Service Protocol::
4807* The CORE Peer-to-Peer Protocol::
4808@end menu
4809
4810@cindex core subsystem limitations
4811@node Limitations
4812@subsection Limitations
4813@c %**end of header
4814
4815CORE does not perform
4816@uref{http://en.wikipedia.org/wiki/Routing, routing}; using CORE it is
4817only possible to communicate with peers that happen to already be
4818"directly" connected with each other. CORE also does not have an
4819API to allow applications to establish such "direct" connections --- for
4820this, applications can ask TRANSPORT, but TRANSPORT might not be able to
4821establish a "direct" connection. The TOPOLOGY subsystem is responsible for
4822trying to keep a few "direct" connections open at all times. Applications
4823that need to talk to particular peers should use the CADET subsystem, as
4824it can establish arbitrary "indirect" connections.
4825
4826Because CORE does not perform routing, CORE must only be used directly by
4827applications that either perform their own routing logic (such as
4828anonymous file-sharing) or that do not require routing, for example
4829because they are based on flooding the network. CORE communication is
4830unreliable and delivery is possibly out-of-order. Applications that
4831require reliable communication should use the CADET service. Each
4832application can only queue one message per target peer with the CORE
4833service at any time; messages cannot be larger than approximately
483463 kilobytes. If messages are small, CORE may group multiple messages
4835(possibly from different applications) prior to encryption. If permitted
4836by the application (using the @uref{http://baus.net/on-tcp_cork/, cork}
4837option), CORE may delay transmissions to facilitate grouping of multiple
4838small messages. If cork is not enabled, CORE will transmit the message as
4839soon as TRANSPORT allows it (TRANSPORT is responsible for limiting
4840bandwidth and congestion control). CORE does not allow flow control;
4841applications are expected to process messages at line-speed. If flow
4842control is needed, applications should use the CADET service.
4843
4844@cindex when is a peer connected
4845@node When is a peer "connected"?
4846@subsection When is a peer "connected"?
4847@c %**end of header
4848
4849In addition to the security features mentioned above, CORE also provides
4850one additional key feature to applications using it, and that is a
4851limited form of protocol-compatibility checking. CORE distinguishes
4852between TRANSPORT-level connections (which enable communication with other
4853peers) and application-level connections. Applications using the CORE API
4854will (typically) learn about application-level connections from CORE, and
4855not about TRANSPORT-level connections. When a typical application uses
4856CORE, it will specify a set of message types
4857(from @code{gnunet_protocols.h}) that it understands. CORE will then
4858notify the application about connections it has with other peers if and
4859only if those applications registered an intersecting set of message
4860types with their CORE service. Thus, it is quite possible that CORE only
4861exposes a subset of the established direct connections to a particular
4862application --- and different applications running above CORE might see
4863different sets of connections at the same time.
4864
4865A special case are applications that do not register a handler for any
4866message type.
4867CORE assumes that these applications merely want to monitor connections
4868(or "all" messages via other callbacks) and will notify those applications
4869about all connections. This is used, for example, by the
4870@code{gnunet-core} command-line tool to display the active connections.
4871Note that it is also possible that the TRANSPORT service has more active
4872connections than the CORE service, as the CORE service first has to
4873perform a key exchange with connecting peers before exchanging information
4874about supported message types and notifying applications about the new
4875connection.
4876
4877@cindex libgnunetcore
4878@node libgnunetcore
4879@subsection libgnunetcore
4880@c %**end of header
4881
4882The CORE API (defined in @file{gnunet_core_service.h}) is the basic
4883messaging API used by P2P applications built using GNUnet. It provides
4884applications the ability to send and receive encrypted messages to the
4885peer's "directly" connected neighbours.
4886
4887As CORE connections are generally "direct" connections,@ applications must
4888not assume that they can connect to arbitrary peers this way, as "direct"
4889connections may not always be possible. Applications using CORE are
4890notified about which peers are connected. Creating new "direct"
4891connections must be done using the TRANSPORT API.
4892
4893The CORE API provides unreliable, out-of-order delivery. While the
4894implementation tries to ensure timely, in-order delivery, both message
4895losses and reordering are not detected and must be tolerated by the
4896application. Most important, the core will NOT perform retransmission if
4897messages could not be delivered.
4898
4899Note that CORE allows applications to queue one message per connected
4900peer. The rate at which each connection operates is influenced by the
4901preferences expressed by local application as well as restrictions
4902imposed by the other peer. Local applications can express their
4903preferences for particular connections using the "performance" API of the
4904ATS service.
4905
4906Applications that require more sophisticated transmission capabilities
4907such as TCP-like behavior, or if you intend to send messages to arbitrary
4908remote peers, should use the CADET API.
4909
4910The typical use of the CORE API is to connect to the CORE service using
4911@code{GNUNET_CORE_connect}, process events from the CORE service (such as
4912peers connecting, peers disconnecting and incoming messages) and send
4913messages to connected peers using
4914@code{GNUNET_CORE_notify_transmit_ready}. Note that applications must
4915cancel pending transmission requests if they receive a disconnect event
4916for a peer that had a transmission pending; furthermore, queuing more
4917than one transmission request per peer per application using the
4918service is not permitted.
4919
4920The CORE API also allows applications to monitor all communications of the
4921peer prior to encryption (for outgoing messages) or after decryption (for
4922incoming messages). This can be useful for debugging, diagnostics or to
4923establish the presence of cover traffic (for anonymity). As monitoring
4924applications are often not interested in the payload, the monitoring
4925callbacks can be configured to only provide the message headers (including
4926the message type and size) instead of copying the full data stream to the
4927monitoring client.
4928
4929The init callback of the @code{GNUNET_CORE_connect} function is called
4930with the hash of the public key of the peer. This public key is used to
4931identify the peer globally in the GNUnet network. Applications are
4932encouraged to check that the provided hash matches the hash that they are
4933using (as theoretically the application may be using a different
4934configuration file with a different private key, which would result in
4935hard to find bugs).
4936
4937As with most service APIs, the CORE API isolates applications from crashes
4938of the CORE service. If the CORE service crashes, the application will see
4939disconnect events for all existing connections. Once the connections are
4940re-established, the applications will be receive matching connect events.
4941
4942@cindex core clinet-service protocol
4943@node The CORE Client-Service Protocol
4944@subsection The CORE Client-Service Protocol
4945@c %**end of header
4946
4947This section describes the protocol between an application using the CORE
4948service (the client) and the CORE service process itself.
4949
4950
4951@menu
4952* Setup2::
4953* Notifications::
4954* Sending::
4955@end menu
4956
4957@node Setup2
4958@subsubsection Setup2
4959@c %**end of header
4960
4961When a client connects to the CORE service, it first sends a
4962@code{InitMessage} which specifies options for the connection and a set of
4963message type values which are supported by the application. The options
4964bitmask specifies which events the client would like to be notified about.
4965The options include:
4966
4967@table @asis
4968@item GNUNET_CORE_OPTION_NOTHING No notifications
4969@item GNUNET_CORE_OPTION_STATUS_CHANGE Peers connecting and disconnecting
4970@item GNUNET_CORE_OPTION_FULL_INBOUND All inbound messages (after
4971decryption) with full payload
4972@item GNUNET_CORE_OPTION_HDR_INBOUND Just the @code{MessageHeader}
4973of all inbound messages
4974@item GNUNET_CORE_OPTION_FULL_OUTBOUND All outbound
4975messages (prior to encryption) with full payload
4976@item GNUNET_CORE_OPTION_HDR_OUTBOUND Just the @code{MessageHeader} of all
4977outbound messages
4978@end table
4979
4980Typical applications will only monitor for connection status changes.
4981
4982The CORE service responds to the @code{InitMessage} with an
4983@code{InitReplyMessage} which contains the peer's identity. Afterwards,
4984both CORE and the client can send messages.
4985
4986@node Notifications
4987@subsubsection Notifications
4988@c %**end of header
4989
4990The CORE will send @code{ConnectNotifyMessage}s and
4991@code{DisconnectNotifyMessage}s whenever peers connect or disconnect from
4992the CORE (assuming their type maps overlap with the message types
4993registered by the client). When the CORE receives a message that matches
4994the set of message types specified during the @code{InitMessage} (or if
4995monitoring is enabled in for inbound messages in the options), it sends a
4996@code{NotifyTrafficMessage} with the peer identity of the sender and the
4997decrypted payload. The same message format (except with
4998@code{GNUNET_MESSAGE_TYPE_CORE_NOTIFY_OUTBOUND} for the message type) is
4999used to notify clients monitoring outbound messages; here, the peer
5000identity given is that of the receiver.
5001
5002@node Sending
5003@subsubsection Sending
5004@c %**end of header
5005
5006When a client wants to transmit a message, it first requests a
5007transmission slot by sending a @code{SendMessageRequest} which specifies
5008the priority, deadline and size of the message. Note that these values
5009may be ignored by CORE. When CORE is ready for the message, it answers
5010with a @code{SendMessageReady} response. The client can then transmit the
5011payload with a @code{SendMessage} message. Note that the actual message
5012size in the @code{SendMessage} is allowed to be smaller than the size in
5013the original request. A client may at any time send a fresh
5014@code{SendMessageRequest}, which then superceeds the previous
5015@code{SendMessageRequest}, which is then no longer valid. The client can
5016tell which @code{SendMessageRequest} the CORE service's
5017@code{SendMessageReady} message is for as all of these messages contain a
5018"unique" request ID (based on a counter incremented by the client
5019for each request).
5020
5021@cindex CORE Peer-to-Peer Protocol
5022@node The CORE Peer-to-Peer Protocol
5023@subsection The CORE Peer-to-Peer Protocol
5024@c %**end of header
5025
5026
5027@menu
5028* Creating the EphemeralKeyMessage::
5029* Establishing a connection::
5030* Encryption and Decryption::
5031* Type maps::
5032@end menu
5033
5034@cindex EphemeralKeyMessage creation
5035@node Creating the EphemeralKeyMessage
5036@subsubsection Creating the EphemeralKeyMessage
5037@c %**end of header
5038
5039When the CORE service starts, each peer creates a fresh ephemeral (ECC)
5040public-private key pair and signs the corresponding
5041@code{EphemeralKeyMessage} with its long-term key (which we usually call
5042the peer's identity; the hash of the public long term key is what results
5043in a @code{struct GNUNET_PeerIdentity} in all GNUnet APIs. The ephemeral
5044key is ONLY used for an ECDHE
5045(@uref{http://en.wikipedia.org/wiki/Elliptic_curve_Diffie%E2%80%93Hellman, Elliptic-curve Diffie---Hellman})
5046exchange by the CORE service to establish symmetric session keys. A peer
5047will use the same @code{EphemeralKeyMessage} for all peers for
5048@code{REKEY_FREQUENCY}, which is usually 12 hours. After that time, it
5049will create a fresh ephemeral key (forgetting the old one) and broadcast
5050the new @code{EphemeralKeyMessage} to all connected peers, resulting in
5051fresh symmetric session keys. Note that peers independently decide on
5052when to discard ephemeral keys; it is not a protocol violation to discard
5053keys more often. Ephemeral keys are also never stored to disk; restarting
5054a peer will thus always create a fresh ephemeral key. The use of ephemeral
5055keys is what provides @uref{http://en.wikipedia.org/wiki/Forward_secrecy, forward secrecy}.
5056
5057Just before transmission, the @code{EphemeralKeyMessage} is patched to
5058reflect the current sender_status, which specifies the current state of
5059the connection from the point of view of the sender. The possible values
5060are:
5061
5062@itemize @bullet
5063@item @code{KX_STATE_DOWN} Initial value, never used on the network
5064@item @code{KX_STATE_KEY_SENT} We sent our ephemeral key, do not know the
5065key of the other peer
5066@item @code{KX_STATE_KEY_RECEIVED} This peer has received a valid
5067ephemeral key of the other peer, but we are waiting for the other peer to
5068confirm it's authenticity (ability to decode) via challenge-response.
5069@item @code{KX_STATE_UP} The connection is fully up from the point of
5070view of the sender (now performing keep-alives)
5071@item @code{KX_STATE_REKEY_SENT} The sender has initiated a rekeying
5072operation; the other peer has so far failed to confirm a working
5073connection using the new ephemeral key
5074@end itemize
5075
5076@node Establishing a connection
5077@subsubsection Establishing a connection
5078@c %**end of header
5079
5080Peers begin their interaction by sending a @code{EphemeralKeyMessage} to
5081the other peer once the TRANSPORT service notifies the CORE service about
5082the connection.
5083A peer receiving an @code{EphemeralKeyMessage} with a status
5084indicating that the sender does not have the receiver's ephemeral key, the
5085receiver's @code{EphemeralKeyMessage} is sent in response.
5086Additionally, if the receiver has not yet confirmed the authenticity of
5087the sender, it also sends an (encrypted)@code{PingMessage} with a
5088challenge (and the identity of the target) to the other peer. Peers
5089receiving a @code{PingMessage} respond with an (encrypted)
5090@code{PongMessage} which includes the challenge. Peers receiving a
5091@code{PongMessage} check the challenge, and if it matches set the
5092connection to @code{KX_STATE_UP}.
5093
5094@node Encryption and Decryption
5095@subsubsection Encryption and Decryption
5096@c %**end of header
5097
5098All functions related to the key exchange and encryption/decryption of
5099messages can be found in @file{gnunet-service-core_kx.c} (except for the
5100cryptographic primitives, which are in @file{util/crypto*.c}).
5101Given the key material from ECDHE, a Key derivation function
5102(@uref{https://en.wikipedia.org/wiki/Key_derivation_function, Key derivation function})
5103is used to derive two pairs of encryption and decryption keys for AES-256
5104and TwoFish, as well as initialization vectors and authentication keys
5105(for HMAC
5106(@uref{https://en.wikipedia.org/wiki/HMAC, HMAC})).
5107The HMAC is computed over the encrypted payload.
5108Encrypted messages include an iv_seed and the HMAC in the header.
5109
5110Each encrypted message in the CORE service includes a sequence number and
5111a timestamp in the encrypted payload. The CORE service remembers the
5112largest observed sequence number and a bit-mask which represents which of
5113the previous 32 sequence numbers were already used.
5114Messages with sequence numbers lower than the largest observed sequence
5115number minus 32 are discarded. Messages with a timestamp that is less
5116than @code{REKEY_TOLERANCE} off (5 minutes) are also discarded. This of
5117course means that system clocks need to be reasonably synchronized for
5118peers to be able to communicate. Additionally, as the ephemeral key
5119changes every 12 hours, a peer would not even be able to decrypt messages
5120older than 12 hours.
5121
5122@node Type maps
5123@subsubsection Type maps
5124@c %**end of header
5125
5126Once an encrypted connection has been established, peers begin to exchange
5127type maps. Type maps are used to allow the CORE service to determine which
5128(encrypted) connections should be shown to which applications. A type map
5129is an array of 65536 bits representing the different types of messages
5130understood by applications using the CORE service. Each CORE service
5131maintains this map, simply by setting the respective bit for each message
5132type supported by any of the applications using the CORE service. Note
5133that bits for message types embedded in higher-level protocols (such as
5134MESH) will not be included in these type maps.
5135
5136Typically, the type map of a peer will be sparse. Thus, the CORE service
5137attempts to compress its type map using @code{gzip}-style compression
5138("deflate") prior to transmission. However, if the compression fails to
5139compact the map, the map may also be transmitted without compression
5140(resulting in @code{GNUNET_MESSAGE_TYPE_CORE_COMPRESSED_TYPE_MAP} or
5141@code{GNUNET_MESSAGE_TYPE_CORE_BINARY_TYPE_MAP} messages respectively).
5142Upon receiving a type map, the respective CORE service notifies
5143applications about the connection to the other peer if they support any
5144message type indicated in the type map (or no message type at all).
5145If the CORE service experience a connect or disconnect event from an
5146application, it updates its type map (setting or unsetting the respective
5147bits) and notifies its neighbours about the change.
5148The CORE services of the neighbours then in turn generate connect and
5149disconnect events for the peer that sent the type map for their respective
5150applications. As CORE messages may be lost, the CORE service confirms
5151receiving a type map by sending back a
5152@code{GNUNET_MESSAGE_TYPE_CORE_CONFIRM_TYPE_MAP}. If such a confirmation
5153(with the correct hash of the type map) is not received, the sender will
5154retransmit the type map (with exponential back-off).
5155
5156@cindex CADET Subsystem
5157@node CADET Subsystem
5158@section CADET Subsystem
5159
5160The CADET subsystem in GNUnet is responsible for secure end-to-end
5161communications between nodes in the GNUnet overlay network. CADET builds
5162on the CORE subsystem which provides for the link-layer communication and
5163then adds routing, forwarding and additional security to the connections.
5164CADET offers the same cryptographic services as CORE, but on an
5165end-to-end level. This is done so peers retransmitting traffic on behalf
5166of other peers cannot access the payload data.
5167
5168@itemize @bullet
5169@item CADET provides confidentiality with so-called perfect forward
5170secrecy; we use ECDHE powered by Curve25519 for the key exchange and then
5171use symmetric encryption, encrypting with both AES-256 and Twofish
5172@item authentication is achieved by signing the ephemeral keys using
5173Ed25519, a deterministic variant of ECDSA
5174@item integrity protection (using SHA-512 to do encrypt-then-MAC, although
5175only 256 bits are sent to reduce overhead)
5176@item replay protection (using nonces, timestamps, challenge-response,
5177message counters and ephemeral keys)
5178@item liveness (keep-alive messages, timeout)
5179@end itemize
5180
5181Additional to the CORE-like security benefits, CADET offers other
5182properties that make it a more universal service than CORE.
5183
5184@itemize @bullet
5185@item CADET can establish channels to arbitrary peers in GNUnet. If a
5186peer is not immediately reachable, CADET will find a path through the
5187network and ask other peers to retransmit the traffic on its behalf.
5188@item CADET offers (optional) reliability mechanisms. In a reliable
5189channel traffic is guaranteed to arrive complete, unchanged and in-order.
5190@item CADET takes care of flow and congestion control mechanisms, not
5191allowing the sender to send more traffic than the receiver or the network
5192are able to process.
5193@end itemize
5194
5195@menu
5196* libgnunetcadet::
5197@end menu
5198
5199@cindex libgnunetcadet
5200@node libgnunetcadet
5201@subsection libgnunetcadet
5202
5203
5204The CADET API (defined in @file{gnunet_cadet_service.h}) is the
5205messaging API used by P2P applications built using GNUnet.
5206It provides applications the ability to send and receive encrypted
5207messages to any peer participating in GNUnet.
5208The API is heavily base on the CORE API.
5209
5210CADET delivers messages to other peers in "channels".
5211A channel is a permanent connection defined by a destination peer
5212(identified by its public key) and a port number.
5213Internally, CADET tunnels all channels towards a destination peer
5214using one session key and relays the data on multiple "connections",
5215independent from the channels.
5216
5217Each channel has optional parameters, the most important being the
5218reliability flag.
5219Should a message get lost on TRANSPORT/CORE level, if a channel is
5220created with as reliable, CADET will retransmit the lost message and
5221deliver it in order to the destination application.
5222
5223To communicate with other peers using CADET, it is necessary to first
5224connect to the service using @code{GNUNET_CADET_connect}.
5225This function takes several parameters in form of callbacks, to allow the
5226client to react to various events, like incoming channels or channels that
5227terminate, as well as specify a list of ports the client wishes to listen
5228to (at the moment it is not possible to start listening on further ports
5229once connected, but nothing prevents a client to connect several times to
5230CADET, even do one connection per listening port).
5231The function returns a handle which has to be used for any further
5232interaction with the service.
5233
5234To connect to a remote peer a client has to call the
5235@code{GNUNET_CADET_channel_create} function. The most important parameters
5236given are the remote peer's identity (it public key) and a port, which
5237specifies which application on the remote peer to connect to, similar to
5238TCP/UDP ports. CADET will then find the peer in the GNUnet network and
5239establish the proper low-level connections and do the necessary key
5240exchanges to assure and authenticated, secure and verified communication.
5241Similar to @code{GNUNET_CADET_connect},@code{GNUNET_CADET_create_channel}
5242returns a handle to interact with the created channel.
5243
5244For every message the client wants to send to the remote application,
5245@code{GNUNET_CADET_notify_transmit_ready} must be called, indicating the
5246channel on which the message should be sent and the size of the message
5247(but not the message itself!). Once CADET is ready to send the message,
5248the provided callback will fire, and the message contents are provided to
5249this callback.
5250
5251Please note the CADET does not provide an explicit notification of when a
5252channel is connected. In loosely connected networks, like big wireless
5253mesh networks, this can take several seconds, even minutes in the worst
5254case. To be alerted when a channel is online, a client can call
5255@code{GNUNET_CADET_notify_transmit_ready} immediately after
5256@code{GNUNET_CADET_create_channel}. When the callback is activated, it
5257means that the channel is online. The callback can give 0 bytes to CADET
5258if no message is to be sent, this is OK.
5259
5260If a transmission was requested but before the callback fires it is no
5261longer needed, it can be canceled with
5262@code{GNUNET_CADET_notify_transmit_ready_cancel}, which uses the handle
5263given back by @code{GNUNET_CADET_notify_transmit_ready}.
5264As in the case of CORE, only one message can be requested at a time: a
5265client must not call @code{GNUNET_CADET_notify_transmit_ready} again until
5266the callback is called or the request is canceled.
5267
5268When a channel is no longer needed, a client can call
5269@code{GNUNET_CADET_channel_destroy} to get rid of it.
5270Note that CADET will try to transmit all pending traffic before notifying
5271the remote peer of the destruction of the channel, including
5272retransmitting lost messages if the channel was reliable.
5273
5274Incoming channels, channels being closed by the remote peer, and traffic
5275on any incoming or outgoing channels are given to the client when CADET
5276executes the callbacks given to it at the time of
5277@code{GNUNET_CADET_connect}.
5278
5279Finally, when an application no longer wants to use CADET, it should call
5280@code{GNUNET_CADET_disconnect}, but first all channels and pending
5281transmissions must be closed (otherwise CADET will complain).
5282
5283@cindex NSE Subsystem
5284@node NSE Subsystem
5285@section NSE Subsystem
5286
5287
5288NSE stands for @dfn{Network Size Estimation}. The NSE subsystem provides
5289other subsystems and users with a rough estimate of the number of peers
5290currently participating in the GNUnet overlay.
5291The computed value is not a precise number as producing a precise number
5292in a decentralized, efficient and secure way is impossible.
5293While NSE's estimate is inherently imprecise, NSE also gives the expected
5294range. For a peer that has been running in a stable network for a
5295while, the real network size will typically (99.7% of the time) be in the
5296range of [2/3 estimate, 3/2 estimate]. We will now give an overview of the
5297algorithm used to calculate the estimate;
5298all of the details can be found in this technical report.
5299
5300@c FIXME: link to the report.
5301
5302@menu
5303* Motivation::
5304* Principle::
5305* libgnunetnse::
5306* The NSE Client-Service Protocol::
5307* The NSE Peer-to-Peer Protocol::
5308@end menu
5309
5310@node Motivation
5311@subsection Motivation
5312
5313
5314Some subsystems, like DHT, need to know the size of the GNUnet network to
5315optimize some parameters of their own protocol. The decentralized nature
5316of GNUnet makes efficient and securely counting the exact number of peers
5317infeasible. Although there are several decentralized algorithms to count
5318the number of peers in a system, so far there is none to do so securely.
5319Other protocols may allow any malicious peer to manipulate the final
5320result or to take advantage of the system to perform
5321@dfn{Denial of Service} (DoS) attacks against the network.
5322GNUnet's NSE protocol avoids these drawbacks.
5323
5324
5325
5326@menu
5327* Security::
5328@end menu
5329
5330@cindex NSE security
5331@cindex nse security
5332@node Security
5333@subsubsection Security
5334
5335
5336The NSE subsystem is designed to be resilient against these attacks.
5337It uses @uref{http://en.wikipedia.org/wiki/Proof-of-work_system, proofs of work}
5338to prevent one peer from impersonating a large number of participants,
5339which would otherwise allow an adversary to artificially inflate the
5340estimate.
5341The DoS protection comes from the time-based nature of the protocol:
5342the estimates are calculated periodically and out-of-time traffic is
5343either ignored or stored for later retransmission by benign peers.
5344In particular, peers cannot trigger global network communication at will.
5345
5346@cindex NSE principle
5347@cindex nse principle
5348@node Principle
5349@subsection Principle
5350
5351
5352The algorithm calculates the estimate by finding the globally closest
5353peer ID to a random, time-based value.
5354
5355The idea is that the closer the ID is to the random value, the more
5356"densely packed" the ID space is, and therefore, more peers are in the
5357network.
5358
5359
5360
5361@menu
5362* Example::
5363* Algorithm::
5364* Target value::
5365* Timing::
5366* Controlled Flooding::
5367* Calculating the estimate::
5368@end menu
5369
5370@node Example
5371@subsubsection Example
5372
5373
5374Suppose all peers have IDs between 0 and 100 (our ID space), and the
5375random value is 42.
5376If the closest peer has the ID 70 we can imagine that the average
5377"distance" between peers is around 30 and therefore the are around 3
5378peers in the whole ID space. On the other hand, if the closest peer has
5379the ID 44, we can imagine that the space is rather packed with peers,
5380maybe as much as 50 of them.
5381Naturally, we could have been rather unlucky, and there is only one peer
5382and happens to have the ID 44. Thus, the current estimate is calculated
5383as the average over multiple rounds, and not just a single sample.
5384
5385@node Algorithm
5386@subsubsection Algorithm
5387
5388
5389Given that example, one can imagine that the job of the subsystem is to
5390efficiently communicate the ID of the closest peer to the target value
5391to all the other peers, who will calculate the estimate from it.
5392
5393@node Target value
5394@subsubsection Target value
5395
5396@c %**end of header
5397
5398The target value itself is generated by hashing the current time, rounded
5399down to an agreed value. If the rounding amount is 1h (default) and the
5400time is 12:34:56, the time to hash would be 12:00:00. The process is
5401repeated each rounding amount (in this example would be every hour).
5402Every repetition is called a round.
5403
5404@node Timing
5405@subsubsection Timing
5406@c %**end of header
5407
5408The NSE subsystem has some timing control to avoid everybody broadcasting
5409its ID all at one. Once each peer has the target random value, it
5410compares its own ID to the target and calculates the hypothetical size of
5411the network if that peer were to be the closest.
5412Then it compares the hypothetical size with the estimate from the previous
5413rounds. For each value there is an associated point in the period,
5414let's call it "broadcast time". If its own hypothetical estimate
5415is the same as the previous global estimate, its "broadcast time" will be
5416in the middle of the round. If its bigger it will be earlier and if its
5417smaller (the most likely case) it will be later. This ensures that the
5418peers closest to the target value start broadcasting their ID the first.
5419
5420@node Controlled Flooding
5421@subsubsection Controlled Flooding
5422
5423@c %**end of header
5424
5425When a peer receives a value, first it verifies that it is closer than the
5426closest value it had so far, otherwise it answers the incoming message
5427with a message containing the better value. Then it checks a proof of
5428work that must be included in the incoming message, to ensure that the
5429other peer's ID is not made up (otherwise a malicious peer could claim to
5430have an ID of exactly the target value every round). Once validated, it
5431compares the broadcast time of the received value with the current time
5432and if it's not too early, sends the received value to its neighbors.
5433Otherwise it stores the value until the correct broadcast time comes.
5434This prevents unnecessary traffic of sub-optimal values, since a better
5435value can come before the broadcast time, rendering the previous one
5436obsolete and saving the traffic that would have been used to broadcast it
5437to the neighbors.
5438
5439@node Calculating the estimate
5440@subsubsection Calculating the estimate
5441
5442@c %**end of header
5443
5444Once the closest ID has been spread across the network each peer gets the
5445exact distance between this ID and the target value of the round and
5446calculates the estimate with a mathematical formula described in the tech
5447report. The estimate generated with this method for a single round is not
5448very precise. Remember the case of the example, where the only peer is the
5449ID 44 and we happen to generate the target value 42, thinking there are
545050 peers in the network. Therefore, the NSE subsystem remembers the last
545164 estimates and calculates an average over them, giving a result of which
5452usually has one bit of uncertainty (the real size could be half of the
5453estimate or twice as much). Note that the actual network size is
5454calculated in powers of two of the raw input, thus one bit of uncertainty
5455means a factor of two in the size estimate.
5456
5457@cindex libgnunetnse
5458@node libgnunetnse
5459@subsection libgnunetnse
5460
5461@c %**end of header
5462
5463The NSE subsystem has the simplest API of all services, with only two
5464calls: @code{GNUNET_NSE_connect} and @code{GNUNET_NSE_disconnect}.
5465
5466The connect call gets a callback function as a parameter and this function
5467is called each time the network agrees on an estimate. This usually is
5468once per round, with some exceptions: if the closest peer has a late
5469local clock and starts spreading its ID after everyone else agreed on a
5470value, the callback might be activated twice in a round, the second value
5471being always bigger than the first. The default round time is set to
54721 hour.
5473
5474The disconnect call disconnects from the NSE subsystem and the callback
5475is no longer called with new estimates.
5476
5477
5478
5479@menu
5480* Results::
5481* libgnunetnse - Examples::
5482@end menu
5483
5484@node Results
5485@subsubsection Results
5486
5487@c %**end of header
5488
5489The callback provides two values: the average and the
5490@uref{http://en.wikipedia.org/wiki/Standard_deviation, standard deviation}
5491of the last 64 rounds. The values provided by the callback function are
5492logarithmic, this means that the real estimate numbers can be obtained by
5493calculating 2 to the power of the given value (2average). From a
5494statistics point of view this means that:
5495
5496@itemize @bullet
5497@item 68% of the time the real size is included in the interval
5498[(2average-stddev), 2]
5499@item 95% of the time the real size is included in the interval
5500[(2average-2*stddev, 2^average+2*stddev]
5501@item 99.7% of the time the real size is included in the interval
5502[(2average-3*stddev, 2average+3*stddev]
5503@end itemize
5504
5505The expected standard variation for 64 rounds in a network of stable size
5506is 0.2. Thus, we can say that normally:
5507
5508@itemize @bullet
5509@item 68% of the time the real size is in the range [-13%, +15%]
5510@item 95% of the time the real size is in the range [-24%, +32%]
5511@item 99.7% of the time the real size is in the range [-34%, +52%]
5512@end itemize
5513
5514As said in the introduction, we can be quite sure that usually the real
5515size is between one third and three times the estimate. This can of
5516course vary with network conditions.
5517Thus, applications may want to also consider the provided standard
5518deviation value, not only the average (in particular, if the standard
5519variation is very high, the average maybe meaningless: the network size is
5520changing rapidly).
5521
5522@node libgnunetnse - Examples
5523@subsubsection libgnunetnse -Examples
5524
5525@c %**end of header
5526
5527Let's close with a couple examples.
5528
5529@table @asis
5530
5531@item Average: 10, std dev: 1 Here the estimate would be
55322^10 = 1024 peers. (The range in which we can be 95% sure is:
5533[2^8, 2^12] = [256, 4096]. We can be very (>99.7%) sure that the network
5534is not a hundred peers and absolutely sure that it is not a million peers,
5535but somewhere around a thousand.)
5536
5537@item Average 22, std dev: 0.2 Here the estimate would be
55382^22 = 4 Million peers. (The range in which we can be 99.7% sure
5539is: [2^21.4, 2^22.6] = [2.8M, 6.3M]. We can be sure that the network size
5540is around four million, with absolutely way of it being 1 million.)
5541
5542@end table
5543
5544To put this in perspective, if someone remembers the LHC Higgs boson
5545results, were announced with "5 sigma" and "6 sigma" certainties. In this
5546case a 5 sigma minimum would be 2 million and a 6 sigma minimum,
55471.8 million.
5548
5549@node The NSE Client-Service Protocol
5550@subsection The NSE Client-Service Protocol
5551
5552@c %**end of header
5553
5554As with the API, the client-service protocol is very simple, only has 2
5555different messages, defined in @code{src/nse/nse.h}:
5556
5557@itemize @bullet
5558@item @code{GNUNET_MESSAGE_TYPE_NSE_START}@ This message has no parameters
5559and is sent from the client to the service upon connection.
5560@item @code{GNUNET_MESSAGE_TYPE_NSE_ESTIMATE}@ This message is sent from
5561the service to the client for every new estimate and upon connection.
5562Contains a timestamp for the estimate, the average and the standard
5563deviation for the respective round.
5564@end itemize
5565
5566When the @code{GNUNET_NSE_disconnect} API call is executed, the client
5567simply disconnects from the service, with no message involved.
5568
5569@cindex NSE Peer-to-Peer Protocol
5570@node The NSE Peer-to-Peer Protocol
5571@subsection The NSE Peer-to-Peer Protocol
5572
5573@c %**end of header
5574
5575The NSE subsystem only has one message in the P2P protocol, the
5576@code{GNUNET_MESSAGE_TYPE_NSE_P2P_FLOOD} message.
5577
5578This message key contents are the timestamp to identify the round
5579(differences in system clocks may cause some peers to send messages way
5580too early or way too late, so the timestamp allows other peers to
5581identify such messages easily), the
5582@uref{http://en.wikipedia.org/wiki/Proof-of-work_system, proof of work}
5583used to make it difficult to mount a
5584@uref{http://en.wikipedia.org/wiki/Sybil_attack, Sybil attack}, and the
5585public key, which is used to verify the signature on the message.
5586
5587Every peer stores a message for the previous, current and next round. The
5588messages for the previous and current round are given to peers that
5589connect to us. The message for the next round is simply stored until our
5590system clock advances to the next round. The message for the current round
5591is what we are flooding the network with right now.
5592At the beginning of each round the peer does the following:
5593
5594@itemize @bullet
5595@item calculates its own distance to the target value
5596@item creates, signs and stores the message for the current round (unless
5597it has a better message in the "next round" slot which came early in the
5598previous round)
5599@item calculates, based on the stored round message (own or received) when
5600to start flooding it to its neighbors
5601@end itemize
5602
5603Upon receiving a message the peer checks the validity of the message
5604(round, proof of work, signature). The next action depends on the
5605contents of the incoming message:
5606
5607@itemize @bullet
5608@item if the message is worse than the current stored message, the peer
5609sends the current message back immediately, to stop the other peer from
5610spreading suboptimal results
5611@item if the message is better than the current stored message, the peer
5612stores the new message and calculates the new target time to start
5613spreading it to its neighbors (excluding the one the message came from)
5614@item if the message is for the previous round, it is compared to the
5615message stored in the "previous round slot", which may then be updated
5616@item if the message is for the next round, it is compared to the message
5617stored in the "next round slot", which again may then be updated
5618@end itemize
5619
5620Finally, when it comes to send the stored message for the current round to
5621the neighbors there is a random delay added for each neighbor, to avoid
5622traffic spikes and minimize cross-messages.
5623
5624@cindex HOSTLIST Subsystem
5625@node HOSTLIST Subsystem
5626@section HOSTLIST Subsystem
5627
5628@c %**end of header
5629
5630Peers in the GNUnet overlay network need address information so that they
5631can connect with other peers. GNUnet uses so called HELLO messages to
5632store and exchange peer addresses.
5633GNUnet provides several methods for peers to obtain this information:
5634
5635@itemize @bullet
5636@item out-of-band exchange of HELLO messages (manually, using for example
5637gnunet-peerinfo)
5638@item HELLO messages shipped with GNUnet (automatic with distribution)
5639@item UDP neighbor discovery in LAN (IPv4 broadcast, IPv6 multicast)
5640@item topology gossiping (learning from other peers we already connected
5641to), and
5642@item the HOSTLIST daemon covered in this section, which is particularly
5643relevant for bootstrapping new peers.
5644@end itemize
5645
5646New peers have no existing connections (and thus cannot learn from gossip
5647among peers), may not have other peers in their LAN and might be started
5648with an outdated set of HELLO messages from the distribution.
5649In this case, getting new peers to connect to the network requires either
5650manual effort or the use of a HOSTLIST to obtain HELLOs.
5651
5652@menu
5653* HELLOs::
5654* Overview for the HOSTLIST subsystem::
5655* Interacting with the HOSTLIST daemon::
5656* Hostlist security address validation::
5657* The HOSTLIST daemon::
5658* The HOSTLIST server::
5659* The HOSTLIST client::
5660* Usage::
5661@end menu
5662
5663@node HELLOs
5664@subsection HELLOs
5665
5666@c %**end of header
5667
5668The basic information peers require to connect to other peers are
5669contained in so called HELLO messages you can think of as a business card.
5670Besides the identity of the peer (based on the cryptographic public key) a
5671HELLO message may contain address information that specifies ways to
5672contact a peer. By obtaining HELLO messages, a peer can learn how to
5673contact other peers.
5674
5675@node Overview for the HOSTLIST subsystem
5676@subsection Overview for the HOSTLIST subsystem
5677
5678@c %**end of header
5679
5680The HOSTLIST subsystem provides a way to distribute and obtain contact
5681information to connect to other peers using a simple HTTP GET request.
5682It's implementation is split in three parts, the main file for the daemon
5683itself (@file{gnunet-daemon-hostlist.c}), the HTTP client used to download
5684peer information (@file{hostlist-client.c}) and the server component used
5685to provide this information to other peers (@file{hostlist-server.c}).
5686The server is basically a small HTTP web server (based on GNU
5687libmicrohttpd) which provides a list of HELLOs known to the local peer for
5688download. The client component is basically a HTTP client
5689(based on libcurl) which can download hostlists from one or more websites.
5690The hostlist format is a binary blob containing a sequence of HELLO
5691messages. Note that any HTTP server can theoretically serve a hostlist,
5692the build-in hostlist server makes it simply convenient to offer this
5693service.
5694
5695
5696@menu
5697* Features::
5698* HOSTLIST - Limitations::
5699@end menu
5700
5701@node Features
5702@subsubsection Features
5703
5704@c %**end of header
5705
5706The HOSTLIST daemon can:
5707
5708@itemize @bullet
5709@item provide HELLO messages with validated addresses obtained from
5710PEERINFO to download for other peers
5711@item download HELLO messages and forward these message to the TRANSPORT
5712subsystem for validation
5713@item advertises the URL of this peer's hostlist address to other peers
5714via gossip
5715@item automatically learn about hostlist servers from the gossip of other
5716peers
5717@end itemize
5718
5719@node HOSTLIST - Limitations
5720@subsubsection HOSTLIST - Limitations
5721
5722@c %**end of header
5723
5724The HOSTLIST daemon does not:
5725
5726@itemize @bullet
5727@item verify the cryptographic information in the HELLO messages
5728@item verify the address information in the HELLO messages
5729@end itemize
5730
5731@node Interacting with the HOSTLIST daemon
5732@subsection Interacting with the HOSTLIST daemon
5733
5734@c %**end of header
5735
5736The HOSTLIST subsystem is currently implemented as a daemon, so there is
5737no need for the user to interact with it and therefore there is no
5738command line tool and no API to communicate with the daemon. In the
5739future, we can envision changing this to allow users to manually trigger
5740the download of a hostlist.
5741
5742Since there is no command line interface to interact with HOSTLIST, the
5743only way to interact with the hostlist is to use STATISTICS to obtain or
5744modify information about the status of HOSTLIST:
5745
5746@example
5747$ gnunet-statistics -s hostlist
5748@end example
5749
5750@noindent
5751In particular, HOSTLIST includes a @strong{persistent} value in statistics
5752that specifies when the hostlist server might be queried next. As this
5753value is exponentially increasing during runtime, developers may want to
5754reset or manually adjust it. Note that HOSTLIST (but not STATISTICS) needs
5755to be shutdown if changes to this value are to have any effect on the
5756daemon (as HOSTLIST does not monitor STATISTICS for changes to the
5757download frequency).
5758
5759@node Hostlist security address validation
5760@subsection Hostlist security address validation
5761
5762@c %**end of header
5763
5764Since information obtained from other parties cannot be trusted without
5765validation, we have to distinguish between @emph{validated} and
5766@emph{not validated} addresses. Before using (and so trusting)
5767information from other parties, this information has to be double-checked
5768(validated). Address validation is not done by HOSTLIST but by the
5769TRANSPORT service.
5770
5771The HOSTLIST component is functionally located between the PEERINFO and
5772the TRANSPORT subsystem. When acting as a server, the daemon obtains valid
5773(@emph{validated}) peer information (HELLO messages) from the PEERINFO
5774service and provides it to other peers. When acting as a client, it
5775contacts the HOSTLIST servers specified in the configuration, downloads
5776the (unvalidated) list of HELLO messages and forwards these information
5777to the TRANSPORT server to validate the addresses.
5778
5779@cindex HOSTLIST daemon
5780@node The HOSTLIST daemon
5781@subsection The HOSTLIST daemon
5782
5783@c %**end of header
5784
5785The hostlist daemon is the main component of the HOSTLIST subsystem. It is
5786started by the ARM service and (if configured) starts the HOSTLIST client
5787and server components.
5788
5789If the daemon provides a hostlist itself it can advertise it's own
5790hostlist to other peers. To do so it sends a
5791@code{GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT} message to other peers
5792when they connect to this peer on the CORE level. This hostlist
5793advertisement message contains the URL to access the HOSTLIST HTTP
5794server of the sender. The daemon may also subscribe to this type of
5795message from CORE service, and then forward these kind of message to the
5796HOSTLIST client. The client then uses all available URLs to download peer
5797information when necessary.
5798
5799When starting, the HOSTLIST daemon first connects to the CORE subsystem
5800and if hostlist learning is enabled, registers a CORE handler to receive
5801this kind of messages. Next it starts (if configured) the client and
5802server. It passes pointers to CORE connect and disconnect and receive
5803handlers where the client and server store their functions, so the daemon
5804can notify them about CORE events.
5805
5806To clean up on shutdown, the daemon has a cleaning task, shutting down all
5807subsystems and disconnecting from CORE.
5808
5809@cindex HOSTLIST server
5810@node The HOSTLIST server
5811@subsection The HOSTLIST server
5812
5813@c %**end of header
5814
5815The server provides a way for other peers to obtain HELLOs. Basically it
5816is a small web server other peers can connect to and download a list of
5817HELLOs using standard HTTP; it may also advertise the URL of the hostlist
5818to other peers connecting on CORE level.
5819
5820
5821@menu
5822* The HTTP Server::
5823* Advertising the URL::
5824@end menu
5825
5826@node The HTTP Server
5827@subsubsection The HTTP Server
5828
5829@c %**end of header
5830
5831During startup, the server starts a web server listening on the port
5832specified with the HTTPPORT value (default 8080). In addition it connects
5833to the PEERINFO service to obtain peer information. The HOSTLIST server
5834uses the GNUNET_PEERINFO_iterate function to request HELLO information for
5835all peers and adds their information to a new hostlist if they are
5836suitable (expired addresses and HELLOs without addresses are both not
5837suitable) and the maximum size for a hostlist is not exceeded
5838(MAX_BYTES_PER_HOSTLISTS = 500000).
5839When PEERINFO finishes (with a last NULL callback), the server destroys
5840the previous hostlist response available for download on the web server
5841and replaces it with the updated hostlist. The hostlist format is
5842basically a sequence of HELLO messages (as obtained from PEERINFO) without
5843any special tokenization. Since each HELLO message contains a size field,
5844the response can easily be split into separate HELLO messages by the
5845client.
5846
5847A HOSTLIST client connecting to the HOSTLIST server will receive the
5848hostlist as a HTTP response and the the server will terminate the
5849connection with the result code @code{HTTP 200 OK}.
5850The connection will be closed immediately if no hostlist is available.
5851
5852@node Advertising the URL
5853@subsubsection Advertising the URL
5854
5855@c %**end of header
5856
5857The server also advertises the URL to download the hostlist to other peers
5858if hostlist advertisement is enabled.
5859When a new peer connects and has hostlist learning enabled, the server
5860sends a @code{GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT} message to this
5861peer using the CORE service.
5862
5863@cindex HOSTLIST client
5864@node The HOSTLIST client
5865@subsection The HOSTLIST client
5866
5867@c %**end of header
5868
5869The client provides the functionality to download the list of HELLOs from
5870a set of URLs.
5871It performs a standard HTTP request to the URLs configured and learned
5872from advertisement messages received from other peers. When a HELLO is
5873downloaded, the HOSTLIST client forwards the HELLO to the TRANSPORT
5874service for validation.
5875
5876The client supports two modes of operation:
5877
5878@itemize @bullet
5879@item download of HELLOs (bootstrapping)
5880@item learning of URLs
5881@end itemize
5882
5883@menu
5884* Bootstrapping::
5885* Learning::
5886@end menu
5887
5888@node Bootstrapping
5889@subsubsection Bootstrapping
5890
5891@c %**end of header
5892
5893For bootstrapping, it schedules a task to download the hostlist from the
5894set of known URLs.
5895The downloads are only performed if the number of current
5896connections is smaller than a minimum number of connections
5897(at the moment 4).
5898The interval between downloads increases exponentially; however, the
5899exponential growth is limited if it becomes longer than an hour.
5900At that point, the frequency growth is capped at
5901(#number of connections * 1h).
5902
5903Once the decision has been taken to download HELLOs, the daemon chooses a
5904random URL from the list of known URLs. URLs can be configured in the
5905configuration or be learned from advertisement messages.
5906The client uses a HTTP client library (libcurl) to initiate the download
5907using the libcurl multi interface.
5908Libcurl passes the data to the callback_download function which
5909stores the data in a buffer if space is available and the maximum size for
5910a hostlist download is not exceeded (MAX_BYTES_PER_HOSTLISTS = 500000).
5911When a full HELLO was downloaded, the HOSTLIST client offers this
5912HELLO message to the TRANSPORT service for validation.
5913When the download is finished or failed, statistical information about the
5914quality of this URL is updated.
5915
5916@cindex HOSTLIST learning
5917@node Learning
5918@subsubsection Learning
5919
5920@c %**end of header
5921
5922The client also manages hostlist advertisements from other peers. The
5923HOSTLIST daemon forwards @code{GNUNET_MESSAGE_TYPE_HOSTLIST_ADVERTISEMENT}
5924messages to the client subsystem, which extracts the URL from the message.
5925Next, a test of the newly obtained URL is performed by triggering a
5926download from the new URL. If the URL works correctly, it is added to the
5927list of working URLs.
5928
5929The size of the list of URLs is restricted, so if an additional server is
5930added and the list is full, the URL with the worst quality ranking
5931(determined through successful downloads and number of HELLOs e.g.) is
5932discarded. During shutdown the list of URLs is saved to a file for
5933persistance and loaded on startup. URLs from the configuration file are
5934never discarded.
5935
5936@node Usage
5937@subsection Usage
5938
5939@c %**end of header
5940
5941To start HOSTLIST by default, it has to be added to the DEFAULTSERVICES
5942section for the ARM services. This is done in the default configuration.
5943
5944For more information on how to configure the HOSTLIST subsystem see the
5945installation handbook:@
5946Configuring the hostlist to bootstrap@
5947Configuring your peer to provide a hostlist
5948
5949@cindex IDENTITY Subsystem
5950@node IDENTITY Subsystem
5951@section IDENTITY Subsystem
5952
5953@c %**end of header
5954
5955Identities of "users" in GNUnet are called egos.
5956Egos can be used as pseudonyms ("fake names") or be tied to an
5957organization (for example, "GNU") or even the actual identity of a human.
5958GNUnet users are expected to have many egos. They might have one tied to
5959their real identity, some for organizations they manage, and more for
5960different domains where they want to operate under a pseudonym.
5961
5962The IDENTITY service allows users to manage their egos. The identity
5963service manages the private keys egos of the local user; it does not
5964manage identities of other users (public keys). Public keys for other
5965users need names to become manageable. GNUnet uses the
5966@dfn{GNU Name System} (GNS) to give names to other users and manage their
5967public keys securely. This chapter is about the IDENTITY service,
5968which is about the management of private keys.
5969
5970On the network, an ego corresponds to an ECDSA key (over Curve25519,
5971using RFC 6979, as required by GNS). Thus, users can perform actions
5972under a particular ego by using (signing with) a particular private key.
5973Other users can then confirm that the action was really performed by that
5974ego by checking the signature against the respective public key.
5975
5976The IDENTITY service allows users to associate a human-readable name with
5977each ego. This way, users can use names that will remind them of the
5978purpose of a particular ego.
5979The IDENTITY service will store the respective private keys and
5980allows applications to access key information by name.
5981Users can change the name that is locally (!) associated with an ego.
5982Egos can also be deleted, which means that the private key will be removed
5983and it thus will not be possible to perform actions with that ego in the
5984future.
5985
5986Additionally, the IDENTITY subsystem can associate service functions with
5987egos.
5988For example, GNS requires the ego that should be used for the shorten
5989zone. GNS will ask IDENTITY for an ego for the "gns-short" service.
5990The IDENTITY service has a mapping of such service strings to the name of
5991the ego that the user wants to use for this service, for example
5992"my-short-zone-ego".
5993
5994Finally, the IDENTITY API provides access to a special ego, the
5995anonymous ego. The anonymous ego is special in that its private key is not
5996really private, but fixed and known to everyone.
5997Thus, anyone can perform actions as anonymous. This can be useful as with
5998this trick, code does not have to contain a special case to distinguish
5999between anonymous and pseudonymous egos.
6000
6001@menu
6002* libgnunetidentity::
6003* The IDENTITY Client-Service Protocol::
6004@end menu
6005
6006@cindex libgnunetidentity
6007@node libgnunetidentity
6008@subsection libgnunetidentity
6009@c %**end of header
6010
6011
6012@menu
6013* Connecting to the service::
6014* Operations on Egos::
6015* The anonymous Ego::
6016* Convenience API to lookup a single ego::
6017* Associating egos with service functions::
6018@end menu
6019
6020@node Connecting to the service
6021@subsubsection Connecting to the service
6022
6023@c %**end of header
6024
6025First, typical clients connect to the identity service using
6026@code{GNUNET_IDENTITY_connect}. This function takes a callback as a
6027parameter.
6028If the given callback parameter is non-null, it will be invoked to notify
6029the application about the current state of the identities in the system.
6030
6031@itemize @bullet
6032@item First, it will be invoked on all known egos at the time of the
6033connection. For each ego, a handle to the ego and the user's name for the
6034ego will be passed to the callback. Furthermore, a @code{void **} context
6035argument will be provided which gives the client the opportunity to
6036associate some state with the ego.
6037@item Second, the callback will be invoked with NULL for the ego, the name
6038and the context. This signals that the (initial) iteration over all egos
6039has completed.
6040@item Then, the callback will be invoked whenever something changes about
6041an ego.
6042If an ego is renamed, the callback is invoked with the ego handle of the
6043ego that was renamed, and the new name. If an ego is deleted, the callback
6044is invoked with the ego handle and a name of NULL. In the deletion case,
6045the application should also release resources stored in the context.
6046@item When the application destroys the connection to the identity service
6047using @code{GNUNET_IDENTITY_disconnect}, the callback is again invoked
6048with the ego and a name of NULL (equivalent to deletion of the egos).
6049This should again be used to clean up the per-ego context.
6050@end itemize
6051
6052The ego handle passed to the callback remains valid until the callback is
6053invoked with a name of NULL, so it is safe to store a reference to the
6054ego's handle.
6055
6056@node Operations on Egos
6057@subsubsection Operations on Egos
6058
6059@c %**end of header
6060
6061Given an ego handle, the main operations are to get its associated private
6062key using @code{GNUNET_IDENTITY_ego_get_private_key} or its associated
6063public key using @code{GNUNET_IDENTITY_ego_get_public_key}.
6064
6065The other operations on egos are pretty straightforward.
6066Using @code{GNUNET_IDENTITY_create}, an application can request the
6067creation of an ego by specifying the desired name.
6068The operation will fail if that name is
6069already in use. Using @code{GNUNET_IDENTITY_rename} the name of an
6070existing ego can be changed. Finally, egos can be deleted using
6071@code{GNUNET_IDENTITY_delete}. All of these operations will trigger
6072updates to the callback given to the @code{GNUNET_IDENTITY_connect}
6073function of all applications that are connected with the identity service
6074at the time. @code{GNUNET_IDENTITY_cancel} can be used to cancel the
6075operations before the respective continuations would be called.
6076It is not guaranteed that the operation will not be completed anyway,
6077only the continuation will no longer be called.
6078
6079@node The anonymous Ego
6080@subsubsection The anonymous Ego
6081
6082@c %**end of header
6083
6084A special way to obtain an ego handle is to call
6085@code{GNUNET_IDENTITY_ego_get_anonymous}, which returns an ego for the
6086"anonymous" user --- anyone knows and can get the private key for this
6087user, so it is suitable for operations that are supposed to be anonymous
6088but require signatures (for example, to avoid a special path in the code).
6089The anonymous ego is always valid and accessing it does not require a
6090connection to the identity service.
6091
6092@node Convenience API to lookup a single ego
6093@subsubsection Convenience API to lookup a single ego
6094
6095
6096As applications commonly simply have to lookup a single ego, there is a
6097convenience API to do just that. Use @code{GNUNET_IDENTITY_ego_lookup} to
6098lookup a single ego by name. Note that this is the user's name for the
6099ego, not the service function. The resulting ego will be returned via a
6100callback and will only be valid during that callback. The operation can
6101be canceled via @code{GNUNET_IDENTITY_ego_lookup_cancel}
6102(cancellation is only legal before the callback is invoked).
6103
6104@node Associating egos with service functions
6105@subsubsection Associating egos with service functions
6106
6107
6108The @code{GNUNET_IDENTITY_set} function is used to associate a particular
6109ego with a service function. The name used by the service and the ego are
6110given as arguments.
6111Afterwards, the service can use its name to lookup the associated ego
6112using @code{GNUNET_IDENTITY_get}.
6113
6114@node The IDENTITY Client-Service Protocol
6115@subsection The IDENTITY Client-Service Protocol
6116
6117@c %**end of header
6118
6119A client connecting to the identity service first sends a message with
6120type
6121@code{GNUNET_MESSAGE_TYPE_IDENTITY_START} to the service. After that, the
6122client will receive information about changes to the egos by receiving
6123messages of type @code{GNUNET_MESSAGE_TYPE_IDENTITY_UPDATE}.
6124Those messages contain the private key of the ego and the user's name of
6125the ego (or zero bytes for the name to indicate that the ego was deleted).
6126A special bit @code{end_of_list} is used to indicate the end of the
6127initial iteration over the identity service's egos.
6128
6129The client can trigger changes to the egos by sending @code{CREATE},
6130@code{RENAME} or @code{DELETE} messages.
6131The CREATE message contains the private key and the desired name.@
6132The RENAME message contains the old name and the new name.@
6133The DELETE message only needs to include the name of the ego to delete.@
6134The service responds to each of these messages with a @code{RESULT_CODE}
6135message which indicates success or error of the operation, and possibly
6136a human-readable error message.
6137
6138Finally, the client can bind the name of a service function to an ego by
6139sending a @code{SET_DEFAULT} message with the name of the service function
6140and the private key of the ego.
6141Such bindings can then be resolved using a @code{GET_DEFAULT} message,
6142which includes the name of the service function. The identity service
6143will respond to a GET_DEFAULT request with a SET_DEFAULT message
6144containing the respective information, or with a RESULT_CODE to
6145indicate an error.
6146
6147@cindex NAMESTORE Subsystem
6148@node NAMESTORE Subsystem
6149@section NAMESTORE Subsystem
6150
6151The NAMESTORE subsystem provides persistent storage for local GNS zone
6152information. All local GNS zone information are managed by NAMESTORE. It
6153provides both the functionality to administer local GNS information (e.g.
6154delete and add records) as well as to retrieve GNS information (e.g to
6155list name information in a client).
6156NAMESTORE does only manage the persistent storage of zone information
6157belonging to the user running the service: GNS information from other
6158users obtained from the DHT are stored by the NAMECACHE subsystem.
6159
6160NAMESTORE uses a plugin-based database backend to store GNS information
6161with good performance. Here sqlite, MySQL and PostgreSQL are supported
6162database backends.
6163NAMESTORE clients interact with the IDENTITY subsystem to obtain
6164cryptographic information about zones based on egos as described with the
6165IDENTITY subsystem, but internally NAMESTORE refers to zones using the
6166ECDSA private key.
6167In addition, it collaborates with the NAMECACHE subsystem and
6168stores zone information when local information are modified in the
6169GNS cache to increase look-up performance for local information.
6170
6171NAMESTORE provides functionality to look-up and store records, to iterate
6172over a specific or all zones and to monitor zones for changes. NAMESTORE
6173functionality can be accessed using the NAMESTORE api or the NAMESTORE
6174command line tool.
6175
6176@menu
6177* libgnunetnamestore::
6178@end menu
6179
6180@cindex libgnunetnamestore
6181@node libgnunetnamestore
6182@subsection libgnunetnamestore
6183
6184To interact with NAMESTORE clients first connect to the NAMESTORE service
6185using the @code{GNUNET_NAMESTORE_connect} passing a configuration handle.
6186As a result they obtain a NAMESTORE handle, they can use for operations,
6187or NULL is returned if the connection failed.
6188
6189To disconnect from NAMESTORE, clients use
6190@code{GNUNET_NAMESTORE_disconnect} and specify the handle to disconnect.
6191
6192NAMESTORE internally uses the ECDSA private key to refer to zones. These
6193private keys can be obtained from the IDENTITY subsytem.
6194Here @emph{egos} @emph{can be used to refer to zones or the default ego
6195assigned to the GNS subsystem can be used to obtained the master zone's
6196private key.}
6197
6198
6199@menu
6200* Editing Zone Information::
6201* Iterating Zone Information::
6202* Monitoring Zone Information::
6203@end menu
6204
6205@node Editing Zone Information
6206@subsubsection Editing Zone Information
6207
6208@c %**end of header
6209
6210NAMESTORE provides functions to lookup records stored under a label in a
6211zone and to store records under a label in a zone.
6212
6213To store (and delete) records, the client uses the
6214@code{GNUNET_NAMESTORE_records_store} function and has to provide
6215namestore handle to use, the private key of the zone, the label to store
6216the records under, the records and number of records plus an callback
6217function.
6218After the operation is performed NAMESTORE will call the provided
6219callback function with the result GNUNET_SYSERR on failure
6220(including timeout/queue drop/failure to validate), GNUNET_NO if content
6221was already there or not found GNUNET_YES (or other positive value) on
6222success plus an additional error message.
6223
6224Records are deleted by using the store command with 0 records to store.
6225It is important to note, that records are not merged when records exist
6226with the label.
6227So a client has first to retrieve records, merge with existing records
6228and then store the result.
6229
6230To perform a lookup operation, the client uses the
6231@code{GNUNET_NAMESTORE_records_store} function. Here it has to pass the
6232namestore handle, the private key of the zone and the label. It also has
6233to provide a callback function which will be called with the result of
6234the lookup operation:
6235the zone for the records, the label, and the records including the
6236number of records included.
6237
6238A special operation is used to set the preferred nickname for a zone.
6239This nickname is stored with the zone and is automatically merged with
6240all labels and records stored in a zone. Here the client uses the
6241@code{GNUNET_NAMESTORE_set_nick} function and passes the private key of
6242the zone, the nickname as string plus a the callback with the result of
6243the operation.
6244
6245@node Iterating Zone Information
6246@subsubsection Iterating Zone Information
6247
6248@c %**end of header
6249
6250A client can iterate over all information in a zone or all zones managed
6251by NAMESTORE.
6252Here a client uses the @code{GNUNET_NAMESTORE_zone_iteration_start}
6253function and passes the namestore handle, the zone to iterate over and a
6254callback function to call with the result.
6255If the client wants to iterate over all the WHAT!? FIXME, it passes NULL for the zone.
6256A @code{GNUNET_NAMESTORE_ZoneIterator} handle is returned to be used to
6257continue iteration.
6258
6259NAMESTORE calls the callback for every result and expects the client to
6260call @code{GNUNET_NAMESTORE_zone_iterator_next} to continue to iterate or
6261@code{GNUNET_NAMESTORE_zone_iterator_stop} to interrupt the iteration.
6262When NAMESTORE reached the last item it will call the callback with a
6263NULL value to indicate.
6264
6265@node Monitoring Zone Information
6266@subsubsection Monitoring Zone Information
6267
6268@c %**end of header
6269
6270Clients can also monitor zones to be notified about changes. Here the
6271clients uses the @code{GNUNET_NAMESTORE_zone_monitor_start} function and
6272passes the private key of the zone and and a callback function to call
6273with updates for a zone.
6274The client can specify to obtain zone information first by iterating over
6275the zone and specify a synchronization callback to be called when the
6276client and the namestore are synced.
6277
6278On an update, NAMESTORE will call the callback with the private key of the
6279zone, the label and the records and their number.
6280
6281To stop monitoring, the client calls
6282@code{GNUNET_NAMESTORE_zone_monitor_stop} and passes the handle obtained
6283from the function to start the monitoring.
6284
6285@cindex PEERINFO Subsystem
6286@node PEERINFO Subsystem
6287@section PEERINFO Subsystem
6288
6289@c %**end of header
6290
6291The PEERINFO subsystem is used to store verified (validated) information
6292about known peers in a persistent way. It obtains these addresses for
6293example from TRANSPORT service which is in charge of address validation.
6294Validation means that the information in the HELLO message are checked by
6295connecting to the addresses and performing a cryptographic handshake to
6296authenticate the peer instance stating to be reachable with these
6297addresses.
6298Peerinfo does not validate the HELLO messages itself but only stores them
6299and gives them to interested clients.
6300
6301As future work, we think about moving from storing just HELLO messages to
6302providing a generic persistent per-peer information store.
6303More and more subsystems tend to need to store per-peer information in
6304persistent way.
6305To not duplicate this functionality we plan to provide a PEERSTORE
6306service providing this functionality.
6307
6308@menu
6309* PEERINFO - Features::
6310* PEERINFO - Limitations::
6311* DeveloperPeer Information::
6312* Startup::
6313* Managing Information::
6314* Obtaining Information::
6315* The PEERINFO Client-Service Protocol::
6316* libgnunetpeerinfo::
6317@end menu
6318
6319@node PEERINFO - Features
6320@subsection PEERINFO - Features
6321
6322@c %**end of header
6323
6324@itemize @bullet
6325@item Persistent storage
6326@item Client notification mechanism on update
6327@item Periodic clean up for expired information
6328@item Differentiation between public and friend-only HELLO
6329@end itemize
6330
6331@node PEERINFO - Limitations
6332@subsection PEERINFO - Limitations
6333
6334
6335@itemize @bullet
6336@item Does not perform HELLO validation
6337@end itemize
6338
6339@node DeveloperPeer Information
6340@subsection DeveloperPeer Information
6341
6342@c %**end of header
6343
6344The PEERINFO subsystem stores these information in the form of HELLO
6345messages you can think of as business cards.
6346These HELLO messages contain the public key of a peer and the addresses
6347a peer can be reached under.
6348The addresses include an expiration date describing how long they are
6349valid. This information is updated regularly by the TRANSPORT service by
6350revalidating the address.
6351If an address is expired and not renewed, it can be removed from the
6352HELLO message.
6353
6354Some peer do not want to have their HELLO messages distributed to other
6355peers, especially when GNUnet's friend-to-friend modus is enabled.
6356To prevent this undesired distribution. PEERINFO distinguishes between
6357@emph{public} and @emph{friend-only} HELLO messages.
6358Public HELLO messages can be freely distributed to other (possibly
6359unknown) peers (for example using the hostlist, gossiping, broadcasting),
6360whereas friend-only HELLO messages may not be distributed to other peers.
6361Friend-only HELLO messages have an additional flag @code{friend_only} set
6362internally. For public HELLO message this flag is not set.
6363PEERINFO does and cannot not check if a client is allowed to obtain a
6364specific HELLO type.
6365
6366The HELLO messages can be managed using the GNUnet HELLO library.
6367Other GNUnet systems can obtain these information from PEERINFO and use
6368it for their purposes.
6369Clients are for example the HOSTLIST component providing these
6370information to other peers in form of a hostlist or the TRANSPORT
6371subsystem using these information to maintain connections to other peers.
6372
6373@node Startup
6374@subsection Startup
6375
6376@c %**end of header
6377
6378During startup the PEERINFO services loads persistent HELLOs from disk.
6379First PEERINFO parses the directory configured in the HOSTS value of the
6380@code{PEERINFO} configuration section to store PEERINFO information.
6381For all files found in this directory valid HELLO messages are extracted.
6382In addition it loads HELLO messages shipped with the GNUnet distribution.
6383These HELLOs are used to simplify network bootstrapping by providing
6384valid peer information with the distribution.
6385The use of these HELLOs can be prevented by setting the
6386@code{USE_INCLUDED_HELLOS} in the @code{PEERINFO} configuration section to
6387@code{NO}. Files containing invalid information are removed.
6388
6389@node Managing Information
6390@subsection Managing Information
6391
6392@c %**end of header
6393
6394The PEERINFO services stores information about known PEERS and a single
6395HELLO message for every peer.
6396A peer does not need to have a HELLO if no information are available.
6397HELLO information from different sources, for example a HELLO obtained
6398from a remote HOSTLIST and a second HELLO stored on disk, are combined
6399and merged into one single HELLO message per peer which will be given to
6400clients. During this merge process the HELLO is immediately written to
6401disk to ensure persistence.
6402
6403PEERINFO in addition periodically scans the directory where information
6404are stored for empty HELLO messages with expired TRANSPORT addresses.
6405This periodic task scans all files in the directory and recreates the
6406HELLO messages it finds.
6407Expired TRANSPORT addresses are removed from the HELLO and if the
6408HELLO does not contain any valid addresses, it is discarded and removed
6409from the disk.
6410
6411@node Obtaining Information
6412@subsection Obtaining Information
6413
6414@c %**end of header
6415
6416When a client requests information from PEERINFO, PEERINFO performs a
6417lookup for the respective peer or all peers if desired and transmits this
6418information to the client.
6419The client can specify if friend-only HELLOs have to be included or not
6420and PEERINFO filters the respective HELLO messages before transmitting
6421information.
6422
6423To notify clients about changes to PEERINFO information, PEERINFO
6424maintains a list of clients interested in this notifications.
6425Such a notification occurs if a HELLO for a peer was updated (due to a
6426merge for example) or a new peer was added.
6427
6428@node The PEERINFO Client-Service Protocol
6429@subsection The PEERINFO Client-Service Protocol
6430
6431@c %**end of header
6432
6433To connect and disconnect to and from the PEERINFO Service PEERINFO
6434utilizes the util client/server infrastructure, so no special messages
6435types are used here.
6436
6437To add information for a peer, the plain HELLO message is transmitted to
6438the service without any wrapping. All pieces of information required are
6439stored within the HELLO message.
6440The PEERINFO service provides a message handler accepting and processing
6441these HELLO messages.
6442
6443When obtaining PEERINFO information using the iterate functionality
6444specific messages are used. To obtain information for all peers, a
6445@code{struct ListAllPeersMessage} with message type
6446@code{GNUNET_MESSAGE_TYPE_PEERINFO_GET_ALL} and a flag
6447include_friend_only to indicate if friend-only HELLO messages should be
6448included are transmitted. If information for a specific peer is required
6449a @code{struct ListAllPeersMessage} with
6450@code{GNUNET_MESSAGE_TYPE_PEERINFO_GET} containing the peer identity is
6451used.
6452
6453For both variants the PEERINFO service replies for each HELLO message it
6454wants to transmit with a @code{struct ListAllPeersMessage} with type
6455@code{GNUNET_MESSAGE_TYPE_PEERINFO_INFO} containing the plain HELLO.
6456The final message is @code{struct GNUNET_MessageHeader} with type
6457@code{GNUNET_MESSAGE_TYPE_PEERINFO_INFO}. If the client receives this
6458message, it can proceed with the next request if any is pending.
6459
6460@node libgnunetpeerinfo
6461@subsection libgnunetpeerinfo
6462
6463@c %**end of header
6464
6465The PEERINFO API consists mainly of three different functionalities:
6466
6467@itemize @bullet
6468@item maintaining a connection to the service
6469@item adding new information to the PEERINFO service
6470@item retrieving information from the PEERINFO service
6471@end itemize
6472
6473@menu
6474* Connecting to the PEERINFO Service::
6475* Adding Information to the PEERINFO Service::
6476* Obtaining Information from the PEERINFO Service::
6477@end menu
6478
6479@node Connecting to the PEERINFO Service
6480@subsubsection Connecting to the PEERINFO Service
6481
6482@c %**end of header
6483
6484To connect to the PEERINFO service the function
6485@code{GNUNET_PEERINFO_connect} is used, taking a configuration handle as
6486an argument, and to disconnect from PEERINFO the function
6487@code{GNUNET_PEERINFO_disconnect}, taking the PEERINFO
6488handle returned from the connect function has to be called.
6489
6490@node Adding Information to the PEERINFO Service
6491@subsubsection Adding Information to the PEERINFO Service
6492
6493@c %**end of header
6494
6495@code{GNUNET_PEERINFO_add_peer} adds a new peer to the PEERINFO subsystem
6496storage. This function takes the PEERINFO handle as an argument, the HELLO
6497message to store and a continuation with a closure to be called with the
6498result of the operation.
6499The @code{GNUNET_PEERINFO_add_peer} returns a handle to this operation
6500allowing to cancel the operation with the respective cancel function
6501@code{GNUNET_PEERINFO_add_peer_cancel}. To retrieve information from
6502PEERINFO you can iterate over all information stored with PEERINFO or you
6503can tell PEERINFO to notify if new peer information are available.
6504
6505@node Obtaining Information from the PEERINFO Service
6506@subsubsection Obtaining Information from the PEERINFO Service
6507
6508@c %**end of header
6509
6510To iterate over information in PEERINFO you use
6511@code{GNUNET_PEERINFO_iterate}.
6512This function expects the PEERINFO handle, a flag if HELLO messages
6513intended for friend only mode should be included, a timeout how long the
6514operation should take and a callback with a callback closure to be called
6515for the results.
6516If you want to obtain information for a specific peer, you can specify
6517the peer identity, if this identity is NULL, information for all peers are
6518returned. The function returns a handle to allow to cancel the operation
6519using @code{GNUNET_PEERINFO_iterate_cancel}.
6520
6521To get notified when peer information changes, you can use
6522@code{GNUNET_PEERINFO_notify}.
6523This function expects a configuration handle and a flag if friend-only
6524HELLO messages should be included. The PEERINFO service will notify you
6525about every change and the callback function will be called to notify you
6526about changes. The function returns a handle to cancel notifications
6527with @code{GNUNET_PEERINFO_notify_cancel}.
6528
6529@cindex PEERSTORE Subsystem
6530@node PEERSTORE Subsystem
6531@section PEERSTORE Subsystem
6532
6533@c %**end of header
6534
6535GNUnet's PEERSTORE subsystem offers persistent per-peer storage for other
6536GNUnet subsystems. GNUnet subsystems can use PEERSTORE to persistently
6537store and retrieve arbitrary data.
6538Each data record stored with PEERSTORE contains the following fields:
6539
6540@itemize @bullet
6541@item subsystem: Name of the subsystem responsible for the record.
6542@item peerid: Identity of the peer this record is related to.
6543@item key: a key string identifying the record.
6544@item value: binary record value.
6545@item expiry: record expiry date.
6546@end itemize
6547
6548@menu
6549* Functionality::
6550* Architecture::
6551* libgnunetpeerstore::
6552@end menu
6553
6554@node Functionality
6555@subsection Functionality
6556
6557@c %**end of header
6558
6559Subsystems can store any type of value under a (subsystem, peerid, key)
6560combination. A "replace" flag set during store operations forces the
6561PEERSTORE to replace any old values stored under the same
6562(subsystem, peerid, key) combination with the new value.
6563Additionally, an expiry date is set after which the record is *possibly*
6564deleted by PEERSTORE.
6565
6566Subsystems can iterate over all values stored under any of the following
6567combination of fields:
6568
6569@itemize @bullet
6570@item (subsystem)
6571@item (subsystem, peerid)
6572@item (subsystem, key)
6573@item (subsystem, peerid, key)
6574@end itemize
6575
6576Subsystems can also request to be notified about any new values stored
6577under a (subsystem, peerid, key) combination by sending a "watch"
6578request to PEERSTORE.
6579
6580@node Architecture
6581@subsection Architecture
6582
6583@c %**end of header
6584
6585PEERSTORE implements the following components:
6586
6587@itemize @bullet
6588@item PEERSTORE service: Handles store, iterate and watch operations.
6589@item PEERSTORE API: API to be used by other subsystems to communicate and
6590issue commands to the PEERSTORE service.
6591@item PEERSTORE plugins: Handles the persistent storage. At the moment,
6592only an "sqlite" plugin is implemented.
6593@end itemize
6594
6595@cindex libgnunetpeerstore
6596@node libgnunetpeerstore
6597@subsection libgnunetpeerstore
6598
6599@c %**end of header
6600
6601libgnunetpeerstore is the library containing the PEERSTORE API. Subsystems
6602wishing to communicate with the PEERSTORE service use this API to open a
6603connection to PEERSTORE. This is done by calling
6604@code{GNUNET_PEERSTORE_connect} which returns a handle to the newly
6605created connection.
6606This handle has to be used with any further calls to the API.
6607
6608To store a new record, the function @code{GNUNET_PEERSTORE_store} is to
6609be used which requires the record fields and a continuation function that
6610will be called by the API after the STORE request is sent to the
6611PEERSTORE service.
6612Note that calling the continuation function does not mean that the record
6613is successfully stored, only that the STORE request has been successfully
6614sent to the PEERSTORE service.
6615@code{GNUNET_PEERSTORE_store_cancel} can be called to cancel the STORE
6616request only before the continuation function has been called.
6617
6618To iterate over stored records, the function
6619@code{GNUNET_PEERSTORE_iterate} is
6620to be used. @emph{peerid} and @emph{key} can be set to NULL. An iterator
6621callback function will be called with each matching record found and a
6622NULL record at the end to signal the end of result set.
6623@code{GNUNET_PEERSTORE_iterate_cancel} can be used to cancel the ITERATE
6624request before the iterator callback is called with a NULL record.
6625
6626To be notified with new values stored under a (subsystem, peerid, key)
6627combination, the function @code{GNUNET_PEERSTORE_watch} is to be used.
6628This will register the watcher with the PEERSTORE service, any new
6629records matching the given combination will trigger the callback
6630function passed to @code{GNUNET_PEERSTORE_watch}. This continues until
6631@code{GNUNET_PEERSTORE_watch_cancel} is called or the connection to the
6632service is destroyed.
6633
6634After the connection is no longer needed, the function
6635@code{GNUNET_PEERSTORE_disconnect} can be called to disconnect from the
6636PEERSTORE service.
6637Any pending ITERATE or WATCH requests will be destroyed.
6638If the @code{sync_first} flag is set to @code{GNUNET_YES}, the API will
6639delay the disconnection until all pending STORE requests are sent to
6640the PEERSTORE service, otherwise, the pending STORE requests will be
6641destroyed as well.
6642
6643@cindex SET Subsystem
6644@node SET Subsystem
6645@section SET Subsystem
6646
6647@c %**end of header
6648
6649The SET service implements efficient set operations between two peers
6650over a mesh tunnel.
6651Currently, set union and set intersection are the only supported
6652operations. Elements of a set consist of an @emph{element type} and
6653arbitrary binary @emph{data}.
6654The size of an element's data is limited to around 62 KB.
6655
6656@menu
6657* Local Sets::
6658* Set Modifications::
6659* Set Operations::
6660* Result Elements::
6661* libgnunetset::
6662* The SET Client-Service Protocol::
6663* The SET Intersection Peer-to-Peer Protocol::
6664* The SET Union Peer-to-Peer Protocol::
6665@end menu
6666
6667@node Local Sets
6668@subsection Local Sets
6669
6670@c %**end of header
6671
6672Sets created by a local client can be modified and reused for multiple
6673operations. As each set operation requires potentially expensive special
6674auxiliary data to be computed for each element of a set, a set can only
6675participate in one type of set operation (i.e. union or intersection).
6676The type of a set is determined upon its creation.
6677If a the elements of a set are needed for an operation of a different
6678type, all of the set's element must be copied to a new set of appropriate
6679type.
6680
6681@node Set Modifications
6682@subsection Set Modifications
6683
6684@c %**end of header
6685
6686Even when set operations are active, one can add to and remove elements
6687from a set.
6688However, these changes will only be visible to operations that have been
6689created after the changes have taken place. That is, every set operation
6690only sees a snapshot of the set from the time the operation was started.
6691This mechanism is @emph{not} implemented by copying the whole set, but by
6692attaching @emph{generation information} to each element and operation.
6693
6694@node Set Operations
6695@subsection Set Operations
6696
6697@c %**end of header
6698
6699Set operations can be started in two ways: Either by accepting an
6700operation request from a remote peer, or by requesting a set operation
6701from a remote peer.
6702Set operations are uniquely identified by the involved @emph{peers}, an
6703@emph{application id} and the @emph{operation type}.
6704
6705The client is notified of incoming set operations by @emph{set listeners}.
6706A set listener listens for incoming operations of a specific operation
6707type and application id.
6708Once notified of an incoming set request, the client can accept the set
6709request (providing a local set for the operation) or reject it.
6710
6711@node Result Elements
6712@subsection Result Elements
6713
6714@c %**end of header
6715
6716The SET service has three @emph{result modes} that determine how an
6717operation's result set is delivered to the client:
6718
6719@itemize @bullet
6720@item @strong{Full Result Set.} All elements of set resulting from the set
6721operation are returned to the client.
6722@item @strong{Added Elements.} Only elements that result from the
6723operation and are not already in the local peer's set are returned.
6724Note that for some operations (like set intersection) this result mode
6725will never return any elements.
6726This can be useful if only the remove peer is actually interested in
6727the result of the set operation.
6728@item @strong{Removed Elements.} Only elements that are in the local
6729peer's initial set but not in the operation's result set are returned.
6730Note that for some operations (like set union) this result mode will
6731never return any elements. This can be useful if only the remove peer is
6732actually interested in the result of the set operation.
6733@end itemize
6734
6735@cindex libgnunetset
6736@node libgnunetset
6737@subsection libgnunetset
6738
6739@c %**end of header
6740
6741@menu
6742* Sets::
6743* Listeners::
6744* Operations::
6745* Supplying a Set::
6746* The Result Callback::
6747@end menu
6748
6749@node Sets
6750@subsubsection Sets
6751
6752@c %**end of header
6753
6754New sets are created with @code{GNUNET_SET_create}. Both the local peer's
6755configuration (as each set has its own client connection) and the
6756operation type must be specified.
6757The set exists until either the client calls @code{GNUNET_SET_destroy} or
6758the client's connection to the service is disrupted.
6759In the latter case, the client is notified by the return value of
6760functions dealing with sets. This return value must always be checked.
6761
6762Elements are added and removed with @code{GNUNET_SET_add_element} and
6763@code{GNUNET_SET_remove_element}.
6764
6765@node Listeners
6766@subsubsection Listeners
6767
6768@c %**end of header
6769
6770Listeners are created with @code{GNUNET_SET_listen}. Each time time a
6771remote peer suggests a set operation with an application id and operation
6772type matching a listener, the listener's callback is invoked.
6773The client then must synchronously call either @code{GNUNET_SET_accept}
6774or @code{GNUNET_SET_reject}. Note that the operation will not be started
6775until the client calls @code{GNUNET_SET_commit}
6776(see Section "Supplying a Set").
6777
6778@node Operations
6779@subsubsection Operations
6780
6781@c %**end of header
6782
6783Operations to be initiated by the local peer are created with
6784@code{GNUNET_SET_prepare}. Note that the operation will not be started
6785until the client calls @code{GNUNET_SET_commit}
6786(see Section "Supplying a Set").
6787
6788@node Supplying a Set
6789@subsubsection Supplying a Set
6790
6791@c %**end of header
6792
6793To create symmetry between the two ways of starting a set operation
6794(accepting and initiating it), the operation handles returned by
6795@code{GNUNET_SET_accept} and @code{GNUNET_SET_prepare} do not yet have a
6796set to operate on, thus they can not do any work yet.
6797
6798The client must call @code{GNUNET_SET_commit} to specify a set to use for
6799an operation. @code{GNUNET_SET_commit} may only be called once per set
6800operation.
6801
6802@node The Result Callback
6803@subsubsection The Result Callback
6804
6805@c %**end of header
6806
6807Clients must specify both a result mode and a result callback with
6808@code{GNUNET_SET_accept} and @code{GNUNET_SET_prepare}. The result
6809callback with a status indicating either that an element was received, or
6810the operation failed or succeeded.
6811The interpretation of the received element depends on the result mode.
6812The callback needs to know which result mode it is used in, as the
6813arguments do not indicate if an element is part of the full result set,
6814or if it is in the difference between the original set and the final set.
6815
6816@node The SET Client-Service Protocol
6817@subsection The SET Client-Service Protocol
6818
6819@c %**end of header
6820
6821@menu
6822* Creating Sets::
6823* Listeners2::
6824* Initiating Operations::
6825* Modifying Sets::
6826* Results and Operation Status::
6827* Iterating Sets::
6828@end menu
6829
6830@node Creating Sets
6831@subsubsection Creating Sets
6832
6833@c %**end of header
6834
6835For each set of a client, there exists a client connection to the service.
6836Sets are created by sending the @code{GNUNET_SERVICE_SET_CREATE} message
6837over a new client connection. Multiple operations for one set are
6838multiplexed over one client connection, using a request id supplied by
6839the client.
6840
6841@node Listeners2
6842@subsubsection Listeners2
6843
6844@c %**end of header
6845
6846Each listener also requires a seperate client connection. By sending the
6847@code{GNUNET_SERVICE_SET_LISTEN} message, the client notifies the service
6848of the application id and operation type it is interested in. A client
6849rejects an incoming request by sending @code{GNUNET_SERVICE_SET_REJECT}
6850on the listener's client connection.
6851In contrast, when accepting an incoming request, a
6852@code{GNUNET_SERVICE_SET_ACCEPT} message must be sent over the@ set that
6853is supplied for the set operation.
6854
6855@node Initiating Operations
6856@subsubsection Initiating Operations
6857
6858@c %**end of header
6859
6860Operations with remote peers are initiated by sending a
6861@code{GNUNET_SERVICE_SET_EVALUATE} message to the service. The@ client
6862connection that this message is sent by determines the set to use.
6863
6864@node Modifying Sets
6865@subsubsection Modifying Sets
6866
6867@c %**end of header
6868
6869Sets are modified with the @code{GNUNET_SERVICE_SET_ADD} and
6870@code{GNUNET_SERVICE_SET_REMOVE} messages.
6871
6872
6873@c %@menu
6874@c %* Results and Operation Status::
6875@c %* Iterating Sets::
6876@c %@end menu
6877
6878@node Results and Operation Status
6879@subsubsection Results and Operation Status
6880@c %**end of header
6881
6882The service notifies the client of result elements and success/failure of
6883a set operation with the @code{GNUNET_SERVICE_SET_RESULT} message.
6884
6885@node Iterating Sets
6886@subsubsection Iterating Sets
6887
6888@c %**end of header
6889
6890All elements of a set can be requested by sending
6891@code{GNUNET_SERVICE_SET_ITER_REQUEST}. The server responds with
6892@code{GNUNET_SERVICE_SET_ITER_ELEMENT} and eventually terminates the
6893iteration with @code{GNUNET_SERVICE_SET_ITER_DONE}.
6894After each received element, the client
6895must send @code{GNUNET_SERVICE_SET_ITER_ACK}. Note that only one set
6896iteration may be active for a set at any given time.
6897
6898@node The SET Intersection Peer-to-Peer Protocol
6899@subsection The SET Intersection Peer-to-Peer Protocol
6900
6901@c %**end of header
6902
6903The intersection protocol operates over CADET and starts with a
6904GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST being sent by the peer
6905initiating the operation to the peer listening for inbound requests.
6906It includes the number of elements of the initiating peer, which is used
6907to decide which side will send a Bloom filter first.
6908
6909The listening peer checks if the operation type and application
6910identifier are acceptable for its current state.
6911If not, it responds with a GNUNET_MESSAGE_TYPE_SET_RESULT and a status of
6912GNUNET_SET_STATUS_FAILURE (and terminates the CADET channel).
6913
6914If the application accepts the request, the listener sends back a
6915@code{GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO} if it has
6916more elements in the set than the client.
6917Otherwise, it immediately starts with the Bloom filter exchange.
6918If the initiator receives a
6919@code{GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_ELEMENT_INFO} response,
6920it beings the Bloom filter exchange, unless the set size is indicated to
6921be zero, in which case the intersection is considered finished after
6922just the initial handshake.
6923
6924
6925@menu
6926* The Bloom filter exchange::
6927* Salt::
6928@end menu
6929
6930@node The Bloom filter exchange
6931@subsubsection The Bloom filter exchange
6932
6933@c %**end of header
6934
6935In this phase, each peer transmits a Bloom filter over the remaining
6936keys of the local set to the other peer using a
6937@code{GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_BF} message. This
6938message additionally includes the number of elements left in the sender's
6939set, as well as the XOR over all of the keys in that set.
6940
6941The number of bits 'k' set per element in the Bloom filter is calculated
6942based on the relative size of the two sets.
6943Furthermore, the size of the Bloom filter is calculated based on 'k' and
6944the number of elements in the set to maximize the amount of data filtered
6945per byte transmitted on the wire (while avoiding an excessively high
6946number of iterations).
6947
6948The receiver of the message removes all elements from its local set that
6949do not pass the Bloom filter test.
6950It then checks if the set size of the sender and the XOR over the keys
6951match what is left of its own set. If they do, it sends a
6952@code{GNUNET_MESSAGE_TYPE_SET_INTERSECTION_P2P_DONE} back to indicate
6953that the latest set is the final result.
6954Otherwise, the receiver starts another Bloom filter exchange, except
6955this time as the sender.
6956
6957@node Salt
6958@subsubsection Salt
6959
6960@c %**end of header
6961
6962Bloomfilter operations are probabilistic: With some non-zero probability
6963the test may incorrectly say an element is in the set, even though it is
6964not.
6965
6966To mitigate this problem, the intersection protocol iterates exchanging
6967Bloom filters using a different random 32-bit salt in each iteration (the
6968salt is also included in the message).
6969With different salts, set operations may fail for different elements.
6970Merging the results from the executions, the probability of failure drops
6971to zero.
6972
6973The iterations terminate once both peers have established that they have
6974sets of the same size, and where the XOR over all keys computes the same
6975512-bit value (leaving a failure probability of 2-511).
6976
6977@node The SET Union Peer-to-Peer Protocol
6978@subsection The SET Union Peer-to-Peer Protocol
6979
6980@c %**end of header
6981
6982The SET union protocol is based on Eppstein's efficient set reconciliation
6983without prior context. You should read this paper first if you want to
6984understand the protocol.
6985
6986The union protocol operates over CADET and starts with a
6987GNUNET_MESSAGE_TYPE_SET_P2P_OPERATION_REQUEST being sent by the peer
6988initiating the operation to the peer listening for inbound requests.
6989It includes the number of elements of the initiating peer, which is
6990currently not used.
6991
6992The listening peer checks if the operation type and application
6993identifier are acceptable for its current state. If not, it responds with
6994a @code{GNUNET_MESSAGE_TYPE_SET_RESULT} and a status of
6995@code{GNUNET_SET_STATUS_FAILURE} (and terminates the CADET channel).
6996
6997If the application accepts the request, it sends back a strata estimator
6998using a message of type GNUNET_MESSAGE_TYPE_SET_UNION_P2P_SE. The
6999initiator evaluates the strata estimator and initiates the exchange of
7000invertible Bloom filters, sending a GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF.
7001
7002During the IBF exchange, if the receiver cannot invert the Bloom filter or
7003detects a cycle, it sends a larger IBF in response (up to a defined
7004maximum limit; if that limit is reached, the operation fails).
7005Elements decoded while processing the IBF are transmitted to the other
7006peer using GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS, or requested from the
7007other peer using GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS messages,
7008depending on the sign observed during decoding of the IBF.
7009Peers respond to a GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENT_REQUESTS message
7010with the respective element in a GNUNET_MESSAGE_TYPE_SET_P2P_ELEMENTS
7011message. If the IBF fully decodes, the peer responds with a
7012GNUNET_MESSAGE_TYPE_SET_UNION_P2P_DONE message instead of another
7013GNUNET_MESSAGE_TYPE_SET_UNION_P2P_IBF.
7014
7015All Bloom filter operations use a salt to mingle keys before hashing them
7016into buckets, such that future iterations have a fresh chance of
7017succeeding if they failed due to collisions before.
7018
7019@cindex STATISTICS Subsystem
7020@node STATISTICS Subsystem
7021@section STATISTICS Subsystem
7022
7023@c %**end of header
7024
7025In GNUnet, the STATISTICS subsystem offers a central place for all
7026subsystems to publish unsigned 64-bit integer run-time statistics.
7027Keeping this information centrally means that there is a unified way for
7028the user to obtain data on all subsystems, and individual subsystems do
7029not have to always include a custom data export method for performance
7030metrics and other statistics. For example, the TRANSPORT system uses
7031STATISTICS to update information about the number of directly connected
7032peers and the bandwidth that has been consumed by the various plugins.
7033This information is valuable for diagnosing connectivity and performance
7034issues.
7035
7036Following the GNUnet service architecture, the STATISTICS subsystem is
7037divided into an API which is exposed through the header
7038@strong{gnunet_statistics_service.h} and the STATISTICS service
7039@strong{gnunet-service-statistics}. The @strong{gnunet-statistics}
7040command-line tool can be used to obtain (and change) information about
7041the values stored by the STATISTICS service. The STATISTICS service does
7042not communicate with other peers.
7043
7044Data is stored in the STATISTICS service in the form of tuples
7045@strong{(subsystem, name, value, persistence)}. The subsystem determines
7046to which other GNUnet's subsystem the data belongs. name is the name
7047through which value is associated. It uniquely identifies the record
7048from among other records belonging to the same subsystem.
7049In some parts of the code, the pair @strong{(subsystem, name)} is called
7050a @strong{statistic} as it identifies the values stored in the STATISTCS
7051service.The persistence flag determines if the record has to be preserved
7052across service restarts. A record is said to be persistent if this flag
7053is set for it; if not, the record is treated as a non-persistent record
7054and it is lost after service restart. Persistent records are written to
7055and read from the file @strong{statistics.data} before shutdown
7056and upon startup. The file is located in the HOME directory of the peer.
7057
7058An anomaly of the STATISTICS service is that it does not terminate
7059immediately upon receiving a shutdown signal if it has any clients
7060connected to it. It waits for all the clients that are not monitors to
7061close their connections before terminating itself.
7062This is to prevent the loss of data during peer shutdown --- delaying the
7063STATISTICS service shutdown helps other services to store important data
7064to STATISTICS during shutdown.
7065
7066@menu
7067* libgnunetstatistics::
7068* The STATISTICS Client-Service Protocol::
7069@end menu
7070
7071@cindex libgnunetstatistics
7072@node libgnunetstatistics
7073@subsection libgnunetstatistics
7074
7075@c %**end of header
7076
7077@strong{libgnunetstatistics} is the library containing the API for the
7078STATISTICS subsystem. Any process requiring to use STATISTICS should use
7079this API by to open a connection to the STATISTICS service.
7080This is done by calling the function @code{GNUNET_STATISTICS_create()}.
7081This function takes the subsystem's name which is trying to use STATISTICS
7082and a configuration.
7083All values written to STATISTICS with this connection will be placed in
7084the section corresponding to the given subsystem's name.
7085The connection to STATISTICS can be destroyed with the function
7086@code{GNUNET_STATISTICS_destroy()}. This function allows for the
7087connection to be destroyed immediately or upon transferring all
7088pending write requests to the service.
7089
7090Note: STATISTICS subsystem can be disabled by setting @code{DISABLE = YES}
7091under the @code{[STATISTICS]} section in the configuration. With such a
7092configuration all calls to @code{GNUNET_STATISTICS_create()} return
7093@code{NULL} as the STATISTICS subsystem is unavailable and no other
7094functions from the API can be used.
7095
7096
7097@menu
7098* Statistics retrieval::
7099* Setting statistics and updating them::
7100* Watches::
7101@end menu
7102
7103@node Statistics retrieval
7104@subsubsection Statistics retrieval
7105
7106@c %**end of header
7107
7108Once a connection to the statistics service is obtained, information
7109about any other system which uses statistics can be retrieved with the
7110function GNUNET_STATISTICS_get().
7111This function takes the connection handle, the name of the subsystem
7112whose information we are interested in (a @code{NULL} value will
7113retrieve information of all available subsystems using STATISTICS), the
7114name of the statistic we are interested in (a @code{NULL} value will
7115retrieve all available statistics), a continuation callback which is
7116called when all of requested information is retrieved, an iterator
7117callback which is called for each parameter in the retrieved information
7118and a closure for the aforementioned callbacks. The library then invokes
7119the iterator callback for each value matching the request.
7120
7121Call to @code{GNUNET_STATISTICS_get()} is asynchronous and can be
7122canceled with the function @code{GNUNET_STATISTICS_get_cancel()}.
7123This is helpful when retrieving statistics takes too long and especially
7124when we want to shutdown and cleanup everything.
7125
7126@node Setting statistics and updating them
7127@subsubsection Setting statistics and updating them
7128
7129@c %**end of header
7130
7131So far we have seen how to retrieve statistics, here we will learn how we
7132can set statistics and update them so that other subsystems can retrieve
7133them.
7134
7135A new statistic can be set using the function
7136@code{GNUNET_STATISTICS_set()}.
7137This function takes the name of the statistic and its value and a flag to
7138make the statistic persistent.
7139The value of the statistic should be of the type @code{uint64_t}.
7140The function does not take the name of the subsystem; it is determined
7141from the previous @code{GNUNET_STATISTICS_create()} invocation. If
7142the given statistic is already present, its value is overwritten.
7143
7144An existing statistics can be updated, i.e its value can be increased or
7145decreased by an amount with the function
7146@code{GNUNET_STATISTICS_update()}.
7147The parameters to this function are similar to
7148@code{GNUNET_STATISTICS_set()}, except that it takes the amount to be
7149changed as a type @code{int64_t} instead of the value.
7150
7151The library will combine multiple set or update operations into one
7152message if the client performs requests at a rate that is faster than the
7153available IPC with the STATISTICS service. Thus, the client does not have
7154to worry about sending requests too quickly.
7155
7156@node Watches
7157@subsubsection Watches
7158
7159@c %**end of header
7160
7161As interesting feature of STATISTICS lies in serving notifications
7162whenever a statistic of our interest is modified.
7163This is achieved by registering a watch through the function
7164@code{GNUNET_STATISTICS_watch()}.
7165The parameters of this function are similar to those of
7166@code{GNUNET_STATISTICS_get()}.
7167Changes to the respective statistic's value will then cause the given
7168iterator callback to be called.
7169Note: A watch can only be registered for a specific statistic. Hence
7170the subsystem name and the parameter name cannot be @code{NULL} in a
7171call to @code{GNUNET_STATISTICS_watch()}.
7172
7173A registered watch will keep notifying any value changes until
7174@code{GNUNET_STATISTICS_watch_cancel()} is called with the same
7175parameters that are used for registering the watch.
7176
7177@node The STATISTICS Client-Service Protocol
7178@subsection The STATISTICS Client-Service Protocol
7179@c %**end of header
7180
7181
7182@menu
7183* Statistics retrieval2::
7184* Setting and updating statistics::
7185* Watching for updates::
7186@end menu
7187
7188@node Statistics retrieval2
7189@subsubsection Statistics retrieval2
7190
7191@c %**end of header
7192
7193To retrieve statistics, the client transmits a message of type
7194@code{GNUNET_MESSAGE_TYPE_STATISTICS_GET} containing the given subsystem
7195name and statistic parameter to the STATISTICS service.
7196The service responds with a message of type
7197@code{GNUNET_MESSAGE_TYPE_STATISTICS_VALUE} for each of the statistics
7198parameters that match the client request for the client. The end of
7199information retrieved is signaled by the service by sending a message of
7200type @code{GNUNET_MESSAGE_TYPE_STATISTICS_END}.
7201
7202@node Setting and updating statistics
7203@subsubsection Setting and updating statistics
7204
7205@c %**end of header
7206
7207The subsystem name, parameter name, its value and the persistence flag are
7208communicated to the service through the message
7209@code{GNUNET_MESSAGE_TYPE_STATISTICS_SET}.
7210
7211When the service receives a message of type
7212@code{GNUNET_MESSAGE_TYPE_STATISTICS_SET}, it retrieves the subsystem
7213name and checks for a statistic parameter with matching the name given in
7214the message.
7215If a statistic parameter is found, the value is overwritten by the new
7216value from the message; if not found then a new statistic parameter is
7217created with the given name and value.
7218
7219In addition to just setting an absolute value, it is possible to perform a
7220relative update by sending a message of type
7221@code{GNUNET_MESSAGE_TYPE_STATISTICS_SET} with an update flag
7222(@code{GNUNET_STATISTICS_SETFLAG_RELATIVE}) signifying that the value in
7223the message should be treated as an update value.
7224
7225@node Watching for updates
7226@subsubsection Watching for updates
7227
7228@c %**end of header
7229
7230The function registers the watch at the service by sending a message of
7231type @code{GNUNET_MESSAGE_TYPE_STATISTICS_WATCH}. The service then sends
7232notifications through messages of type
7233@code{GNUNET_MESSAGE_TYPE_STATISTICS_WATCH_VALUE} whenever the statistic
7234parameter's value is changed.
7235
7236@cindex DHT
7237@cindex Distributed Hash Table
7238@node Distributed Hash Table (DHT)
7239@section Distributed Hash Table (DHT)
7240
7241@c %**end of header
7242
7243GNUnet includes a generic distributed hash table that can be used by
7244developers building P2P applications in the framework.
7245This section documents high-level features and how developers are
7246expected to use the DHT.
7247We have a research paper detailing how the DHT works.
7248Also, Nate's thesis includes a detailed description and performance
7249analysis (in chapter 6).
7250
7251Key features of GNUnet's DHT include:
7252
7253@itemize @bullet
7254@item stores key-value pairs with values up to (approximately) 63k in size
7255@item works with many underlay network topologies (small-world, random
7256graph), underlay does not need to be a full mesh / clique
7257@item support for extended queries (more than just a simple 'key'),
7258filtering duplicate replies within the network (bloomfilter) and content
7259validation (for details, please read the subsection on the block library)
7260@item can (optionally) return paths taken by the PUT and GET operations
7261to the application
7262@item provides content replication to handle churn
7263@end itemize
7264
7265GNUnet's DHT is randomized and unreliable. Unreliable means that there is
7266no strict guarantee that a value stored in the DHT is always
7267found --- values are only found with high probability.
7268While this is somewhat true in all P2P DHTs, GNUnet developers should be
7269particularly wary of this fact (this will help you write secure,
7270fault-tolerant code). Thus, when writing any application using the DHT,
7271you should always consider the possibility that a value stored in the
7272DHT by you or some other peer might simply not be returned, or returned
7273with a significant delay.
7274Your application logic must be written to tolerate this (naturally, some
7275loss of performance or quality of service is expected in this case).
7276
7277@menu
7278* Block library and plugins::
7279* libgnunetdht::
7280* The DHT Client-Service Protocol::
7281* The DHT Peer-to-Peer Protocol::
7282@end menu
7283
7284@node Block library and plugins
7285@subsection Block library and plugins
7286
7287@c %**end of header
7288
7289@menu
7290* What is a Block?::
7291* The API of libgnunetblock::
7292* Queries::
7293* Sample Code::
7294* Conclusion2::
7295@end menu
7296
7297@node What is a Block?
7298@subsubsection What is a Block?
7299
7300@c %**end of header
7301
7302Blocks are small (< 63k) pieces of data stored under a key (struct
7303GNUNET_HashCode). Blocks have a type (enum GNUNET_BlockType) which defines
7304their data format. Blocks are used in GNUnet as units of static data
7305exchanged between peers and stored (or cached) locally.
7306Uses of blocks include file-sharing (the files are broken up into blocks),
7307the VPN (DNS information is stored in blocks) and the DHT (all
7308information in the DHT and meta-information for the maintenance of the
7309DHT are both stored using blocks).
7310The block subsystem provides a few common functions that must be
7311available for any type of block.
7312
7313@cindex libgnunetblock API
7314@node The API of libgnunetblock
7315@subsubsection The API of libgnunetblock
7316
7317@c %**end of header
7318
7319The block library requires for each (family of) block type(s) a block
7320plugin (implementing @file{gnunet_block_plugin.h}) that provides basic
7321functions that are needed by the DHT (and possibly other subsystems) to
7322manage the block.
7323These block plugins are typically implemented within their respective
7324subsystems.
7325The main block library is then used to locate, load and query the
7326appropriate block plugin.
7327Which plugin is appropriate is determined by the block type (which is
7328just a 32-bit integer). Block plugins contain code that specifies which
7329block types are supported by a given plugin. The block library loads all
7330block plugins that are installed at the local peer and forwards the
7331application request to the respective plugin.
7332
7333The central functions of the block APIs (plugin and main library) are to
7334allow the mapping of blocks to their respective key (if possible) and the
7335ability to check that a block is well-formed and matches a given
7336request (again, if possible).
7337This way, GNUnet can avoid storing invalid blocks, storing blocks under
7338the wrong key and forwarding blocks in response to a query that they do
7339not answer.
7340
7341One key function of block plugins is that it allows GNUnet to detect
7342duplicate replies (via the Bloom filter). All plugins MUST support
7343detecting duplicate replies (by adding the current response to the
7344Bloom filter and rejecting it if it is encountered again).
7345If a plugin fails to do this, responses may loop in the network.
7346
7347@node Queries
7348@subsubsection Queries
7349@c %**end of header
7350
7351The query format for any block in GNUnet consists of four main components.
7352First, the type of the desired block must be specified. Second, the query
7353must contain a hash code. The hash code is used for lookups in hash
7354tables and databases and must not be unique for the block (however, if
7355possible a unique hash should be used as this would be best for
7356performance).
7357Third, an optional Bloom filter can be specified to exclude known results;
7358replies that hash to the bits set in the Bloom filter are considered
7359invalid. False-positives can be eliminated by sending the same query
7360again with a different Bloom filter mutator value, which parameterizes
7361the hash function that is used.
7362Finally, an optional application-specific "eXtended query" (xquery) can
7363be specified to further constrain the results. It is entirely up to
7364the type-specific plugin to determine whether or not a given block
7365matches a query (type, hash, Bloom filter, and xquery).
7366Naturally, not all xquery's are valid and some types of blocks may not
7367support Bloom filters either, so the plugin also needs to check if the
7368query is valid in the first place.
7369
7370Depending on the results from the plugin, the DHT will then discard the
7371(invalid) query, forward the query, discard the (invalid) reply, cache the
7372(valid) reply, and/or forward the (valid and non-duplicate) reply.
7373
7374@node Sample Code
7375@subsubsection Sample Code
7376
7377@c %**end of header
7378
7379The source code in @strong{plugin_block_test.c} is a good starting point
7380for new block plugins --- it does the minimal work by implementing a
7381plugin that performs no validation at all.
7382The respective @strong{Makefile.am} shows how to build and install a
7383block plugin.
7384
7385@node Conclusion2
7386@subsubsection Conclusion2
7387
7388@c %**end of header
7389
7390In conclusion, GNUnet subsystems that want to use the DHT need to define a
7391block format and write a plugin to match queries and replies. For testing,
7392the @code{GNUNET_BLOCK_TYPE_TEST} block type can be used; it accepts
7393any query as valid and any reply as matching any query.
7394This type is also used for the DHT command line tools.
7395However, it should NOT be used for normal applications due to the lack
7396of error checking that results from this primitive implementation.
7397
7398@cindex libgnunetdht
7399@node libgnunetdht
7400@subsection libgnunetdht
7401
7402@c %**end of header
7403
7404The DHT API itself is pretty simple and offers the usual GET and PUT
7405functions that work as expected. The specified block type refers to the
7406block library which allows the DHT to run application-specific logic for
7407data stored in the network.
7408
7409
7410@menu
7411* GET::
7412* PUT::
7413* MONITOR::
7414* DHT Routing Options::
7415@end menu
7416
7417@node GET
7418@subsubsection GET
7419
7420@c %**end of header
7421
7422When using GET, the main consideration for developers (other than the
7423block library) should be that after issuing a GET, the DHT will
7424continuously cause (small amounts of) network traffic until the operation
7425is explicitly canceled.
7426So GET does not simply send out a single network request once; instead,
7427the DHT will continue to search for data. This is needed to achieve good
7428success rates and also handles the case where the respective PUT
7429operation happens after the GET operation was started.
7430Developers should not cancel an existing GET operation and then
7431explicitly re-start it to trigger a new round of network requests;
7432this is simply inefficient, especially as the internal automated version
7433can be more efficient, for example by filtering results in the network
7434that have already been returned.
7435
7436If an application that performs a GET request has a set of replies that it
7437already knows and would like to filter, it can call@
7438@code{GNUNET_DHT_get_filter_known_results} with an array of hashes over
7439the respective blocks to tell the DHT that these results are not
7440desired (any more).
7441This way, the DHT will filter the respective blocks using the block
7442library in the network, which may result in a significant reduction in
7443bandwidth consumption.
7444
7445@node PUT
7446@subsubsection PUT
7447
7448@c %**end of header
7449
7450@c inconsistent use of ``must'' above it's written ``MUST''
7451In contrast to GET operations, developers @strong{must} manually re-run
7452PUT operations periodically (if they intend the content to continue to be
7453available). Content stored in the DHT expires or might be lost due to
7454churn.
7455Furthermore, GNUnet's DHT typically requires multiple rounds of PUT
7456operations before a key-value pair is consistently available to all
7457peers (the DHT randomizes paths and thus storage locations, and only
7458after multiple rounds of PUTs there will be a sufficient number of
7459replicas in large DHTs). An explicit PUT operation using the DHT API will
7460only cause network traffic once, so in order to ensure basic availability
7461and resistance to churn (and adversaries), PUTs must be repeated.
7462While the exact frequency depends on the application, a rule of thumb is
7463that there should be at least a dozen PUT operations within the content
7464lifetime. Content in the DHT typically expires after one day, so
7465DHT PUT operations should be repeated at least every 1-2 hours.
7466
7467@node MONITOR
7468@subsubsection MONITOR
7469
7470@c %**end of header
7471
7472The DHT API also allows applications to monitor messages crossing the
7473local DHT service.
7474The types of messages used by the DHT are GET, PUT and RESULT messages.
7475Using the monitoring API, applications can choose to monitor these
7476requests, possibly limiting themselves to requests for a particular block
7477type.
7478
7479The monitoring API is not only useful for diagnostics, it can also be
7480used to trigger application operations based on PUT operations.
7481For example, an application may use PUTs to distribute work requests to
7482other peers.
7483The workers would then monitor for PUTs that give them work, instead of
7484looking for work using GET operations.
7485This can be beneficial, especially if the workers have no good way to
7486guess the keys under which work would be stored.
7487Naturally, additional protocols might be needed to ensure that the desired
7488number of workers will process the distributed workload.
7489
7490@node DHT Routing Options
7491@subsubsection DHT Routing Options
7492
7493@c %**end of header
7494
7495There are two important options for GET and PUT requests:
7496
7497@table @asis
7498@item GNUNET_DHT_RO_DEMULITPLEX_EVERYWHERE This option means that all
7499peers should process the request, even if their peer ID is not closest to
7500the key. For a PUT request, this means that all peers that a request
7501traverses may make a copy of the data.
7502Similarly for a GET request, all peers will check their local database
7503for a result. Setting this option can thus significantly improve caching
7504and reduce bandwidth consumption --- at the expense of a larger DHT
7505database. If in doubt, we recommend that this option should be used.
7506@item GNUNET_DHT_RO_RECORD_ROUTE This option instructs the DHT to record
7507the path that a GET or a PUT request is taking through the overlay
7508network. The resulting paths are then returned to the application with
7509the respective result. This allows the receiver of a result to construct
7510a path to the originator of the data, which might then be used for
7511routing. Naturally, setting this option requires additional bandwidth
7512and disk space, so applications should only set this if the paths are
7513needed by the application logic.
7514@item GNUNET_DHT_RO_FIND_PEER This option is an internal option used by
7515the DHT's peer discovery mechanism and should not be used by applications.
7516@item GNUNET_DHT_RO_BART This option is currently not implemented. It may
7517in the future offer performance improvements for clique topologies.
7518@end table
7519
7520@node The DHT Client-Service Protocol
7521@subsection The DHT Client-Service Protocol
7522
7523@c %**end of header
7524
7525@menu
7526* PUTting data into the DHT::
7527* GETting data from the DHT::
7528* Monitoring the DHT::
7529@end menu
7530
7531@node PUTting data into the DHT
7532@subsubsection PUTting data into the DHT
7533
7534@c %**end of header
7535
7536To store (PUT) data into the DHT, the client sends a
7537@code{struct GNUNET_DHT_ClientPutMessage} to the service.
7538This message specifies the block type, routing options, the desired
7539replication level, the expiration time, key,
7540value and a 64-bit unique ID for the operation. The service responds with
7541a @code{struct GNUNET_DHT_ClientPutConfirmationMessage} with the same
754264-bit unique ID. Note that the service sends the confirmation as soon as
7543it has locally processed the PUT request. The PUT may still be
7544propagating through the network at this time.
7545
7546In the future, we may want to change this to provide (limited) feedback
7547to the client, for example if we detect that the PUT operation had no
7548effect because the same key-value pair was already stored in the DHT.
7549However, changing this would also require additional state and messages
7550in the P2P interaction.
7551
7552@node GETting data from the DHT
7553@subsubsection GETting data from the DHT
7554
7555@c %**end of header
7556
7557To retrieve (GET) data from the DHT, the client sends a
7558@code{struct GNUNET_DHT_ClientGetMessage} to the service. The message
7559specifies routing options, a replication level (for replicating the GET,
7560not the content), the desired block type, the key, the (optional)
7561extended query and unique 64-bit request ID.
7562
7563Additionally, the client may send any number of
7564@code{struct GNUNET_DHT_ClientGetResultSeenMessage}s to notify the
7565service about results that the client is already aware of.
7566These messages consist of the key, the unique 64-bit ID of the request,
7567and an arbitrary number of hash codes over the blocks that the client is
7568already aware of. As messages are restricted to 64k, a client that
7569already knows more than about a thousand blocks may need to send
7570several of these messages. Naturally, the client should transmit these
7571messages as quickly as possible after the original GET request such that
7572the DHT can filter those results in the network early on. Naturally, as
7573these messages are sent after the original request, it is conceivable
7574that the DHT service may return blocks that match those already known
7575to the client anyway.
7576
7577In response to a GET request, the service will send @code{struct
7578GNUNET_DHT_ClientResultMessage}s to the client. These messages contain the
7579block type, expiration, key, unique ID of the request and of course the
7580value (a block). Depending on the options set for the respective
7581operations, the replies may also contain the path the GET and/or the PUT
7582took through the network.
7583
7584A client can stop receiving replies either by disconnecting or by sending
7585a @code{struct GNUNET_DHT_ClientGetStopMessage} which must contain the
7586key and the 64-bit unique ID of the original request. Using an
7587explicit "stop" message is more common as this allows a client to run
7588many concurrent GET operations over the same connection with the DHT
7589service --- and to stop them individually.
7590
7591@node Monitoring the DHT
7592@subsubsection Monitoring the DHT
7593
7594@c %**end of header
7595
7596To begin monitoring, the client sends a
7597@code{struct GNUNET_DHT_MonitorStartStop} message to the DHT service.
7598In this message, flags can be set to enable (or disable) monitoring of
7599GET, PUT and RESULT messages that pass through a peer. The message can
7600also restrict monitoring to a particular block type or a particular key.
7601Once monitoring is enabled, the DHT service will notify the client about
7602any matching event using @code{struct GNUNET_DHT_MonitorGetMessage}s for
7603GET events, @code{struct GNUNET_DHT_MonitorPutMessage} for PUT events
7604and @code{struct GNUNET_DHT_MonitorGetRespMessage} for RESULTs. Each of
7605these messages contains all of the information about the event.
7606
7607@node The DHT Peer-to-Peer Protocol
7608@subsection The DHT Peer-to-Peer Protocol
7609@c %**end of header
7610
7611
7612@menu
7613* Routing GETs or PUTs::
7614* PUTting data into the DHT2::
7615* GETting data from the DHT2::
7616@end menu
7617
7618@node Routing GETs or PUTs
7619@subsubsection Routing GETs or PUTs
7620
7621@c %**end of header
7622
7623When routing GETs or PUTs, the DHT service selects a suitable subset of
7624neighbours for forwarding. The exact number of neighbours can be zero or
7625more and depends on the hop counter of the query (initially zero) in
7626relation to the (log of) the network size estimate, the desired
7627replication level and the peer's connectivity.
7628Depending on the hop counter and our network size estimate, the selection
7629of the peers maybe randomized or by proximity to the key.
7630Furthermore, requests include a set of peers that a request has already
7631traversed; those peers are also excluded from the selection.
7632
7633@node PUTting data into the DHT2
7634@subsubsection PUTting data into the DHT2
7635
7636@c %**end of header
7637
7638To PUT data into the DHT, the service sends a @code{struct PeerPutMessage}
7639of type @code{GNUNET_MESSAGE_TYPE_DHT_P2P_PUT} to the respective
7640neighbour.
7641In addition to the usual information about the content (type, routing
7642options, desired replication level for the content, expiration time, key
7643and value), the message contains a fixed-size Bloom filter with
7644information about which peers (may) have already seen this request.
7645This Bloom filter is used to ensure that DHT messages never loop back to
7646a peer that has already processed the request.
7647Additionally, the message includes the current hop counter and, depending
7648on the routing options, the message may include the full path that the
7649message has taken so far.
7650The Bloom filter should already contain the identity of the previous hop;
7651however, the path should not include the identity of the previous hop and
7652the receiver should append the identity of the sender to the path, not
7653its own identity (this is done to reduce bandwidth).
7654
7655@node GETting data from the DHT2
7656@subsubsection GETting data from the DHT2
7657
7658@c %**end of header
7659
7660A peer can search the DHT by sending @code{struct PeerGetMessage}s of type
7661@code{GNUNET_MESSAGE_TYPE_DHT_P2P_GET} to other peers. In addition to the
7662usual information about the request (type, routing options, desired
7663replication level for the request, the key and the extended query), a GET
7664request also contains a hop counter, a Bloom filter over the peers
7665that have processed the request already and depending on the routing
7666options the full path traversed by the GET.
7667Finally, a GET request includes a variable-size second Bloom filter and a
7668so-called Bloom filter mutator value which together indicate which
7669replies the sender has already seen. During the lookup, each block that
7670matches they block type, key and extended query is additionally subjected
7671to a test against this Bloom filter.
7672The block plugin is expected to take the hash of the block and combine it
7673with the mutator value and check if the result is not yet in the Bloom
7674filter. The originator of the query will from time to time modify the
7675mutator to (eventually) allow false-positives filtered by the Bloom filter
7676to be returned.
7677
7678Peers that receive a GET request perform a local lookup (depending on
7679their proximity to the key and the query options) and forward the request
7680to other peers.
7681They then remember the request (including the Bloom filter for blocking
7682duplicate results) and when they obtain a matching, non-filtered response
7683a @code{struct PeerResultMessage} of type
7684@code{GNUNET_MESSAGE_TYPE_DHT_P2P_RESULT} is forwarded to the previous
7685hop.
7686Whenever a result is forwarded, the block plugin is used to update the
7687Bloom filter accordingly, to ensure that the same result is never
7688forwarded more than once.
7689The DHT service may also cache forwarded results locally if the
7690"CACHE_RESULTS" option is set to "YES" in the configuration.
7691
7692@cindex GNS
7693@cindex GNU Name System
7694@node GNU Name System (GNS)
7695@section GNU Name System (GNS)
7696
7697@c %**end of header
7698
7699The GNU Name System (GNS) is a decentralized database that enables users
7700to securely resolve names to values.
7701Names can be used to identify other users (for example, in social
7702networking), or network services (for example, VPN services running at a
7703peer in GNUnet, or purely IP-based services on the Internet).
7704Users interact with GNS by typing in a hostname that ends in a
7705top-level domain that is configured in the ``GNS'' section, matches
7706an identity of the user or ends in a Base32-encoded public key.
7707
7708Videos giving an overview of most of the GNS and the motivations behind
7709it is available here and here.
7710The remainder of this chapter targets developers that are familiar with
7711high level concepts of GNS as presented in these talks.
7712@c TODO: Add links to here and here and to these.
7713
7714GNS-aware applications should use the GNS resolver to obtain the
7715respective records that are stored under that name in GNS.
7716Each record consists of a type, value, expiration time and flags.
7717
7718The type specifies the format of the value. Types below 65536 correspond
7719to DNS record types, larger values are used for GNS-specific records.
7720Applications can define new GNS record types by reserving a number and
7721implementing a plugin (which mostly needs to convert the binary value
7722representation to a human-readable text format and vice-versa).
7723The expiration time specifies how long the record is to be valid.
7724The GNS API ensures that applications are only given non-expired values.
7725The flags are typically irrelevant for applications, as GNS uses them
7726internally to control visibility and validity of records.
7727
7728Records are stored along with a signature.
7729The signature is generated using the private key of the authoritative
7730zone. This allows any GNS resolver to verify the correctness of a
7731name-value mapping.
7732
7733Internally, GNS uses the NAMECACHE to cache information obtained from
7734other users, the NAMESTORE to store information specific to the local
7735users, and the DHT to exchange data between users.
7736A plugin API is used to enable applications to define new GNS
7737record types.
7738
7739@menu
7740* libgnunetgns::
7741* libgnunetgnsrecord::
7742* GNS plugins::
7743* The GNS Client-Service Protocol::
7744* Hijacking the DNS-Traffic using gnunet-service-dns::
7745* Serving DNS lookups via GNS on W32::
7746@end menu
7747
7748@node libgnunetgns
7749@subsection libgnunetgns
7750
7751@c %**end of header
7752
7753The GNS API itself is extremely simple. Clients first connect to the
7754GNS service using @code{GNUNET_GNS_connect}.
7755They can then perform lookups using @code{GNUNET_GNS_lookup} or cancel
7756pending lookups using @code{GNUNET_GNS_lookup_cancel}.
7757Once finished, clients disconnect using @code{GNUNET_GNS_disconnect}.
7758
7759@menu
7760* Looking up records::
7761* Accessing the records::
7762* Creating records::
7763* Future work::
7764@end menu
7765
7766@node Looking up records
7767@subsubsection Looking up records
7768
7769@c %**end of header
7770
7771@code{GNUNET_GNS_lookup} takes a number of arguments:
7772
7773@table @asis
7774@item handle This is simply the GNS connection handle from
7775@code{GNUNET_GNS_connect}.
7776@item name The client needs to specify the name to
7777be resolved. This can be any valid DNS or GNS hostname.
7778@item zone The client
7779needs to specify the public key of the GNS zone against which the
7780resolution should be done.
7781Note that a key must be provided, the client should
7782look up plausible values using its configuration,
7783the identity service and by attempting to interpret the
7784TLD as a base32-encoded public key.
7785@item type This is the desired GNS or DNS record type
7786to look for. While all records for the given name will be returned, this
7787can be important if the client wants to resolve record types that
7788themselves delegate resolution, such as CNAME, PKEY or GNS2DNS.
7789Resolving a record of any of these types will only work if the respective
7790record type is specified in the request, as the GNS resolver will
7791otherwise follow the delegation and return the records from the
7792respective destination, instead of the delegating record.
7793@item only_cached This argument should typically be set to
7794@code{GNUNET_NO}. Setting it to @code{GNUNET_YES} disables resolution via
7795the overlay network.
7796@item shorten_zone_key If GNS encounters new names during resolution,
7797their respective zones can automatically be learned and added to the
7798"shorten zone". If this is desired, clients must pass the private key of
7799the shorten zone. If NULL is passed, shortening is disabled.
7800@item proc This argument identifies
7801the function to call with the result. It is given proc_cls, the number of
7802records found (possibly zero) and the array of the records as arguments.
7803proc will only be called once. After proc,> has been called, the lookup
7804must no longer be canceled.
7805@item proc_cls The closure for proc.
7806@end table
7807
7808@node Accessing the records
7809@subsubsection Accessing the records
7810
7811@c %**end of header
7812
7813The @code{libgnunetgnsrecord} library provides an API to manipulate the
7814GNS record array that is given to proc. In particular, it offers
7815functions such as converting record values to human-readable
7816strings (and back). However, most @code{libgnunetgnsrecord} functions are
7817not interesting to GNS client applications.
7818
7819For DNS records, the @code{libgnunetdnsparser} library provides
7820functions for parsing (and serializing) common types of DNS records.
7821
7822@node Creating records
7823@subsubsection Creating records
7824
7825@c %**end of header
7826
7827Creating GNS records is typically done by building the respective record
7828information (possibly with the help of @code{libgnunetgnsrecord} and
7829@code{libgnunetdnsparser}) and then using the @code{libgnunetnamestore} to
7830publish the information. The GNS API is not involved in this
7831operation.
7832
7833@node Future work
7834@subsubsection Future work
7835
7836@c %**end of header
7837
7838In the future, we want to expand @code{libgnunetgns} to allow
7839applications to observe shortening operations performed during GNS
7840resolution, for example so that users can receive visual feedback when
7841this happens.
7842
7843@node libgnunetgnsrecord
7844@subsection libgnunetgnsrecord
7845
7846@c %**end of header
7847
7848The @code{libgnunetgnsrecord} library is used to manipulate GNS
7849records (in plaintext or in their encrypted format).
7850Applications mostly interact with @code{libgnunetgnsrecord} by using the
7851functions to convert GNS record values to strings or vice-versa, or to
7852lookup a GNS record type number by name (or vice-versa).
7853The library also provides various other functions that are mostly
7854used internally within GNS, such as converting keys to names, checking for
7855expiration, encrypting GNS records to GNS blocks, verifying GNS block
7856signatures and decrypting GNS records from GNS blocks.
7857
7858We will now discuss the four commonly used functions of the API.@
7859@code{libgnunetgnsrecord} does not perform these operations itself,
7860but instead uses plugins to perform the operation.
7861GNUnet includes plugins to support common DNS record types as well as
7862standard GNS record types.
7863
7864@menu
7865* Value handling::
7866* Type handling::
7867@end menu
7868
7869@node Value handling
7870@subsubsection Value handling
7871
7872@c %**end of header
7873
7874@code{GNUNET_GNSRECORD_value_to_string} can be used to convert
7875the (binary) representation of a GNS record value to a human readable,
78760-terminated UTF-8 string.
7877NULL is returned if the specified record type is not supported by any
7878available plugin.
7879
7880@code{GNUNET_GNSRECORD_string_to_value} can be used to try to convert a
7881human readable string to the respective (binary) representation of
7882a GNS record value.
7883
7884@node Type handling
7885@subsubsection Type handling
7886
7887@c %**end of header
7888
7889@code{GNUNET_GNSRECORD_typename_to_number} can be used to obtain the
7890numeric value associated with a given typename. For example, given the
7891typename "A" (for DNS A reocrds), the function will return the number 1.
7892A list of common DNS record types is
7893@uref{http://en.wikipedia.org/wiki/List_of_DNS_record_types, here}.
7894Note that not all DNS record types are supported by GNUnet GNSRECORD
7895plugins at this time.
7896
7897@code{GNUNET_GNSRECORD_number_to_typename} can be used to obtain the
7898typename associated with a given numeric value.
7899For example, given the type number 1, the function will return the
7900typename "A".
7901
7902@node GNS plugins
7903@subsection GNS plugins
7904
7905@c %**end of header
7906
7907Adding a new GNS record type typically involves writing (or extending) a
7908GNSRECORD plugin. The plugin needs to implement the
7909@code{gnunet_gnsrecord_plugin.h} API which provides basic functions that
7910are needed by GNSRECORD to convert typenames and values of the respective
7911record type to strings (and back).
7912These gnsrecord plugins are typically implemented within their respective
7913subsystems.
7914Examples for such plugins can be found in the GNSRECORD, GNS and
7915CONVERSATION subsystems.
7916
7917The @code{libgnunetgnsrecord} library is then used to locate, load and
7918query the appropriate gnsrecord plugin.
7919Which plugin is appropriate is determined by the record type (which is
7920just a 32-bit integer). The @code{libgnunetgnsrecord} library loads all
7921block plugins that are installed at the local peer and forwards the
7922application request to the plugins. If the record type is not
7923supported by the plugin, it should simply return an error code.
7924
7925The central functions of the block APIs (plugin and main library) are the
7926same four functions for converting between values and strings, and
7927typenames and numbers documented in the previous subsection.
7928
7929@node The GNS Client-Service Protocol
7930@subsection The GNS Client-Service Protocol
7931@c %**end of header
7932
7933The GNS client-service protocol consists of two simple messages, the
7934@code{LOOKUP} message and the @code{LOOKUP_RESULT}. Each @code{LOOKUP}
7935message contains a unique 32-bit identifier, which will be included in the
7936corresponding response. Thus, clients can send many lookup requests in
7937parallel and receive responses out-of-order.
7938A @code{LOOKUP} request also includes the public key of the GNS zone,
7939the desired record type and fields specifying whether shortening is
7940enabled or networking is disabled. Finally, the @code{LOOKUP} message
7941includes the name to be resolved.
7942
7943The response includes the number of records and the records themselves
7944in the format created by @code{GNUNET_GNSRECORD_records_serialize}.
7945They can thus be deserialized using
7946@code{GNUNET_GNSRECORD_records_deserialize}.
7947
7948@node Hijacking the DNS-Traffic using gnunet-service-dns
7949@subsection Hijacking the DNS-Traffic using gnunet-service-dns
7950
7951@c %**end of header
7952
7953This section documents how the gnunet-service-dns (and the
7954gnunet-helper-dns) intercepts DNS queries from the local system.
7955This is merely one method for how we can obtain GNS queries.
7956It is also possible to change @code{resolv.conf} to point to a machine
7957running @code{gnunet-dns2gns} or to modify libc's name system switch
7958(NSS) configuration to include a GNS resolution plugin.
7959The method described in this chapter is more of a last-ditch catch-all
7960approach.
7961
7962@code{gnunet-service-dns} enables intercepting DNS traffic using policy
7963based routing.
7964We MARK every outgoing DNS-packet if it was not sent by our application.
7965Using a second routing table in the Linux kernel these marked packets are
7966then routed through our virtual network interface and can thus be
7967captured unchanged.
7968
7969Our application then reads the query and decides how to handle it.
7970If the query can be addressed via GNS, it is passed to
7971@code{gnunet-service-gns} and resolved internally using GNS.
7972In the future, a reverse query for an address of the configured virtual
7973network could be answered with records kept about previous forward
7974queries.
7975Queries that are not hijacked by some application using the DNS service
7976will be sent to the original recipient.
7977The answer to the query will always be sent back through the virtual
7978interface with the original nameserver as source address.
7979
7980
7981@menu
7982* Network Setup Details::
7983@end menu
7984
7985@node Network Setup Details
7986@subsubsection Network Setup Details
7987
7988@c %**end of header
7989
7990The DNS interceptor adds the following rules to the Linux kernel:
7991@example
7992iptables -t mangle -I OUTPUT 1 -p udp --sport $LOCALPORT --dport 53 \
7993-j ACCEPT iptables -t mangle -I OUTPUT 2 -p udp --dport 53 -j MARK \
7994--set-mark 3 ip rule add fwmark 3 table2 ip route add default via \
7995$VIRTUALDNS table2
7996@end example
7997
7998@c FIXME: Rewrite to reflect display which is no longer content by line
7999@c FIXME: due to the < 74 characters limit.
8000Line 1 makes sure that all packets coming from a port our application
8001opened beforehand (@code{$LOCALPORT}) will be routed normally.
8002Line 2 marks every other packet to a DNS-Server with mark 3 (chosen
8003arbitrarily). The third line adds a routing policy based on this mark
80043 via the routing table.
8005
8006@node Serving DNS lookups via GNS on W32
8007@subsection Serving DNS lookups via GNS on W32
8008
8009@c %**end of header
8010
8011This section documents how the libw32nsp (and
8012gnunet-gns-helper-service-w32) do DNS resolutions of DNS queries on the
8013local system. This only applies to GNUnet running on W32.
8014
8015W32 has a concept of "Namespaces" and "Namespace providers".
8016These are used to present various name systems to applications in a
8017generic way.
8018Namespaces include DNS, mDNS, NLA and others. For each namespace any
8019number of providers could be registered, and they are queried in an order
8020of priority (which is adjustable).
8021
8022Applications can resolve names by using WSALookupService*() family of
8023functions.
8024
8025However, these are WSA-only facilities. Common BSD socket functions for
8026namespace resolutions are gethostbyname and getaddrinfo (among others).
8027These functions are implemented internally (by default - by mswsock,
8028which also implements the default DNS provider) as wrappers around
8029WSALookupService*() functions (see "Sample Code for a Service Provider"
8030on MSDN).
8031
8032On W32 GNUnet builds a libw32nsp - a namespace provider, which can then be
8033installed into the system by using w32nsp-install (and uninstalled by
8034w32nsp-uninstall), as described in "Installation Handbook".
8035
8036libw32nsp is very simple and has almost no dependencies. As a response to
8037NSPLookupServiceBegin(), it only checks that the provider GUID passed to
8038it by the caller matches GNUnet DNS Provider GUID,
8039then connects to
8040gnunet-gns-helper-service-w32 at 127.0.0.1:5353 (hardcoded) and sends the
8041name resolution request there, returning the connected socket to the
8042caller.
8043
8044When the caller invokes NSPLookupServiceNext(), libw32nsp reads a
8045completely formed reply from that socket, unmarshalls it, then gives
8046it back to the caller.
8047
8048At the moment gnunet-gns-helper-service-w32 is implemented to ever give
8049only one reply, and subsequent calls to NSPLookupServiceNext() will fail
8050with WSA_NODATA (first call to NSPLookupServiceNext() might also fail if
8051GNS failed to find the name, or there was an error connecting to it).
8052
8053gnunet-gns-helper-service-w32 does most of the processing:
8054
8055@itemize @bullet
8056@item Maintains a connection to GNS.
8057@item Reads GNS config and loads appropriate keys.
8058@item Checks service GUID and decides on the type of record to look up,
8059refusing to make a lookup outright when unsupported service GUID is
8060passed.
8061@item Launches the lookup
8062@end itemize
8063
8064When lookup result arrives, gnunet-gns-helper-service-w32 forms a complete
8065reply (including filling a WSAQUERYSETW structure and, possibly, a binary
8066blob with a hostent structure for gethostbyname() client), marshalls it,
8067and sends it back to libw32nsp. If no records were found, it sends an
8068empty header.
8069
8070This works for most normal applications that use gethostbyname() or
8071getaddrinfo() to resolve names, but fails to do anything with
8072applications that use alternative means of resolving names (such as
8073sending queries to a DNS server directly by themselves).
8074This includes some of well known utilities, like "ping" and "nslookup".
8075
8076@cindex GNS Namecache
8077@node GNS Namecache
8078@section GNS Namecache
8079
8080@c %**end of header
8081
8082The NAMECACHE subsystem is responsible for caching (encrypted) resolution
8083results of the GNU Name System (GNS). GNS makes zone information available
8084to other users via the DHT. However, as accessing the DHT for every
8085lookup is expensive (and as the DHT's local cache is lost whenever the
8086peer is restarted), GNS uses the NAMECACHE as a more persistent cache for
8087DHT lookups.
8088Thus, instead of always looking up every name in the DHT, GNS first
8089checks if the result is already available locally in the NAMECACHE.
8090Only if there is no result in the NAMECACHE, GNS queries the DHT.
8091The NAMECACHE stores data in the same (encrypted) format as the DHT.
8092It thus makes no sense to iterate over all items in the
8093NAMECACHE --- the NAMECACHE does not have a way to provide the keys
8094required to decrypt the entries.
8095
8096Blocks in the NAMECACHE share the same expiration mechanism as blocks in
8097the DHT --- the block expires wheneever any of the records in
8098the (encrypted) block expires.
8099The expiration time of the block is the only information stored in
8100plaintext. The NAMECACHE service internally performs all of the required
8101work to expire blocks, clients do not have to worry about this.
8102Also, given that NAMECACHE stores only GNS blocks that local users
8103requested, there is no configuration option to limit the size of the
8104NAMECACHE. It is assumed to be always small enough (a few MB) to fit on
8105the drive.
8106
8107The NAMECACHE supports the use of different database backends via a
8108plugin API.
8109
8110@menu
8111* libgnunetnamecache::
8112* The NAMECACHE Client-Service Protocol::
8113* The NAMECACHE Plugin API::
8114@end menu
8115
8116@node libgnunetnamecache
8117@subsection libgnunetnamecache
8118
8119@c %**end of header
8120
8121The NAMECACHE API consists of five simple functions. First, there is
8122@code{GNUNET_NAMECACHE_connect} to connect to the NAMECACHE service.
8123This returns the handle required for all other operations on the
8124NAMECACHE. Using @code{GNUNET_NAMECACHE_block_cache} clients can insert a
8125block into the cache.
8126@code{GNUNET_NAMECACHE_lookup_block} can be used to lookup blocks that
8127were stored in the NAMECACHE. Both operations can be canceled using
8128@code{GNUNET_NAMECACHE_cancel}. Note that canceling a
8129@code{GNUNET_NAMECACHE_block_cache} operation can result in the block
8130being stored in the NAMECACHE --- or not. Cancellation primarily ensures
8131that the continuation function with the result of the operation will no
8132longer be invoked.
8133Finally, @code{GNUNET_NAMECACHE_disconnect} closes the connection to the
8134NAMECACHE.
8135
8136The maximum size of a block that can be stored in the NAMECACHE is
8137@code{GNUNET_NAMECACHE_MAX_VALUE_SIZE}, which is defined to be 63 kB.
8138
8139@node The NAMECACHE Client-Service Protocol
8140@subsection The NAMECACHE Client-Service Protocol
8141
8142@c %**end of header
8143
8144All messages in the NAMECACHE IPC protocol start with the
8145@code{struct GNUNET_NAMECACHE_Header} which adds a request
8146ID (32-bit integer) to the standard message header.
8147The request ID is used to match requests with the
8148respective responses from the NAMECACHE, as they are allowed to happen
8149out-of-order.
8150
8151
8152@menu
8153* Lookup::
8154* Store::
8155@end menu
8156
8157@node Lookup
8158@subsubsection Lookup
8159
8160@c %**end of header
8161
8162The @code{struct LookupBlockMessage} is used to lookup a block stored in
8163the cache.
8164It contains the query hash. The NAMECACHE always responds with a
8165@code{struct LookupBlockResponseMessage}. If the NAMECACHE has no
8166response, it sets the expiration time in the response to zero.
8167Otherwise, the response is expected to contain the expiration time, the
8168ECDSA signature, the derived key and the (variable-size) encrypted data
8169of the block.
8170
8171@node Store
8172@subsubsection Store
8173
8174@c %**end of header
8175
8176The @code{struct BlockCacheMessage} is used to cache a block in the
8177NAMECACHE.
8178It has the same structure as the @code{struct LookupBlockResponseMessage}.
8179The service responds with a @code{struct BlockCacheResponseMessage} which
8180contains the result of the operation (success or failure).
8181In the future, we might want to make it possible to provide an error
8182message as well.
8183
8184@node The NAMECACHE Plugin API
8185@subsection The NAMECACHE Plugin API
8186@c %**end of header
8187
8188The NAMECACHE plugin API consists of two functions, @code{cache_block} to
8189store a block in the database, and @code{lookup_block} to lookup a block
8190in the database.
8191
8192
8193@menu
8194* Lookup2::
8195* Store2::
8196@end menu
8197
8198@node Lookup2
8199@subsubsection Lookup2
8200
8201@c %**end of header
8202
8203The @code{lookup_block} function is expected to return at most one block
8204to the iterator, and return @code{GNUNET_NO} if there were no non-expired
8205results.
8206If there are multiple non-expired results in the cache, the lookup is
8207supposed to return the result with the largest expiration time.
8208
8209@node Store2
8210@subsubsection Store2
8211
8212@c %**end of header
8213
8214The @code{cache_block} function is expected to try to store the block in
8215the database, and return @code{GNUNET_SYSERR} if this was not possible
8216for any reason.
8217Furthermore, @code{cache_block} is expected to implicitly perform cache
8218maintenance and purge blocks from the cache that have expired. Note that
8219@code{cache_block} might encounter the case where the database already has
8220another block stored under the same key. In this case, the plugin must
8221ensure that the block with the larger expiration time is preserved.
8222Obviously, this can done either by simply adding new blocks and selecting
8223for the most recent expiration time during lookup, or by checking which
8224block is more recent during the store operation.
8225
8226@cindex REVOCATION Subsystem
8227@node REVOCATION Subsystem
8228@section REVOCATION Subsystem
8229@c %**end of header
8230
8231The REVOCATION subsystem is responsible for key revocation of Egos.
8232If a user learns that theis private key has been compromised or has lost
8233it, they can use the REVOCATION system to inform all of the other users
8234that their private key is no longer valid.
8235The subsystem thus includes ways to query for the validity of keys and to
8236propagate revocation messages.
8237
8238@menu
8239* Dissemination::
8240* Revocation Message Design Requirements::
8241* libgnunetrevocation::
8242* The REVOCATION Client-Service Protocol::
8243* The REVOCATION Peer-to-Peer Protocol::
8244@end menu
8245
8246@node Dissemination
8247@subsection Dissemination
8248
8249@c %**end of header
8250
8251When a revocation is performed, the revocation is first of all
8252disseminated by flooding the overlay network.
8253The goal is to reach every peer, so that when a peer needs to check if a
8254key has been revoked, this will be purely a local operation where the
8255peer looks at its local revocation list. Flooding the network is also the
8256most robust form of key revocation --- an adversary would have to control
8257a separator of the overlay graph to restrict the propagation of the
8258revocation message. Flooding is also very easy to implement --- peers that
8259receive a revocation message for a key that they have never seen before
8260simply pass the message to all of their neighbours.
8261
8262Flooding can only distribute the revocation message to peers that are
8263online.
8264In order to notify peers that join the network later, the revocation
8265service performs efficient set reconciliation over the sets of known
8266revocation messages whenever two peers (that both support REVOCATION
8267dissemination) connect.
8268The SET service is used to perform this operation efficiently.
8269
8270@node Revocation Message Design Requirements
8271@subsection Revocation Message Design Requirements
8272
8273@c %**end of header
8274
8275However, flooding is also quite costly, creating O(|E|) messages on a
8276network with |E| edges.
8277Thus, revocation messages are required to contain a proof-of-work, the
8278result of an expensive computation (which, however, is cheap to verify).
8279Only peers that have expended the CPU time necessary to provide
8280this proof will be able to flood the network with the revocation message.
8281This ensures that an attacker cannot simply flood the network with
8282millions of revocation messages. The proof-of-work required by GNUnet is
8283set to take days on a typical PC to compute; if the ability to quickly
8284revoke a key is needed, users have the option to pre-compute revocation
8285messages to store off-line and use instantly after their key has expired.
8286
8287Revocation messages must also be signed by the private key that is being
8288revoked. Thus, they can only be created while the private key is in the
8289possession of the respective user. This is another reason to create a
8290revocation message ahead of time and store it in a secure location.
8291
8292@node libgnunetrevocation
8293@subsection libgnunetrevocation
8294
8295@c %**end of header
8296
8297The REVOCATION API consists of two parts, to query and to issue
8298revocations.
8299
8300
8301@menu
8302* Querying for revoked keys::
8303* Preparing revocations::
8304* Issuing revocations::
8305@end menu
8306
8307@node Querying for revoked keys
8308@subsubsection Querying for revoked keys
8309
8310@c %**end of header
8311
8312@code{GNUNET_REVOCATION_query} is used to check if a given ECDSA public
8313key has been revoked.
8314The given callback will be invoked with the result of the check.
8315The query can be canceled using @code{GNUNET_REVOCATION_query_cancel} on
8316the return value.
8317
8318@node Preparing revocations
8319@subsubsection Preparing revocations
8320
8321@c %**end of header
8322
8323It is often desirable to create a revocation record ahead-of-time and
8324store it in an off-line location to be used later in an emergency.
8325This is particularly true for GNUnet revocations, where performing the
8326revocation operation itself is computationally expensive and thus is
8327likely to take some time.
8328Thus, if users want the ability to perform revocations quickly in an
8329emergency, they must pre-compute the revocation message.
8330The revocation API enables this with two functions that are used to
8331compute the revocation message, but not trigger the actual revocation
8332operation.
8333
8334@code{GNUNET_REVOCATION_check_pow} should be used to calculate the
8335proof-of-work required in the revocation message. This function takes the
8336public key, the required number of bits for the proof of work (which in
8337GNUnet is a network-wide constant) and finally a proof-of-work number as
8338arguments.
8339The function then checks if the given proof-of-work number is a valid
8340proof of work for the given public key. Clients preparing a revocation
8341are expected to call this function repeatedly (typically with a
8342monotonically increasing sequence of numbers of the proof-of-work number)
8343until a given number satisfies the check.
8344That number should then be saved for later use in the revocation
8345operation.
8346
8347@code{GNUNET_REVOCATION_sign_revocation} is used to generate the
8348signature that is required in a revocation message.
8349It takes the private key that (possibly in the future) is to be revoked
8350and returns the signature.
8351The signature can again be saved to disk for later use, which will then
8352allow performing a revocation even without access to the private key.
8353
8354@node Issuing revocations
8355@subsubsection Issuing revocations
8356
8357
8358Given a ECDSA public key, the signature from @code{GNUNET_REVOCATION_sign}
8359and the proof-of-work,
8360@code{GNUNET_REVOCATION_revoke} can be used to perform the
8361actual revocation. The given callback is called upon completion of the
8362operation. @code{GNUNET_REVOCATION_revoke_cancel} can be used to stop the
8363library from calling the continuation; however, in that case it is
8364undefined whether or not the revocation operation will be executed.
8365
8366@node The REVOCATION Client-Service Protocol
8367@subsection The REVOCATION Client-Service Protocol
8368
8369
8370The REVOCATION protocol consists of four simple messages.
8371
8372A @code{QueryMessage} containing a public ECDSA key is used to check if a
8373particular key has been revoked. The service responds with a
8374@code{QueryResponseMessage} which simply contains a bit that says if the
8375given public key is still valid, or if it has been revoked.
8376
8377The second possible interaction is for a client to revoke a key by
8378passing a @code{RevokeMessage} to the service. The @code{RevokeMessage}
8379contains the ECDSA public key to be revoked, a signature by the
8380corresponding private key and the proof-of-work, The service responds
8381with a @code{RevocationResponseMessage} which can be used to indicate
8382that the @code{RevokeMessage} was invalid (i.e. proof of work incorrect),
8383or otherwise indicates that the revocation has been processed
8384successfully.
8385
8386@node The REVOCATION Peer-to-Peer Protocol
8387@subsection The REVOCATION Peer-to-Peer Protocol
8388
8389@c %**end of header
8390
8391Revocation uses two disjoint ways to spread revocation information among
8392peers.
8393First of all, P2P gossip exchanged via CORE-level neighbours is used to
8394quickly spread revocations to all connected peers.
8395Second, whenever two peers (that both support revocations) connect,
8396the SET service is used to compute the union of the respective revocation
8397sets.
8398
8399In both cases, the exchanged messages are @code{RevokeMessage}s which
8400contain the public key that is being revoked, a matching ECDSA signature,
8401and a proof-of-work.
8402Whenever a peer learns about a new revocation this way, it first
8403validates the signature and the proof-of-work, then stores it to disk
8404(typically to a file $GNUNET_DATA_HOME/revocation.dat) and finally
8405spreads the information to all directly connected neighbours.
8406
8407For computing the union using the SET service, the peer with the smaller
8408hashed peer identity will connect (as a "client" in the two-party set
8409protocol) to the other peer after one second (to reduce traffic spikes
8410on connect) and initiate the computation of the set union.
8411All revocation services use a common hash to identify the SET operation
8412over revocation sets.
8413
8414The current implementation accepts revocation set union operations from
8415all peers at any time; however, well-behaved peers should only initiate
8416this operation once after establishing a connection to a peer with a
8417larger hashed peer identity.
8418
8419@cindex FS
8420@cindex FS Subsystem
8421@node File-sharing (FS) Subsystem
8422@section File-sharing (FS) Subsystem
8423
8424@c %**end of header
8425
8426This chapter describes the details of how the file-sharing service works.
8427As with all services, it is split into an API (libgnunetfs), the service
8428process (gnunet-service-fs) and user interface(s).
8429The file-sharing service uses the datastore service to store blocks and
8430the DHT (and indirectly datacache) for lookups for non-anonymous
8431file-sharing.
8432Furthermore, the file-sharing service uses the block library (and the
8433block fs plugin) for validation of DHT operations.
8434
8435In contrast to many other services, libgnunetfs is rather complex since
8436the client library includes a large number of high-level abstractions;
8437this is necessary since the Fs service itself largely only operates on
8438the block level.
8439The FS library is responsible for providing a file-based abstraction to
8440applications, including directories, meta data, keyword search,
8441verification, and so on.
8442
8443The method used by GNUnet to break large files into blocks and to use
8444keyword search is called the
8445"Encoding for Censorship Resistant Sharing" (ECRS).
8446ECRS is largely implemented in the fs library; block validation is also
8447reflected in the block FS plugin and the FS service.
8448ECRS on-demand encoding is implemented in the FS service.
8449
8450NOTE: The documentation in this chapter is quite incomplete.
8451
8452@menu
8453* Encoding for Censorship-Resistant Sharing (ECRS)::
8454* File-sharing persistence directory structure::
8455@end menu
8456
8457@cindex ECRS
8458@cindex Encoding for Censorship-Resistant Sharing
8459@node Encoding for Censorship-Resistant Sharing (ECRS)
8460@subsection Encoding for Censorship-Resistant Sharing (ECRS)
8461
8462@c %**end of header
8463
8464When GNUnet shares files, it uses a content encoding that is called ECRS,
8465the Encoding for Censorship-Resistant Sharing.
8466Most of ECRS is described in the (so far unpublished) research paper
8467attached to this page. ECRS obsoletes the previous ESED and ESED II
8468encodings which were used in GNUnet before version 0.7.0.
8469The rest of this page assumes that the reader is familiar with the
8470attached paper. What follows is a description of some minor extensions
8471that GNUnet makes over what is described in the paper.
8472The reason why these extensions are not in the paper is that we felt
8473that they were obvious or trivial extensions to the original scheme and
8474thus did not warrant space in the research report.
8475
8476@menu
8477* Namespace Advertisements::
8478* KSBlocks::
8479@end menu
8480
8481@node Namespace Advertisements
8482@subsubsection Namespace Advertisements
8483
8484@c %**end of header
8485@c %**FIXME: all zeroses -> ?
8486
8487An @code{SBlock} with identifier all zeros is a signed
8488advertisement for a namespace. This special @code{SBlock} contains
8489metadata describing the content of the namespace.
8490Instead of the name of the identifier for a potential update, it contains
8491the identifier for the root of the namespace.
8492The URI should always be empty. The @code{SBlock} is signed with the
8493content provider's RSA private key (just like any other SBlock). Peers
8494can search for @code{SBlock}s in order to find out more about a namespace.
8495
8496@node KSBlocks
8497@subsubsection KSBlocks
8498
8499@c %**end of header
8500
8501GNUnet implements @code{KSBlocks} which are @code{KBlocks} that, instead
8502of encrypting a CHK and metadata, encrypt an @code{SBlock} instead.
8503In other words, @code{KSBlocks} enable GNUnet to find @code{SBlocks}
8504using the global keyword search.
8505Usually the encrypted @code{SBlock} is a namespace advertisement.
8506The rationale behind @code{KSBlock}s and @code{SBlock}s is to enable
8507peers to discover namespaces via keyword searches, and, to associate
8508useful information with namespaces. When GNUnet finds @code{KSBlocks}
8509during a normal keyword search, it adds the information to an internal
8510list of discovered namespaces. Users looking for interesting namespaces
8511can then inspect this list, reducing the need for out-of-band discovery
8512of namespaces.
8513Naturally, namespaces (or more specifically, namespace advertisements) can
8514also be referenced from directories, but @code{KSBlock}s should make it
8515easier to advertise namespaces for the owner of the pseudonym since they
8516eliminate the need to first create a directory.
8517
8518Collections are also advertised using @code{KSBlock}s.
8519
8520@c https://gnunet.org/sites/default/files/ecrs.pdf
8521
8522@node File-sharing persistence directory structure
8523@subsection File-sharing persistence directory structure
8524
8525@c %**end of header
8526
8527This section documents how the file-sharing library implements
8528persistence of file-sharing operations and specifically the resulting
8529directory structure.
8530This code is only active if the @code{GNUNET_FS_FLAGS_PERSISTENCE} flag
8531was set when calling @code{GNUNET_FS_start}.
8532In this case, the file-sharing library will try hard to ensure that all
8533major operations (searching, downloading, publishing, unindexing) are
8534persistent, that is, can live longer than the process itself.
8535More specifically, an operation is supposed to live until it is
8536explicitly stopped.
8537
8538If @code{GNUNET_FS_stop} is called before an operation has been stopped, a
8539@code{SUSPEND} event is generated and then when the process calls
8540@code{GNUNET_FS_start} next time, a @code{RESUME} event is generated.
8541Additionally, even if an application crashes (segfault, SIGKILL, system
8542crash) and hence @code{GNUNET_FS_stop} is never called and no
8543@code{SUSPEND} events are generated, operations are still resumed (with
8544@code{RESUME} events).
8545This is implemented by constantly writing the current state of the
8546file-sharing operations to disk.
8547Specifically, the current state is always written to disk whenever
8548anything significant changes (the exception are block-wise progress in
8549publishing and unindexing, since those operations would be slowed down
8550significantly and can be resumed cheaply even without detailed
8551accounting).
8552Note that if the process crashes (or is killed) during a serialization
8553operation, FS does not guarantee that this specific operation is
8554recoverable (no strict transactional semantics, again for performance
8555reasons). However, all other unrelated operations should resume nicely.
8556
8557Since we need to serialize the state continuously and want to recover as
8558much as possible even after crashing during a serialization operation,
8559we do not use one large file for serialization.
8560Instead, several directories are used for the various operations.
8561When @code{GNUNET_FS_start} executes, the master directories are scanned
8562for files describing operations to resume.
8563Sometimes, these operations can refer to related operations in child
8564directories which may also be resumed at this point.
8565Note that corrupted files are cleaned up automatically.
8566However, dangling files in child directories (those that are not
8567referenced by files from the master directories) are not automatically
8568removed.
8569
8570Persistence data is kept in a directory that begins with the "STATE_DIR"
8571prefix from the configuration file
8572(by default, "$SERVICEHOME/persistence/") followed by the name of the
8573client as given to @code{GNUNET_FS_start} (for example, "gnunet-gtk")
8574followed by the actual name of the master or child directory.
8575
8576The names for the master directories follow the names of the operations:
8577
8578@itemize @bullet
8579@item "search"
8580@item "download"
8581@item "publish"
8582@item "unindex"
8583@end itemize
8584
8585Each of the master directories contains names (chosen at random) for each
8586active top-level (master) operation.
8587Note that a download that is associated with a search result is not a
8588top-level operation.
8589
8590In contrast to the master directories, the child directories are only
8591consulted when another operation refers to them.
8592For each search, a subdirectory (named after the master search
8593synchronization file) contains the search results.
8594Search results can have an associated download, which is then stored in
8595the general "download-child" directory.
8596Downloads can be recursive, in which case children are stored in
8597subdirectories mirroring the structure of the recursive download
8598(either starting in the master "download" directory or in the
8599"download-child" directory depending on how the download was initiated).
8600For publishing operations, the "publish-file" directory contains
8601information about the individual files and directories that are part of
8602the publication.
8603However, this directory structure is flat and does not mirror the
8604structure of the publishing operation.
8605Note that unindex operations cannot have associated child operations.
8606
8607@cindex REGEX subsystem
8608@node REGEX Subsystem
8609@section REGEX Subsystem
8610
8611@c %**end of header
8612
8613Using the REGEX subsystem, you can discover peers that offer a particular
8614service using regular expressions.
8615The peers that offer a service specify it using a regular expressions.
8616Peers that want to patronize a service search using a string.
8617The REGEX subsystem will then use the DHT to return a set of matching
8618offerers to the patrons.
8619
8620For the technical details, we have Max's defense talk and Max's Master's
8621thesis.
8622
8623@c An additional publication is under preparation and available to
8624@c team members (in Git).
8625@c FIXME: Where is the file? Point to it. Assuming that it's szengel2012ms
8626
8627@menu
8628* How to run the regex profiler::
8629@end menu
8630
8631@node How to run the regex profiler
8632@subsection How to run the regex profiler
8633
8634@c %**end of header
8635
8636The gnunet-regex-profiler can be used to profile the usage of mesh/regex
8637for a given set of regular expressions and strings.
8638Mesh/regex allows you to announce your peer ID under a certain regex and
8639search for peers matching a particular regex using a string.
8640See @uref{https://gnunet.org/szengel2012ms, szengel2012ms} for a full
8641introduction.
8642
8643First of all, the regex profiler uses GNUnet testbed, thus all the
8644implications for testbed also apply to the regex profiler
8645(for example you need password-less ssh login to the machines listed in
8646your hosts file).
8647
8648@strong{Configuration}
8649
8650Moreover, an appropriate configuration file is needed.
8651Generally you can refer to the
8652@file{contrib/regex_profiler_infiniband.conf} file in the sourcecode
8653of GNUnet for an example configuration.
8654In the following paragraph the important details are highlighted.
8655
8656Announcing of the regular expressions is done by the
8657gnunet-daemon-regexprofiler, therefore you have to make sure it is
8658started, by adding it to the START_ON_DEMAND set of ARM:
8659
8660@example
8661[regexprofiler]
8662START_ON_DEMAND = YES
8663@end example
8664
8665@noindent
8666Furthermore you have to specify the location of the binary:
8667
8668@example
8669[regexprofiler]
8670# Location of the gnunet-daemon-regexprofiler binary.
8671BINARY = /home/szengel/gnunet/src/mesh/.libs/gnunet-daemon-regexprofiler
8672# Regex prefix that will be applied to all regular expressions and
8673# search string.
8674REGEX_PREFIX = "GNVPN-0001-PAD"
8675@end example
8676
8677@noindent
8678When running the profiler with a large scale deployment, you probably
8679want to reduce the workload of each peer.
8680Use the following options to do this.
8681
8682@example
8683[dht]
8684# Force network size estimation
8685FORCE_NSE = 1
8686
8687[dhtcache]
8688DATABASE = heap
8689# Disable RC-file for Bloom filter? (for benchmarking with limited IO
8690# availability)
8691DISABLE_BF_RC = YES
8692# Disable Bloom filter entirely
8693DISABLE_BF = YES
8694
8695[nse]
8696# Minimize proof-of-work CPU consumption by NSE
8697WORKBITS = 1
8698@end example
8699
8700@noindent
8701@strong{Options}
8702
8703To finally run the profiler some options and the input data need to be
8704specified on the command line.
8705
8706@example
8707gnunet-regex-profiler -c config-file -d log-file -n num-links \
8708-p path-compression-length -s search-delay -t matching-timeout \
8709-a num-search-strings hosts-file policy-dir search-strings-file
8710@end example
8711
8712@noindent
8713Where...
8714
8715@itemize @bullet
8716@item ... @code{config-file} means the configuration file created earlier.
8717@item ... @code{log-file} is the file where to write statistics output.
8718@item ... @code{num-links} indicates the number of random links between
8719started peers.
8720@item ... @code{path-compression-length} is the maximum path compression
8721length in the DFA.
8722@item ... @code{search-delay} time to wait between peers finished linking
8723and starting to match strings.
8724@item ... @code{matching-timeout} timeout after which to cancel the
8725searching.
8726@item ... @code{num-search-strings} number of strings in the
8727search-strings-file.
8728@item ... the @code{hosts-file} should contain a list of hosts for the
8729testbed, one per line in the following format:
8730
8731@itemize @bullet
8732@item @code{user@@host_ip:port}
8733@end itemize
8734@item ... the @code{policy-dir} is a folder containing text files
8735containing one or more regular expressions. A peer is started for each
8736file in that folder and the regular expressions in the corresponding file
8737are announced by this peer.
8738@item ... the @code{search-strings-file} is a text file containing search
8739strings, one in each line.
8740@end itemize
8741
8742@noindent
8743You can create regular expressions and search strings for every AS in the
8744Internet using the attached scripts. You need one of the
8745@uref{http://data.caida.org/datasets/routing/routeviews-prefix2as/, CAIDA routeviews prefix2as}
8746data files for this. Run
8747
8748@example
8749create_regex.py <filename> <output path>
8750@end example
8751
8752@noindent
8753to create the regular expressions and
8754
8755@example
8756create_strings.py <input path> <outfile>
8757@end example
8758
8759@noindent
8760to create a search strings file from the previously created
8761regular expressions.
8762
8763@cindex REST subsystem
8764@node REST Subsystem
8765@section REST Subsystem
8766
8767@c %**end of header
8768
8769Using the REST subsystem, you can expose REST-based APIs or services.
8770The REST service is designed as a pluggable architecture.
8771To create a new REST endpoint, simply add a library in the form
8772``plugin_rest_*''.
8773The REST service will automatically load all REST plugins on startup.
8774
8775@strong{Configuration}
8776
8777The REST service can be configured in various ways.
8778The reference config file can be found in
8779@file{src/rest/rest.conf}:
8780@example
8781[rest]
8782REST_PORT=7776
8783REST_ALLOW_HEADERS=Authorization,Accept,Content-Type
8784REST_ALLOW_ORIGIN=*
8785REST_ALLOW_CREDENTIALS=true
8786@end example
8787
8788The port as well as
8789@deffn{cross-origin resource sharing} (CORS)
8790@end deffn
8791headers that are supposed to be advertised by the rest service are
8792configurable.
8793
8794@menu
8795* Namespace considerations::
8796* Endpoint documentation::
8797@end menu
8798
8799@node Namespace considerations
8800@subsection Namespace considerations
8801
8802The @command{gnunet-rest-service} will load all plugins that are installed.
8803As such it is important that the endpoint namespaces do not clash.
8804
8805For example, plugin X might expose the endpoint ``/xxx'' while plugin Y
8806exposes endpoint ``/xxx/yyy''.
8807This is a problem if plugin X is also supposed to handle a call
8808to ``/xxx/yyy''.
8809Currently the REST service will not complain or warn about such clashes,
8810so please make sure that endpoints are unambiguous.
8811
8812@node Endpoint documentation
8813@subsection Endpoint documentation
8814
8815This is WIP. Endpoints should be documented appropriately.
8816Preferably using annotations.
8817
diff --git a/doc/documentation/chapters/installation.texi b/doc/documentation/chapters/installation.texi
deleted file mode 100644
index 6b68ac498..000000000
--- a/doc/documentation/chapters/installation.texi
+++ /dev/null
@@ -1,2233 +0,0 @@
1@node Installing GNUnet
2@chapter Installing GNUnet
3
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.
8
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
22@section Installing dependencies
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.
27
28The mandatory libraries and applications are
29@itemize @bullet
30@item libtool
31@item autoconf @geq{}2.59
32@item automake @geq{}1.11.1
33@item pkg-config
34@item libgcrypt @geq{}1.6
35@item libextractor
36@item libidn
37@item libmicrohttpd @geq{}0.9.52
38@item libnss
39@item libunistring
40@item gettext
41@item glibc
42@item libgmp
43@item gnutls
44@item libcurl (has to be linked to GnuTLS) or libgnurl
45@item zlib
46@end itemize
47
48In addition GNUnet needs one of of these three databases
49@itemize @bullet
50@item sqlite + libsqlite (the default, requires no further configuration)
51@item postgres + libpq
52@item mysql + libmysqlclient
53@end itemize
54
55These are the dependencies only required for certain features
56@itemize @bullet
57@item Texinfo (for building the documentation)
58@item Texlive (for building the documentation)
59@item miniupnpc (for traversing NAT boxes more reliably)
60@item libopus (for running the GNUnet conversation telephony application)
61@item libpulse (for running the GNUnet conversation telephony application)
62@item libogg (for running the GNUnet conversation telephony application)
63@item bluez (for bluetooth support)
64@item libpbc
65(for attribute-based encryption and the identity provider subsystem)
66@item libgabe
67(for attribute-based encryption and the identity provider subsystem)
68@end itemize
69
70@c -----------------------------------------------------------------------
71@node Getting the Source Code
72@section Getting the Source Code
73You can either download the source code using git (you obviously need
74git installed) or as an archive.
75
76Using git type
77@example
78git clone https://gnunet.org/git/gnunet.git
79@end example
80
81The archive can be found at
82@uref{https://gnunet.org/downloads}. Extract it using a graphical
83archive tool or @code{tar}:
84@example
85tar xzvf gnunet-0.11.0pre66.tar.gz
86@end example
87
88In the next chapter we will assume that the source code is available
89in the home directory at @code{~/gnunet}.
90
91@c -----------------------------------------------------------------------
92@node Create @code{gnunet} user and group
93@section Create @code{gnunet} user and group
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.
97
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.
101@example
102$ sudo useradd --system --groups gnunet --home-dir /var/lib/gnunet
103@end example
104
105Now add your own user to the @code{gnunet} group.
106@example
107$ sudo adduser alice gnunet
108@end example
109
110@c -----------------------------------------------------------------------
111@node Preparing and Compiling the Source Code
112@section Preparing and Compiling the Source Code
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:
117
118@itemize @bullet
119@item @code{--disable-documentation} - don't build the configuration documents
120@item @code{--enable-looging=[LOGLEVEL]} - choose a loglevel (@code{debug}, @code{info}, @code{warning} or @code{error})
121@item @code{--prefix=[PATH]} - the directory where the GNUnet libraries and binaries will be installed
122@item @code{--with-extractor=[PATH]} - the path to libextractor
123@item @code{--with-libidn=[PATH]} - the path to libidn
124@item @code{--with-microhttpd=[PATH]} - the path to libmicrohttpd
125@item @code{--with-sqlite=[PATH]} - the path to libsqlite
126@item @code{--with-zlib=[PATH]} - the path to zlib
127@item @code{--with-sudo=[PATH]} - path to the sudo binary (no need to run @code{make install} as root if specified)
128@end itemize
129
130The following example configures the installation prefix
131@code{/usr/lib} and disables building the documentation
132@example
133$ cd ~/gnunet
134$ ./bootstrap
135$ configure --prefix=/usr/lib --disable-configuration
136@end example
137
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.
141@example
142$ make -j5
143@end example
144
145@c -----------------------------------------------------------------------
146@node Installation
147@section Installation
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.
152
153@example
154$ sudo make install
155@end example
156
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.
163
164Find the directory where nss plugins are installed on your system, e.g.
165
166@example
167$ ls -l /lib/libnss_*
168/lib/libnss_mymachines.so.2
169/lib/libnss_resolve.so.2
170/lib/libnss_myhostname.so.2
171/lib/libnss_systemd.so.2
172@end example
173
174Copy the GNS NSS plugin to that directory:
175
176@example
177cp ~/gnunet/src/gns/nss/libnss_gns.so.2 /lib
178@end example
179
180Now, to activate the plugin, you need to edit your
181@code{/etc/nsswitch.conf} where you should find a line like this:
182
183@example
184hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
185@end example
186
187The exact details may differ a bit, which is fine. Add the text
188@code{"gns [NOTFOUND=return]"} after @code{"files"}.
189
190@example
191hosts: files gns [NOTFOUND=return] mdns4_minimal [NOTFOUND=return] dns mdns4
192@end example
193
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.
197@example
198$ gnunet-gns-proxy-setup-ca
199@end example
200
201Finally install a configuration file in
202@code{~/.gnunet/gnunet.conf}. Below you find an example config which
203allows you to start GNUnet.
204
205@example
206[arm]
207SYSTEM_ONLY = NO
208USER_ONLY = NO
209
210[transport]
211PLUGINS = tcp
212@end example
213
214
215
216
217
218
219@node MOVED FROM USER Checking the Installation
220@section MOVED FROM USER Checking the Installation
221@c %**end of header
222
223This section describes a quick, casual way to check if your GNUnet
224installation works. However, if it does not, we do not cover
225steps for recovery --- for this, please study the instructions
226provided in the developer handbook as well as the system-specific
227instruction in the source code repository.
228Please note that the system specific instructions are not provided
229as part of this handbook!.
230
231
232@menu
233* gnunet-gtk::
234* Statistics::
235* Peer Information::
236@end menu
237
238@cindex GNUnet GTK
239@cindex GTK
240@cindex GTK user interface
241@node gnunet-gtk
242@subsection gnunet-gtk
243@c %**end of header
244
245The @command{gnunet-gtk} package contains several graphical
246user interfaces for the respective GNUnet applications.
247Currently these interfaces cover:
248
249@itemize @bullet
250@item Statistics
251@item Peer Information
252@item GNU Name System
253@item File Sharing
254@item Identity Management
255@item Conversation
256@end itemize
257
258@node Statistics
259@subsection Statistics
260@c %**end of header
261
262We assume that you have started gnunet via @code{gnunet-arm} or via your
263system-provided method for starting services.
264First, you should launch GNUnet gtk.
265You can do this from the command-line by typing
266
267@example
268gnunet-statistics-gtk
269@end example
270
271If your peer is running correctly, you should see a bunch
272of lines, all of which should be ``significantly'' above zero (at
273least if your peer has been running for more than a few seconds). The
274lines indicate how many other peers your peer is connected to (via
275different mechanisms) and how large the entire overlay network is
276currently estimated to be. The X-axis represents time (in seconds
277since the start of @command{gnunet-gtk}).
278
279You can click on "Traffic" to see information about the amount of
280bandwidth your peer has consumed, and on "Storage" to check the amount
281of storage available and used by your peer. Note that "Traffic" is
282plotted cumulatively, so you should see a strict upwards trend in the
283traffic.
284
285The term ``peer'' is a common word used in
286federated and distributed networks to describe a participating device
287which is connected to the network. Thus, your Personal Computer or
288whatever it is you are looking at the Gtk+ interface describes a
289``Peer'' or a ``Node''.
290
291@node Peer Information
292@subsection Peer Information
293@c %**end of header
294
295First, you should launch the graphical user interface. You can do
296this from the command-line by typing
297
298@example
299$ gnunet-peerinfo-gtk
300@end example
301
302Once you have done this, you will see a list of known peers (by the
303first four characters of their public key), their friend status (all
304should be marked as not-friends initially), their connectivity (green
305is connected, red is disconnected), assigned bandwidth, country of
306origin (if determined) and address information. If hardly any peers
307are listed and/or if there are very few peers with a green light for
308connectivity, there is likely a problem with your network
309configuration.
310
311@c NOTE: Inserted from Installation Handbook in original ``order'':
312@c FIXME: Move this to User Handbook.
313@node MOVED FROM USER The graphical configuration interface
314@section MOVED FROM USER The graphical configuration interface
315
316If you also would like to use @command{gnunet-gtk} and
317@command{gnunet-setup} (highly recommended for beginners), do:
318
319@menu
320* Configuring your peer::
321* Configuring the Friend-to-Friend (F2F) mode::
322* Configuring the hostlist to bootstrap::
323* Configuration of the HOSTLIST proxy settings::
324* Configuring your peer to provide a hostlist ::
325* Configuring the datastore::
326* Configuring the MySQL database::
327* Reasons for using MySQL::
328* Reasons for not using MySQL::
329* Setup Instructions::
330* Testing::
331* Performance Tuning::
332* Setup for running Testcases::
333* Configuring the Postgres database::
334* Reasons to use Postgres::
335* Reasons not to use Postgres::
336* Manual setup instructions::
337* Testing the setup manually::
338* Configuring the datacache::
339* Configuring the file-sharing service::
340* Configuring logging::
341* Configuring the transport service and plugins::
342* Configuring the WLAN transport plugin::
343* Configuring HTTP(S) reverse proxy functionality using Apache or nginx::
344* Blacklisting peers::
345* Configuration of the HTTP and HTTPS transport plugins::
346* Configuring the GNU Name System::
347* Configuring the GNUnet VPN::
348* Bandwidth Configuration::
349* Configuring NAT::
350* Peer configuration for distributions::
351@end menu
352
353@node Configuring your peer
354@subsection Configuring your peer
355
356This chapter will describe the various configuration options in GNUnet.
357
358The easiest way to configure your peer is to use the
359@command{gnunet-setup} tool.
360@command{gnunet-setup} is part of the @command{gnunet-gtk}
361application. You might have to install it separately.
362
363Many of the specific sections from this chapter actually are linked from
364within @command{gnunet-setup} to help you while using the setup tool.
365
366While you can also configure your peer by editing the configuration
367file by hand, this is not recommended for anyone except for developers
368as it requires a more in-depth understanding of the configuration files
369and internal dependencies of GNUnet.
370
371@node Configuring the Friend-to-Friend (F2F) mode
372@subsection Configuring the Friend-to-Friend (F2F) mode
373
374GNUnet knows three basic modes of operation:
375@itemize @bullet
376@item In standard "peer-to-peer" mode,
377your peer will connect to any peer.
378@item In the pure "friend-to-friend"
379mode, your peer will ONLY connect to peers from a list of friends
380specified in the configuration.
381@item Finally, in mixed mode,
382GNUnet will only connect to arbitrary peers if it
383has at least a specified number of connections to friends.
384@end itemize
385
386When configuring any of the F2F ("friend-to-friend") modes,
387you first need to create a file with the peer identities
388of your friends. Ask your friends to run
389
390@example
391$ gnunet-peerinfo -sq
392@end example
393
394@noindent
395The resulting output of this command needs to be added to your
396@file{friends} file, which is simply a plain text file with one line
397per friend with the output from the above command.
398
399You then specify the location of your @file{friends} file in the
400@code{FRIENDS} option of the "topology" section.
401
402Once you have created the @file{friends} file, you can tell GNUnet to only
403connect to your friends by setting the @code{FRIENDS-ONLY} option
404(again in the "topology" section) to YES.
405
406If you want to run in mixed-mode, set "FRIENDS-ONLY" to NO and configure a
407minimum number of friends to have (before connecting to arbitrary peers)
408under the "MINIMUM-FRIENDS" option.
409
410If you want to operate in normal P2P-only mode, simply set
411@code{MINIMUM-FRIENDS} to zero and @code{FRIENDS_ONLY} to NO.
412This is the default.
413
414@node Configuring the hostlist to bootstrap
415@subsection Configuring the hostlist to bootstrap
416
417After installing the software you need to get connected to the GNUnet
418network. The configuration file included in your download is already
419configured to connect you to the GNUnet network.
420In this section the relevant configuration settings are explained.
421
422To get an initial connection to the GNUnet network and to get to know
423peers already connected to the network you can use the so called
424"bootstrap servers".
425These servers can give you a list of peers connected to the network.
426To use these bootstrap servers you have to configure the hostlist daemon
427to activate bootstrapping.
428
429To activate bootstrapping, edit the @code{[hostlist]}-section in your
430configuration file. You have to set the argument @command{-b} in the
431options line:
432
433@example
434[hostlist]
435OPTIONS = -b
436@end example
437
438Additionally you have to specify which server you want to use.
439The default bootstrapping server is
440"@uref{http://v10.gnunet.org/hostlist, http://v10.gnunet.org/hostlist}".
441[^] To set the server you have to edit the line "SERVERS" in the hostlist
442section. To use the default server you should set the lines to
443
444@example
445SERVERS = http://v10.gnunet.org/hostlist [^]
446@end example
447
448@noindent
449To use bootstrapping your configuration file should include these lines:
450
451@example
452[hostlist]
453OPTIONS = -b
454SERVERS = http://v10.gnunet.org/hostlist [^]
455@end example
456
457@noindent
458Besides using bootstrap servers you can configure your GNUnet peer to
459receive hostlist advertisements.
460Peers offering hostlists to other peers can send advertisement messages
461to peers that connect to them. If you configure your peer to receive these
462messages, your peer can download these lists and connect to the peers
463included. These lists are persistent, which means that they are saved to
464your hard disk regularly and are loaded during startup.
465
466To activate hostlist learning you have to add the @command{-e}
467switch to the @code{OPTIONS} line in the hostlist section:
468
469@example
470[hostlist]
471OPTIONS = -b -e
472@end example
473
474@noindent
475Furthermore you can specify in which file the lists are saved.
476To save the lists in the file @file{hostlists.file} just add the line:
477
478@example
479HOSTLISTFILE = hostlists.file
480@end example
481
482@noindent
483Best practice is to activate both bootstrapping and hostlist learning.
484So your configuration file should include these lines:
485
486@example
487[hostlist]
488OPTIONS = -b -e
489HTTPPORT = 8080
490SERVERS = http://v10.gnunet.org/hostlist [^]
491HOSTLISTFILE = $SERVICEHOME/hostlists.file
492@end example
493
494@node Configuration of the HOSTLIST proxy settings
495@subsection Configuration of the HOSTLIST proxy settings
496
497The hostlist client can be configured to use a proxy to connect to the
498hostlist server.
499This functionality can be configured in the configuration file directly
500or using the @command{gnunet-setup} tool.
501
502The hostlist client supports the following proxy types at the moment:
503
504@itemize @bullet
505@item HTTP and HTTP 1.0 only proxy
506@item SOCKS 4/4a/5/5 with hostname
507@end itemize
508
509In addition authentication at the proxy with username and password can be
510configured.
511
512To configure proxy support for the hostlist client in the
513@command{gnunet-setup} tool, select the "hostlist" tab and select
514the appropriate proxy type.
515The hostname or IP address (including port if required) has to be entered
516in the "Proxy hostname" textbox. If required, enter username and password
517in the "Proxy username" and "Proxy password" boxes.
518Be aware that this information will be stored in the configuration in
519plain text (TODO: Add explanation and generalize the part in Chapter 3.6
520about the encrypted home).
521
522To provide these options directly in the configuration, you can
523enter the following settings in the @code{[hostlist]} section of
524the configuration:
525
526@example
527# Type of proxy server,
528# Valid values: HTTP, HTTP_1_0, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
529# Default: HTTP
530# PROXY_TYPE = HTTP
531
532# Hostname or IP of proxy server
533# PROXY =
534# User name for proxy server
535# PROXY_USERNAME =
536# User password for proxy server
537# PROXY_PASSWORD =
538@end example
539
540@node Configuring your peer to provide a hostlist
541@subsection Configuring your peer to provide a hostlist
542
543If you operate a peer permanently connected to GNUnet you can configure
544your peer to act as a hostlist server, providing other peers the list of
545peers known to him.
546
547Your server can act as a bootstrap server and peers needing to obtain a
548list of peers can contact it to download this list.
549To download this hostlist the peer uses HTTP.
550For this reason you have to build your peer with libgnurl (or libcurl)
551and microhttpd support.
552
553To configure your peer to act as a bootstrap server you have to add the
554@command{-p} option to @code{OPTIONS} in the @code{[hostlist]} section
555of your configuration file.
556Besides that you have to specify a port number for the http server.
557In conclusion you have to add the following lines:
558
559@example
560[hostlist]
561HTTPPORT = 12980
562OPTIONS = -p
563@end example
564
565@noindent
566If your peer acts as a bootstrap server other peers should know about
567that. You can advertise the hostlist your are providing to other peers.
568Peers connecting to your peer will get a message containing an
569advertisement for your hostlist and the URL where it can be downloaded.
570If this peer is in learning mode, it will test the hostlist and, in the
571case it can obtain the list successfully, it will save it for
572bootstrapping.
573
574To activate hostlist advertisement on your peer, you have to set the
575following lines in your configuration file:
576
577@example
578[hostlist]
579EXTERNAL_DNS_NAME = example.org
580HTTPPORT = 12981
581OPTIONS = -p -a
582@end example
583
584@noindent
585With this configuration your peer will a act as a bootstrap server and
586advertise this hostlist to other peers connecting to it.
587The URL used to download the list will be
588@code{@uref{http://example.org:12981/, http://example.org:12981/}}.
589
590Please notice:
591
592@itemize @bullet
593@item The hostlist is @b{not} human readable, so you should not try to
594download it using your webbrowser. Just point your GNUnet peer to the
595address!
596@item Advertising without providing a hostlist does not make sense and
597will not work.
598@end itemize
599
600@node Configuring the datastore
601@subsection Configuring the datastore
602
603The datastore is what GNUnet uses for long-term storage of file-sharing
604data. Note that long-term does not mean 'forever' since content does have
605an expiration date, and of course storage space is finite (and hence
606sometimes content may have to be discarded).
607
608Use the @code{QUOTA} option to specify how many bytes of storage space
609you are willing to dedicate to GNUnet.
610
611In addition to specifying the maximum space GNUnet is allowed to use for
612the datastore, you need to specify which database GNUnet should use to do
613so. Currently, you have the choice between sqLite, MySQL and Postgres.
614
615@node Configuring the MySQL database
616@subsection Configuring the MySQL database
617
618This section describes how to setup the MySQL database for GNUnet.
619
620Note that the mysql plugin does NOT work with mysql before 4.1 since we
621need prepared statements.
622We are generally testing the code against MySQL 5.1 at this point.
623
624@node Reasons for using MySQL
625@subsection Reasons for using MySQL
626
627@itemize @bullet
628
629@item On up-to-date hardware wher
630mysql can be used comfortably, this module
631will have better performance than the other database choices (according
632to our tests).
633
634@item Its often possible to recover the mysql database from internal
635inconsistencies. Some of the other databases do not support repair.
636@end itemize
637
638@node Reasons for not using MySQL
639@subsection Reasons for not using MySQL
640
641@itemize @bullet
642@item Memory usage (likely not an issue if you have more than 1 GB)
643@item Complex manual setup
644@end itemize
645
646@node Setup Instructions
647@subsection Setup Instructions
648
649@itemize @bullet
650
651@item In @file{gnunet.conf} set in section @code{DATASTORE} the value for
652@code{DATABASE} to @code{mysql}.
653
654@item Access mysql as root:
655
656@example
657$ mysql -u root -p
658@end example
659
660@noindent
661and issue the following commands, replacing $USER with the username
662that will be running @command{gnunet-arm} (so typically "gnunet"):
663
664@example
665CREATE DATABASE gnunet;
666GRANT select,insert,update,delete,create,alter,drop,create \
667temporary tables ON gnunet.* TO $USER@@localhost;
668SET PASSWORD FOR $USER@@localhost=PASSWORD('$the_password_you_like');
669FLUSH PRIVILEGES;
670@end example
671
672@item
673In the $HOME directory of $USER, create a @file{.my.cnf} file with the
674following lines
675
676@example
677[client]
678user=$USER
679password=$the_password_you_like
680@end example
681
682@end itemize
683
684That's it. Note that @file{.my.cnf} file is a slight security risk unless
685its on a safe partition. The @file{$HOME/.my.cnf} can of course be
686a symbolic link.
687Luckily $USER has only privileges to mess up GNUnet's tables,
688which should be pretty harmless.
689
690@node Testing
691@subsection Testing
692
693You should briefly try if the database connection works. First, login
694as $USER. Then use:
695
696@example
697$ mysql -u $USER
698mysql> use gnunet;
699@end example
700
701@noindent
702If you get the message
703
704@example
705Database changed
706@end example
707
708@noindent
709it probably works.
710
711If you get
712
713@example
714ERROR 2002: Can't connect to local MySQL server
715through socket '/tmp/mysql.sock' (2)
716@end example
717
718@noindent
719it may be resolvable by
720
721@example
722ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
723@end example
724
725@noindent
726so there may be some additional trouble depending on your mysql setup.
727
728@node Performance Tuning
729@subsection Performance Tuning
730
731For GNUnet, you probably want to set the option
732
733@example
734innodb_flush_log_at_trx_commit = 0
735@end example
736
737@noindent
738for a rather dramatic boost in MySQL performance. However, this reduces
739the "safety" of your database as with this options you may loose
740transactions during a power outage.
741While this is totally harmless for GNUnet, the option applies to all
742applications using MySQL. So you should set it if (and only if) GNUnet is
743the only application on your system using MySQL.
744
745@node Setup for running Testcases
746@subsection Setup for running Testcases
747
748If you want to run the testcases, you must create a second database
749"gnunetcheck" with the same username and password. This database will
750then be used for testing (@command{make check}).
751
752@node Configuring the Postgres database
753@subsection Configuring the Postgres database
754
755This text describes how to setup the Postgres database for GNUnet.
756
757This Postgres plugin was developed for Postgres 8.3 but might work for
758earlier versions as well.
759
760@node Reasons to use Postgres
761@subsection Reasons to use Postgres
762
763@itemize @bullet
764@item Easier to setup than MySQL
765@item Real database
766@end itemize
767
768@node Reasons not to use Postgres
769@subsection Reasons not to use Postgres
770
771@itemize @bullet
772@item Quite slow
773@item Still some manual setup required
774@end itemize
775
776@node Manual setup instructions
777@subsection Manual setup instructions
778
779@itemize @bullet
780@item In @file{gnunet.conf} set in section @code{DATASTORE} the value for
781@code{DATABASE} to @code{postgres}.
782@item Access Postgres to create a user:
783
784@table @asis
785@item with Postgres 8.x, use:
786
787@example
788# su - postgres
789$ createuser
790@end example
791
792@noindent
793and enter the name of the user running GNUnet for the role interactively.
794Then, when prompted, do not set it to superuser, allow the creation of
795databases, and do not allow the creation of new roles.
796
797@item with Postgres 9.x, use:
798
799@example
800# su - postgres
801$ createuser -d $GNUNET_USER
802@end example
803
804@noindent
805where $GNUNET_USER is the name of the user running GNUnet.
806
807@end table
808
809
810@item
811As that user (so typically as user "gnunet"), create a database (or two):
812
813@example
814$ createdb gnunet
815# this way you can run "make check"
816$ createdb gnunetcheck
817@end example
818
819@end itemize
820
821Now you should be able to start @code{gnunet-arm}.
822
823@node Testing the setup manually
824@subsection Testing the setup manually
825
826You may want to try if the database connection works. First, again login
827as the user who will run @command{gnunet-arm}. Then use:
828
829@example
830$ psql gnunet # or gnunetcheck
831gnunet=> \dt
832@end example
833
834@noindent
835If, after you have started @command{gnunet-arm} at least once, you get
836a @code{gn090} table here, it probably works.
837
838@node Configuring the datacache
839@subsection Configuring the datacache
840@c %**end of header
841
842The datacache is what GNUnet uses for storing temporary data. This data is
843expected to be wiped completely each time GNUnet is restarted (or the
844system is rebooted).
845
846You need to specify how many bytes GNUnet is allowed to use for the
847datacache using the @code{QUOTA} option in the section @code{[dhtcache]}.
848Furthermore, you need to specify which database backend should be used to
849store the data. Currently, you have the choice between
850sqLite, MySQL and Postgres.
851
852@node Configuring the file-sharing service
853@subsection Configuring the file-sharing service
854
855In order to use GNUnet for file-sharing, you first need to make sure
856that the file-sharing service is loaded.
857This is done by setting the @code{START_ON_DEMAND} option in
858section @code{[fs]} to "YES". Alternatively, you can run
859
860@example
861$ gnunet-arm -i fs
862@end example
863
864@noindent
865to start the file-sharing service by hand.
866
867Except for configuring the database and the datacache the only important
868option for file-sharing is content migration.
869
870Content migration allows your peer to cache content from other peers as
871well as send out content stored on your system without explicit requests.
872This content replication has positive and negative impacts on both system
873performance and privacy.
874
875FIXME: discuss the trade-offs. Here is some older text about it...
876
877Setting this option to YES allows gnunetd to migrate data to the local
878machine. Setting this option to YES is highly recommended for efficiency.
879Its also the default. If you set this value to YES, GNUnet will store
880content on your machine that you cannot decrypt.
881While this may protect you from liability if the judge is sane, it may
882not (IANAL). If you put illegal content on your machine yourself, setting
883this option to YES will probably increase your chances to get away with it
884since you can plausibly deny that you inserted the content.
885Note that in either case, your anonymity would have to be broken first
886(which may be possible depending on the size of the GNUnet network and the
887strength of the adversary).
888
889@node Configuring logging
890@subsection Configuring logging
891
892Logging in GNUnet 0.9.0 is controlled via the "-L" and "-l" options.
893Using @code{-L}, a log level can be specified. With log level
894@code{ERROR} only serious errors are logged.
895The default log level is @code{WARNING} which causes anything of
896concern to be logged.
897Log level @code{INFO} can be used to log anything that might be
898interesting information whereas
899@code{DEBUG} can be used by developers to log debugging messages
900(but you need to run @code{./configure} with
901@code{--enable-logging=verbose} to get them compiled).
902The @code{-l} option is used to specify the log file.
903
904Since most GNUnet services are managed by @code{gnunet-arm}, using the
905@code{-l} or @code{-L} options directly is not possible.
906Instead, they can be specified using the @code{OPTIONS} configuration
907value in the respective section for the respective service.
908In order to enable logging globally without editing the @code{OPTIONS}
909values for each service, @command{gnunet-arm} supports a
910@code{GLOBAL_POSTFIX} option.
911The value specified here is given as an extra option to all services for
912which the configuration does contain a service-specific @code{OPTIONS}
913field.
914
915@code{GLOBAL_POSTFIX} can contain the special sequence "@{@}" which
916is replaced by the name of the service that is being started.
917Furthermore, @code{GLOBAL_POSTFIX} is special in that sequences
918starting with "$" anywhere in the string are expanded (according
919to options in @code{PATHS}); this expansion otherwise is
920only happening for filenames and then the "$" must be the
921first character in the option. Both of these restrictions do
922not apply to @code{GLOBAL_POSTFIX}.
923Note that specifying @code{%} anywhere in the @code{GLOBAL_POSTFIX}
924disables both of these features.
925
926In summary, in order to get all services to log at level
927@code{INFO} to log-files called @code{SERVICENAME-logs}, the
928following global prefix should be used:
929
930@example
931GLOBAL_POSTFIX = -l $SERVICEHOME/@{@}-logs -L INFO
932@end example
933
934@node Configuring the transport service and plugins
935@subsection Configuring the transport service and plugins
936
937The transport service in GNUnet is responsible to maintain basic
938connectivity to other peers.
939Besides initiating and keeping connections alive it is also responsible
940for address validation.
941
942The GNUnet transport supports more than one transport protocol.
943These protocols are configured together with the transport service.
944
945The configuration section for the transport service itself is quite
946similar to all the other services
947
948@example
949START_ON_DEMAND = YES
950@@UNIXONLY@@ PORT = 2091
951HOSTNAME = localhost
952HOME = $SERVICEHOME
953CONFIG = $DEFAULTCONFIG
954BINARY = gnunet-service-transport
955#PREFIX = valgrind
956NEIGHBOUR_LIMIT = 50
957ACCEPT_FROM = 127.0.0.1;
958ACCEPT_FROM6 = ::1;
959PLUGINS = tcp udp
960UNIXPATH = /tmp/gnunet-service-transport.sock
961@end example
962
963Different are the settings for the plugins to load @code{PLUGINS}.
964The first setting specifies which transport plugins to load.
965
966@itemize @bullet
967@item transport-unix
968A plugin for local only communication with UNIX domain sockets. Used for
969testing and available on unix systems only. Just set the port
970
971@example
972[transport-unix]
973PORT = 22086
974TESTING_IGNORE_KEYS = ACCEPT_FROM;
975@end example
976
977@item transport-tcp
978A plugin for communication with TCP. Set port to 0 for client mode with
979outbound only connections
980
981@example
982[transport-tcp]
983# Use 0 to ONLY advertise as a peer behind NAT (no port binding)
984PORT = 2086
985ADVERTISED_PORT = 2086
986TESTING_IGNORE_KEYS = ACCEPT_FROM;
987# Maximum number of open TCP connections allowed
988MAX_CONNECTIONS = 128
989@end example
990
991@item transport-udp
992A plugin for communication with UDP. Supports peer discovery using
993broadcasts.
994
995@example
996[transport-udp]
997PORT = 2086
998BROADCAST = YES
999BROADCAST_INTERVAL = 30 s
1000MAX_BPS = 1000000
1001TESTING_IGNORE_KEYS = ACCEPT_FROM;
1002@end example
1003
1004@item transport-http
1005HTTP and HTTPS support is split in two part: a client plugin initiating
1006outbound connections and a server part accepting connections from the
1007client. The client plugin just takes the maximum number of connections as
1008an argument.
1009
1010@example
1011[transport-http_client]
1012MAX_CONNECTIONS = 128
1013TESTING_IGNORE_KEYS = ACCEPT_FROM;
1014@end example
1015
1016@example
1017[transport-https_client]
1018MAX_CONNECTIONS = 128
1019TESTING_IGNORE_KEYS = ACCEPT_FROM;
1020@end example
1021
1022@noindent
1023The server has a port configured and the maximum number of connections.
1024The HTTPS part has two files with the certificate key and the certificate
1025file.
1026
1027The server plugin supports reverse proxies, so a external hostname can be
1028set using the @code{EXTERNAL_HOSTNAME} setting.
1029The webserver under this address should forward the request to the peer
1030and the configure port.
1031
1032@example
1033[transport-http_server]
1034EXTERNAL_HOSTNAME = fulcrum.net.in.tum.de/gnunet
1035PORT = 1080
1036MAX_CONNECTIONS = 128
1037TESTING_IGNORE_KEYS = ACCEPT_FROM;
1038@end example
1039
1040@example
1041[transport-https_server]
1042PORT = 4433
1043CRYPTO_INIT = NORMAL
1044KEY_FILE = https.key
1045CERT_FILE = https.cert
1046MAX_CONNECTIONS = 128
1047TESTING_IGNORE_KEYS = ACCEPT_FROM;
1048@end example
1049
1050@item transport-wlan
1051
1052The next section describes how to setup the WLAN plugin,
1053so here only the settings. Just specify the interface to use:
1054
1055@example
1056[transport-wlan]
1057# Name of the interface in monitor mode (typically monX)
1058INTERFACE = mon0
1059# Real hardware, no testing
1060TESTMODE = 0
1061TESTING_IGNORE_KEYS = ACCEPT_FROM;
1062@end example
1063@end itemize
1064
1065@node Configuring the WLAN transport plugin
1066@subsection Configuring the WLAN transport plugin
1067
1068The wlan transport plugin enables GNUnet to send and to receive data on a
1069wlan interface.
1070It has not to be connected to a wlan network as long as sender and
1071receiver are on the same channel. This enables you to get connection to
1072GNUnet where no internet access is possible, for example during
1073catastrophes or when censorship cuts you off from the internet.
1074
1075
1076@menu
1077* Requirements for the WLAN plugin::
1078* Configuration::
1079* Before starting GNUnet::
1080* Limitations and known bugs::
1081@end menu
1082
1083
1084@node Requirements for the WLAN plugin
1085@subsubsection Requirements for the WLAN plugin
1086
1087@itemize @bullet
1088
1089@item wlan network card with monitor support and packet injection
1090(see @uref{http://www.aircrack-ng.org/, aircrack-ng.org})
1091
1092@item Linux kernel with mac80211 stack, introduced in 2.6.22, tested with
10932.6.35 and 2.6.38
1094
1095@item Wlantools to create the a monitor interface, tested with airmon-ng
1096of the aircrack-ng package
1097@end itemize
1098
1099@node Configuration
1100@subsubsection Configuration
1101
1102There are the following options for the wlan plugin (they should be like
1103this in your default config file, you only need to adjust them if the
1104values are incorrect for your system)
1105
1106@example
1107# section for the wlan transport plugin
1108[transport-wlan]
1109# interface to use, more information in the
1110# "Before starting GNUnet" section of the handbook.
1111INTERFACE = mon0
1112# testmode for developers:
1113# 0 use wlan interface,
1114#1 or 2 use loopback driver for tests 1 = server, 2 = client
1115TESTMODE = 0
1116@end example
1117
1118@node Before starting GNUnet
1119@subsubsection Before starting GNUnet
1120
1121Before starting GNUnet, you have to make sure that your wlan interface is
1122in monitor mode.
1123One way to put the wlan interface into monitor mode (if your interface
1124name is wlan0) is by executing:
1125
1126@example
1127sudo airmon-ng start wlan0
1128@end example
1129
1130@noindent
1131Here is an example what the result should look like:
1132
1133@example
1134Interface Chipset Driver
1135wlan0 Intel 4965 a/b/g/n iwl4965 - [phy0]
1136(monitor mode enabled on mon0)
1137@end example
1138
1139@noindent
1140The monitor interface is mon0 is the one that you have to put into the
1141configuration file.
1142
1143@node Limitations and known bugs
1144@subsubsection Limitations and known bugs
1145
1146Wlan speed is at the maximum of 1 Mbit/s because support for choosing the
1147wlan speed with packet injection was removed in newer kernels.
1148Please pester the kernel developers about fixing this.
1149
1150The interface channel depends on the wlan network that the card is
1151connected to. If no connection has been made since the start of the
1152computer, it is usually the first channel of the card.
1153Peers will only find each other and communicate if they are on the same
1154channel. Channels must be set manually, i.e. using:
1155
1156@example
1157iwconfig wlan0 channel 1
1158@end example
1159
1160@node Configuring HTTP(S) reverse proxy functionality using Apache or nginx
1161@subsection Configuring HTTP(S) reverse proxy functionality using Apache or nginx
1162
1163The HTTP plugin supports data transfer using reverse proxies. A reverse
1164proxy forwards the HTTP request he receives with a certain URL to another
1165webserver, here a GNUnet peer.
1166
1167So if you have a running Apache or nginx webserver you can configure it to
1168be a GNUnet reverse proxy. Especially if you have a well-known webiste
1169this improves censorship resistance since it looks as normal surfing
1170behaviour.
1171
1172To do so, you have to do two things:
1173
1174@itemize @bullet
1175@item Configure your webserver to forward the GNUnet HTTP traffic
1176@item Configure your GNUnet peer to announce the respective address
1177@end itemize
1178
1179As an example we want to use GNUnet peer running:
1180
1181@itemize @bullet
1182
1183@item HTTP server plugin on @code{gnunet.foo.org:1080}
1184
1185@item HTTPS server plugin on @code{gnunet.foo.org:4433}
1186
1187@item A apache or nginx webserver on
1188@uref{http://www.foo.org/, http://www.foo.org:80/}
1189
1190@item A apache or nginx webserver on https://www.foo.org:443/
1191@end itemize
1192
1193And we want the webserver to accept GNUnet traffic under
1194@code{http://www.foo.org/bar/}. The required steps are described here:
1195
1196@menu
1197* Reverse Proxy - Configure your Apache2 HTTP webserver::
1198* Reverse Proxy - Configure your Apache2 HTTPS webserver::
1199* Reverse Proxy - Configure your nginx HTTPS webserver::
1200* Reverse Proxy - Configure your nginx HTTP webserver::
1201* Reverse Proxy - Configure your GNUnet peer::
1202@end menu
1203
1204@node Reverse Proxy - Configure your Apache2 HTTP webserver
1205@subsubsection Reverse Proxy - Configure your Apache2 HTTP webserver
1206
1207First of all you need mod_proxy installed.
1208
1209Edit your webserver configuration. Edit
1210@code{/etc/apache2/apache2.conf} or the site-specific configuration file.
1211
1212In the respective @code{server config},@code{virtual host} or
1213@code{directory} section add the following lines:
1214
1215@example
1216ProxyTimeout 300
1217ProxyRequests Off
1218<Location /bar/ >
1219ProxyPass http://gnunet.foo.org:1080/
1220ProxyPassReverse http://gnunet.foo.org:1080/
1221</Location>
1222@end example
1223
1224@node Reverse Proxy - Configure your Apache2 HTTPS webserver
1225@subsubsection Reverse Proxy - Configure your Apache2 HTTPS webserver
1226
1227We assume that you already have an HTTPS server running, if not please
1228check how to configure a HTTPS host. An uncomplicated to use example
1229is the example configuration file for Apache2/HTTPD provided in
1230@file{apache2/sites-available/default-ssl}.
1231
1232In the respective HTTPS @code{server config},@code{virtual host} or
1233@code{directory} section add the following lines:
1234
1235@example
1236SSLProxyEngine On
1237ProxyTimeout 300
1238ProxyRequests Off
1239<Location /bar/ >
1240ProxyPass https://gnunet.foo.org:4433/
1241ProxyPassReverse https://gnunet.foo.org:4433/
1242</Location>
1243@end example
1244
1245@noindent
1246More information about the apache mod_proxy configuration can be found
1247in the
1248@uref{http://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass, Apache documentation}.
1249
1250@node Reverse Proxy - Configure your nginx HTTPS webserver
1251@subsubsection Reverse Proxy - Configure your nginx HTTPS webserver
1252
1253Since nginx does not support chunked encoding, you first of all have to
1254install the @code{chunkin}
1255@uref{http://wiki.nginx.org/HttpChunkinModule, module}.
1256
1257To enable chunkin add:
1258
1259@example
1260chunkin on;
1261error_page 411 = @@my_411_error;
1262location @@my_411_error @{
1263chunkin_resume;
1264@}
1265@end example
1266
1267@noindent
1268Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or
1269the site-specific configuration file.
1270
1271In the @code{server} section add:
1272
1273@example
1274location /bar/ @{
1275proxy_pass http://gnunet.foo.org:1080/;
1276proxy_buffering off;
1277proxy_connect_timeout 5; # more than http_server
1278proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
1279proxy_http_version 1.1; # 1.0 default
1280proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
1281@}
1282@end example
1283
1284@node Reverse Proxy - Configure your nginx HTTP webserver
1285@subsubsection Reverse Proxy - Configure your nginx HTTP webserver
1286
1287Edit your webserver configuration. Edit @file{/etc/nginx/nginx.conf} or
1288the site-specific configuration file.
1289
1290In the @code{server} section add:
1291
1292@example
1293ssl_session_timeout 6m;
1294location /bar/
1295@{
1296proxy_pass https://gnunet.foo.org:4433/;
1297proxy_buffering off;
1298proxy_connect_timeout 5; # more than http_server
1299proxy_read_timeout 350; # 60 default, 300s is GNUnet's idle timeout
1300proxy_http_version 1.1; # 1.0 default
1301proxy_next_upstream error timeout invalid_header http_500 http_503 http_502 http_504;
1302@}
1303@end example
1304
1305@node Reverse Proxy - Configure your GNUnet peer
1306@subsubsection Reverse Proxy - Configure your GNUnet peer
1307
1308To have your GNUnet peer announce the address, you have to specify the
1309@code{EXTERNAL_HOSTNAME} option in the @code{[transport-http_server]}
1310section:
1311
1312@example
1313[transport-http_server]
1314EXTERNAL_HOSTNAME = http://www.foo.org/bar/
1315@end example
1316
1317@noindent
1318and/or @code{[transport-https_server]} section:
1319
1320@example
1321[transport-https_server]
1322EXTERNAL_HOSTNAME = https://www.foo.org/bar/
1323@end example
1324
1325@noindent
1326Now restart your webserver and your peer...
1327
1328@node Blacklisting peers
1329@subsection Blacklisting peers
1330
1331Transport service supports to deny connecting to a specific peer of to a
1332specific peer with a specific transport plugin using te blacklisting
1333component of transport service. With@ blacklisting it is possible to deny
1334connections to specific peers of@ to use a specific plugin to a specific
1335peer. Peers can be blacklisted using@ the configuration or a blacklist
1336client can be asked.
1337
1338To blacklist peers using the configuration you have to add a section to
1339your configuration containing the peer id of the peer to blacklist and
1340the plugin@ if required.
1341
1342Examples:
1343
1344To blacklist connections to P565... on peer AG2P... using tcp add:
1345
1346@c FIXME: This is too long and produces errors in the pdf.
1347@example
1348[transport-blacklist AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
1349P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G = tcp
1350@end example
1351
1352To blacklist connections to P565... on peer AG2P... using all plugins add:
1353
1354@example
1355[transport-blacklist-AG2PHES1BARB9IJCPAMJTFPVJ5V3A72S3F2A8SBUB8DAQ2V0O3V8G6G2JU56FHGFOHMQVKBSQFV98TCGTC3RJ1NINP82G0RC00N1520]
1356P565723JO1C2HSN6J29TAQ22MN6CI8HTMUU55T0FUQG4CMDGGEQ8UCNBKUMB94GC8R9G4FB2SF9LDOBAJ6AMINBP4JHHDD6L7VD801G =
1357@end example
1358
1359You can also add a blacklist client usign the blacklist API. On a
1360blacklist check, blacklisting first checks internally if the peer is
1361blacklisted and if not, it asks the blacklisting clients. Clients are
1362asked if it is OK to connect to a peer ID, the plugin is omitted.
1363
1364On blacklist check for (peer, plugin)
1365
1366@itemize @bullet
1367@item Do we have a local blacklist entry for this peer and this plugin?
1368@item YES: disallow connection
1369@item Do we have a local blacklist entry for this peer and all plugins?
1370@item YES: disallow connection
1371@item Does one of the clients disallow?
1372@item YES: disallow connection
1373@end itemize
1374
1375@node Configuration of the HTTP and HTTPS transport plugins
1376@subsection Configuration of the HTTP and HTTPS transport plugins
1377
1378The client parts of the http and https transport plugins can be configured
1379to use a proxy to connect to the hostlist server. This functionality can
1380be configured in the configuration file directly or using the
1381gnunet-setup tool.
1382
1383Both the HTTP and HTTPS clients support the following proxy types at
1384the moment:
1385
1386@itemize @bullet
1387@item HTTP 1.1 proxy
1388@item SOCKS 4/4a/5/5 with hostname
1389@end itemize
1390
1391In addition authentication at the proxy with username and password can be
1392configured.
1393
1394To configure proxy support for the clients in the gnunet-setup tool,
1395select the "transport" tab and activate the respective plugin. Now you
1396can select the appropriate proxy type. The hostname or IP address
1397(including port if required) has to be entered in the "Proxy hostname"
1398textbox. If required, enter username and password in the "Proxy username"
1399and "Proxy password" boxes. Be aware that these information will be stored
1400in the configuration in plain text.
1401
1402To configure these options directly in the configuration, you can
1403configure the following settings in the @code{[transport-http_client]}
1404and @code{[transport-https_client]} section of the configuration:
1405
1406@example
1407# Type of proxy server,
1408# Valid values: HTTP, SOCKS4, SOCKS5, SOCKS4A, SOCKS5_HOSTNAME
1409# Default: HTTP
1410# PROXY_TYPE = HTTP
1411
1412# Hostname or IP of proxy server
1413# PROXY =
1414# User name for proxy server
1415# PROXY_USERNAME =
1416# User password for proxy server
1417# PROXY_PASSWORD =
1418@end example
1419
1420@node Configuring the GNU Name System
1421@subsection Configuring the GNU Name System
1422
1423@menu
1424* Configuring system-wide DNS interception::
1425* Configuring the GNS nsswitch plugin::
1426* Configuring GNS on W32::
1427* GNS Proxy Setup::
1428* Setup of the GNS CA::
1429* Testing the GNS setup::
1430@end menu
1431
1432
1433@node Configuring system-wide DNS interception
1434@subsubsection Configuring system-wide DNS interception
1435
1436Before you install GNUnet, make sure you have a user and group 'gnunet'
1437as well as an empty group 'gnunetdns'.
1438
1439When using GNUnet with system-wide DNS interception, it is absolutely
1440necessary for all GNUnet service processes to be started by
1441@code{gnunet-service-arm} as user and group 'gnunet'. You also need to be
1442sure to run @code{make install} as root (or use the @code{sudo} option to
1443configure) to grant GNUnet sufficient privileges.
1444
1445With this setup, all that is required for enabling system-wide DNS
1446interception is for some GNUnet component (VPN or GNS) to request it.
1447The @code{gnunet-service-dns} will then start helper programs that will
1448make the necessary changes to your firewall (@code{iptables}) rules.
1449
1450Note that this will NOT work if your system sends out DNS traffic to a
1451link-local IPv6 address, as in this case GNUnet can intercept the traffic,
1452but not inject the responses from the link-local IPv6 address. Hence you
1453cannot use system-wide DNS interception in conjunction with link-local
1454IPv6-based DNS servers. If such a DNS server is used, it will bypass
1455GNUnet's DNS traffic interception.
1456
1457Using the GNU Name System (GNS) requires two different configuration
1458steps.
1459First of all, GNS needs to be integrated with the operating system. Most
1460of this section is about the operating system level integration.
1461
1462The remainder of this chapter will detail the various methods for
1463configuring the use of GNS with your operating system.
1464
1465At this point in time you have different options depending on your OS:
1466
1467@table @asis
1468
1469@item Use the gnunet-gns-proxy This approach works for all operating
1470systems and is likely the easiest. However, it enables GNS only for
1471browsers, not for other applications that might be using DNS, such as SSH.
1472Still, using the proxy is required for using HTTP with GNS and is thus
1473recommended for all users. To do this, you simply have to run the
1474@code{gnunet-gns-proxy-setup-ca} script as the user who will run the
1475browser (this will create a GNS certificate authority (CA) on your system
1476and import its key into your browser), then start @code{gnunet-gns-proxy}
1477and inform your browser to use the Socks5 proxy which
1478@code{gnunet-gns-proxy} makes available by default on port 7777.
1479@item Use a nsswitch plugin (recommended on GNU systems)
1480This approach has the advantage of offering fully personalized resolution
1481even on multi-user systems. A potential disadvantage is that some
1482applications might be able to bypass GNS.
1483@item Use a W32 resolver plugin (recommended on W32)
1484This is currently the only option on W32 systems.
1485@item Use system-wide DNS packet interception
1486This approach is recommended for the GNUnet VPN. It can be used to handle
1487GNS at the same time; however, if you only use this method, you will only
1488get one root zone per machine (not so great for multi-user systems).
1489@end table
1490
1491You can combine system-wide DNS packet interception with the nsswitch
1492plugin.
1493The setup of the system-wide DNS interception is described here. All of
1494the other GNS-specific configuration steps are described in the following
1495sections.
1496
1497@node Configuring the GNS nsswitch plugin
1498@subsubsection Configuring the GNS nsswitch plugin
1499
1500The Name Service Switch (NSS) is a facility in Unix-like operating systems
1501(in most cases provided by the GNU C Library)
1502that provides a variety of sources for common configuration databases and
1503name resolution mechanisms.
1504A superuser (system administrator) usually configures the
1505operating system's name services using the file
1506@file{/etc/nsswitch.conf}.
1507
1508GNS provides a NSS plugin to integrate GNS name resolution with the
1509operating system's name resolution process.
1510To use the GNS NSS plugin you have to either
1511
1512@itemize @bullet
1513@item install GNUnet as root or
1514@item compile GNUnet with the @code{--with-sudo=yes} switch.
1515@end itemize
1516
1517Name resolution is controlled by the @emph{hosts} section in the NSS
1518configuration. By default this section first performs a lookup in the
1519@file{/etc/hosts} file and then in DNS.
1520The nsswitch file should contain a line similar to:
1521
1522@example
1523hosts: files dns [NOTFOUND=return] mdns4_minimal mdns4
1524@end example
1525
1526@noindent
1527Here the GNS NSS plugin can be added to perform a GNS lookup before
1528performing a DNS lookup.
1529The GNS NSS plugin has to be added to the "hosts" section in
1530@file{/etc/nsswitch.conf} file before DNS related plugins:
1531
1532@example
1533...
1534hosts: files gns [NOTFOUND=return] dns mdns4_minimal mdns4
1535...
1536@end example
1537
1538@noindent
1539The @code{NOTFOUND=return} will ensure that if a @code{.gnu} name is not
1540found in GNS it will not be queried in DNS.
1541
1542@node Configuring GNS on W32
1543@subsubsection Configuring GNS on W32
1544
1545This document is a guide to configuring GNU Name System on W32-compatible
1546platforms.
1547
1548After GNUnet is installed, run the w32nsp-install tool:
1549
1550@example
1551w32nsp-install.exe libw32nsp-0.dll
1552@end example
1553
1554@noindent
1555('0' is the library version of W32 NSP; it might increase in the future,
1556change the invocation accordingly).
1557
1558This will install GNS namespace provider into the system and allow other
1559applications to resolve names that end in '@strong{gnu}'
1560and '@strong{zkey}'. Note that namespace provider requires
1561gnunet-gns-helper-service-w32 to be running, as well as gns service
1562itself (and its usual dependencies).
1563
1564Namespace provider is hardcoded to connect to @strong{127.0.0.1:5353},
1565and this is where gnunet-gns-helper-service-w32 should be listening to
1566(and is configured to listen to by default).
1567
1568To uninstall the provider, run:
1569
1570@example
1571w32nsp-uninstall.exe
1572@end example
1573
1574@noindent
1575(uses provider GUID to uninstall it, does not need a dll name).
1576
1577Note that while MSDN claims that other applications will only be able to
1578use the new namespace provider after re-starting, in reality they might
1579stat to use it without that. Conversely, they might stop using the
1580provider after it's been uninstalled, even if they were not re-started.
1581W32 will not permit namespace provider library to be deleted or
1582overwritten while the provider is installed, and while there is at least
1583one process still using it (even after it was uninstalled).
1584
1585@node GNS Proxy Setup
1586@subsubsection GNS Proxy Setup
1587
1588When using the GNU Name System (GNS) to browse the WWW, there are several
1589issues that can be solved by adding the GNS Proxy to your setup:
1590
1591@itemize @bullet
1592
1593@item If the target website does not support GNS, it might assume that it
1594is operating under some name in the legacy DNS system (such as
1595example.com). It may then attempt to set cookies for that domain, and the
1596web server might expect a @code{Host: example.com} header in the request
1597from your browser.
1598However, your browser might be using @code{example.gnu} for the
1599@code{Host} header and might only accept (and send) cookies for
1600@code{example.gnu}. The GNS Proxy will perform the necessary translations
1601of the hostnames for cookies and HTTP headers (using the LEHO record for
1602the target domain as the desired substitute).
1603
1604@item If using HTTPS, the target site might include an SSL certificate
1605which is either only valid for the LEHO domain or might match a TLSA
1606record in GNS. However, your browser would expect a valid certificate for
1607@code{example.gnu}, not for some legacy domain name. The proxy will
1608validate the certificate (either against LEHO or TLSA) and then
1609on-the-fly produce a valid certificate for the exchange, signed by your
1610own CA. Assuming you installed the CA of your proxy in your browser's
1611certificate authority list, your browser will then trust the
1612HTTPS/SSL/TLS connection, as the hostname mismatch is hidden by the proxy.
1613
1614@item Finally, the proxy will in the future indicate to the server that it
1615speaks GNS, which will enable server operators to deliver GNS-enabled web
1616sites to your browser (and continue to deliver legacy links to legacy
1617browsers)
1618@end itemize
1619
1620@node Setup of the GNS CA
1621@subsubsection Setup of the GNS CA
1622
1623First you need to create a CA certificate that the proxy can use.
1624To do so use the provided script gnunet-gns-proxy-ca:
1625
1626@example
1627$ gnunet-gns-proxy-setup-ca
1628@end example
1629
1630@noindent
1631This will create a personal certification authority for you and add this
1632authority to the firefox and chrome database. The proxy will use the this
1633CA certificate to generate @code{*.gnu} client certificates on the fly.
1634
1635Note that the proxy uses libcurl. Make sure your version of libcurl uses
1636GnuTLS and NOT OpenSSL. The proxy will @b{not} work with libcurl compiled
1637against OpenSSL.
1638
1639You can check the configuration your libcurl was build with by
1640running:
1641
1642@example
1643curl --version
1644@end example
1645
1646the output will look like this (without the linebreaks):
1647
1648@example
1649gnurl --version
1650curl 7.56.0 (x86_64-unknown-linux-gnu) libcurl/7.56.0 \
1651GnuTLS/3.5.13 zlib/1.2.11 libidn2/2.0.4
1652Release-Date: 2017-10-08
1653Protocols: http https
1654Features: AsynchDNS IDN IPv6 Largefile NTLM SSL libz \
1655TLS-SRP UnixSockets HTTPS-proxy
1656@end example
1657
1658@node Testing the GNS setup
1659@subsubsection Testing the GNS setup
1660
1661Now for testing purposes we can create some records in our zone to test
1662the SSL functionality of the proxy:
1663
1664@example
1665$ gnunet-identity -C test
1666$ gnunet-namestore -a -e "1 d" -n "homepage" \
1667 -t A -V 131.159.74.67 -z test
1668$ gnunet-namestore -a -e "1 d" -n "homepage" \
1669 -t LEHO -V "gnunet.org" -z test
1670@end example
1671
1672@noindent
1673At this point we can start the proxy. Simply execute
1674
1675@example
1676$ gnunet-gns-proxy
1677@end example
1678
1679@noindent
1680Configure your browser to use this SOCKSv5 proxy on port 7777 and visit
1681this link.
1682If you use @command{Firefox} (or one of its derivatives/forks such as
1683Icecat) you also have to go to @code{about:config} and set the key
1684@code{network.proxy.socks_remote_dns} to @code{true}.
1685
1686When you visit @code{https://homepage.test/}, you should get to the
1687@code{https://gnunet.org/} frontpage and the browser (with the correctly
1688configured proxy) should give you a valid SSL certificate for
1689@code{homepage.gnu} and no warnings. It should look like this:
1690
1691@c FIXME: Image does not exist, create it or save it from Drupal?
1692@c @image{images/gnunethpgns.png,5in,, picture of homepage.gnu in Webbrowser}
1693
1694
1695@node Configuring the GNUnet VPN
1696@subsection Configuring the GNUnet VPN
1697
1698@menu
1699* IPv4 address for interface::
1700* IPv6 address for interface::
1701* Configuring the GNUnet VPN DNS::
1702* Configuring the GNUnet VPN Exit Service::
1703* IP Address of external DNS resolver::
1704* IPv4 address for Exit interface::
1705* IPv6 address for Exit interface::
1706@end menu
1707
1708Before configuring the GNUnet VPN, please make sure that system-wide DNS
1709interception is configured properly as described in the section on the
1710GNUnet DNS setup. @pxref{Configuring the GNU Name System},
1711if you haven't done so already.
1712
1713The default options for the GNUnet VPN are usually sufficient to use
1714GNUnet as a Layer 2 for your Internet connection.
1715However, what you always have to specify is which IP protocol you want
1716to tunnel: IPv4, IPv6 or both.
1717Furthermore, if you tunnel both, you most likely should also tunnel
1718all of your DNS requests.
1719You theoretically can tunnel "only" your DNS traffic, but that usually
1720makes little sense.
1721
1722The other options as shown on the gnunet-setup tool are:
1723
1724@node IPv4 address for interface
1725@subsubsection IPv4 address for interface
1726
1727This is the IPv4 address the VPN interface will get. You should pick an
1728'private' IPv4 network that is not yet in use for you system. For example,
1729if you use @code{10.0.0.1/255.255.0.0} already, you might use
1730@code{10.1.0.1/255.255.0.0}.
1731If you use @code{10.0.0.1/255.0.0.0} already, then you might use
1732@code{192.168.0.1/255.255.0.0}.
1733If your system is not in a private IP-network, using any of the above will
1734work fine.
1735You should try to make the mask of the address big enough
1736(@code{255.255.0.0} or, even better, @code{255.0.0.0}) to allow more
1737mappings of remote IP Addresses into this range.
1738However, even a @code{255.255.255.0} mask will suffice for most users.
1739
1740@node IPv6 address for interface
1741@subsubsection IPv6 address for interface
1742
1743The IPv6 address the VPN interface will get. Here you can specify any
1744non-link-local address (the address should not begin with @code{fe80:}).
1745A subnet Unique Local Unicast (@code{fd00::/8} prefix) that you are
1746currently not using would be a good choice.
1747
1748@node Configuring the GNUnet VPN DNS
1749@subsubsection Configuring the GNUnet VPN DNS
1750
1751To resolve names for remote nodes, activate the DNS exit option.
1752
1753@node Configuring the GNUnet VPN Exit Service
1754@subsubsection Configuring the GNUnet VPN Exit Service
1755
1756If you want to allow other users to share your Internet connection (yes,
1757this may be dangerous, just as running a Tor exit node) or want to
1758provide access to services on your host (this should be less dangerous,
1759as long as those services are secure), you have to enable the GNUnet exit
1760daemon.
1761
1762You then get to specify which exit functions you want to provide. By
1763enabling the exit daemon, you will always automatically provide exit
1764functions for manually configured local services (this component of the
1765system is under
1766development and not documented further at this time). As for those
1767services you explicitly specify the target IP address and port, there is
1768no significant security risk in doing so.
1769
1770Furthermore, you can serve as a DNS, IPv4 or IPv6 exit to the Internet.
1771Being a DNS exit is usually pretty harmless. However, enabling IPv4 or
1772IPv6-exit without further precautions may enable adversaries to access
1773your local network, send spam, attack other systems from your Internet
1774connection and to other mischief that will appear to come from your
1775machine. This may or may not get you into legal trouble.
1776If you want to allow IPv4 or IPv6-exit functionality, you should strongly
1777consider adding additional firewall rules manually to protect your local
1778network and to restrict outgoing TCP traffic (i.e. by not allowing access
1779to port 25). While we plan to improve exit-filtering in the future,
1780you're currently on your own here.
1781Essentially, be prepared for any kind of IP-traffic to exit the respective
1782TUN interface (and GNUnet will enable IP-forwarding and NAT for the
1783interface automatically).
1784
1785Additional configuration options of the exit as shown by the gnunet-setup
1786tool are:
1787
1788@node IP Address of external DNS resolver
1789@subsubsection IP Address of external DNS resolver
1790
1791If DNS traffic is to exit your machine, it will be send to this DNS
1792resolver. You can specify an IPv4 or IPv6 address.
1793
1794@node IPv4 address for Exit interface
1795@subsubsection IPv4 address for Exit interface
1796
1797This is the IPv4 address the Interface will get. Make the mask of the
1798address big enough (255.255.0.0 or, even better, 255.0.0.0) to allow more
1799mappings of IP addresses into this range. As for the VPN interface, any
1800unused, private IPv4 address range will do.
1801
1802@node IPv6 address for Exit interface
1803@subsubsection IPv6 address for Exit interface
1804
1805The public IPv6 address the interface will get. If your kernel is not a
1806very recent kernel and you are willing to manually enable IPv6-NAT, the
1807IPv6 address you specify here must be a globally routed IPv6 address of
1808your host.
1809
1810Suppose your host has the address @code{2001:4ca0::1234/64}, then
1811using @code{2001:4ca0::1:0/112} would be fine (keep the first 64 bits,
1812then change at least one bit in the range before the bitmask, in the
1813example above we changed bit 111 from 0 to 1).
1814
1815You may also have to configure your router to route traffic for the entire
1816subnet (@code{2001:4ca0::1:0/112} for example) through your computer (this
1817should be automatic with IPv6, but obviously anything can be
1818disabled).
1819
1820@node Bandwidth Configuration
1821@subsection Bandwidth Configuration
1822
1823You can specify how many bandwidth GNUnet is allowed to use to receive
1824and send data. This is important for users with limited bandwidth or
1825traffic volume.
1826
1827@node Configuring NAT
1828@subsection Configuring NAT
1829
1830Most hosts today do not have a normal global IP address but instead are
1831behind a router performing Network Address Translation (NAT) which assigns
1832each host in the local network a private IP address.
1833As a result, these machines cannot trivially receive inbound connections
1834from the Internet. GNUnet supports NAT traversal to enable these machines
1835to receive incoming connections from other peers despite their
1836limitations.
1837
1838In an ideal world, you can press the "Attempt automatic configuration"
1839button in gnunet-setup to automatically configure your peer correctly.
1840Alternatively, your distribution might have already triggered this
1841automatic configuration during the installation process.
1842However, automatic configuration can fail to determine the optimal
1843settings, resulting in your peer either not receiving as many connections
1844as possible, or in the worst case it not connecting to the network at all.
1845
1846To manually configure the peer, you need to know a few things about your
1847network setup. First, determine if you are behind a NAT in the first
1848place.
1849This is always the case if your IP address starts with "10.*" or
1850"192.168.*". Next, if you have control over your NAT router, you may
1851choose to manually configure it to allow GNUnet traffic to your host.
1852If you have configured your NAT to forward traffic on ports 2086 (and
1853possibly 1080) to your host, you can check the "NAT ports have been opened
1854manually" option, which corresponds to the "PUNCHED_NAT" option in the
1855configuration file. If you did not punch your NAT box, it may still be
1856configured to support UPnP, which allows GNUnet to automatically
1857configure it. In that case, you need to install the "upnpc" command,
1858enable UPnP (or PMP) on your NAT box and set the "Enable NAT traversal
1859via UPnP or PMP" option (corresponding to "ENABLE_UPNP" in the
1860configuration file).
1861
1862Some NAT boxes can be traversed using the autonomous NAT traversal method.
1863This requires certain GNUnet components to be installed with "SUID"
1864privileges on your system (so if you're installing on a system you do
1865not have administrative rights to, this will not work).
1866If you installed as 'root', you can enable autonomous NAT traversal by
1867checking the "Enable NAT traversal using ICMP method".
1868The ICMP method requires a way to determine your NAT's external (global)
1869IP address. This can be done using either UPnP, DynDNS, or by manual
1870configuration. If you have a DynDNS name or know your external IP address,
1871you should enter that name under "External (public) IPv4 address" (which
1872corresponds to the "EXTERNAL_ADDRESS" option in the configuration file).
1873If you leave the option empty, GNUnet will try to determine your external
1874IP address automatically (which may fail, in which case autonomous
1875NAT traversal will then not work).
1876
1877Finally, if you yourself are not behind NAT but want to be able to
1878connect to NATed peers using autonomous NAT traversal, you need to check
1879the "Enable connecting to NATed peers using ICMP method" box.
1880
1881
1882@node Peer configuration for distributions
1883@subsection Peer configuration for distributions
1884
1885The "GNUNET_DATA_HOME" in "[path]" in @file{/etc/gnunet.conf} should be
1886manually set to "/var/lib/gnunet/data/" as the default
1887"~/.local/share/gnunet/" is probably not that appropriate in this case.
1888Similarly, distributions may consider pointing "GNUNET_RUNTIME_DIR" to
1889"/var/run/gnunet/" and "GNUNET_HOME" to "/var/lib/gnunet/". Also, should a
1890distribution decide to override system defaults, all of these changes
1891should be done in a custom @file{/etc/gnunet.conf} and not in the files
1892in the @file{config.d/} directory.
1893
1894Given the proposed access permissions, the "gnunet-setup" tool must be
1895run as use "gnunet" (and with option "-c /etc/gnunet.conf" so that it
1896modifies the system configuration). As always, gnunet-setup should be run
1897after the GNUnet peer was stopped using "gnunet-arm -e". Distributions
1898might want to include a wrapper for gnunet-setup that allows the
1899desktop-user to "sudo" (i.e. using gtksudo) to the "gnunet" user account
1900and then runs "gnunet-arm -e", "gnunet-setup" and "gnunet-arm -s" in
1901sequence.
1902
1903@node MOVED FROM USER Config Leftovers
1904@section MOVED FROM USER Config Leftovers
1905
1906This section describes how to start a GNUnet peer. It assumes that you
1907have already compiled and installed GNUnet and its' dependencies.
1908Before you start a GNUnet peer, you may want to create a configuration
1909file using gnunet-setup (but you do not have to).
1910Sane defaults should exist in your
1911@file{$GNUNET_PREFIX/share/gnunet/config.d/} directory, so in practice
1912you could simply start without any configuration. If you want to
1913configure your peer later, you need to stop it before invoking the
1914@code{gnunet-setup} tool to customize further and to test your
1915configuration (@code{gnunet-setup} has build-in test functions).
1916
1917The most important option you might have to still set by hand is in
1918[PATHS]. Here, you use the option "GNUNET_HOME" to specify the path where
1919GNUnet should store its data.
1920It defaults to @code{$HOME/}, which again should work for most users.
1921Make sure that the directory specified as GNUNET_HOME is writable to
1922the user that you will use to run GNUnet (note that you can run frontends
1923using other users, GNUNET_HOME must only be accessible to the user used to
1924run the background processes).
1925
1926You will also need to make one central decision: should all of GNUnet be
1927run under your normal UID, or do you want distinguish between system-wide
1928(user-independent) GNUnet services and personal GNUnet services. The
1929multi-user setup is slightly more complicated, but also more secure and
1930generally recommended.
1931
1932@menu
1933* The Single-User Setup::
1934* The Multi-User Setup::
1935* Killing GNUnet services::
1936* Access Control for GNUnet::
1937@end menu
1938
1939@node The Single-User Setup
1940@subsection The Single-User Setup
1941
1942For the single-user setup, you do not need to do anything special and can
1943just start the GNUnet background processes using @code{gnunet-arm}.
1944By default, GNUnet looks in @file{~/.config/gnunet.conf} for a
1945configuration (or @code{$XDG_CONFIG_HOME/gnunet.conf} if@
1946@code{$XDG_CONFIG_HOME} is defined). If your configuration lives
1947elsewhere, you need to pass the @code{-c FILENAME} option to all GNUnet
1948commands.
1949
1950Assuming the configuration file is called @file{~/.config/gnunet.conf},
1951you start your peer using the @code{gnunet-arm} command (say as user
1952@code{gnunet}) using:
1953
1954@example
1955gnunet-arm -c ~/.config/gnunet.conf -s
1956@end example
1957
1958@noindent
1959The "-s" option here is for "start". The command should return almost
1960instantly. If you want to stop GNUnet, you can use:
1961
1962@example
1963gnunet-arm -c ~/.config/gnunet.conf -e
1964@end example
1965
1966@noindent
1967The "-e" option here is for "end".
1968
1969Note that this will only start the basic peer, no actual applications
1970will be available.
1971If you want to start the file-sharing service, use (after starting
1972GNUnet):
1973
1974@example
1975gnunet-arm -c ~/.config/gnunet.conf -i fs
1976@end example
1977
1978@noindent
1979The "-i fs" option here is for "initialize" the "fs" (file-sharing)
1980application. You can also selectively kill only file-sharing support using
1981
1982@example
1983gnunet-arm -c ~/.config/gnunet.conf -k fs
1984@end example
1985
1986@noindent
1987Assuming that you want certain services (like file-sharing) to be always
1988automatically started whenever you start GNUnet, you can activate them by
1989setting "IMMEDIATE_START=YES" in the respective section of the configuration
1990file (for example, "[fs]"). Then GNUnet with file-sharing support would
1991be started whenever you@ enter:
1992
1993@example
1994gnunet-arm -c ~/.config/gnunet.conf -s
1995@end example
1996
1997@noindent
1998Alternatively, you can combine the two options:
1999
2000@example
2001gnunet-arm -c ~/.config/gnunet.conf -s -i fs
2002@end example
2003
2004@noindent
2005Using @code{gnunet-arm} is also the preferred method for initializing
2006GNUnet from @code{init}.
2007
2008Finally, you should edit your @code{crontab} (using the @code{crontab}
2009command) and insert a line@
2010
2011@example
2012@@reboot gnunet-arm -c ~/.config/gnunet.conf -s
2013@end example
2014
2015to automatically start your peer whenever your system boots.
2016
2017@node The Multi-User Setup
2018@subsection The Multi-User Setup
2019
2020This requires you to create a user @code{gnunet} and an additional group
2021@code{gnunetdns}, prior to running @code{make install} during
2022installation.
2023Then, you create a configuration file @file{/etc/gnunet.conf} which should
2024contain the lines:@
2025
2026@example
2027[arm]
2028START_SYSTEM_SERVICES = YES
2029START_USER_SERVICES = NO
2030@end example
2031
2032@noindent
2033Then, perform the same steps to run GNUnet as in the per-user
2034configuration, except as user @code{gnunet} (including the
2035@code{crontab} installation).
2036You may also want to run @code{gnunet-setup} to configure your peer
2037(databases, etc.).
2038Make sure to pass @code{-c /etc/gnunet.conf} to all commands. If you
2039run @code{gnunet-setup} as user @code{gnunet}, you might need to change
2040permissions on @file{/etc/gnunet.conf} so that the @code{gnunet} user can
2041write to the file (during setup).
2042
2043Afterwards, you need to perform another setup step for each normal user
2044account from which you want to access GNUnet. First, grant the normal user
2045(@code{$USER}) permission to the group gnunet:
2046
2047@example
2048# adduser $USER gnunet
2049@end example
2050
2051@noindent
2052Then, create a configuration file in @file{~/.config/gnunet.conf} for the
2053$USER with the lines:
2054
2055@example
2056[arm]
2057START_SYSTEM_SERVICES = NO
2058START_USER_SERVICES = YES
2059@end example
2060
2061@noindent
2062This will ensure that @code{gnunet-arm} when started by the normal user
2063will only run services that are per-user, and otherwise rely on the
2064system-wide services.
2065Note that the normal user may run gnunet-setup, but the
2066configuration would be ineffective as the system-wide services will use
2067@file{/etc/gnunet.conf} and ignore options set by individual users.
2068
2069Again, each user should then start the peer using
2070@file{gnunet-arm -s} --- and strongly consider adding logic to start
2071the peer automatically to their crontab.
2072
2073Afterwards, you should see two (or more, if you have more than one USER)
2074@code{gnunet-service-arm} processes running in your system.
2075
2076@node Killing GNUnet services
2077@subsection Killing GNUnet services
2078
2079It is not necessary to stop GNUnet services explicitly when shutting
2080down your computer.
2081
2082It should be noted that manually killing "most" of the
2083@code{gnunet-service} processes is generally not a successful method for
2084stopping a peer (since @code{gnunet-service-arm} will instantly restart
2085them). The best way to explicitly stop a peer is using
2086@code{gnunet-arm -e}; note that the per-user services may need to be
2087terminated before the system-wide services will terminate normally.
2088
2089@node Access Control for GNUnet
2090@subsection Access Control for GNUnet
2091
2092This chapter documents how we plan to make access control work within the
2093GNUnet system for a typical peer. It should be read as a best-practice
2094installation guide for advanced users and builders of binary
2095distributions. The recommendations in this guide apply to POSIX-systems
2096with full support for UNIX domain sockets only.
2097
2098Note that this is an advanced topic. The discussion presumes a very good
2099understanding of users, groups and file permissions. Normal users on
2100hosts with just a single user can just install GNUnet under their own
2101account (and possibly allow the installer to use SUDO to grant additional
2102permissions for special GNUnet tools that need additional rights).
2103The discussion below largely applies to installations where multiple users
2104share a system and to installations where the best possible security is
2105paramount.
2106
2107A typical GNUnet system consists of components that fall into four
2108categories:
2109
2110@table @asis
2111
2112@item User interfaces
2113User interfaces are not security sensitive and are supposed to be run and
2114used by normal system users.
2115The GTK GUIs and most command-line programs fall into this category.
2116Some command-line tools (like gnunet-transport) should be excluded as they
2117offer low-level access that normal users should not need.
2118@item System services and support tools
2119System services should always run and offer services that can then be
2120accessed by the normal users.
2121System services do not require special permissions, but as they are not
2122specific to a particular user, they probably should not run as a
2123particular user. Also, there should typically only be one GNUnet peer per
2124host. System services include the gnunet-service and gnunet-daemon
2125programs; support tools include command-line programs such as gnunet-arm.
2126@item Privileged helpers
2127Some GNUnet components require root rights to open raw sockets or perform
2128other special operations. These gnunet-helper binaries are typically
2129installed SUID and run from services or daemons.
2130@item Critical services
2131Some GNUnet services (such as the DNS service) can manipulate the service
2132in deep and possibly highly security sensitive ways. For example, the DNS
2133service can be used to intercept and alter any DNS query originating from
2134the local machine. Access to the APIs of these critical services and their
2135privileged helpers must be tightly controlled.
2136@end table
2137
2138@c FIXME: The titles of these chapters are too long in the index.
2139
2140@menu
2141* Recommendation - Disable access to services via TCP::
2142* Recommendation - Run most services as system user "gnunet"::
2143* Recommendation - Control access to services using group "gnunet"::
2144* Recommendation - Limit access to certain SUID binaries by group "gnunet"::
2145* Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"::
2146* Differences between "make install" and these recommendations::
2147@end menu
2148
2149@node Recommendation - Disable access to services via TCP
2150@subsubsection Recommendation - Disable access to services via TCP
2151
2152GNUnet services allow two types of access: via TCP socket or via UNIX
2153domain socket.
2154If the service is available via TCP, access control can only be
2155implemented by restricting connections to a particular range of IP
2156addresses.
2157This is acceptable for non-critical services that are supposed to be
2158available to all users on the local system or local network.
2159However, as TCP is generally less efficient and it is rarely the case
2160that a single GNUnet peer is supposed to serve an entire local network,
2161the default configuration should disable TCP access to all GNUnet
2162services on systems with support for UNIX domain sockets.
2163As of GNUnet 0.9.2, configuration files with TCP access disabled should be
2164generated by default. Users can re-enable TCP access to particular
2165services simply by specifying a non-zero port number in the section of
2166the respective service.
2167
2168
2169@node Recommendation - Run most services as system user "gnunet"
2170@subsubsection Recommendation - Run most services as system user "gnunet"
2171
2172GNUnet's main services should be run as a separate user "gnunet" in a
2173special group "gnunet".
2174The user "gnunet" should start the peer using "gnunet-arm -s" during
2175system startup. The home directory for this user should be
2176@file{/var/lib/gnunet} and the configuration file should be
2177@file{/etc/gnunet.conf}.
2178Only the @code{gnunet} user should have the right to access
2179@file{/var/lib/gnunet} (@emph{mode: 700}).
2180
2181@node Recommendation - Control access to services using group "gnunet"
2182@subsubsection Recommendation - Control access to services using group "gnunet"
2183
2184Users that should be allowed to use the GNUnet peer should be added to the
2185group "gnunet". Using GNUnet's access control mechanism for UNIX domain
2186sockets, those services that are considered useful to ordinary users
2187should be made available by setting "UNIX_MATCH_GID=YES" for those
2188services.
2189Again, as shipped, GNUnet provides reasonable defaults.
2190Permissions to access the transport and core subsystems might additionally
2191be granted without necessarily causing security concerns.
2192Some services, such as DNS, must NOT be made accessible to the "gnunet"
2193group (and should thus only be accessible to the "gnunet" user and
2194services running with this UID).
2195
2196@node Recommendation - Limit access to certain SUID binaries by group "gnunet"
2197@subsubsection Recommendation - Limit access to certain SUID binaries by group "gnunet"
2198
2199Most of GNUnet's SUID binaries should be safe even if executed by normal
2200users. However, it is possible to reduce the risk a little bit more by
2201making these binaries owned by the group "gnunet" and restricting their
2202execution to user of the group "gnunet" as well (4750).
2203
2204@node Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"
2205@subsubsection Recommendation - Limit access to critical gnunet-helper-dns to group "gnunetdns"
2206
2207A special group "gnunetdns" should be created for controlling access to
2208the "gnunet-helper-dns".
2209The binary should then be owned by root and be in group "gnunetdns" and
2210be installed SUID and only be group-executable (2750).
2211@b{Note that the group "gnunetdns" should have no users in it at all,
2212ever.}
2213The "gnunet-service-dns" program should be executed by user "gnunet" (via
2214gnunet-service-arm) with the binary owned by the user "root" and the group
2215"gnunetdns" and be SGID (2700). This way, @strong{only}
2216"gnunet-service-dns" can change its group to "gnunetdns" and execute the
2217helper, and the helper can then run as root (as per SUID).
2218Access to the API offered by "gnunet-service-dns" is in turn restricted
2219to the user "gnunet" (not the group!), which means that only
2220"benign" services can manipulate DNS queries using "gnunet-service-dns".
2221
2222@node Differences between "make install" and these recommendations
2223@subsubsection Differences between "make install" and these recommendations
2224
2225The current build system does not set all permissions automatically based
2226on the recommendations above. In particular, it does not use the group
2227"gnunet" at all (so setting gnunet-helpers other than the
2228gnunet-helper-dns to be owned by group "gnunet" must be done manually).
2229Furthermore, 'make install' will silently fail to set the DNS binaries to
2230be owned by group "gnunetdns" unless that group already exists (!).
2231An alternative name for the "gnunetdns" group can be specified using the
2232@code{--with-gnunetdns=GRPNAME} configure option.
2233
diff --git a/doc/documentation/chapters/keyconcepts.texi b/doc/documentation/chapters/keyconcepts.texi
deleted file mode 100644
index b4a60024c..000000000
--- a/doc/documentation/chapters/keyconcepts.texi
+++ /dev/null
@@ -1,317 +0,0 @@
1
2@cindex Key Concepts
3@node Key Concepts
4@chapter Key Concepts
5
6In this section, the fundamental concepts of GNUnet are explained.
7@c FIXME: Use @uref{https://docs.gnunet.org/bib/, research papers}
8@c once we have the new bibliography + subdomain setup.
9Most of them are also described in our research papers.
10First, some of the concepts used in the GNUnet framework are detailed.
11The second part describes concepts specific to anonymous file-sharing.
12
13@menu
14* Authentication::
15* Accounting to Encourage Resource Sharing::
16* Confidentiality::
17* Anonymity::
18* Deniability::
19* Peer Identities::
20* Zones in the GNU Name System (GNS Zones)::
21* Egos::
22@end menu
23
24@cindex Authentication
25@node Authentication
26@section Authentication
27
28Almost all peer-to-peer communications in GNUnet are between mutually
29authenticated peers. The authentication works by using ECDHE, that is a
30DH (Diffie---Hellman) key exchange using ephemeral elliptic curve
31cryptography. The ephemeral ECC (Elliptic Curve Cryptography) keys are
32signed using ECDSA (@uref{http://en.wikipedia.org/wiki/ECDSA, ECDSA}).
33The shared secret from ECDHE is used to create a pair of session keys
34@c FIXME: Long word for HKDF. More FIXMEs: Explain MITM etc.
35(using HKDF) which are then used to encrypt the communication between the
36two peers using both 256-bit AES (Advanced Encryption Standard)
37and 256-bit Twofish (with independently derived secret keys).
38As only the two participating hosts know the shared secret, this
39authenticates each packet
40without requiring signatures each time. GNUnet uses SHA-512
41(Secure Hash Algorithm) hash codes to verify the integrity of messages.
42
43@c FIXME: A while back I got the feedback that I should try and integrate
44@c explanation boxes in the long-run. So we could explain
45@c "man-in-the-middle" and "man-in-the-middle attacks" and other words
46@c which are not common knowledge. MITM is not common knowledge. To be
47@c selfcontained, we should be able to explain words and concepts used in
48@c a chapter or paragraph without hinting at Wikipedia and other online
49@c sources which might not be available or accessible to everyone.
50@c On the other hand we could write an introductionary chapter or book
51@c that we could then reference in each chapter, which sound like it
52@c could be more reusable.
53In GNUnet, the identity of a host is its public key. For that reason,
54man-in-the-middle attacks will not break the authentication or accounting
55goals. Essentially, for GNUnet, the IP of the host has nothing to do with
56the identity of the host. As the public key is the only thing that truly
57matters, faking an IP, a port or any other property of the underlying
58transport protocol is irrelevant. In fact, GNUnet peers can use
59multiple IPs (IPv4 and IPv6) on multiple ports --- or even not use the
60IP protocol at all (by running directly on layer 2).
61@c FIXME: "IP protocol" feels wrong, but could be what people expect, as
62@c IP is "the number" and "IP protocol" the protocol itself in general
63@c knowledge?
64
65@c NOTE: For consistency we will use @code{HELLO}s throughout this Manual.
66GNUnet uses a special type of message to communicate a binding between
67public (ECC) keys to their current network address. These messages are
68commonly called @code{HELLO}s or @code{peer advertisements}.
69They contain the public key of the peer and its current network
70addresses for various transport services.
71A transport service is a special kind of shared library that
72provides (possibly unreliable, out-of-order) message delivery between
73peers.
74For the UDP and TCP transport services, a network address is an IP and a
75port.
76GNUnet can also use other transports (HTTP, HTTPS, WLAN, etc.) which use
77various other forms of addresses. Note that any node can have many
78different active transport services at the same time,
79and each of these can have a different addresses.
80Binding messages expire after at most a week (the timeout can be
81shorter if the user configures the node appropriately).
82This expiration ensures that the network will eventually get rid of
83outdated advertisements.
84
85For more information, refer to the following paper:
86
87Ronaldo A. Ferreira, Christian Grothoff, and Paul Ruth.
88A Transport Layer Abstraction for Peer-to-Peer Networks
89Proceedings of the 3rd International Symposium on Cluster Computing
90and the Grid (GRID 2003), 2003.
91(@uref{https://gnunet.org/git/bibliography.git/plain/docs/transport.pdf, https://gnunet.org/git/bibliography.git/plain/docs/transport.pdf})
92
93@cindex Accounting to Encourage Resource Sharing
94@node Accounting to Encourage Resource Sharing
95@section Accounting to Encourage Resource Sharing
96
97Most distributed P2P networks suffer from a lack of defenses or
98precautions against attacks in the form of freeloading.
99While the intentions of an attacker and a freeloader are different, their
100effect on the network is the same; they both render it useless.
101Most simple attacks on networks such as @command{Gnutella}
102involve flooding the network with traffic, particularly
103with queries that are, in the worst case, multiplied by the network.
104
105In order to ensure that freeloaders or attackers have a minimal impact
106on the network, GNUnet's file-sharing implementation (@code{FS} tries
107to distinguish good (contributing) nodes from malicious (freeloading)
108nodes. In GNUnet, every file-sharing node keeps track of the behavior
109of every other node it has been in contact with. Many requests
110(depending on the application) are transmitted with a priority (or
111importance) level. That priority is used to establish how important
112the sender believes this request is. If a peer responds to an
113important request, the recipient will increase its trust in the
114responder: the responder contributed resources. If a peer is too busy
115to answer all requests, it needs to prioritize. For that, peers do
116not take the priorities of the requests received at face value.
117First, they check how much they trust the sender, and depending on
118that amount of trust they assign the request a (possibly lower)
119effective priority. Then, they drop the requests with the lowest
120effective priority to satisfy their resource constraints. This way,
121GNUnet's economic model ensures that nodes that are not currently
122considered to have a surplus in contributions will not be served if
123the network load is high.
124
125For more information, refer to the following paper:
126Christian Grothoff. An Excess-Based Economic Model for Resource
127Allocation in Peer-to-Peer Networks. Wirtschaftsinformatik, June 2003.
128(@uref{https://gnunet.org/git/bibliography.git/plain/docs/ebe.pdf, https://gnunet.org/git/bibliography.git/plain/docs/ebe.pdf})
129
130@cindex Confidentiality
131@node Confidentiality
132@section Confidentiality
133
134Adversaries (malicious, bad actors) outside of GNUnet are not supposed
135to know what kind of actions a peer is involved in. Only the specific
136neighbor of a peer that is the corresponding sender or recipient of a
137message may know its contents, and even then application protocols may
138place further restrictions on that knowledge. In order to ensure
139confidentiality, GNUnet uses link encryption, that is each message
140exchanged between two peers is encrypted using a pair of keys only
141known to these two peers. Encrypting traffic like this makes any kind
142of traffic analysis much harder. Naturally, for some applications, it
143may still be desirable if even neighbors cannot determine the concrete
144contents of a message. In GNUnet, this problem is addressed by the
145specific application-level protocols. See for example the following
146sections @pxref{Anonymity}, @pxref{How file-sharing achieves Anonymity},
147and @pxref{Deniability}.
148
149@cindex Anonymity
150@node Anonymity
151@section Anonymity
152
153@menu
154* How file-sharing achieves Anonymity::
155@end menu
156
157Providing anonymity for users is the central goal for the anonymous
158file-sharing application. Many other design decisions follow in the
159footsteps of this requirement.
160Anonymity is never absolute. While there are various
161scientific metrics
162(Claudia Díaz, Stefaan Seys, Joris Claessens,
163and Bart Preneel. Towards measuring anonymity.
1642002.
165(@uref{https://gnunet.org/git/bibliography.git/plain/docs/article-89.pdf, https://gnunet.org/git/bibliography.git/plain/docs/article-89.pdf}))
166that can help quantify the level of anonymity that a given mechanism
167provides, there is no such thing as "complete anonymity".
168GNUnet's file-sharing implementation allows users to select for each
169operation (publish, search, download) the desired level of anonymity.
170The metric used is the amount of cover traffic available to hide the
171request.
172While this metric is not as good as, for example, the theoretical metric
173given in scientific metrics,
174it is probably the best metric available to a peer with a purely local
175view of the world that does not rely on unreliable external information.
176The default anonymity level is @code{1}, which uses anonymous routing but
177imposes no minimal requirements on cover traffic. It is possible
178to forego anonymity when this is not required. The anonymity level of
179@code{0} allows GNUnet to use more efficient, non-anonymous routing.
180
181@cindex How file-sharing achieves Anonymity
182@node How file-sharing achieves Anonymity
183@subsection How file-sharing achieves Anonymity
184
185Contrary to other designs, we do not believe that users achieve strong
186anonymity just because their requests are obfuscated by a couple of
187indirections. This is not sufficient if the adversary uses traffic
188analysis.
189The threat model used for anonymous file sharing in GNUnet assumes that
190the adversary is quite powerful.
191In particular, we assume that the adversary can see all the traffic on
192the Internet. And while we assume that the adversary
193can not break our encryption, we assume that the adversary has many
194participating nodes in the network and that it can thus see many of the
195node-to-node interactions since it controls some of the nodes.
196
197The system tries to achieve anonymity based on the idea that users can be
198anonymous if they can hide their actions in the traffic created by other
199users.
200Hiding actions in the traffic of other users requires participating in the
201traffic, bringing back the traditional technique of using indirection and
202source rewriting. Source rewriting is required to gain anonymity since
203otherwise an adversary could tell if a message originated from a host by
204looking at the source address. If all packets look like they originate
205from one node, the adversary can not tell which ones originate from that
206node and which ones were routed.
207Note that in this mindset, any node can decide to break the
208source-rewriting paradigm without violating the protocol, as this
209only reduces the amount of traffic that a node can hide its own traffic
210in.
211
212If we want to hide our actions in the traffic of other nodes, we must make
213our traffic indistinguishable from the traffic that we route for others.
214As our queries must have us as the receiver of the reply
215(otherwise they would be useless), we must put ourselves as the receiver
216of replies that actually go to other hosts; in other words, we must
217indirect replies.
218Unlike other systems, in anonymous file-sharing as implemented on top of
219GNUnet we do not have to indirect the replies if we don't think we need
220more traffic to hide our own actions.
221
222This increases the efficiency of the network as we can indirect less under
223higher load.
224Refer to the following paper for more:
225Krista Bennett and Christian Grothoff.
226GAP --- practical anonymous networking. In Proceedings of
227Designing Privacy Enhancing Technologies, 2003.
228(@uref{https://gnunet.org/git/bibliography.git/plain/docs/aff.pdf, https://gnunet.org/git/bibliography.git/plain/docs/aff.pdf})
229
230@cindex Deniability
231@node Deniability
232@section Deniability
233
234Even if the user that downloads data and the server that provides data are
235anonymous, the intermediaries may still be targets. In particular, if the
236intermediaries can find out which queries or which content they are
237processing, a strong adversary could try to force them to censor
238certain materials.
239
240With the file-encoding used by GNUnet's anonymous file-sharing, this
241problem does not arise.
242The reason is that queries and replies are transmitted in
243an encrypted format such that intermediaries cannot tell what the query
244is for or what the content is about. Mind that this is not the same
245encryption as the link-encryption between the nodes. GNUnet has
246encryption on the network layer (link encryption, confidentiality,
247authentication) and again on the application layer (provided
248by @command{gnunet-publish}, @command{gnunet-download},
249@command{gnunet-search} and @command{gnunet-gtk}).
250
251Refer to the following paper for more:
252Christian Grothoff, Krista Grothoff, Tzvetan Horozov,
253and Jussi T. Lindgren.
254An Encoding for Censorship-Resistant Sharing.
2552009.
256(@uref{https://gnunet.org/git/bibliography.git/plain/docs/ecrs.pdf, https://gnunet.org/git/bibliography.git/plain/docs/ecrs.pdf})
257
258@cindex Peer Identities
259@node Peer Identities
260@section Peer Identities
261
262Peer identities are used to identify peers in the network and are unique
263for each peer. The identity for a peer is simply its public key, which is
264generated along with a private key the peer is started for the first time.
265While the identity is binary data, it is often expressed as ASCII string.
266For example, the following is a peer identity as you might see it in
267various places:
268
269@example
270UAT1S6PMPITLBKSJ2DGV341JI6KF7B66AC4JVCN9811NNEGQLUN0
271@end example
272
273@noindent
274You can find your peer identity by running @command{gnunet-peerinfo -s}.
275
276@cindex Zones in the GNU Name System (GNS Zones)
277@node Zones in the GNU Name System (GNS Zones)
278@section Zones in the GNU Name System (GNS Zones)
279
280@c FIXME: Explain or link to an explanation of the concept of public keys
281@c and private keys.
282@c FIXME: Rewrite for the latest GNS changes.
283GNS (Matthias Wachs, Martin Schanzenbach, and Christian Grothoff.
284A Censorship-Resistant, Privacy-Enhancing and Fully Decentralized Name
285System. In proceedings of 13th International Conference on Cryptology and
286Network Security (CANS 2014). 2014.
287@uref{https://gnunet.org/git/bibliography.git/plain/docs/gns2014wachs.pdf, https://gnunet.org/git/bibliography.git/plain/docs/gns2014wachs.pdf})
288zones are similar to those of DNS zones, but instead of a hierarchy of
289authorities to governing their use, GNS zones are controlled by a private
290key.
291When you create a record in a DNS zone, that information is stored in your
292nameserver. Anyone trying to resolve your domain then gets pointed
293(hopefully) by the centralised authority to your nameserver.
294Whereas GNS, being fully decentralized by design, stores that information
295in DHT. The validity of the records is assured cryptographically, by
296signing them with the private key of the respective zone.
297
298Anyone trying to resolve records in a zone of your domain can then verify
299the signature of the records they get from the DHT and be assured that
300they are indeed from the respective zone.
301To make this work, there is a 1:1 correspondence between zones and
302their public-private key pairs.
303So when we talk about the owner of a GNS zone, that's really the owner of
304the private key.
305And a user accessing a zone needs to somehow specify the corresponding
306public key first.
307
308@cindex Egos
309@node Egos
310@section Egos
311
312@c what is the difference between peer identity and egos? It seems
313@c like both are linked to public-private key pair.
314Egos are your "identities" in GNUnet. Any user can assume multiple
315identities, for example to separate their activities online. Egos can
316correspond to "pseudonyms" or "real-world identities". Technically an
317ego is first of all a key pair of a public- and private-key.
diff --git a/doc/documentation/chapters/philosophy.texi b/doc/documentation/chapters/philosophy.texi
deleted file mode 100644
index e57c20914..000000000
--- a/doc/documentation/chapters/philosophy.texi
+++ /dev/null
@@ -1,81 +0,0 @@
1@cindex Philosophy
2@node Philosophy
3@chapter Philosophy
4
5@c NOTE: We should probably re-use some of the images lynX created
6@c for secushare, showing some of the relations and functionalities
7@c of GNUnet.
8The primary goal of the GNUnet project is to provide a reliable, open,
9non-discriminating and censorship-resistant system for information
10exchange. We value free speech above state interests and intellectual
11monopoly. GNUnet's long-term goal is to serve as a development
12platform for the next generation of Internet protocols.
13
14GNUnet is an anarchistic network. Participants are encouraged to
15contribute at least as much resources (storage, bandwidth) to the network
16as they consume, so that their participation does not have a negative
17impact on other users.
18
19@menu
20* Design Principles::
21* Privacy and Anonymity::
22* Practicality::
23@end menu
24
25@cindex Design Principles
26@node Design Principles
27@section Design Principles
28
29These are the GNUnet design principles, in order of importance:
30
31@itemize
32@item GNUnet must be implemented as
33@uref{https://www.gnu.org/philosophy/free-sw.html, Free Software} ---
34This means that you you have the four essential freedoms: to run
35the program, to study and change the program in source code form,
36to redistribute exact copies, and to distribute modified versions.
37(@uref{https://www.gnu.org/philosophy/free-sw.html}).
38@item GNUnet must minimize the amount of personally identifiable information exposed.
39@item GNUnet must be fully distributed and resilient to external attacks and rogue participants.
40@item GNUnet must be self-organizing and not depend on administrators or centralized infrastructure.
41@item GNUnet must inform the user which other participants have to be trusted when establishing private communications.
42@item GNUnet must be open and permit new peers to join.
43@item GNUnet must support a diverse range of applications and devices.
44@item GNUnet must use compartmentalization to protect sensitive information.
45@item The GNUnet architecture must be resource efficient.
46@item GNUnet must provide incentives for peers to contribute more resources than they consume.
47@end itemize
48
49
50@cindex Privacy and Anonymity
51@node Privacy and Anonymity
52@section Privacy and Anonymity
53
54The GNUnet protocols minimize the leakage of personally identifiable
55information of participants and do not allow adversaries to control,
56track, monitor or censor users activities. The GNUnet protocols also
57make it as hard as possible to disrupt operations by participating in
58the network with malicious intent.
59
60Analyzing participant's activities becomes more difficult as the
61number of peers and applications that generate traffic on the network
62grows, even if the additional traffic generated is not related to
63anonymous communication. This is one of the reasons why GNUnet is
64developed as a peer-to-peer framework where many applications share
65the lower layers of an increasingly complex protocol stack. The GNUnet
66architecture encourages many different forms of peer-to-peer
67applications.
68
69@cindex Practicality
70@node Practicality
71@section Practicality
72
73Whereever possible GNUnet allows the peer to adjust its operations and
74functionalities to specific use cases. A GNUnet peer running on a
75mobile device with limited battery for example might choose not to
76relay traffic for other participants.
77
78For certain applications like file-sharing GNUnet allows participants
79to trade degrees of anonymity in exchange for increased
80efficiency. However, it is not possible for any user's efficiency
81requirements to compromise the anonymity of any other user.
diff --git a/doc/documentation/chapters/preface.texi b/doc/documentation/chapters/preface.texi
deleted file mode 100644
index 386cefa6d..000000000
--- a/doc/documentation/chapters/preface.texi
+++ /dev/null
@@ -1,173 +0,0 @@
1@node Preface
2@chapter Preface
3
4This collection of manuals describes how to use GNUnet, a framework
5for secure peer-to-peer networking with the high-level goal to provide
6a strong foundation Free Software for a global, distributed network
7that provides security and privacy. GNUnet in that sense aims to
8replace the current Internet protocol stack. Along with an
9application for secure publication of files, it has grown to include
10all kinds of basic applications for the foundation of a new Internet.
11
12@menu
13* About this book::
14* Contributing to this book::
15* Introduction::
16* Project governance::
17* Typography::
18@end menu
19
20@node About this book
21@section About this book
22
23The books (described as ``book'' or ``books'' in the following)
24bundled as the ``GNUnet Reference Manual'' are based on the historic
25work of all contributors to GNUnet's documentation. It is our hope
26that the content is described in a way that does not require any
27academic background, although some concepts will require further
28reading.
29
30Our (long-term) goal with these books is to keep them self-contained. If
31you see references to Wikipedia and other external sources (except for
32our academic papers) it means that we are working on a solution to
33describe the explanations found there which fits our use-case and licensing.
34
35The first chapter (``Preface'') as well as the the second
36chapter (``Philosophy'') give an introduction to GNUnet as a project,
37what GNUnet tries to achieve.
38
39@node Contributing to this book
40@section Contributing to this book
41
42The GNUnet Reference Manual is a collective work produced by various
43people throughout the years. The version you are reading is derived
44from many individual efforts hosted on our website. This was a failed
45experiment, and with the conversion to Texinfo we hope to address this
46in the longterm. Texinfo is the documentation language of the GNU project.
47While it can be intimidating at first and look scary or complicated,
48it is just another way to express text format instructions. We encourage
49you to take this opportunity and learn about Texinfo, learn about GNUnet,
50and one word at a time we will arrive at a book which explains GNUnet in
51the least complicated way to you. Even when you don't want or can't learn
52Texinfo, you can contribute. Send us an Email or join our IRC chat room
53on freenode and talk with us about the documentation (the prefered way
54to reach out is the mailinglist, since you can communicate with us
55without waiting on someone in the chatroom). One way or another you
56can help shape the understanding of GNUnet without the ability to read
57and understand its sourcecode.
58
59@node Introduction
60@section Introduction
61
62@c In less than 2 printed pages describe the history of GNUnet here,
63@c what we have now and what's still missing (could be split into
64@c subchapters).
65
66GNUnet in its current version is the result of almost 20 years of work
67from many contributors. So far, most contributions were made by
68volunteers or people paid to do fundamental research. At this stage,
69GNUnet remains an experimental system where
70significant parts of the software lack a reasonable degree of
71professionalism in its implementation. Furthermore, we are aware of a
72significant number of existing bugs and critical design flaws, as some
73unfortunate early design decisions remain to be rectified. There are
74still known open problems; GNUnet remains an active research project.
75
76The project was started in 2001 when some initial ideas for improving
77Freenet's file-sharing turned out to be too radical to be easily
78realized within the scope of the existing Freenet project. We lost
79our first contributor on 11.9.2001 as the contributor realized that
80privacy may help terrorists. The rest of the team concluded that it
81was now even more important to fight for civil liberties. The first
82release was called ``GNet'' -- already with the name GNUnet in mind,
83but without the blessing of GNU we did not dare to call it GNUnet
84immediately. A few months after the first release we contacted the
85GNU project, happily agreed to their governance model and became an
86official GNU package.
87
88Within the first year, we created
89@uref{https://gnu.org/s/libextractor, GNU libextractor}, a helper library
90for meta data extraction which has been used by a few other projects
91as well. 2003 saw the emergence of pluggable transports, the ability
92for GNUnet to use different mechanisms for communication, starting
93with TCP, UDP and SMTP (support for the latter was later dropped due
94to a lack of maintenance). In 2005, the project first started to
95evolve beyond the original file-sharing application with a first
96simple P2P chat. In 2007, we created
97@uref{https://gnu.org/s/libmicrohttpd, GNU libmicrohttpd}
98to support a pluggable transport based on HTTP. In 2009, the
99architecture was radically modularized into the multi-process system
100that exists today. Coincidentally, the first version of the ARM
101service (ARM: Automatic Restart Manager)
102was implemented a day before systemd was announced. From 2009
103to 2014 work progressed rapidly thanks to a significant research grant
104from the Deutsche Forschungsgesellschaft. This resulted in particular
105in the creation of the R5N DHT, CADET, ATS and the GNU Name System.
106In 2010, GNUnet was selected as the basis for the
107@uref{https://secushare.org, secushare} online
108social network, resulting in a significant growth of the core team.
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} (pretty Easy privacy) project
114announced that they will use GNUnet as the technology for their
115meta-data protection layer, ultimately resulting in GNUnet e.V.
116entering into a formal long-term collaboration with the pEp
117foundation. In 2016, Taler Systems SA, a first startup using GNUnet
118technology, was founded with support from the community.
119
120GNUnet is not merely a technical project, but also a political
121mission: like the GNU project as a whole, we are writing software to
122achieve political goals with a focus on the human right of
123informational self-determination. Putting users in control of their
124computing has been the core driver of the GNU project. With GNUnet we
125are focusing on informational self-determination for collaborative
126computing and communication over networks.
127
128The Internet is shaped as much by code and protocols as it is by its
129associated political processes (IETF, ICANN, IEEE, etc.).
130Similarly its flaws are not limited to the protocol design. Thus,
131technical excellence by itself will not suffice to create a better
132network. We also need to build a community that is wise, humble and
133has a sense of humor to achieve our goal to create a technical
134foundation for a society we would like to live in.
135
136
137@node Project governance
138@section Project governance
139
140GNUnet, like the GNU project and many other free software projects,
141follows the governance model of a benevolent dictator. This means
142that ultimately, the GNU project appoints the GNU maintainer and can
143overrule decisions made by the GNUnet maintainer. Similarly, the
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.
148developers. Still, in practice neither has happened in the last 20
149years, and we hope to keep it that way.
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.
154The GNUnet project is supported by GNUnet e.V., a German association
155where any developer can become a member. GNUnet e.V. serves as a
156legal entity to hold the copyrights to GNUnet. GNUnet e.V. may also
157choose to pay for project resources, and can collect donations.
158GNUnet e.V. may also choose to adjust the license of the
159software (with the constraint that it has to remain free software).
160In 2018 we switched from GPL3 to AGPL3, in practice these changes do
161not happen very often.
162
163
164@node Typography
165@section Typography
166
167When giving examples for commands, shell prompts are used to show if the
168command should/can be issued as root, or if "normal" user privileges are
169sufficient. We use a @code{#} for root's shell prompt, a
170@code{%} for users' shell prompt, assuming they use the C-shell or tcsh
171and a @code{$} for bourne shell and derivatives.
172@c TODO: Really? Why the different prompts? Do we already have c-shell
173@c TODO: examples?
diff --git a/doc/documentation/chapters/user.texi b/doc/documentation/chapters/user.texi
deleted file mode 100644
index 5aa3a62bf..000000000
--- a/doc/documentation/chapters/user.texi
+++ /dev/null
@@ -1,2293 +0,0 @@
1@node Using GNUnet
2@chapter Using GNUnet
3@c %**end of header
4
5This tutorial is supposed to give a first introduction for users
6trying to do something real with GNUnet. Installation and
7configuration are specifically outside of the scope of this tutorial.
8Instead, we start by briefly checking that the installation works, and
9then dive into uncomplicated, concrete practical things that can be done
10with the framework provided by GNUnet.
11
12In short, this chapter of the ``GNUnet Reference Documentation'' will
13show you how to use the various peer-to-peer applications of the
14GNUnet system.
15As GNUnet evolves, we will add new sections for the various
16applications that are being created.
17
18Comments on the content of this chapter, and extensions of it are
19always welcome.
20
21
22@menu
23* Start and stop GNUnet::
24* First steps - Using the GNU Name System::
25* First steps - Using GNUnet Conversation::
26* First steps - Using the GNUnet VPN::
27* File-sharing::
28* The GNU Name System::
29* re@:claim Identity Provider::
30* Using the Virtual Public Network::
31@end menu
32
33@node Start and stop GNUnet
34@section Start and stop GNUnet
35
36Previous to use any GNUnet-based application, one has to start a node:
37
38@example
39$ gnunet-arm -s -l gnunet.log
40@end example
41
42To stop GNUnet:
43
44@example
45$ gnunet-arm -e
46@end example
47
48@node First steps - Using the GNU Name System
49@section First steps - Using the GNU Name System
50@c %**end of header
51
52@menu
53* Preliminaries::
54* Managing Egos::
55* The GNS Tab::
56* Creating a Record::
57* Resolving GNS records::
58* Integration with Browsers::
59* Creating a Business Card::
60* Be Social::
61* Backup of Identities and Egos::
62* Revocation::
63* What's Next?::
64@end menu
65
66@node Preliminaries
67@subsection Preliminaries
68@c %**end of header
69
70``.pin'' is a default zone which points to a zone managed by gnunet.org.
71Use @code{gnunet-config -s gns} to view the GNS configuration, including
72all configured zones that are operated by other users. The respective
73configuration entry names start with a ``.'', i.e. ``.pin''.
74
75You can configure any number of top-level domains, and point them to
76the respective zones of your friends! For this, simply obtain the
77respective public key (you will learn how below) and extend the
78configuration:
79
80@example
81$ gnunet-config -s gns -n .myfriend -V PUBLIC_KEY
82@end example
83
84@node Managing Egos
85@subsection Managing Egos
86
87In GNUnet, identity management is about managing egos. Egos can
88correspond to pseudonyms or real-world identities. If you value your
89privacy, you are encouraged to use separate egos for separate
90activities.
91
92Technically, an ego is first of all a public-private key pair, and
93thus egos also always correspond to a GNS zone. Egos are managed by
94the IDENTITY service. Note that this service has nothing to do with
95the peer identity. The IDENTITY service essentially stores the
96private keys under human-readable names, and keeps a mapping of which
97private key should be used for particular important system functions.
98The existing identities can be listed using the command
99@command{gnunet-identity -d}
100
101@example
102gnu - JTDVJC69NHU6GQS4B5721MV8VM7J6G2DVRGJV0ONIT6QH7OI6D50
103rules - GO0T87F9BPMF8NKD5A54L2AH1T0GRML539TPFSRMCEA98182QD30
104@end example
105
106
107@node The GNS Tab
108@subsection The GNS Tab
109@c %**end of header
110
111Maintaing your zones is through the NAMESTORE service and is discussed
112here. You can manage your zone using @command{gnunet-identity} and
113@command{gnunet-namestore}, or most conveniently using
114@command{gnunet-namestore-gtk}.
115
116We will use the GTK+ interface in this introduction. Please start
117@command{gnunet-gkt} and switch to the GNS tab, which is the tab in
118the middle with the letters "GNS" connected by a graph.
119
120Next to the ``Add'' button there is a field where you can enter the
121label (pseudonym in IDENTITY subsystem speak) of a zone you would like
122to create. Pushing the ``Add'' button will create the zone.
123Afterwards, you can change the label in the combo box below at any
124time. The label will be the top-level domain that the GNU Name System
125will resolve using your zone. For the label, you should pick
126a name by which you would like to
127be known by your friends (or colleagues). You should pick a label that
128is reasonably unique within your social group. Be aware that
129the label will be published together with every record in that zone.
130
131Once you have created a first zone, you should see a QR code for the
132zone on the right. Next to it is a "Copy" button to copy the public
133key string to the clipboard. You can also save the QR code image to
134disk.
135
136Furthermore, you now can see the bottom part of the dialog. The
137bottom of the window contains the existing entries in the selected zone.
138
139@node Creating a Record
140@subsection Creating a Record
141@c %**end of header
142
143We will begin by creating a simple record in your master zone.
144To do this, click on the text "<new name>" in the table. The field is
145editable, allowing you to enter a fresh label. Labels are restricted
146to 63 characters and must not contain dots. For now, simply enter
147"test", then press ENTER to confirm. This will create a new (empty)
148record group under the label "test". Now click on "<new record>" next
149to the new label "test". In the drop-down menu, select "A" and push
150ENTER to confirm. Afterwards, a new dialog will pop up, asking to enter
151details for the "A" record.
152
153"A" records are used in the @dfn{Domain Name System} (DNS) to specify
154IPv4 addresses. An IPv4 address is a number that is used to identify
155and address a computer on the Internet (version 4). Please enter
156"217.92.15.146" in the dialog below "Destination IPv4 Address" and
157select "Record is public". Do not change any of the other options.
158Note that as you enter a (well-formed) IPv4 address, the "Save"
159button in the bottom right corner becomes sensitive. In general, buttons
160in dialogs are often insensitive as long as the contents of the dialog
161are incorrect.
162
163Once finished, press the "Save" button. Back in the main dialog, select
164the tiny triangle left of the "test" label. By doing so, you get to see
165all of the records under "test". Note that you can right-click a record
166to edit it later.
167
168
169@node Resolving GNS records
170@subsection Resolving GNS records
171@c %**end of header
172
173Next, you should try resolving your own GNS records. The method we
174found to be the most uncomplicated is to do this by explicitly
175resolving using @code{gnunet-gns}. For this exercise, we will assume
176that you used the string ``gnu'' for the pseudonym (or label) of your
177GNS zone. If you used something else, replace ``.gnu'' with your real
178pseudonym in the examples below.
179
180In the shell, type:
181
182@example
183$ gnunet-gns -u test.gnu # what follows is the reply
184test.gnu:
185Got `A' record: 217.92.15.146
186@end example
187
188@noindent
189That shows that resolution works, once GNS is integrated with
190the application.
191
192@node Integration with Browsers
193@subsection Integration with Browsers
194@c %**end of header
195
196While we recommend integrating GNS using the NSS module in the
197GNU libc Name Service Switch, you can also integrate GNS
198directly with your browser via the @code{gnunet-gns-proxy}.
199This method can have the advantage that the proxy can validate
200TLS/X.509 records and thus strengthen web security; however, the proxy
201is still a bit brittle, so expect subtle failures. We have had reasonable
202success with Chromium, and various frustrations with Firefox in this area
203recently.
204
205The first step is to start the proxy. As the proxy is (usually)
206not started by default, this is done as a unprivileged user
207using @command{gnunet-arm -i gns-proxy}. Use @command{gnunet-arm -I}
208as a unprivileged user to check that the proxy was actually
209started. (The most common error for why the proxy may fail to start
210is that you did not run @command{gnunet-gns-proxy-setup-ca} during
211installation.) The proxy is a SOCKS5 proxy running (by default)
212on port 7777. Thus, you need to now configure your browser to use
213this proxy. With Chromium, you can do this by starting the browser
214as a unprivileged user using
215@command{chromium --proxy-server="socks5://localhost:7777"}
216For @command{Firefox} (or @command{Icecat}), select "Edit-Preferences"
217in the menu, and then select the "Advanced" tab in the dialog
218and then "Network":
219
220Here, select "Settings..." to open the proxy settings dialog.
221Select "Manual proxy configuration" and enter @code{localhost}
222with port 7777 under SOCKS Host. Furthermore, set the
223checkbox ``Proxy DNS when using SOCKS v5'' at the bottom of
224the dialog. Finally, push "OK".
225
226You must also go to about:config and change the
227@code{browser.fixup.alternate.enabled} option to @code{false},
228otherwise the browser will autoblunder an address like
229@code{@uref{http://www.gnu/, www.gnu}} to
230@code{@uref{http://www.gnu.com/, www.gnu.com}}. If you want
231to resolve @@ in your own TLDs, you must additionally
232set @code{browser.fixup.dns_first_use_for_single_words} to @code{true}.
233
234After configuring your browser, you might want to first confirm that it
235continues to work as before. (The proxy is still experimental and if you
236experience "odd" failures with some webpages, you might want to disable
237it again temporarily.) Next, test if things work by typing
238"@uref{http://test.gnu/}" into the URL bar of your browser.
239This currently fails with (my version of) Firefox as Firefox is
240super-smart and tries to resolve "@uref{http://www.test.gnu/}" instead of
241"@uref{test.gnu}". Chromium can be convinced to comply if you explicitly
242include the "http://" prefix --- otherwise a Google search might be
243attempted, which is not what you want. If successful, you should
244see a simple website.
245
246Note that while you can use GNS to access ordinary websites, this is
247more an experimental feature and not really our primary goal at this
248time. Still, it is a possible use-case and we welcome help with testing
249and development.
250
251@pindex gnunet-bcd
252@node Creating a Business Card
253@subsection Creating a Business Card
254@c FIXME: Which parts of texlive are needed? Some systems offer a modular
255@c texlive (smaller size).
256
257Before we can really use GNS, you should create a business card.
258Note that this requires having @command{LaTeX} installed on your system.
259If you are using a Debian GNU/Linux based operating system, the
260following command should install the required components.
261Keep in mind that this @b{requires 3GB} of downloaded data and possibly
262@b{even more} when unpacked. On a GNU Guix based system texlive 2017 has
263returns a DAG size of 5032.4 MiB.
264@b{We welcome any help in identifying the required components of the
265TexLive Distribution. This way we could just state the required components
266without pulling in the full distribution of TexLive.}
267
268@example
269apt-get install texlive-full
270@end example
271
272@noindent
273Start creating a business card by clicking the "Copy" button
274in @command{gnunet-gtk}'s GNS tab. Next, you should start
275the @command{gnunet-bcd} program (in the terminal, on the command-line).
276You do not need to pass any options, and please be not surprised if
277there is no output:
278
279@example
280$ gnunet-bcd # seems to hang...
281@end example
282
283@noindent
284Then, start a browser and point it to @uref{http://localhost:8888/}
285where @code{gnunet-bcd} is running a Web server!
286
287First, you might want to fill in the "GNS Public Key" field by
288right-clicking and selecting "Paste", filling in the public key
289from the copy you made in @command{gnunet-gtk}.
290Then, fill in all of the other fields, including your @b{GNS NICKname}.
291Adding a GPG fingerprint is optional.
292Once finished, click "Submit Query".
293If your @code{LaTeX} installation is incomplete, the result will be
294disappointing.
295Otherwise, you should get a PDF containing fancy 5x2 double-sided
296translated business cards with a QR code containing your public key
297and a GNUnet logo.
298We'll explain how to use those a bit later.
299You can now go back to the shell running @code{gnunet-bcd} and press
300@b{CTRL-C} to shut down the Web server.
301
302
303@node Be Social
304@subsection Be Social
305@c %**end of header
306
307Next, you should print out your business card and be social.
308Find a friend, help them install GNUnet and exchange business cards with
309them. Or, if you're a desperate loner, you might try the next step with
310your own card. Still, it'll be hard to have a conversation with
311yourself later, so it would be better if you could find a friend.
312You might also want a camera attached to your computer, so
313you might need a trip to the store together.
314
315Before we get started, we need to tell @code{gnunet-qr} which zone
316it should import new records into. For this, run:
317
318@pindex gnunet-identity
319@example
320$ gnunet-identity -s namestore -e NAME
321@end example
322where NAME is the name of the zone you want to import records
323into. In our running example, this would be ``gnu''.
324
325@pindex gnunet-qr
326Henceforth, for every business card you collect, simply run:
327@example
328$ gnunet-qr
329@end example
330
331@noindent
332to open a window showing whatever your camera points at.
333Hold up your friend's business card and tilt it until
334the QR code is recognized. At that point, the window should
335automatically close. At that point, your friend's NICKname and their
336public key should have been automatically imported into your zone.
337
338Assuming both of your peers are properly integrated in the
339GNUnet network at this time, you should thus be able to
340resolve your friends names. Suppose your friend's nickname
341is "Bob". Then, type
342
343@pindex gnunet-gns
344@example
345$ gnunet-gns -u test.bob.gnu
346@end example
347
348@noindent
349to check if your friend was as good at following instructions
350as you were.
351
352
353@node Backup of Identities and Egos
354@subsection Backup of Identities and Egos
355
356
357One should always backup their files, especially in these SSD days (our
358team has suffered 3 SSD crashes over a span of 2 weeks). Backing up peer
359identity and zones is achieved by copying the following files:
360
361The peer identity file can be found
362in @file{~/.local/share/gnunet/private_key.ecc}
363
364The private keys of your egos are stored in the
365directory @file{~/.local/share/gnunet/identity/egos/}.
366They are stored in files whose filenames correspond to the zones'
367ego names. These are probably the most important files you want
368to backup from a GNUnet installation.
369
370Note: All these files contain cryptographic keys and they are
371stored without any encryption. So it is advisable to backup
372encrypted copies of them.
373
374
375@node Revocation
376@subsection Revocation
377
378Now, in the situation of an attacker gaining access to the private key of
379one of your egos, the attacker can create records in the respective
380GNS zone
381and publish them as if you published them. Anyone resolving your
382domain will get these new records and when they verify they seem
383authentic because the attacker has signed them with your key.
384
385To address this potential security issue, you can pre-compute
386a revocation certificate corresponding to your ego. This certificate,
387when published on the P2P network, flags your private key as invalid,
388and all further resolutions or other checks involving the key will fail.
389
390@pindex gnunet-revocation
391A revocation certificate is thus a useful tool when things go out of
392control, but at the same time it should be stored securely.
393Generation of the revocation certificate for a zone can be done through
394@command{gnunet-revocation}. For example, the following command (as
395unprivileged user) generates a revocation file
396@file{revocation.dat} for the zone @code{zone1}:
397@command{gnunet-revocation -f revocation.dat -R zone1}
398
399The above command only pre-computes a revocation certificate. It does
400not revoke the given zone. Pre-computing a revocation certificate
401involves computing a proof-of-work and hence may take up to 4 to 5 days
402on a modern processor. Note that you can abort and resume the
403calculation at any time. Also, even if you did not finish the
404calculation, the resulting file will contain the signature, which is
405sufficient to complete the revocation process even without access to
406the private key. So instead of waiting for a few days, you can just
407abort with CTRL-C, backup the revocation certificate and run the
408calculation only if your key actually was compromised. This has the
409disadvantage of revocation taking longer after the incident, but
410the advantage of saving a significant amount of energy. So unless
411you believe that a key compromise will need a rapid response, we
412urge you to wait with generating the revocation certificate.
413Also, the calculation is deliberately expensive, to deter people from
414doing this just for fun (as the actual revocation operation is expensive
415for the network, not for the peer performing the revocation).
416
417
418@c FIXME: The Manual should give away the command using an example that is
419@c very likely to never exist.
420To avoid TL;DR ones from accidentally revocating their zones, we are not
421giving away the command, but it is uncomplicated: the actual revocation is
422performed by using the @command{-p} option of @command{gnunet-revocation}.
423
424
425@node What's Next?
426@subsection What's Next?
427@c %**end of header
428
429This may seem not like much of an application yet, but you have
430just been one of the first to perform a decentralized secure name
431lookup (where nobody could have altered the value supplied by your
432friend) in a privacy-preserving manner (your query on the network
433and the corresponding response were always encrypted). So what
434can you really do with this? Well, to start with, you can publish your
435GnuPG fingerprint in GNS as a "CERT" record and replace the public
436web-of-trust with its complicated trust model with explicit names
437and privacy-preserving resolution. Also, you should read the next
438chapter of the tutorial and learn how to use GNS to have a
439private conversation with your friend. Finally, help us
440with the next GNUnet release for even more applications
441using this new public key infrastructure.
442
443@pindex gnunet-conservation-gtk
444@node First steps - Using GNUnet Conversation
445@section First steps - Using GNUnet Conversation
446@c %**end of header
447
448First, you should launch the graphical user interface. You can do
449this from the command-line by typing
450
451@example
452$ gnunet-conversation-gtk
453@end example
454
455@menu
456* Testing your Audio Equipment::
457* GNS Zones::
458@end menu
459
460@node Testing your Audio Equipment
461@subsection Testing your Audio Equipment
462@c %**end of header
463
464First, you should use @code{gnunet-conversation-test} to check that your
465microphone and speaker are working correctly. You will be prompted to
466speak for 5 seconds, and then those 5 seconds will be replayed to you.
467The network is not involved in this test. If it fails, you should run
468your pulse audio configuration tool to check that microphone and
469speaker are not muted and, if you have multiple input/output devices,
470that the correct device is being associated with GNUnet's audio tools.
471
472@node GNS Zones
473@subsection GNS Zones
474@c %**end of header
475
476@code{gnunet-conversation} uses GNS for addressing. This means that
477you need to have a GNS zone created before using it. Information
478about how to create GNS zones can be found here.
479
480
481@menu
482* Picking an Identity::
483* Calling somebody::
484@end menu
485
486@node Picking an Identity
487@subsubsection Picking an Identity
488@c %**end of header
489
490To make a call with @code{gnunet-conversation}, you first
491need to choose an identity. This identity is both the caller ID
492that will show up when you call somebody else, as well as the
493GNS zone that will be used to resolve names of users that you
494are calling. Run
495
496@pindex gnunet-conversation
497@example
498gnunet-conversation -e zone-name
499@end example
500
501@noindent
502to start the command-line tool. You will see a message saying
503that your phone is now "active on line 0". You can connect
504multiple phones on different lines at the same peer. For the
505first phone, the line zero is of course a fine choice.
506
507Next, you should type in @command{/help} for a list of
508available commands. We will explain the important ones
509during this tutorial. First, you will need to type in
510@command{/address} to determine the address of your
511phone. The result should look something like this:
512
513@example
514/address
5150-PD67SGHF3E0447TU9HADIVU9OM7V4QHTOG0EBU69TFRI2LG63DR0
516@end example
517
518@noindent
519Here, the "0" is your phone line, and what follows
520after the hyphen is your peer's identity. This information will
521need to be placed in a PHONE record of
522your GNS master-zone so that other users can call you.
523
524Start @code{gnunet-namestore-gtk} now (possibly from another
525shell) and create an entry home-phone in your master zone.
526For the record type, select PHONE. You should then see the
527PHONE dialog:
528
529@c image here
530
531Note: Do not choose the expiry time to be 'Never'. If you
532do that, you assert that this record will never change and
533can be cached indefinitely by the DHT and the peers which
534resolve this record. A reasonable period is 1 year.
535
536Enter your peer identity under Peer and leave the line
537at zero. Select the first option to make the record public.
538If you entered your peer identity incorrectly,
539the "Save" button will not work; you might want to use
540copy-and-paste instead of typing in the peer identity
541manually. Save the record.
542
543@node Calling somebody
544@subsubsection Calling somebody
545@c %**end of header
546
547Now you can call a buddy. Obviously, your buddy will have to have GNUnet
548installed and must have performed the same steps. Also, you must have
549your buddy in your GNS master zone, for example by having imported
550your buddy's public key using @code{gnunet-qr}. Suppose your buddy
551is in your zone as @code{buddy.mytld} and they also created their
552phone using a label "home-phone". Then you can initiate a call using:
553
554@example
555/call home-phone.buddy.mytld
556@end example
557
558It may take some time for GNUnet to resolve the name and to establish
559a link. If your buddy has your public key in their master zone, they
560should see an incoming call with your name. If your public key is not
561in their master zone, they will just see the public key as the caller ID.
562
563Your buddy then can answer the call using the "/accept" command. After
564that, (encrypted) voice data should be relayed between your two peers.
565Either of you can end the call using @command{/cancel}. You can exit
566@code{gnunet-conversation} using @command{/quit}.
567
568
569@node First steps - Using the GNUnet VPN
570@section First steps - Using the GNUnet VPN
571@c %**end of header
572
573
574@menu
575* VPN Preliminaries::
576* GNUnet-Exit configuration::
577* GNS configuration::
578* Accessing the service::
579* Using a Browser::
580@end menu
581
582@node VPN Preliminaries
583@subsection VPN Preliminaries
584@c %**end of header
585
586To test the GNUnet VPN, we should first run a web server.
587The easiest way to do this is to just start @code{gnunet-bcd},
588which will run a webserver on port @code{8888} by default.
589Naturally, you can run some other HTTP server for our little tutorial.
590
591If you have not done this, you should also configure your
592Name System Service switch to use GNS. In your @code{/etc/nsswitch.conf}
593you should fine a line like this:
594
595@example
596hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
597@end example
598
599@noindent
600The exact details may differ a bit, which is fine. Add the text
601@code{gns [NOTFOUND=return]} after @code{files}:
602
603@example
604hosts: files gns [NOTFOUND=return] mdns4_minimal [NOTFOUND=return] dns mdns4
605@end example
606
607@c TODO: outdated section, we no longer install this as part of the
608@c TODO: standard installation procedure and should point out the manual
609@c TODO: steps required to make it useful.
610@noindent
611You might want to make sure that @code{/lib/libnss_gns.so.2} exists on
612your system, it should have been created during the installation.
613If not, re-run
614
615@example
616$ configure --with-nssdir=/lib
617$ cd src/gns/nss; sudo make install
618@end example
619
620@noindent
621to install the NSS plugins in the proper location.
622
623@node GNUnet-Exit configuration
624@subsection GNUnet-Exit configuration
625@c %**end of header
626
627Stop your peer (as user @code{gnunet}, run @command{gnunet-arm -e}) and
628run @command{gnunet-setup}. In @command{gnunet-setup}, make sure to
629activate the @strong{EXIT} and @strong{GNS} services in the General tab.
630Then select the Exit tab. Most of the defaults should be fine (but
631you should check against the screenshot that they have not been modified).
632In the bottom area, enter @code{bcd} under Identifier and change the
633Destination to @code{169.254.86.1:8888} (if your server runs on a port
634other than 8888, change the 8888 port accordingly).
635
636Now exit @command{gnunet-setup} and restart your peer
637(@command{gnunet-arm -s}).
638
639@node GNS configuration
640@subsection GNS configuration
641@c %**end of header
642
643Now, using your normal user (not the @code{gnunet} system user), run
644@command{gnunet-gtk}. Select the GNS icon and add a new label www in your
645master zone. For the record type, select @code{VPN}. You should then
646see the VPN dialog:
647
648@c insert image
649
650Under peer, you need to supply the peer identity of your own peer. You can
651obtain the respective string by running @command{gnunet-peerinfo -sq}
652as the @code{gnunet} user. For the Identifier, you need to supply the same
653identifier that we used in the Exit setup earlier, so here supply "bcd".
654If you want others to be able to use the service, you should probably make
655the record public. For non-public services, you should use a passphrase
656instead of the string "bcd". Save the record and
657exit @command{gnunet-gtk}.
658
659@node Accessing the service
660@subsection Accessing the service
661@c %**end of header
662
663You should now be able to access your webserver. Type in:
664
665@example
666$ wget http://www.gnu/
667@end example
668
669@noindent
670The request will resolve to the VPN record, telling the GNS resolver
671to route it via the GNUnet VPN. The GNS resolver will ask the
672GNUnet VPN for an IPv4 address to return to the application. The
673VPN service will use the VPN information supplied by GNS to create
674a tunnel (via GNUnet's MESH service) to the EXIT peer.
675At the EXIT, the name "bcd" and destination port (80) will be mapped
676to the specified destination IP and port. While all this is currently
677happening on just the local machine, it should also work with other
678peers --- naturally, they will need a way to access your GNS zone
679first, for example by learning your public key from a QR code on
680your business card.
681
682@node Using a Browser
683@subsection Using a Browser
684@c %**end of header
685
686Sadly, modern browsers tend to bypass the Name Services Switch and
687attempt DNS resolution directly. You can either run
688a @code{gnunet-dns2gns} DNS proxy, or point the browsers to an
689HTTP proxy. When we tried it, Iceweasel did not like to connect to
690the socks proxy for @code{.gnu} TLDs, even if we disabled its
691autoblunder of changing @code{.gnu} to ".gnu.com". Still,
692using the HTTP proxy with Chrome does work.
693
694@node File-sharing
695@section File-sharing
696@c %**end of header
697
698This chapter documents the GNUnet file-sharing application. The original
699file-sharing implementation for GNUnet was designed to provide
700@strong{anonymous} file-sharing. However, over time, we have also added
701support for non-anonymous file-sharing (which can provide better
702performance). Anonymous and non-anonymous file-sharing are quite
703integrated in GNUnet and, except for routing, share most of the concepts
704and implementation. There are three primary file-sharing operations:
705publishing, searching and downloading. For each of these operations,
706the user specifies an @strong{anonymity level}. If both the publisher and
707the searcher/downloader specify "no anonymity", non-anonymous
708file-sharing is used. If either user specifies some desired degree
709of anonymity, anonymous file-sharing will be used.
710
711After a short introduction, we will first look at the various concepts
712in GNUnet's file-sharing implementation. Then, we will discuss
713specifics as to how they impact users that publish, search or download
714files.
715
716
717@menu
718* fs-Searching::
719* fs-Downloading::
720* fs-Publishing::
721* fs-Concepts::
722* Namespace Management::
723* File-Sharing URIs::
724* GTK User Interface::
725@end menu
726
727@node fs-Searching
728@subsection Searching
729@c %**end of header
730
731The command @command{gnunet-search} can be used to search
732for content on GNUnet. The format is:
733
734@example
735$ gnunet-search [-t TIMEOUT] KEYWORD
736@end example
737
738@noindent
739The @command{-t} option specifies that the query should timeout after
740approximately TIMEOUT seconds. A value of zero (``0'') is interpreted
741as @emph{no timeout}, which is the default. In this case,
742@command{gnunet-search} will never terminate (unless you press
743@command{CTRL-C}).
744
745If multiple words are passed as keywords, they will all be
746considered optional. Prefix keywords with a "+" to make them mandatory.
747
748Note that searching using
749
750@example
751$ gnunet-search Das Kapital
752@end example
753
754@noindent
755is not the same as searching for
756
757@example
758$ gnunet-search "Das Kapital"
759@end example
760
761@noindent
762as the first will match files shared under the keywords
763"Das" or "Kapital" whereas the second will match files
764shared under the keyword "Das Kapital".
765
766Search results are printed by @command{gnunet-search} like this:
767
768@c it will be better the avoid the ellipsis altogether because I don't
769@c understand the explanation below that
770@c ng0: who is ``I'' and what was the complete sentence?
771@example
772#15:
773gnunet-download -o "COPYING" gnunet://fs/chk/PGK8M...3EK130.75446
774
775@end example
776
777@noindent
778The whole line is the command you would have to enter to download
779the file. The first argument passed to @code{-o} is the suggested
780filename (you may change it to whatever you like).
781It is followed by the key for decrypting the file, the query for
782searching the file, a checksum (in hexadecimal) finally the size of
783the file in bytes.
784
785@node fs-Downloading
786@subsection Downloading
787@c %**end of header
788
789In order to download a file, you need the whole line returned by
790@command{gnunet-search}.
791You can then use the tool @command{gnunet-download} to obtain the file:
792
793@example
794$ gnunet-download -o <FILENAME> <GNUNET-URL>
795@end example
796
797@noindent
798FILENAME specifies the name of the file where GNUnet is supposed
799to write the result. Existing files are overwritten. If the
800existing file contains blocks that are identical to the
801desired download, those blocks will not be downloaded again
802(automatic resume).
803
804If you want to download the GPL from the previous example,
805you do the following:
806
807@example
808$ gnunet-download -o "COPYING" gnunet://fs/chk/PGK8M...3EK130.75446
809@end example
810
811@noindent
812If you ever have to abort a download, you can continue it at any time by
813re-issuing @command{gnunet-download} with the same filename.
814In that case, GNUnet will @strong{not} download blocks again that are
815already present.
816
817GNUnet's file-encoding mechanism will ensure file integrity, even if the
818existing file was not downloaded from GNUnet in the first place.
819
820You may want to use the @command{-V} switch to turn on verbose
821reporting. In this case, @command{gnunet-download} will print the
822current number of bytes downloaded whenever new data was received.
823
824@node fs-Publishing
825@subsection Publishing
826@c %**end of header
827
828The command @command{gnunet-publish} can be used to add content
829to the network. The basic format of the command is
830
831@example
832$ gnunet-publish [-n] [-k KEYWORDS]* [-m TYPE:VALUE] FILENAME
833@end example
834
835For example
836@example
837$ gnunet-publish -m "description:GNU License" -k gpl -k test -m "mimetype:text/plain" COPYING
838@end example
839
840@menu
841* Important command-line options::
842* Indexing vs. Inserting::
843@end menu
844
845@node Important command-line options
846@subsubsection Important command-line options
847@c %**end of header
848
849The option @code{-k} is used to specify keywords for the file that
850should be inserted. You can supply any number of keywords,
851and each of the keywords will be sufficient to locate and
852retrieve the file. Please note that you must use the @code{-k} option
853more than once -- one for each expression you use as a keyword for
854the filename.
855
856The -m option is used to specify meta-data, such as descriptions.
857You can use -m multiple times. The TYPE passed must be from the
858list of meta-data types known to libextractor. You can obtain this
859list by running @command{extract -L}. Use quotes around the entire
860meta-data argument if the value contains spaces. The meta-data
861is displayed to other users when they select which files to
862download. The meta-data and the keywords are optional and
863may be inferred using @code{GNU libextractor}.
864
865@command{gnunet-publish} has a few additional options to handle
866namespaces and directories. Refer to the man-page for details:
867
868@example
869man gnunet-publish
870@end example
871
872@node Indexing vs. Inserting
873@subsubsection Indexing vs Inserting
874@c %**end of header
875
876By default, GNUnet indexes a file instead of making a full copy.
877This is much more efficient, but requires the file to stay unaltered
878at the location where it was when it was indexed. If you intend to move,
879delete or alter a file, consider using the option @code{-n} which will
880force GNUnet to make a copy of the file in the database.
881
882Since it is much less efficient, this is strongly discouraged for large
883files. When GNUnet indexes a file (default), GNUnet does @strong{not}
884create an additional encrypted copy of the file but just computes a
885summary (or index) of the file. That summary is approximately two percent
886of the size of the original file and is stored in GNUnet's database.
887Whenever a request for a part of an indexed file reaches GNUnet,
888this part is encrypted on-demand and send out. This way, there is no
889need for an additional encrypted copy of the file to stay anywhere
890on the drive. This is different from other systems, such as Freenet,
891where each file that is put online must be in Freenet's database in
892encrypted format, doubling the space requirements if the user wants
893to preserve a directly accessible copy in plaintext.
894
895Thus indexing should be used for all files where the user will keep
896using this file (at the location given to gnunet-publish) and does
897not want to retrieve it back from GNUnet each time. If you want to
898remove a file that you have indexed from the local peer, use the tool
899@command{gnunet-unindex} to un-index the file.
900
901The option @code{-n} may be used if the user fears that the file might
902be found on their drive (assuming the computer comes under the control
903of an adversary). When used with the @code{-n} flag, the user has a
904much better chance of denying knowledge of the existence of the file,
905even if it is still (encrypted) on the drive and the adversary is
906able to crack the encryption (e.g. by guessing the keyword.
907
908@node fs-Concepts
909@subsection Concepts
910@c %**end of header
911
912For better results with filesharing it is useful to understand the
913following concepts.
914In addition to anonymous routing GNUnet attempts to give users a better
915experience in searching for content. GNUnet uses cryptography to safely
916break content into smaller pieces that can be obtained from different
917sources without allowing participants to corrupt files. GNUnet makes it
918difficult for an adversary to send back bogus search results. GNUnet
919enables content providers to group related content and to establish a
920reputation. Furthermore, GNUnet allows updates to certain content to be
921made available. This section is supposed to introduce users to the
922concepts that are used to achieve these goals.
923
924
925@menu
926* Files::
927* Keywords::
928* Directories::
929* Pseudonyms::
930* Namespaces::
931* Advertisements::
932* Anonymity level::
933* Content Priority::
934* Replication::
935@end menu
936
937@node Files
938@subsubsection Files
939@c %**end of header
940
941A file in GNUnet is just a sequence of bytes. Any file-format is allowed
942and the maximum file size is theoretically @math{2^64 - 1} bytes, except
943that it would take an impractical amount of time to share such a file.
944GNUnet itself never interprets the contents of shared files, except when
945using GNU libextractor to obtain keywords.
946
947@node Keywords
948@subsubsection Keywords
949@c %**end of header
950
951Keywords are the most simple mechanism to find files on GNUnet.
952Keywords are @strong{case-sensitive} and the search string
953must always match @strong{exactly} the keyword used by the
954person providing the file. Keywords are never transmitted in
955plaintext. The only way for an adversary to determine the keyword
956that you used to search is to guess it (which then allows the
957adversary to produce the same search request). Since providing
958keywords by hand for each shared file is tedious, GNUnet uses
959GNU libextractor to help automate this process. Starting a
960keyword search on a slow machine can take a little while since
961the keyword search involves computing a fresh RSA key to formulate the
962request.
963
964@node Directories
965@subsubsection Directories
966@c %**end of header
967
968A directory in GNUnet is a list of file identifiers with meta data.
969The file identifiers provide sufficient information about the files
970to allow downloading the contents. Once a directory has been created,
971it cannot be changed since it is treated just like an ordinary file
972by the network. Small files (of a few kilobytes) can be inlined in
973the directory, so that a separate download becomes unnecessary.
974
975Directories are shared just like ordinary files. If you download a
976directory with @command{gnunet-download}, you can use
977@command{gnunet-directory} to list its contents. The canonical
978extension for GNUnet directories when stored as files in your
979local file-system is ".gnd". The contents of a directory are URIs and
980meta data.
981The URIs contain all the information required by
982@command{gnunet-download} to retrieve the file. The meta data
983typically includes the mime-type, description, a filename and
984other meta information, and possibly even the full original file
985(if it was small).
986
987@node Pseudonyms
988@subsubsection Pseudonyms
989@c %**end of header
990
991@b{Please note that the text in this subsection is outdated and needs}
992@b{to be rewritten for version 0.10!}
993@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
994
995Pseudonyms in GNUnet are essentially public-private (RSA) key pairs
996that allow a GNUnet user to maintain an identity (which may or may not
997be detached from their real-life identity). GNUnet's pseudonyms are not
998file-sharing specific --- and they will likely be used by many GNUnet
999applications where a user identity is required.
1000
1001Note that a pseudonym is NOT bound to a GNUnet peer. There can be multiple
1002pseudonyms for a single user, and users could (theoretically) share the
1003private pseudonym keys (currently only out-of-band by knowing which files
1004to copy around).
1005
1006@node Namespaces
1007@subsubsection Namespaces
1008@c %**end of header
1009
1010@b{Please note that the text in this subsection is outdated and needs}
1011@b{to be rewritten for version 0.10!}
1012@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1013
1014A namespace is a set of files that were signed by the same pseudonym.
1015Files (or directories) that have been signed and placed into a namespace
1016can be updated. Updates are identified as authentic if the same secret
1017key was used to sign the update. Namespaces are also useful to establish
1018a reputation, since all of the content in the namespace comes from the
1019same entity (which does not have to be the same person).
1020
1021@node Advertisements
1022@subsubsection Advertisements
1023@c %**end of header
1024
1025@b{Please note that the text in this subsection is outdated and needs}
1026@b{to be rewritten for version 0.10!}
1027@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1028
1029Advertisements are used to notify other users about the existence of a
1030namespace. Advertisements are propagated using the normal keyword search.
1031When an advertisement is received (in response to a search), the namespace
1032is added to the list of namespaces available in the namespace-search
1033dialogs of gnunet-fs-gtk and printed by @code{gnunet-identity}. Whenever a
1034namespace is created, an appropriate advertisement can be generated.
1035The default keyword for the advertising of namespaces is "namespace".
1036
1037Note that GNUnet differentiates between your pseudonyms (the identities
1038that you control) and namespaces. If you create a pseudonym, you will
1039not automatically see the respective namespace. You first have to create
1040an advertisement for the namespace and find it using keyword
1041search --- even for your own namespaces. The @command{gnunet-identity}
1042tool is currently responsible for both managing pseudonyms and namespaces.
1043This will likely change in the future to reduce the potential for
1044confusion.
1045
1046@node Anonymity level
1047@subsubsection Anonymity level
1048@c %**end of header
1049
1050The anonymity level determines how hard it should be for an adversary to
1051determine the identity of the publisher or the searcher/downloader. An
1052anonymity level of zero means that anonymity is not required. The default
1053anonymity level of "1" means that anonymous routing is desired, but no
1054particular amount of cover traffic is necessary. A powerful adversary
1055might thus still be able to deduce the origin of the traffic using
1056traffic analysis. Specifying higher anonymity levels increases the
1057amount of cover traffic required. While this offers better privacy,
1058it can also significantly hurt performance.
1059
1060@node Content Priority
1061@subsubsection Content Priority
1062@c %**end of header
1063
1064Depending on the peer's configuration, GNUnet peers migrate content
1065between peers. Content in this sense are individual blocks of a file,
1066not necessarily entire files. When peers run out of space (due to
1067local publishing operations or due to migration of content from other
1068peers), blocks sometimes need to be discarded. GNUnet first always
1069discards expired blocks (typically, blocks are published with an
1070expiration of about two years in the future; this is another option).
1071If there is still not enough space, GNUnet discards the blocks with the
1072lowest priority. The priority of a block is decided by its popularity
1073(in terms of requests from peers we trust) and, in case of blocks
1074published locally, the base-priority that was specified by the user
1075when the block was published initially.
1076
1077@node Replication
1078@subsubsection Replication
1079@c %**end of header
1080
1081When peers migrate content to other systems, the replication level
1082of a block is used to decide which blocks need to be migrated most
1083urgently. GNUnet will always push the block with the highest
1084replication level into the network, and then decrement the replication
1085level by one. If all blocks reach replication level zero, the
1086selection is simply random.
1087
1088
1089@node Namespace Management
1090@subsection Namespace Management
1091@c %**end of header
1092
1093@b{Please note that the text in this subsection is outdated and needs}
1094@b{to be rewritten for version 0.10!}
1095
1096The @code{gnunet-identity} tool can be used to create pseudonyms and
1097to advertise namespaces. By default, @code{gnunet-identity -D} simply
1098lists all locally available pseudonyms.
1099
1100
1101@menu
1102* Creating Pseudonyms::
1103* Deleting Pseudonyms::
1104* Advertising namespaces::
1105* Namespace names::
1106* Namespace root::
1107@end menu
1108
1109@node Creating Pseudonyms
1110@subsubsection Creating Pseudonyms
1111@c %**end of header
1112
1113@b{Please note that the text in this subsection is outdated and needs}
1114@b{to be rewritten for version 0.10!}
1115@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1116
1117With the @command{-C NICK} option it can also be used to
1118create a new pseudonym. A pseudonym is the virtual identity
1119of the entity in control of a namespace. Anyone can create
1120any number of pseudonyms. Note that creating a pseudonym can
1121take a few minutes depending on the performance of the machine
1122used.
1123
1124@node Deleting Pseudonyms
1125@subsubsection Deleting Pseudonyms
1126@c %**end of header
1127
1128@b{Please note that the text in this subsection is outdated and needs}
1129@b{to be rewritten for version 0.10!}
1130@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1131
1132With the @command{-D NICK} option pseudonyms can be deleted.
1133Once the pseudonym has been deleted it is impossible to add
1134content to the corresponding namespace. Deleting the
1135pseudonym does not make the namespace or any content in it
1136unavailable.
1137
1138@node Advertising namespaces
1139@subsubsection Advertising namespaces
1140@c %**end of header
1141
1142@b{Please note that the text in this subsection is outdated and needs}
1143@b{to be rewritten for version 0.10!}
1144@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1145
1146Each namespace is associated with meta-data that describes
1147the namespace. This meta-data is provided by the user at
1148the time that the namespace is advertised. Advertisements
1149are published under keywords so that they can be found using
1150normal keyword-searches. This way, users can learn about new
1151namespaces without relying on out-of-band communication or directories.
1152A suggested keyword to use for all namespaces is simply "namespace".
1153When a keyword-search finds a namespace advertisement,
1154it is automatically stored in a local list of known namespaces.
1155Users can then associate a rank with the namespace to remember
1156the quality of the content found in it.
1157
1158@node Namespace names
1159@subsubsection Namespace names
1160@c %**end of header
1161
1162@b{Please note that the text in this subsection is outdated and needs}
1163@b{to be rewritten for version 0.10!}
1164@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1165
1166While the namespace is uniquely identified by its ID, another way
1167to refer to the namespace is to use the NICKNAME.
1168The NICKNAME can be freely chosen by the creator of the namespace and
1169hence conflicts are possible. If a GNUnet client learns about more
1170than one namespace using the same NICKNAME, the ID is appended
1171to the NICKNAME to get a unique identifier.
1172
1173@node Namespace root
1174@subsubsection Namespace root
1175@c %**end of header
1176
1177@b{Please note that the text in this subsection is outdated and needs}
1178@b{to be rewritten for version 0.10!}
1179@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1180
1181An item of particular interest in the namespace advertisement is
1182the ROOT. The ROOT is the identifier of a designated entry in the
1183namespace. The idea is that the ROOT can be used to advertise an
1184entry point to the content of the namespace.
1185
1186@node File-Sharing URIs
1187@subsection File-Sharing URIs
1188@c %**end of header
1189
1190GNUnet (currently) uses four different types of URIs for
1191file-sharing. They all begin with "gnunet://fs/".
1192This section describes the four different URI types in detail.
1193
1194For FS URIs empty KEYWORDs are not allowed. Quotes are allowed to
1195denote whitespace between words. Keywords must contain a balanced
1196number of double quotes. Doubles quotes can not be used in the actual
1197keywords. This means that the the string '""foo bar""' will be turned
1198into two OR-ed keywords 'foo' and 'bar', not into '"foo bar"'.
1199
1200@menu
1201* Encoding of hash values in URIs::
1202* Content Hash Key (chk)::
1203* Location identifiers (loc)::
1204* Keyword queries (ksk)::
1205* Namespace content (sks)::
1206@end menu
1207
1208@node Encoding of hash values in URIs
1209@subsubsection Encoding of hash values in URIs
1210@c %**end of header
1211
1212Most URIs include some hash values. Hashes are encoded using
1213base32hex (RFC 2938).
1214
1215@cindex chk-uri
1216@node Content Hash Key (chk)
1217@subsubsection Content Hash Key (chk)
1218@c %**end of header
1219
1220A chk-URI is used to (uniquely) identify a file or directory
1221and to allow peers to download the file. Files are stored in
1222GNUnet as a tree of encrypted blocks.
1223The chk-URI thus contains the information to download and decrypt
1224those blocks. A chk-URI has the format
1225"gnunet://fs/chk/KEYHASH.QUERYHASH.SIZE". Here, "SIZE"
1226is the size of the file (which allows a peer to determine the
1227shape of the tree), KEYHASH is the key used to decrypt the file
1228(also the hash of the plaintext of the top block) and QUERYHASH
1229is the query used to request the top-level block (also the hash
1230of the encrypted block).
1231
1232@cindex loc-uri
1233@node Location identifiers (loc)
1234@subsubsection Location identifiers (loc)
1235@c %**end of header
1236
1237For non-anonymous file-sharing, loc-URIs are used to specify which
1238peer is offering the data (in addition to specifying all of the
1239data from a chk-URI). Location identifiers include a digital
1240signature of the peer to affirm that the peer is truly the
1241origin of the data. The format is
1242"gnunet://fs/loc/KEYHASH.QUERYHASH.SIZE.PEER.SIG.EXPTIME".
1243Here, "PEER" is the public key of the peer (in GNUnet format in
1244base32hex), SIG is the RSA signature (in GNUnet format in
1245base32hex) and EXPTIME specifies when the signature expires
1246(in milliseconds after 1970).
1247
1248@cindex ksk-uri
1249@node Keyword queries (ksk)
1250@subsubsection Keyword queries (ksk)
1251@c %**end of header
1252
1253A keyword-URI is used to specify that the desired operation
1254is the search using a particular keyword. The format is simply
1255"gnunet://fs/ksk/KEYWORD". Non-ASCII characters can be specified
1256using the typical URI-encoding (using hex values) from HTTP.
1257"+" can be used to specify multiple keywords (which are then
1258logically "OR"-ed in the search, results matching both keywords
1259are given a higher rank): "gnunet://fs/ksk/KEYWORD1+KEYWORD2".
1260ksk-URIs must not begin or end with the plus ('+') character.
1261Furthermore they must not contain '++'.
1262
1263@cindex sks-uri
1264@node Namespace content (sks)
1265@subsubsection Namespace content (sks)
1266@c %**end of header
1267
1268@b{Please note that the text in this subsection is outdated and needs}
1269@b{to be rewritten for version 0.10!}
1270@b{This especially concerns the terminology of Pseudonym/Ego/Identity.}
1271
1272Namespaces are sets of files that have been approved by some (usually
1273pseudonymous) user --- typically by that user publishing all of the
1274files together. A file can be in many namespaces. A file is in a
1275namespace if the owner of the ego (aka the namespace's private key)
1276signs the CHK of the file cryptographically. An SKS-URI is used to
1277search a namespace. The result is a block containing meta data,
1278the CHK and the namespace owner's signature. The format of a sks-URI
1279is "gnunet://fs/sks/NAMESPACE/IDENTIFIER". Here, "NAMESPACE"
1280is the public key for the namespace. "IDENTIFIER" is a freely
1281chosen keyword (or password!). A commonly used identifier is
1282"root" which by convention refers to some kind of index or other
1283entry point into the namespace.
1284
1285@node GTK User Interface
1286@subsection GTK User Interface
1287This chapter describes first steps for file-sharing with GNUnet.
1288To start, you should launch @command{gnunet-fs-gtk}.
1289
1290As we want to be sure that the network contains the data that we are
1291looking for for testing, we need to begin by publishing a file.
1292
1293@menu
1294* gtk-Publishing::
1295* gtk-Searching::
1296* gtk-Downloading::
1297@end menu
1298
1299@node gtk-Publishing
1300@subsubsection Publishing
1301@c %**end of header
1302
1303To publish a file, select "File Sharing" in the menu bar just below the
1304"Statistics" icon, and then select "Publish" from the menu.
1305
1306Afterwards, the following publishing dialog will appear:
1307
1308@c Add image here
1309
1310In this dialog, select the "Add File" button. This will open a
1311file selection dialog:
1312
1313@c Add image here
1314
1315Now, you should select a file from your computer to be published on
1316GNUnet. To see more of GNUnet's features later, you should pick a
1317PNG or JPEG file this time. You can leave all of the other options
1318in the dialog unchanged. Confirm your selection by pressing the "OK"
1319button in the bottom right corner. Now, you will briefly see a
1320"Messages..." dialog pop up, but most likely it will be too short for
1321you to really read anything. That dialog is showing you progress
1322information as GNUnet takes a first look at the selected file(s).
1323For a normal image, this is virtually instant, but if you later
1324import a larger directory you might be interested in the progress dialog
1325and potential errors that might be encountered during processing.
1326After the progress dialog automatically disappears, your file
1327should now appear in the publishing dialog:
1328
1329@c Add image here
1330
1331Now, select the file (by clicking on the file name) and then click
1332the "Edit" button. This will open the editing dialog:
1333
1334@c Add image here
1335
1336In this dialog, you can see many details about your file. In the
1337top left area, you can see meta data extracted about the file,
1338such as the original filename, the mimetype and the size of the image.
1339In the top right, you should see a preview for the image
1340(if GNU libextractor was installed correctly with the
1341respective plugins). Note that if you do not see a preview, this
1342is not a disaster, but you might still want to install more of
1343GNU libextractor in the future. In the bottom left, the dialog contains
1344a list of keywords. These are the keywords under which the file will be
1345made available. The initial list will be based on the extracted meta data.
1346Additional publishing options are in the right bottom corner. We will
1347now add an additional keyword to the list of keywords. This is done by
1348entering the keyword above the keyword list between the label "Keyword"
1349and the "Add keyword" button. Enter "test" and select "Add keyword".
1350Note that the keyword will appear at the bottom of the existing keyword
1351list, so you might have to scroll down to see it. Afterwards, push the
1352"OK" button at the bottom right of the dialog.
1353
1354You should now be back at the "Publish content on GNUnet" dialog. Select
1355"Execute" in the bottom right to close the dialog and publish your file
1356on GNUnet! Afterwards, you should see the main dialog with a new area
1357showing the list of published files (or ongoing publishing operations
1358with progress indicators):
1359
1360@c Add image here
1361
1362@node gtk-Searching
1363@subsubsection Searching
1364@c %**end of header
1365
1366Below the menu bar, there are four entry widges labeled "Namespace",
1367"Keywords", "Anonymity" and "Mime-type" (from left to right). These
1368widgets are used to control searching for files in GNUnet. Between the
1369"Keywords" and "Anonymity" widgets, there is also a big "Search" button,
1370which is used to initiate the search. We will ignore the "Namespace",
1371"Anonymity" and "Mime-type" options in this tutorial, please leave them
1372empty. Instead, simply enter "test" under "Keywords" and press "Search".
1373Afterwards, you should immediately see a new tab labeled after your
1374search term, followed by the (current) number of search
1375results --- "(15)" in our screenshot. Note that your results may
1376vary depending on what other users may have shared and how your
1377peer is connected.
1378
1379You can now select one of the search results. Once you do this,
1380additional information about the result should be displayed on the
1381right. If available, a preview image should appear on the top right.
1382Meta data describing the file will be listed at the bottom right.
1383
1384Once a file is selected, at the bottom of the search result list
1385a little area for downloading appears.
1386
1387@node gtk-Downloading
1388@subsubsection Downloading
1389@c %**end of header
1390
1391In the downloading area, you can select the target directory (default is
1392"Downloads") and specify the desired filename (by default the filename it
1393taken from the meta data of the published file). Additionally, you can
1394specify if the download should be anonymous and (for directories) if
1395the download should be recursive. In most cases, you can simply start
1396the download with the "Download!" button.
1397
1398Once you selected download, the progress of the download will be
1399displayed with the search result. You may need to resize the result
1400list or scroll to the right. The "Status" column shows the current
1401status of the download, and "Progress" how much has been completed.
1402When you close the search tab (by clicking on the "X" button next to
1403the "test" label), ongoing and completed downloads are not aborted
1404but moved to a special "*" tab.
1405
1406You can remove completed downloads from the "*" tab by clicking the
1407cleanup button next to the "*". You can also abort downloads by right
1408clicking on the respective download and selecting "Abort download"
1409from the menu.
1410
1411That's it, you now know the basics for file-sharing with GNUnet!
1412
1413
1414@node The GNU Name System
1415@section The GNU Name System
1416@c %**end of header
1417
1418
1419The GNU Name System (GNS) is secure and decentralized naming system.
1420It allows its users to resolve and register names within the @code{.gnu}
1421@dfn{top-level domain} (TLD).
1422
1423GNS is designed to provide:
1424@itemize @bullet
1425@item Censorship resistance
1426@item Query privacy
1427@item Secure name resolution
1428@item Compatibility with DNS
1429@end itemize
1430
1431For the initial configuration and population of your
1432GNS installation, please follow the GNS setup instructions.
1433The remainder of this chapter will provide some background on GNS
1434and then describe how to use GNS in more detail.
1435
1436Unlike DNS, GNS does not rely on central root zones or authorities.
1437Instead any user administers their own root and can can create arbitrary
1438name value mappings. Furthermore users can delegate resolution to other
1439users' zones just like DNS NS records do. Zones are uniquely identified
1440via public keys and resource records are signed using the corresponding
1441public key. Delegation to another user's zone is done using special PKEY
1442records and petnames. A petname is a name that can be freely chosen by
1443the user. This results in non-unique name-value mappings as
1444@code{@uref{http://www.bob.gnu/, www.bob.gnu}} to one user might be
1445@code{@uref{http://www.friend.gnu/, www.friend.gnu}} for someone else.
1446
1447
1448@menu
1449* Creating a Zone::
1450* Maintaining your own Zones::
1451* Obtaining your Zone Key::
1452* Adding Links to Other Zones::
1453* Using Public Keys as Top Level Domains::
1454* Resource Records in GNS::
1455* Synchronizing with legacy DNS::
1456@end menu
1457
1458
1459@node Creating a Zone
1460@subsection Creating a Zone
1461
1462To use GNS, you probably should create at least one zone of your own.
1463You can create any number of zones using the gnunet-identity tool
1464using:
1465
1466@example
1467$ gnunet-identity -C "myzone"
1468@end example
1469
1470Henceforth, on your system you control the TLD ``myzone''.
1471
1472All of your zones can be listed (displayed) using the
1473@command{gnunet-identity} command line tool as well:
1474
1475@example
1476$ gnunet-identity -d
1477@end example
1478
1479@node Maintaining your own Zones
1480@subsection Maintaining your own Zones
1481
1482@noindent
1483Now you can add (or edit, or remove) records in your GNS zone using the
1484@command{gnunet-namestore-gtk} GUI or using the @command{gnunet-namestore}
1485command-line tool.
1486In either case, your records will be stored in an SQL database under
1487control of the @command{gnunet-service-namestore}.
1488Note that if multiple users use one peer, the namestore database will
1489include the combined records of all users.
1490However, users will not be able to see each other's records
1491if they are marked as private.
1492
1493To provide a short example for editing your own zone, suppose you
1494have your own web server with the IP @code{1.2.3.4}. Then you can put an
1495@code{A} record (@code{A} records in DNS are for IPv4 IP addresses)
1496into your local zone ``myzone'' using the command:
1497
1498@example
1499$ gnunet-namestore -z myzone -a -n www -t A -V 1.2.3.4 -e never
1500@end example
1501
1502@noindent
1503Afterwards, you will be able to access your webpage under "www.myzone"
1504(assuming your webserver does not use virtual hosting, if it does,
1505please read up on setting up the GNS proxy).
1506
1507Similar commands will work for other types of DNS and GNS records,
1508the syntax largely depending on the type of the record.
1509Naturally, most users may find editing the zones using the
1510@command{gnunet-namestore-gtk} GUI to be easier.
1511
1512@node Obtaining your Zone Key
1513@subsection Obtaining your Zone Key
1514
1515Each zone in GNS has a public-private key. Usually, gnunet-namestore and
1516gnunet-setup will access your private key as necessary, so you do not
1517have to worry about those. What is important is your public key
1518(or rather, the hash of your public key), as you will likely want to
1519give it to others so that they can securely link to you.
1520
1521You can usually get the hash of your public key using
1522
1523@example
1524$ gnunet-identity -d $options | grep myzone | awk '@{print $3@}'
1525@end example
1526
1527@noindent
1528For example, the output might be something like:
1529
1530@example
1531DC3SEECJORPHQNVRH965A6N74B1M37S721IG4RBQ15PJLLPJKUE0
1532@end example
1533
1534@noindent
1535Alternatively, you can obtain a QR code with your zone key AND your
1536pseudonym from gnunet-namestore-gtk. The QR code is displayed in the
1537main window and can be stored to disk using the ``Save as'' button
1538next to the image.
1539
1540@node Adding Links to Other Zones
1541@subsection Adding Links to Other Zones
1542
1543
1544A central operation in GNS is the ability to securely delegate to
1545other zones. Basically, by adding a delegation you make all of the
1546names from the other zone available to yourself. This section
1547describes how to create delegations.
1548
1549Suppose you have a friend who you call 'bob' who also uses GNS.
1550You can then delegate resolution of names to Bob's zone by adding
1551a PKEY record to their local zone:
1552
1553@example
1554$ gnunet-namestore -a -n bob --type PKEY -V XXXX -e never -Z myzone
1555@end example
1556
1557@noindent
1558Note that ``XXXX'' in the command above must be replaced with the hash
1559of Bob's public key (the output your friend obtained using the
1560@command{gnunet-identity} command from the previous section and told
1561you, for example by giving you a business card containing this
1562information as a QR code).
1563
1564Assuming Bob has an ``A'' record for their website under the name of
1565``www'' in his zone, you can then access Bob's website under
1566``www.bob.myzone'' --- as well as any (public) GNS record that Bob has
1567in their zone by replacing www with the respective name of the
1568record in Bob's zone.
1569
1570@c themselves? themself?
1571Furthermore, if Bob has themselves a (public) delegation to Carol's
1572zone under "carol", you can access Carol's records under
1573``NAME.carol.bob.myzone'' (where ``NAME'' is the name of Carol's
1574record you want to access).
1575
1576
1577@node Using Public Keys as Top Level Domains
1578@subsection Using Public Keys as Top Level Domains
1579
1580
1581GNS also assumes responsibility for any name that uses in a
1582well-formed public key for the TLD. Names ending this way are then
1583resolved by querying the respective zone. Such public key TLDs are
1584expected to be used under rare circumstances where globally unique
1585names are required, and for integration with legacy systems.
1586
1587@node Resource Records in GNS
1588@subsection Resource Records in GNS
1589
1590
1591GNS supports the majority of the DNS records as defined in
1592@uref{http://www.ietf.org/rfc/rfc1035.txt, RFC 1035}. Additionally,
1593GNS defines some new record types the are unique to the GNS system.
1594For example, GNS-specific resource records are used to give petnames
1595for zone delegation, revoke zone keys and provide some compatibility
1596features.
1597
1598For some DNS records, GNS does extended processing to increase their
1599usefulness in GNS. In particular, GNS introduces special names
1600referred to as "zone relative names". Zone relative names are allowed
1601in some resource record types (for example, in NS and CNAME records)
1602and can also be used in links on webpages. Zone relative names end
1603in ".+" which indicates that the name needs to be resolved relative
1604to the current authoritative zone. The extended processing of those
1605names will expand the ".+" with the correct delegation chain to the
1606authoritative zone (replacing ".+" with the name of the location
1607where the name was encountered) and hence generate a
1608valid GNS name.
1609
1610GNS currently supports the following record types:
1611
1612@menu
1613* NICK::
1614* PKEY::
1615* BOX::
1616* LEHO::
1617* VPN::
1618* A AAAA and TXT::
1619* CNAME::
1620* GNS2DNS::
1621* SOA SRV PTR and MX::
1622* PLACE::
1623* PHONE::
1624* ID ATTR::
1625* ID TOKEN::
1626* ID TOKEN METADATA::
1627* CREDENTIAL::
1628* POLICY::
1629* ATTRIBUTE::
1630* ABE KEY::
1631* ABE MASTER::
1632* RECLAIM OIDC CLIENT::
1633* RECLAIM OIDC REDIRECT::
1634@end menu
1635
1636@node NICK
1637@subsubsection NICK
1638
1639A NICK record is used to give a zone a name. With a NICK record, you
1640can essentially specify how you would like to be called. GNS expects
1641this record under the empty label ``@@'' in the zone's database
1642(NAMESTORE); however, it will then automatically be copied into each
1643record set, so that clients never need to do a separate lookup to
1644discover the NICK record. Also, users do not usually have to worry
1645about setting the NICK record: it is automatically set to the local
1646name of the TLD.
1647
1648@b{Example}@
1649
1650@example
1651Name: @@; RRType: NICK; Value: bob
1652@end example
1653
1654@noindent
1655This record in Bob's zone will tell other users that this zone wants
1656to be referred to as 'bob'. Note that nobody is obliged to call Bob's
1657zone 'bob' in their own zones. It can be seen as a
1658recommendation ("Please call this zone 'bob'").
1659
1660@node PKEY
1661@subsubsection PKEY
1662
1663PKEY records are used to add delegation to other users' zones and
1664give those zones a petname.
1665
1666@b{Example}@
1667
1668Let Bob's zone be identified by the hash "ABC012". Bob is your friend
1669so you want to give them the petname "friend". Then you add the
1670following record to your zone:
1671
1672@example
1673Name: friend; RRType: PKEY; Value: ABC012;
1674@end example
1675
1676@noindent
1677This will allow you to resolve records in bob's zone
1678under "*.friend.gnu".
1679
1680@node BOX
1681@subsubsection BOX
1682
1683BOX records are there to integrate information from TLSA or
1684SRV records under the main label. In DNS, TLSA and SRV records
1685use special names of the form @code{_port._proto.(label.)*tld} to
1686indicate the port number and protocol (i.e. tcp or udp) for which
1687the TLSA or SRV record is valid. This causes various problems, and
1688is elegantly solved in GNS by integrating the protocol and port
1689numbers together with the respective value into a "BOX" record.
1690Note that in the GUI, you do not get to edit BOX records directly
1691right now --- the GUI will provide the illusion of directly
1692editing the TLSA and SRV records, even though they internally
1693are BOXed up.
1694
1695@node LEHO
1696@subsubsection LEHO
1697
1698The LEgacy HOstname of a server. Some webservers expect a specific
1699hostname to provide a service (virtiual hosting). Also SSL
1700certificates usually contain DNS names. To provide the expected
1701legacy DNS name for a server, the LEHO record can be used.
1702To mitigate the just mentioned issues the GNS proxy has to be used.
1703The GNS proxy will use the LEHO information to apply the necessary
1704transformations.
1705
1706@node VPN
1707@subsubsection VPN
1708
1709GNS allows easy access to services provided by the GNUnet Virtual Public
1710Network. When the GNS resolver encounters a VPN record it will contact
1711the VPN service to try and allocate an IPv4/v6 address (if the queries
1712record type is an IP address) that can be used to contact the service.
1713
1714@b{Example}@
1715
1716I want to provide access to the VPN service "web.gnu." on port 80 on peer
1717ABC012:@
1718Name: www; RRType: VPN; Value: 80 ABC012 web.gnu.
1719
1720The peer ABC012 is configured to provide an exit point for the service
1721"web.gnu." on port 80 to it's server running locally on port 8080 by
1722having the following lines in the @file{gnunet.conf} configuration file:
1723
1724@example
1725[web.gnunet.]
1726TCP_REDIRECTS = 80:localhost4:8080
1727@end example
1728
1729@node A AAAA and TXT
1730@subsubsection A AAAA and TXT
1731
1732Those records work in exactly the same fashion as in traditional DNS.
1733
1734@node CNAME
1735@subsubsection CNAME
1736
1737As specified in RFC 1035 whenever a CNAME is encountered the query
1738needs to be restarted with the specified name. In GNS a CNAME
1739can either be:
1740
1741@itemize @bullet
1742@item A zone relative name,
1743@item A zkey name or
1744@item A DNS name (in which case resolution will continue outside
1745of GNS with the systems DNS resolver)
1746@end itemize
1747
1748@node GNS2DNS
1749@subsubsection GNS2DNS
1750
1751GNS can delegate authority to a legacy DNS zone. For this, the
1752name of the DNS nameserver and the name of the DNS zone are
1753specified in a GNS2DNS record.
1754
1755@b{Example}
1756
1757@example
1758Name: pet; RRType: GNS2DNS; Value: gnunet.org@@a.ns.joker.com
1759@end example
1760
1761@noindent
1762Any query to @code{pet.gnu} will then be delegated to the DNS server at
1763@code{a.ns.joker.com}. For example,
1764@code{@uref{http://www.pet.gnu/, www.pet.gnu}} will result in a DNS query
1765for @code{@uref{http://www.gnunet.org/, www.gnunet.org}} to the server
1766at @code{a.ns.joker.com}. Delegation to DNS via NS records in GNS can
1767be useful if you do not want to start resolution in the DNS root zone
1768(due to issues such as censorship or availability).
1769
1770Note that you would typically want to use a relative name for the
1771nameserver, i.e.
1772
1773@example
1774Name: pet; RRType: GNS2DNS; Value: gnunet.org@@ns-joker.+@
1775Name: ns-joker; RRType: A; Value: 184.172.157.218
1776@end example
1777
1778@noindent
1779This way, you can avoid involving the DNS hierarchy in the resolution of
1780@code{a.ns.joker.com}. In the example above, the problem may not be
1781obvious as the nameserver for "gnunet.org" is in the ".com" zone.
1782However, imagine the nameserver was "ns.gnunet.org". In this case,
1783delegating to "ns.gnunet.org" would mean that despite using GNS,
1784censorship in the DNS ".org" zone would still be effective.
1785
1786@node SOA SRV PTR and MX
1787@subsubsection SOA SRV PTR and MX
1788
1789The domain names in those records can, again, be either
1790
1791@itemize @bullet
1792@item A zone relative name,
1793@item A zkey name or
1794@item A DNS name
1795@end itemize
1796
1797The resolver will expand the zone relative name if possible.
1798Note that when using MX records within GNS, the target mail
1799server might still refuse to accept e-mails to the resulting
1800domain as the name might not match. GNS-enabled mail clients
1801should use the ZKEY zone as the destination hostname and
1802GNS-enabled mail servers should be configured to accept
1803e-mails to the ZKEY-zones of all local users.
1804
1805@node PLACE
1806@subsubsection PLACE
1807
1808Record type for a social place.
1809
1810@node PHONE
1811@subsubsection PHONE
1812
1813Record type for a phone (of CONVERSATION).
1814
1815@node ID ATTR
1816@subsubsection ID ATTR
1817
1818Record type for identity attributes (of IDENTITY).
1819
1820@node ID TOKEN
1821@subsubsection ID TOKEN
1822
1823Record type for an identity token (of IDENTITY-TOKEN).
1824
1825@node ID TOKEN METADATA
1826@subsubsection ID TOKEN METADATA
1827
1828Record type for the private metadata of an identity token (of IDENTITY-TOKEN).
1829
1830@node CREDENTIAL
1831@subsubsection CREDENTIAL
1832
1833Record type for credential.
1834
1835@node POLICY
1836@subsubsection POLICY
1837
1838Record type for policies.
1839
1840@node ATTRIBUTE
1841@subsubsection ATTRIBUTE
1842
1843Record type for reverse lookups.
1844
1845@node ABE KEY
1846@subsubsection ABE KEY
1847
1848Record type for ABE records.
1849
1850@node ABE MASTER
1851@subsubsection ABE MASTER
1852
1853Record type for ABE master keys.
1854
1855@node RECLAIM OIDC CLIENT
1856@subsubsection RECLAIM OIDC CLIENT
1857
1858Record type for reclaim OIDC clients.
1859
1860@node RECLAIM OIDC REDIRECT
1861@subsubsection RECLAIM OIDC REDIRECT
1862
1863Record type for reclaim OIDC redirect URIs.
1864
1865@node Synchronizing with legacy DNS
1866@subsection Synchronizing with legacy DNS
1867
1868If you want to support GNS but the master database for a zone
1869is only available and maintained in DNS, GNUnet includes the
1870@command{gnunet-zoneimport} tool to monitor a DNS zone and
1871automatically import records into GNS. Today, the tool does
1872not yet support DNS AF(X)R, as we initially used it on the
1873``.fr'' zone which does not allow us to perform a DNS zone
1874transfer. Instead, @command{gnunet-zoneimport} reads a list
1875of DNS domain names from @code{stdin}, issues DNS queries for
1876each, converts the obtained records (if possible) and stores
1877the result in the namestore.
1878
1879@image{images/gns,6in,, picture of DNS-GNS data flow}
1880
1881The zonemaster service then takes the records from the namestore,
1882publishes them into the DHT which makes the result available to the
1883GNS resolver. In the GNS configuration, non-local zones can be
1884configured to be intercepted by specifying ``.tld = PUBLICKEY'' in the
1885configuration file in the ``[gns]'' section.
1886
1887Note that the namestore by default also populates the namecache.
1888This pre-population is cryptographically expensive. Thus, on
1889systems that only serve to import a large (millions of records)
1890DNS zone and that do not have a local gns service in use, it
1891is thus advisable to disable the namecache by setting the
1892option ``DISABLE'' to ``YES'' in section ``[namecache]''.
1893
1894
1895@node re@:claim Identity Provider
1896@section re@:claim Identity Provider
1897
1898The re:claim Identity Provider (IdP) is a decentralized IdP service.
1899It allows its users to manage and authorize third parties to access their identity attributes such as email or shipping addresses.
1900
1901It basically mimics the concepts of centralized IdPs, such as those offered by Google or Facebook.
1902Like 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.
1903
1904@menu
1905* Managing Attributes::
1906* Sharing Attributes with Third Parties::
1907* Revoking Authorizations of Third Parties::
1908* Using the OpenID-Connect IdP::
1909@end menu
1910
1911@node Managing Attributes
1912@subsection Managing Attributes
1913
1914Before adding attributes to an identity, you must first create an ego:
1915
1916@example
1917$ gnunet-identity -C "username"
1918@end example
1919
1920Henceforth, you can manage a new user profile of the user ``username''.
1921
1922To add an email address to your user profile, simply use the @command{gnunet-reclaim} command line tool::
1923
1924@example
1925$ gnunet-reclaim -e "username" -a "email" -V "username@@example.gnunet"
1926@end example
1927
1928All of your attributes can be listed using the @command{gnunet-reclaim}
1929command line tool as well:
1930
1931@example
1932$ gnunet-reclaim -e "username" -D
1933@end example
1934
1935Currently, and by default, attribute values are interpreted as plain text.
1936In the future there might be more value types such as X.509 certificate credentials.
1937
1938@node Sharing Attributes with Third Parties
1939@subsection Sharing Attributes with Third Parties
1940
1941If you want to allow a third party such as a website or friend to access to your attributes (or a subset thereof) execute:
1942
1943@example
1944$ gnunet-reclaim -e "username" -r "PKEY" -i "attribute1,attribute2,..."
1945@end example
1946
1947Where "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.
1948
1949The command will return a "ticket" string.
1950You must give this "ticket" to the requesting third party.
1951
1952The third party can then retrieve your shared identity attributes using:
1953
1954@example
1955$ gnunet-reclaim -e "friend" -C "ticket"
1956@end example
1957
1958This will retrieve and list the shared identity attributes.
1959The above command will also work if the user "username" is currently offline since the attributes are retrieved from GNS.
1960Further, 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.
1961
1962To list all given authorizations (tickets) you can execute:
1963@example
1964$ gnunet-reclaim -e "friend" -T (TODO there is only a REST API for this ATM)
1965@end example
1966
1967
1968@node Revoking Authorizations of Third Parties
1969@subsection Revoking Authorizations of Third Parties
1970
1971If you want to revoke the access of a third party to your attributes you can execute:
1972
1973@example
1974$ gnunet-reclaim -e "username" -R "ticket"
1975@end example
1976
1977This will prevent the third party from accessing the attribute in the future.
1978Please 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.
1979As such, only access to updated data in the future can be revoked.
1980This behaviour is _exactly the same_ as with other IdPs.
1981
1982@node Using the OpenID-Connect IdP
1983@subsection Using the OpenID-Connect IdP
1984
1985@menu
1986* Setting up reclaim.io::
1987* For Users::
1988* For Service Providers::
1989@end menu
1990
1991
1992@node Setting up reclaim.io
1993@subsubsection Setting up reclaim.io
1994
1995@example
1996$ gnunet-identity -C id
1997$ openssl genrsa -des3 -passout pass:xxxx -out server.pass.key 2048
1998$ openssl rsa -passin pass:xxxx -in server.pass.key -out /etc/reclaim/reclaim.id.key
1999$ rm server.pass.key
2000$ openssl req -new -key /etc/reclaim/reclaim.id.key -out server.csr \
2001 -subj "/CN=reclaim.id.local"
2002$ openssl x509 -req -days 365 -in server.csr -signkey /etc/reclaim/reclaim.id.key -out /etc/reclaim/reclaim.id.crt
2003$ openssl x509 -in /etc/reclaim/reclaim.id.crt -out /etc/reclaim/reclaim.id.der -outform DER
2004$ HEXCERT=`xxd -p /etc/reclaim/reclaim.id.der | tr -d '\n'`
2005$ BOXVALUE="6 443 52 3 0 0 $HEXCERT"
2006$ gnunet-namestore -z id -a -n reclaim -t A -V "127.0.0.1" -e 1d -p
2007$ gnunet-namestore -z id -a -n reclaim -t LEHO -V "reclaim.id.local" -e 1d -p
2008$ gnunet-namestore -z id -a -n reclaim -t BOX -V "$BOXVALUE" -e 1d -p
2009@end example
2010
2011NGINX setup:
2012@example
2013server @{
2014 listen 443;
2015 server_name reclaim.id.local;
2016 ssl on;
2017 ssl_certificate /etc/reclaim/reclaim.id.crt;
2018 ssl_certificate_key /etc/reclaim/reclaim.id.key;
2019 ssl_session_timeout 30m;
2020 ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
2021 ssl_session_cache shared:SSL:10m;
2022
2023 location /api @{
2024 rewrite /api/(.*) /$1 break;
2025 proxy_pass http://127.0.0.1:7776;
2026 @}
2027@}
2028@end example
2029
2030This will expose the REST API of GNUnet at https://reclaim.id/api.
2031
2032@node For Users
2033@subsubsection For Users
2034
2035To use the OpenID Connect Identity Provider as an end user, you must first intall the User Interface from TODOINSERTURLHERE.
2036
2037Start the user interface using:
2038
2039@example
2040$ yarn run build --prod
2041@end example
2042
2043Now setup a webserver to serve the compiled website under "dist/".
2044
2045Now we can add the user interfce to our NGINX configuraiton:
2046
2047@example
2048server @{
2049...
2050 location / @{
2051 proxy_pass http://<whereever you serve the UI>;
2052 @}
2053@}
2054@end example
2055
2056You can thest your setup by accessing https://reclaim.id in your browser through the GNS proxy.
2057
2058@node For Service Providers
2059@subsubsection For Service Providers
2060
2061To setup an OpenID Connect client, it must first be registered.
2062In reclaim, client registration is done by creating a client identity and adding the redirect URI and client description into its namespace:
2063
2064@example
2065$ gnunet-identity -C <rp_name>
2066$ gnunet-namestore -z <rp_name> -a -n "+" -t RECLAIM_OIDC_REDIRECT -V <redirect_uri> -e 1d -p
2067$ gnunet-namestore -z <rp_name> -a -n "+" -t RECLAIM_OIDC_CLIENT -V "My OIDC Client" -e 1d -p
2068@end example
2069
2070You can now use the OpenID Connect REST endpoints exposed by reclaim.
2071
2072To request authorization from a user, your webapplication should initiate the OpenID Connect Authorization Flow like this:
2073@example
2074$ https://reclaim.id/openid/authorize?redirect_uri=<redirect_uri>&client_id=<RP_PKEY>&response_type=code&nonce=1234&scope=attribute1 attribute2 ...
2075@end example
2076
2077You should choose a random number for the nonce parameter. The RP_KEY is the public key corresponding to the <rp_name> identity.
2078
2079The redirect URI is the URI that you expect the user to return to within the OpenID Connect authorization code flow.
2080
2081When the user returns to your redirect URI, you can exchange it for an access token at the OpenID Token endpoint.
2082The authentication at the token endpoint is performed using the configured password (PSW) in the reclaim configuration (reclaim.conf). To set it execute:
2083
2084@example
2085$ gnunet-config -s reclaim-rest-plugin -o PSW -V <secret>
2086@end example
2087
2088To retrieve the access token, you can access the token endpoint through the proxy like this:
2089
2090@example
2091$ curl --socks5-hostname 127.0.0.1:7777 \
2092 -X POST \
2093 https://reclaim.id/openid/token?grant_type=authorization_code&redirect_uri=<redirect_uri>&code=<code> \
2094 -u <RP_KEY>:<secret>
2095@end example
2096
2097If successful, this will return a JSON object containing an ID Token and Access Token.
2098The Access Token can be used to access the OpenID Connect userinfo endpoint:
2099
2100@example
2101$ curl --socks5-hostname 127.0.0.1:7777 \
2102 -X POST \
2103 https://reclaim.id/openid/userinfo\
2104 -H 'Authorization: Bearer <access_token>'
2105@end example
2106
2107
2108
2109@node Using the Virtual Public Network
2110@section Using the Virtual Public Network
2111
2112@menu
2113* Setting up an Exit node::
2114* Fedora and the Firewall::
2115* Setting up VPN node for protocol translation and tunneling::
2116@end menu
2117
2118Using the GNUnet Virtual Public Network (VPN) application you can
2119tunnel IP traffic over GNUnet. Moreover, the VPN comes
2120with built-in protocol translation and DNS-ALG support, enabling
2121IPv4-to-IPv6 protocol translation (in both directions).
2122This chapter documents how to use the GNUnet VPN.
2123
2124The first thing to note about the GNUnet VPN is that it is a public
2125network. All participating peers can participate and there is no
2126secret key to control access. So unlike common virtual private
2127networks, the GNUnet VPN is not useful as a means to provide a
2128"private" network abstraction over the Internet. The GNUnet VPN
2129is a virtual network in the sense that it is an overlay over the
2130Internet, using its own routing mechanisms and can also use an
2131internal addressing scheme. The GNUnet VPN is an Internet
2132underlay --- TCP/IP applications run on top of it.
2133
2134The VPN is currently only supported on GNU/Linux systems.
2135Support for operating systems that support TUN (such as FreeBSD)
2136should be easy to add (or might not even require any coding at
2137all --- we just did not test this so far). Support for other
2138operating systems would require re-writing the code to create virtual
2139network interfaces and to intercept DNS requests.
2140
2141The VPN does not provide good anonymity. While requests are routed
2142over the GNUnet network, other peers can directly see the source
2143and destination of each (encapsulated) IP packet. Finally, if you
2144use the VPN to access Internet services, the peer sending the
2145request to the Internet will be able to observe and even alter
2146the IP traffic. We will discuss additional security implications
2147of using the VPN later in this chapter.
2148
2149@node Setting up an Exit node
2150@subsection Setting up an Exit node
2151
2152Any useful operation with the VPN requires the existence of an exit
2153node in the GNUnet Peer-to-Peer network. Exit functionality can only
2154be enabled on peers that have regular Internet access. If you want
2155to play around with the VPN or support the network, we encourage
2156you to setup exit nodes. This chapter documents how to setup an
2157exit node.
2158
2159There are four types of exit functions an exit node can provide,
2160and using the GNUnet VPN to access the Internet will only work
2161nicely if the first three types are provided somewhere in
2162the network. The four exit functions are:
2163
2164@itemize @bullet
2165@item DNS: allow other peers to use your DNS resolver
2166@item IPv4: allow other peers to access your IPv4 Internet connection
2167@item IPv6: allow other peers to access your IPv6 Internet connection
2168@item Local service: allow other peers to access a specific TCP or
2169UDP service your peer is providing
2170@end itemize
2171
2172By enabling "exit" in gnunet-setup and checking the respective boxes
2173in the "exit" tab, you can easily choose which of the above exit
2174functions you want to support.
2175
2176Note, however, that by supporting the first three functions you will
2177allow arbitrary other GNUnet users to access the Internet via your
2178system. This is somewhat similar to running a Tor exit node. The
2179Torproject has a nice article about what to consider if you want
2180to do this here. We believe that generally running a DNS exit node
2181is completely harmless.
2182
2183The exit node configuration does currently not allow you to restrict the
2184Internet traffic that leaves your system. In particular, you cannot
2185exclude SMTP traffic (or block port 25) or limit to HTTP traffic using
2186the GNUnet configuration. However, you can use your host firewall to
2187restrict outbound connections from the virtual tunnel interface. This
2188is highly recommended. In the future, we plan to offer a wider range
2189of configuration options for exit nodes.
2190
2191Note that by running an exit node GNUnet will configure your kernel
2192to perform IP-forwarding (for IPv6) and NAT (for IPv4) so that the
2193traffic from the virtual interface can be routed to the Internet.
2194In order to provide an IPv6-exit, you need to have a subnet routed
2195to your host's external network interface and assign a subrange of
2196that subnet to the GNUnet exit's TUN interface.
2197
2198When running a local service, you should make sure that the local
2199service is (also) bound to the IP address of your EXIT interface
2200(i.e. 169.254.86.1). It will NOT work if your local service is
2201just bound to loopback. You may also want to create a "VPN" record
2202in your zone of the GNU Name System to make it easy for others to
2203access your service via a name instead of just the full service
2204descriptor. Note that the identifier you assign the service can
2205serve as a passphrase or shared secret, clients connecting to the
2206service must somehow learn the service's name. VPN records in the
2207GNU Name System can make this easier.
2208
2209@node Fedora and the Firewall
2210@subsection Fedora and the Firewall
2211
2212
2213When using an exit node on Fedora 15, the standard firewall can
2214create trouble even when not really exiting the local system!
2215For IPv4, the standard rules seem fine. However, for IPv6 the
2216standard rules prohibit traffic from the network range of the
2217virtual interface created by the exit daemon to the local IPv6
2218address of the same interface (which is essentially loopback
2219traffic, so you might suspect that a standard firewall would
2220leave this traffic alone). However, as somehow for IPv6 the
2221traffic is not recognized as originating from the local
2222system (and as the connection is not already "established"),
2223the firewall drops the traffic. You should still get ICMPv6
2224packets back, but that's obviously not very useful.
2225
2226Possible ways to fix this include disabling the firewall (do you
2227have a good reason for having it on?) or disabling the firewall
2228at least for the GNUnet exit interface (or the respective
2229IPv4/IPv6 address range). The best way to diagnose these kinds
2230of problems in general involves setting the firewall to REJECT
2231instead of DROP and to watch the traffic using wireshark
2232(or tcpdump) to see if ICMP messages are generated when running
2233some tests that should work.
2234
2235@node Setting up VPN node for protocol translation and tunneling
2236@subsection Setting up VPN node for protocol translation and tunneling
2237
2238
2239The GNUnet VPN/PT subsystem enables you to tunnel IP traffic over the
2240VPN to an exit node, from where it can then be forwarded to the
2241Internet. This section documents how to setup VPN/PT on a node.
2242Note that you can enable both the VPN and an exit on the same peer.
2243In this case, IP traffic from your system may enter your peer's VPN
2244and leave your peer's exit. This can be useful as a means to do
2245protocol translation. For example, you might have an application that
2246supports only IPv4 but needs to access an IPv6-only site. In this case,
2247GNUnet would perform 4to6 protocol translation between the VPN (IPv4)
2248and the Exit (IPv6). Similarly, 6to4 protocol translation is also
2249possible. However, the primary use for GNUnet would be to access
2250an Internet service running with an IP version that is not supported
2251by your ISP. In this case, your IP traffic would be routed via GNUnet
2252to a peer that has access to the Internet with the desired IP version.
2253
2254Setting up an entry node into the GNUnet VPN primarily requires you
2255to enable the "VPN/PT" option in "gnunet-setup". This will launch the
2256"gnunet-service-vpn", "gnunet-service-dns" and "gnunet-daemon-pt"
2257processes. The "gnunet-service-vpn" will create a virtual interface
2258which will be used as the target for your IP traffic that enters the
2259VPN. Additionally, a second virtual interface will be created by
2260the "gnunet-service-dns" for your DNS traffic. You will then need to
2261specify which traffic you want to tunnel over GNUnet. If your ISP only
2262provides you with IPv4 or IPv6-access, you may choose to tunnel the
2263other IP protocol over the GNUnet VPN. If you do not have an ISP
2264(and are connected to other GNUnet peers via WLAN), you can also
2265choose to tunnel all IP traffic over GNUnet. This might also provide
2266you with some anonymity. After you enable the respective options
2267and restart your peer, your Internet traffic should be tunneled
2268over the GNUnet VPN.
2269
2270The GNUnet VPN uses DNS-ALG to hijack your IP traffic. Whenever an
2271application resolves a hostname (i.e. 'gnunet.org'), the
2272"gnunet-daemon-pt" will instruct the "gnunet-service-dns" to intercept
2273the request (possibly route it over GNUnet as well) and replace the
2274normal answer with an IP in the range of the VPN's interface.
2275"gnunet-daemon-pt" will then tell "gnunet-service-vpn" to forward all
2276traffic it receives on the TUN interface via the VPN to the original
2277destination.
2278
2279For applications that do not use DNS, you can also manually create
2280such a mapping using the gnunet-vpn command-line tool. Here, you
2281specify the desired address family of the result (i.e. "-4"), and the
2282intended target IP on the Internet ("-i 131.159.74.67") and
2283"gnunet-vpn" will tell you which IP address in the range of your
2284VPN tunnel was mapped.
2285
2286@command{gnunet-vpn} can also be used to access "internal" services
2287offered by GNUnet nodes. So if you happen to know a peer and a
2288service offered by that peer, you can create an IP tunnel to
2289that peer by specifying the peer's identity, service name and
2290protocol (--tcp or --udp) and you will again receive an IP address
2291that will terminate at the respective peer's service.
2292
2293
diff --git a/doc/documentation/chapters/vocabulary.texi b/doc/documentation/chapters/vocabulary.texi
deleted file mode 100644
index 0ee472b95..000000000
--- a/doc/documentation/chapters/vocabulary.texi
+++ /dev/null
@@ -1,72 +0,0 @@
1@node Vocabulary
2@chapter Vocabulary
3
4@menu
5* Definitions abbreviations and acronyms::
6* Words and characters::
7* Technical Assumptions::
8@end menu
9
10Throughout this Reference Manual we will use certain words and characters
11which are listed in this introductionary chapter.
12
13@node Definitions abbreviations and acronyms
14@section Definitions abbreviations and acronyms
15
16@menu
17* Definitions::
18@end menu
19
20@node Definitions
21@subsection Definitions
22
23Throughout this Reference Manual, the following terms and definitions
24apply.
25
26@node Words and characters
27@section Words and characters
28
29@enumerate
30@item
31In chapter Installation Handbook,
32``@command{#}'' in example code blocks describes commands executed as root
33
34@example
35# echo "I am root"
36I am root
37@end example
38
39@item
40However, in the chapter GNUnet C Tutorial
41``@command{#}'' in example code blocks describes commands, ie comments.
42
43@example
44# Do the foobar thing:
45$ make foobar
46@end example
47
48@item
49Dollarsign ``@command{$}'' in example code blocks describes commands you
50execute as unprivileged users.
51
52@example
53$ cd foo; ./configure --example-switch
54@end example
55
56@item
57Backslash ``@command{\}'' describes linebreaks.
58
59@example
60./configure --foo --bar --baz \
61 --short-loop
62@end example
63
64...expands to @code{./configure --foo --bar --baz --short-loop}
65
66@end enumerate
67
68@node Technical Assumptions
69@section Technical Assumptions
70
71@c Is it really assuming Bash (ie Bash extensions of POSIX being used)?
72The shell on GNU systems is assumed to be Bash.
diff --git a/doc/documentation/docstyle.css b/doc/documentation/docstyle.css
deleted file mode 100644
index 8719248d0..000000000
--- a/doc/documentation/docstyle.css
+++ /dev/null
@@ -1,76 +0,0 @@
1html, body {
2 font-size: 1em;
3 text-align: left;
4 text-decoration: none;
5}
6html { background-color: #e7e7e7; }
7
8body {
9 max-width: 74.92em;
10 margin: 0 auto;
11 padding: .5em 1em 1em 1em;
12 background-color: white;
13 border: .1em solid #c0c0c0;
14}
15
16h1, h2, h3, h4 { color: #333; }
17h5, h6, dt { color: #222; }
18
19
20a h3 {
21 color: #005090;
22}
23
24a[href] { color: #005090; }
25a[href]:visited { color: #100070; }
26a[href]:active, a[href]:hover {
27 color: #100070;
28 text-decoration: none;
29}
30
31.linkrow {
32 margin: 3em 0;
33}
34
35.linkrow {
36 text-align: center;
37}
38
39div.example { padding: .8em 1.2em .4em; }
40pre.example { padding: .8em 1.2em; }
41div.example, pre.example {
42 margin: 1em 0 1em 3% ;
43 -webkit-border-radius: .3em;
44 -moz-border-radius: .3em;
45 border-radius: .3em;
46 border: 1px solid #d4cbb6;
47 background-color: #f2efe4;
48}
49div.example > pre.example {
50 padding: 0 0 .4em;
51 margin: 0;
52 border: none;
53}
54
55
56/* This makes the very long tables of contents in Gnulib and other
57 manuals easier to read. */
58.contents ul, .shortcontents ul { font-weight: bold; }
59.contents ul ul, .shortcontents ul ul { font-weight: normal; }
60.contents ul { list-style: none; }
61
62/* For colored navigation bars (Emacs manual): make the bar extend
63 across the whole width of the page and give it a decent height. */
64.header, .node { margin: 0 -1em; padding: 0 1em; }
65.header p, .node p { line-height: 2em; }
66
67/* For navigation links */
68.node a, .header a { display: inline-block; line-height: 2em; }
69.node a:hover, .header a:hover { background: #f2efe4; }
70
71table.cartouche {
72 border-collapse: collapse;
73 border-color: darkred;
74 border-style: solid;
75 border-width: 3px;
76}
diff --git a/doc/documentation/fdl-1.3.texi b/doc/documentation/fdl-1.3.texi
deleted file mode 100644
index cb71f05a1..000000000
--- a/doc/documentation/fdl-1.3.texi
+++ /dev/null
@@ -1,505 +0,0 @@
1@c The GNU Free Documentation License.
2@center Version 1.3, 3 November 2008
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{} 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
9@uref{http://fsf.org/}
10
11Everyone is permitted to copy and distribute verbatim copies
12of this license document, but changing it is not allowed.
13@end display
14
15@enumerate 0
16@item
17PREAMBLE
18
19The purpose of this License is to make a manual, textbook, or other
20functional and useful document @dfn{free} in the sense of freedom: to
21assure everyone the effective freedom to copy and redistribute it,
22with or without modifying it, either commercially or noncommercially.
23Secondarily, this License preserves for the author and publisher a way
24to get credit for their work, while not being considered responsible
25for modifications made by others.
26
27This License is a kind of ``copyleft'', which means that derivative
28works of the document must themselves be free in the same sense. It
29complements the GNU General Public License, which is a copyleft
30license designed for free software.
31
32We have designed this License in order to use it for manuals for free
33software, because free software needs free documentation: a free
34program should come with manuals providing the same freedoms that the
35software does. But this License is not limited to software manuals;
36it can be used for any textual work, regardless of subject matter or
37whether it is published as a printed book. We recommend this License
38principally for works whose purpose is instruction or reference.
39
40@item
41APPLICABILITY AND DEFINITIONS
42
43This License applies to any manual or other work, in any medium, that
44contains a notice placed by the copyright holder saying it can be
45distributed under the terms of this License. Such a notice grants a
46world-wide, royalty-free license, unlimited in duration, to use that
47work under the conditions stated herein. The ``Document'', below,
48refers to any such manual or work. Any member of the public is a
49licensee, and is addressed as ``you''. You accept the license if you
50copy, modify or distribute the work in a way requiring permission
51under copyright law.
52
53A ``Modified Version'' of the Document means any work containing the
54Document or a portion of it, either copied verbatim, or with
55modifications and/or translated into another language.
56
57A ``Secondary Section'' is a named appendix or a front-matter section
58of the Document that deals exclusively with the relationship of the
59publishers or authors of the Document to the Document's overall
60subject (or to related matters) and contains nothing that could fall
61directly within that overall subject. (Thus, if the Document is in
62part a textbook of mathematics, a Secondary Section may not explain
63any mathematics.) The relationship could be a matter of historical
64connection with the subject or with related matters, or of legal,
65commercial, philosophical, ethical or political position regarding
66them.
67
68The ``Invariant Sections'' are certain Secondary Sections whose titles
69are designated, as being those of Invariant Sections, in the notice
70that says that the Document is released under this License. If a
71section does not fit the above definition of Secondary then it is not
72allowed to be designated as Invariant. The Document may contain zero
73Invariant Sections. If the Document does not identify any Invariant
74Sections then there are none.
75
76The ``Cover Texts'' are certain short passages of text that are listed,
77as Front-Cover Texts or Back-Cover Texts, in the notice that says that
78the Document is released under this License. A Front-Cover Text may
79be at most 5 words, and a Back-Cover Text may be at most 25 words.
80
81A ``Transparent'' copy of the Document means a machine-readable copy,
82represented in a format whose specification is available to the
83general public, that is suitable for revising the document
84straightforwardly with generic text editors or (for images composed of
85pixels) generic paint programs or (for drawings) some widely available
86drawing editor, and that is suitable for input to text formatters or
87for automatic translation to a variety of formats suitable for input
88to text formatters. A copy made in an otherwise Transparent file
89format whose markup, or absence of markup, has been arranged to thwart
90or discourage subsequent modification by readers is not Transparent.
91An image format is not Transparent if used for any substantial amount
92of text. A copy that is not ``Transparent'' is called ``Opaque''.
93
94Examples of suitable formats for Transparent copies include plain
95ASCII without markup, Texinfo input format, La@TeX{} input
96format, SGML or XML using a publicly available
97DTD, and standard-conforming simple HTML,
98PostScript or PDF designed for human modification. Examples
99of transparent image formats include PNG, XCF and
100JPG. Opaque formats include proprietary formats that can be
101read and edited only by proprietary word processors, SGML or
102XML for which the DTD and/or processing tools are
103not generally available, and the machine-generated HTML,
104PostScript or PDF produced by some word processors for
105output purposes only.
106
107The ``Title Page'' means, for a printed book, the title page itself,
108plus such following pages as are needed to hold, legibly, the material
109this License requires to appear in the title page. For works in
110formats which do not have any title page as such, ``Title Page'' means
111the text near the most prominent appearance of the work's title,
112preceding the beginning of the body of the text.
113
114The ``publisher'' means any person or entity that distributes copies
115of the Document to the public.
116
117A section ``Entitled XYZ'' means a named subunit of the Document whose
118title either is precisely XYZ or contains XYZ in parentheses following
119text that translates XYZ in another language. (Here XYZ stands for a
120specific section name mentioned below, such as ``Acknowledgements'',
121``Dedications'', ``Endorsements'', or ``History''.) To ``Preserve the Title''
122of such a section when you modify the Document means that it remains a
123section ``Entitled XYZ'' according to this definition.
124
125The Document may include Warranty Disclaimers next to the notice which
126states that this License applies to the Document. These Warranty
127Disclaimers are considered to be included by reference in this
128License, but only as regards disclaiming warranties: any other
129implication that these Warranty Disclaimers may have is void and has
130no effect on the meaning of this License.
131
132@item
133VERBATIM COPYING
134
135You may copy and distribute the Document in any medium, either
136commercially or noncommercially, provided that this License, the
137copyright notices, and the license notice saying this License applies
138to the Document are reproduced in all copies, and that you add no other
139conditions whatsoever to those of this License. You may not use
140technical measures to obstruct or control the reading or further
141copying of the copies you make or distribute. However, you may accept
142compensation in exchange for copies. If you distribute a large enough
143number of copies you must also follow the conditions in section 3.
144
145You may also lend copies, under the same conditions stated above, and
146you may publicly display copies.
147
148@item
149COPYING IN QUANTITY
150
151If you publish printed copies (or copies in media that commonly have
152printed covers) of the Document, numbering more than 100, and the
153Document's license notice requires Cover Texts, you must enclose the
154copies in covers that carry, clearly and legibly, all these Cover
155Texts: Front-Cover Texts on the front cover, and Back-Cover Texts on
156the back cover. Both covers must also clearly and legibly identify
157you as the publisher of these copies. The front cover must present
158the full title with all words of the title equally prominent and
159visible. You may add other material on the covers in addition.
160Copying with changes limited to the covers, as long as they preserve
161the title of the Document and satisfy these conditions, can be treated
162as verbatim copying in other respects.
163
164If the required texts for either cover are too voluminous to fit
165legibly, you should put the first ones listed (as many as fit
166reasonably) on the actual cover, and continue the rest onto adjacent
167pages.
168
169If you publish or distribute Opaque copies of the Document numbering
170more than 100, you must either include a machine-readable Transparent
171copy along with each Opaque copy, or state in or with each Opaque copy
172a computer-network location from which the general network-using
173public has access to download using public-standard network protocols
174a complete Transparent copy of the Document, free of added material.
175If you use the latter option, you must take reasonably prudent steps,
176when you begin distribution of Opaque copies in quantity, to ensure
177that this Transparent copy will remain thus accessible at the stated
178location until at least one year after the last time you distribute an
179Opaque copy (directly or through your agents or retailers) of that
180edition to the public.
181
182It is requested, but not required, that you contact the authors of the
183Document well before redistributing any large number of copies, to give
184them a chance to provide you with an updated version of the Document.
185
186@item
187MODIFICATIONS
188
189You may copy and distribute a Modified Version of the Document under
190the conditions of sections 2 and 3 above, provided that you release
191the Modified Version under precisely this License, with the Modified
192Version filling the role of the Document, thus licensing distribution
193and modification of the Modified Version to whoever possesses a copy
194of it. In addition, you must do these things in the Modified Version:
195
196@enumerate A
197@item
198Use in the Title Page (and on the covers, if any) a title distinct
199from that of the Document, and from those of previous versions
200(which should, if there were any, be listed in the History section
201of the Document). You may use the same title as a previous version
202if the original publisher of that version gives permission.
203
204@item
205List on the Title Page, as authors, one or more persons or entities
206responsible for authorship of the modifications in the Modified
207Version, together with at least five of the principal authors of the
208Document (all of its principal authors, if it has fewer than five),
209unless they release you from this requirement.
210
211@item
212State on the Title page the name of the publisher of the
213Modified Version, as the publisher.
214
215@item
216Preserve all the copyright notices of the Document.
217
218@item
219Add an appropriate copyright notice for your modifications
220adjacent to the other copyright notices.
221
222@item
223Include, immediately after the copyright notices, a license notice
224giving the public permission to use the Modified Version under the
225terms of this License, in the form shown in the Addendum below.
226
227@item
228Preserve in that license notice the full lists of Invariant Sections
229and required Cover Texts given in the Document's license notice.
230
231@item
232Include an unaltered copy of this License.
233
234@item
235Preserve the section Entitled ``History'', Preserve its Title, and add
236to it an item stating at least the title, year, new authors, and
237publisher of the Modified Version as given on the Title Page. If
238there is no section Entitled ``History'' in the Document, create one
239stating the title, year, authors, and publisher of the Document as
240given on its Title Page, then add an item describing the Modified
241Version as stated in the previous sentence.
242
243@item
244Preserve the network location, if any, given in the Document for
245public access to a Transparent copy of the Document, and likewise
246the network locations given in the Document for previous versions
247it was based on. These may be placed in the ``History'' section.
248You may omit a network location for a work that was published at
249least four years before the Document itself, or if the original
250publisher of the version it refers to gives permission.
251
252@item
253For any section Entitled ``Acknowledgements'' or ``Dedications'', Preserve
254the Title of the section, and preserve in the section all the
255substance and tone of each of the contributor acknowledgements and/or
256dedications given therein.
257
258@item
259Preserve all the Invariant Sections of the Document,
260unaltered in their text and in their titles. Section numbers
261or the equivalent are not considered part of the section titles.
262
263@item
264Delete any section Entitled ``Endorsements''. Such a section
265may not be included in the Modified Version.
266
267@item
268Do not retitle any existing section to be Entitled ``Endorsements'' or
269to conflict in title with any Invariant Section.
270
271@item
272Preserve any Warranty Disclaimers.
273@end enumerate
274
275If the Modified Version includes new front-matter sections or
276appendices that qualify as Secondary Sections and contain no material
277copied from the Document, you may at your option designate some or all
278of these sections as invariant. To do this, add their titles to the
279list of Invariant Sections in the Modified Version's license notice.
280These titles must be distinct from any other section titles.
281
282You may add a section Entitled ``Endorsements'', provided it contains
283nothing but endorsements of your Modified Version by various
284parties---for example, statements of peer review or that the text has
285been approved by an organization as the authoritative definition of a
286standard.
287
288You may add a passage of up to five words as a Front-Cover Text, and a
289passage of up to 25 words as a Back-Cover Text, to the end of the list
290of Cover Texts in the Modified Version. Only one passage of
291Front-Cover Text and one of Back-Cover Text may be added by (or
292through arrangements made by) any one entity. If the Document already
293includes a cover text for the same cover, previously added by you or
294by arrangement made by the same entity you are acting on behalf of,
295you may not add another; but you may replace the old one, on explicit
296permission from the previous publisher that added the old one.
297
298The author(s) and publisher(s) of the Document do not by this License
299give permission to use their names for publicity for or to assert or
300imply endorsement of any Modified Version.
301
302@item
303COMBINING DOCUMENTS
304
305You may combine the Document with other documents released under this
306License, under the terms defined in section 4 above for modified
307versions, provided that you include in the combination all of the
308Invariant Sections of all of the original documents, unmodified, and
309list them all as Invariant Sections of your combined work in its
310license notice, and that you preserve all their Warranty Disclaimers.
311
312The combined work need only contain one copy of this License, and
313multiple identical Invariant Sections may be replaced with a single
314copy. If there are multiple Invariant Sections with the same name but
315different contents, make the title of each such section unique by
316adding at the end of it, in parentheses, the name of the original
317author or publisher of that section if known, or else a unique number.
318Make the same adjustment to the section titles in the list of
319Invariant Sections in the license notice of the combined work.
320
321In the combination, you must combine any sections Entitled ``History''
322in the various original documents, forming one section Entitled
323``History''; likewise combine any sections Entitled ``Acknowledgements'',
324and any sections Entitled ``Dedications''. You must delete all
325sections Entitled ``Endorsements.''
326
327@item
328COLLECTIONS OF DOCUMENTS
329
330You may make a collection consisting of the Document and other documents
331released under this License, and replace the individual copies of this
332License in the various documents with a single copy that is included in
333the collection, provided that you follow the rules of this License for
334verbatim copying of each of the documents in all other respects.
335
336You may extract a single document from such a collection, and distribute
337it individually under this License, provided you insert a copy of this
338License into the extracted document, and follow this License in all
339other respects regarding verbatim copying of that document.
340
341@item
342AGGREGATION WITH INDEPENDENT WORKS
343
344A compilation of the Document or its derivatives with other separate
345and independent documents or works, in or on a volume of a storage or
346distribution medium, is called an ``aggregate'' if the copyright
347resulting from the compilation is not used to limit the legal rights
348of the compilation's users beyond what the individual works permit.
349When the Document is included in an aggregate, this License does not
350apply to the other works in the aggregate which are not themselves
351derivative works of the Document.
352
353If the Cover Text requirement of section 3 is applicable to these
354copies of the Document, then if the Document is less than one half of
355the entire aggregate, the Document's Cover Texts may be placed on
356covers that bracket the Document within the aggregate, or the
357electronic equivalent of covers if the Document is in electronic form.
358Otherwise they must appear on printed covers that bracket the whole
359aggregate.
360
361@item
362TRANSLATION
363
364Translation is considered a kind of modification, so you may
365distribute translations of the Document under the terms of section 4.
366Replacing Invariant Sections with translations requires special
367permission from their copyright holders, but you may include
368translations of some or all Invariant Sections in addition to the
369original versions of these Invariant Sections. You may include a
370translation of this License, and all the license notices in the
371Document, and any Warranty Disclaimers, provided that you also include
372the original English version of this License and the original versions
373of those notices and disclaimers. In case of a disagreement between
374the translation and the original version of this License or a notice
375or disclaimer, the original version will prevail.
376
377If a section in the Document is Entitled ``Acknowledgements'',
378``Dedications'', or ``History'', the requirement (section 4) to Preserve
379its Title (section 1) will typically require changing the actual
380title.
381
382@item
383TERMINATION
384
385You may not copy, modify, sublicense, or distribute the Document
386except as expressly provided under this License. Any attempt
387otherwise to copy, modify, sublicense, or distribute it is void, and
388will automatically terminate your rights under this License.
389
390However, if you cease all violation of this License, then your license
391from a particular copyright holder is reinstated (a) provisionally,
392unless and until the copyright holder explicitly and finally
393terminates your license, and (b) permanently, if the copyright holder
394fails to notify you of the violation by some reasonable means prior to
39560 days after the cessation.
396
397Moreover, your license from a particular copyright holder is
398reinstated permanently if the copyright holder notifies you of the
399violation by some reasonable means, this is the first time you have
400received notice of violation of this License (for any work) from that
401copyright holder, and you cure the violation prior to 30 days after
402your receipt of the notice.
403
404Termination of your rights under this section does not terminate the
405licenses of parties who have received copies or rights from you under
406this License. If your rights have been terminated and not permanently
407reinstated, receipt of a copy of some or all of the same material does
408not give you any rights to use it.
409
410@item
411FUTURE REVISIONS OF THIS LICENSE
412
413The Free Software Foundation may publish new, revised versions
414of the GNU Free Documentation License from time to time. Such new
415versions will be similar in spirit to the present version, but may
416differ in detail to address new problems or concerns. See
417@uref{http://www.gnu.org/copyleft/}.
418
419Each version of the License is given a distinguishing version number.
420If the Document specifies that a particular numbered version of this
421License ``or any later version'' applies to it, you have the option of
422following the terms and conditions either of that specified version or
423of any later version that has been published (not as a draft) by the
424Free Software Foundation. If the Document does not specify a version
425number of this License, you may choose any version ever published (not
426as a draft) by the Free Software Foundation. If the Document
427specifies that a proxy can decide which future versions of this
428License can be used, that proxy's public statement of acceptance of a
429version permanently authorizes you to choose that version for the
430Document.
431
432@item
433RELICENSING
434
435``Massive Multiauthor Collaboration Site'' (or ``MMC Site'') means any
436World Wide Web server that publishes copyrightable works and also
437provides prominent facilities for anybody to edit those works. A
438public wiki that anybody can edit is an example of such a server. A
439``Massive Multiauthor Collaboration'' (or ``MMC'') contained in the
440site means any set of copyrightable works thus published on the MMC
441site.
442
443``CC-BY-SA'' means the Creative Commons Attribution-Share Alike 3.0
444license published by Creative Commons Corporation, a not-for-profit
445corporation with a principal place of business in San Francisco,
446California, as well as future copyleft versions of that license
447published by that same organization.
448
449``Incorporate'' means to publish or republish a Document, in whole or
450in part, as part of another Document.
451
452An MMC is ``eligible for relicensing'' if it is licensed under this
453License, and if all works that were first published under this License
454somewhere other than this MMC, and subsequently incorporated in whole
455or in part into the MMC, (1) had no cover texts or invariant sections,
456and (2) were thus incorporated prior to November 1, 2008.
457
458The operator of an MMC Site may republish an MMC contained in the site
459under CC-BY-SA on the same site at any time before August 1, 2009,
460provided the MMC is eligible for relicensing.
461
462@end enumerate
463
464@page
465@heading ADDENDUM: How to use this License for your documents
466
467To use this License in a document you have written, include a copy of
468the License in the document and put the following copyright and
469license notices just after the title page:
470
471@smallexample
472@group
473 Copyright (C) @var{year} @var{your name}.
474 Permission is granted to copy, distribute and/or modify this document
475 under the terms of the GNU Free Documentation License, Version 1.3
476 or any later version published by the Free Software Foundation;
477 with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
478 Texts. A copy of the license is included in the section entitled ``GNU
479 Free Documentation License''.
480@end group
481@end smallexample
482
483If you have Invariant Sections, Front-Cover Texts and Back-Cover Texts,
484replace the ``with@dots{}Texts.''@: line with this:
485
486@smallexample
487@group
488 with the Invariant Sections being @var{list their titles}, with
489 the Front-Cover Texts being @var{list}, and with the Back-Cover Texts
490 being @var{list}.
491@end group
492@end smallexample
493
494If you have Invariant Sections without Cover Texts, or some other
495combination of the three, merge those two alternatives to suit the
496situation.
497
498If your document contains nontrivial examples of program code, we
499recommend releasing these examples in parallel under your choice of
500free software license, such as the GNU General Public License,
501to permit their use in free software.
502
503@c Local Variables:
504@c ispell-local-pdict: "ispell-dict"
505@c End:
diff --git a/doc/documentation/gendocs.sh b/doc/documentation/gendocs.sh
deleted file mode 100755
index 3b71b36a2..000000000
--- a/doc/documentation/gendocs.sh
+++ /dev/null
@@ -1,504 +0,0 @@
1#!/bin/sh -e
2# gendocs.sh -- generate a GNU manual in many formats. This script is
3# mentioned in maintain.texi. See the help message below for usage details.
4
5scriptversion=2016-12-31.18
6
7# Copyright 2003-2017 Free Software Foundation, Inc.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation; either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
21#
22# Original author: Mohit Agarwal.
23# Send bug reports and any other correspondence to bug-gnulib@gnu.org.
24#
25# The latest version of this script, and the companion template, is
26# available from the Gnulib repository:
27#
28# http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/gendocs.sh
29# http://git.savannah.gnu.org/cgit/gnulib.git/tree/doc/gendocs_template
30
31# TODO:
32# - image importing was only implemented for HTML generated by
33# makeinfo. But it should be simple enough to adjust.
34# - images are not imported in the source tarball. All the needed
35# formats (PDF, PNG, etc.) should be included.
36
37prog=`basename "$0"`
38srcdir=`pwd`
39
40scripturl="http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/gendocs.sh"
41templateurl="http://git.savannah.gnu.org/cgit/gnulib.git/plain/doc/gendocs_template"
42
43: ${SETLANG="env LANG= LC_MESSAGES= LC_ALL= LANGUAGE="}
44: ${MAKEINFO="makeinfo"}
45: ${TEXI2DVI="texi2dvi"}
46: ${DOCBOOK2HTML="docbook2html"}
47: ${DOCBOOK2PDF="docbook2pdf"}
48: ${DOCBOOK2TXT="docbook2txt"}
49: ${GENDOCS_TEMPLATE_DIR="."}
50: ${PERL='perl'}
51: ${TEXI2HTML="texi2html"}
52unset CDPATH
53unset use_texi2html
54
55MANUAL_TITLE=
56PACKAGE=
57EMAIL=webmasters@gnu.org # please override with --email
58commonarg= # passed to all makeinfo/texi2html invcations.
59dirargs= # passed to all tools (-I dir).
60dirs= # -I directories.
61htmlarg="--css-ref=/software/gnulib/manual.css -c TOP_NODE_UP_URL=/manual"
62infoarg=--no-split
63generate_ascii=true
64generate_html=true
65generate_info=true
66generate_tex=true
67outdir=manual
68source_extra=
69split=node
70srcfile=
71texarg="-t @finalout"
72
73version="gendocs.sh $scriptversion
74
75Copyright 2017 Free Software Foundation, Inc.
76There is NO warranty. You may redistribute this software
77under the terms of the GNU General Public License.
78For more information about these matters, see the files named COPYING."
79
80usage="Usage: $prog [OPTION]... PACKAGE MANUAL-TITLE
81
82Generate output in various formats from PACKAGE.texinfo (or .texi or
83.txi) source. See the GNU Maintainers document for a more extensive
84discussion:
85 http://www.gnu.org/prep/maintain_toc.html
86
87Options:
88 --email ADR use ADR as contact in generated web pages; always give this.
89
90 -s SRCFILE read Texinfo from SRCFILE, instead of PACKAGE.{texinfo|texi|txi}
91 -o OUTDIR write files into OUTDIR, instead of manual/.
92 -I DIR append DIR to the Texinfo search path.
93 --common ARG pass ARG in all invocations.
94 --html ARG pass ARG to makeinfo or texi2html for HTML targets,
95 instead of '$htmlarg'.
96 --info ARG pass ARG to makeinfo for Info, instead of --no-split.
97 --no-ascii skip generating the plain text output.
98 --no-html skip generating the html output.
99 --no-info skip generating the info output.
100 --no-tex skip generating the dvi and pdf output.
101 --source ARG include ARG in tar archive of sources.
102 --split HOW make split HTML by node, section, chapter; default node.
103 --tex ARG pass ARG to texi2dvi for DVI and PDF, instead of -t @finalout.
104
105 --texi2html use texi2html to make HTML target, with all split versions.
106 --docbook convert through DocBook too (xml, txt, html, pdf).
107
108 --help display this help and exit successfully.
109 --version display version information and exit successfully.
110
111Simple example: $prog --email bug-gnu-emacs@gnu.org emacs \"GNU Emacs Manual\"
112
113Typical sequence:
114 cd PACKAGESOURCE/doc
115 wget \"$scripturl\"
116 wget \"$templateurl\"
117 $prog --email BUGLIST MANUAL \"GNU MANUAL - One-line description\"
118
119Output will be in a new subdirectory \"manual\" (by default;
120use -o OUTDIR to override). Move all the new files into your web CVS
121tree, as explained in the Web Pages node of maintain.texi.
122
123Please use the --email ADDRESS option so your own bug-reporting
124address will be used in the generated HTML pages.
125
126MANUAL-TITLE is included as part of the HTML <title> of the overall
127manual/index.html file. It should include the name of the package being
128documented. manual/index.html is created by substitution from the file
129$GENDOCS_TEMPLATE_DIR/gendocs_template. (Feel free to modify the
130generic template for your own purposes.)
131
132If you have several manuals, you'll need to run this script several
133times with different MANUAL values, specifying a different output
134directory with -o each time. Then write (by hand) an overall index.html
135with links to them all.
136
137If a manual's Texinfo sources are spread across several directories,
138first copy or symlink all Texinfo sources into a single directory.
139(Part of the script's work is to make a tar.gz of the sources.)
140
141As implied above, by default monolithic Info files are generated.
142If you want split Info, or other Info options, use --info to override.
143
144You can set the environment variables MAKEINFO, TEXI2DVI, TEXI2HTML,
145and PERL to control the programs that get executed, and
146GENDOCS_TEMPLATE_DIR to control where the gendocs_template file is
147looked for. With --docbook, the environment variables DOCBOOK2HTML,
148DOCBOOK2PDF, and DOCBOOK2TXT are also consulted.
149
150By default, makeinfo and texi2dvi are run in the default (English)
151locale, since that's the language of most Texinfo manuals. If you
152happen to have a non-English manual and non-English web site, see the
153SETLANG setting in the source.
154
155Email bug reports or enhancement requests to bug-gnulib@gnu.org.
156"
157
158while test $# -gt 0; do
159 case $1 in
160 -s) shift; srcfile=$1;;
161 -o) shift; outdir=$1;;
162 -I) shift; dirargs="$dirargs -I '$1'"; dirs="$dirs $1";;
163 --common) shift; commonarg=$1;;
164 --docbook) docbook=yes;;
165 --email) shift; EMAIL=$1;;
166 --html) shift; htmlarg=$1;;
167 --info) shift; infoarg=$1;;
168 --no-ascii) generate_ascii=false;;
169 --no-html) generate_ascii=false;;
170 --no-info) generate_info=false;;
171 --no-tex) generate_tex=false;;
172 --source) shift; source_extra=$1;;
173 --split) shift; split=$1;;
174 --tex) shift; texarg=$1;;
175 --texi2html) use_texi2html=1;;
176
177 --help) echo "$usage"; exit 0;;
178 --version) echo "$version"; exit 0;;
179 -*)
180 echo "$0: Unknown option \`$1'." >&2
181 echo "$0: Try \`--help' for more information." >&2
182 exit 1;;
183 *)
184 if test -z "$PACKAGE"; then
185 PACKAGE=$1
186 elif test -z "$MANUAL_TITLE"; then
187 MANUAL_TITLE=$1
188 else
189 echo "$0: extra non-option argument \`$1'." >&2
190 exit 1
191 fi;;
192 esac
193 shift
194done
195
196# makeinfo uses the dirargs, but texi2dvi doesn't.
197commonarg=" $dirargs $commonarg"
198
199# For most of the following, the base name is just $PACKAGE
200base=$PACKAGE
201
202if test -n "$srcfile"; then
203 # but here, we use the basename of $srcfile
204 base=`basename "$srcfile"`
205 case $base in
206 *.txi|*.texi|*.texinfo) base=`echo "$base"|sed 's/\.[texinfo]*$//'`;;
207 esac
208 PACKAGE=$base
209elif test -s "$srcdir/$PACKAGE.texinfo"; then
210 srcfile=$srcdir/$PACKAGE.texinfo
211elif test -s "$srcdir/$PACKAGE.texi"; then
212 srcfile=$srcdir/$PACKAGE.texi
213elif test -s "$srcdir/$PACKAGE.txi"; then
214 srcfile=$srcdir/$PACKAGE.txi
215else
216 echo "$0: cannot find .texinfo or .texi or .txi for $PACKAGE in $srcdir." >&2
217 exit 1
218fi
219
220if test ! -r $GENDOCS_TEMPLATE_DIR/gendocs_template; then
221 echo "$0: cannot read $GENDOCS_TEMPLATE_DIR/gendocs_template." >&2
222 echo "$0: it is available from $templateurl." >&2
223 exit 1
224fi
225
226# Function to return size of $1 in something resembling kilobytes.
227calcsize()
228{
229 size=`ls -ksl $1 | awk '{print $1}'`
230 echo $size
231}
232
233# copy_images OUTDIR HTML-FILE...
234# -------------------------------
235# Copy all the images needed by the HTML-FILEs into OUTDIR.
236# Look for them in . and the -I directories; this is simpler than what
237# makeinfo supports with -I, but hopefully it will suffice.
238copy_images()
239{
240 local odir
241 odir=$1
242 shift
243 $PERL -n -e "
244BEGIN {
245 \$me = '$prog';
246 \$odir = '$odir';
247 @dirs = qw(. $dirs);
248}
249" -e '
250/<img src="(.*?)"/g && ++$need{$1};
251
252END {
253 #print "$me: @{[keys %need]}\n"; # for debugging, show images found.
254 FILE: for my $f (keys %need) {
255 for my $d (@dirs) {
256 if (-f "$d/$f") {
257 use File::Basename;
258 my $dest = dirname ("$odir/$f");
259 #
260 use File::Path;
261 -d $dest || mkpath ($dest)
262 || die "$me: cannot mkdir $dest: $!\n";
263 #
264 use File::Copy;
265 copy ("$d/$f", $dest)
266 || die "$me: cannot copy $d/$f to $dest: $!\n";
267 next FILE;
268 }
269 }
270 die "$me: $ARGV: cannot find image $f\n";
271 }
272}
273' -- "$@" || exit 1
274}
275
276case $outdir in
277 /*) abs_outdir=$outdir;;
278 *) abs_outdir=$srcdir/$outdir;;
279esac
280
281echo "Making output for $srcfile"
282echo " in `pwd`"
283mkdir -p "$outdir/"
284
285#
286if $generate_info; then
287 cmd="$SETLANG $MAKEINFO -o $PACKAGE.info $commonarg $infoarg \"$srcfile\""
288 echo "Generating info... ($cmd)"
289 rm -f $PACKAGE.info* # get rid of any strays
290 eval "$cmd"
291 tar czf "$outdir/$PACKAGE.info.tar.gz" $PACKAGE.info*
292 ls -l "$outdir/$PACKAGE.info.tar.gz"
293 info_tgz_size=`calcsize "$outdir/$PACKAGE.info.tar.gz"`
294 # do not mv the info files, there's no point in having them available
295 # separately on the web.
296fi # end info
297
298#
299if $generate_tex; then
300 cmd="$SETLANG $TEXI2DVI $dirargs $texarg \"$srcfile\""
301 printf "\nGenerating dvi... ($cmd)\n"
302 eval "$cmd"
303 # compress/finish dvi:
304 gzip -f -9 $PACKAGE.dvi
305 dvi_gz_size=`calcsize $PACKAGE.dvi.gz`
306 mv $PACKAGE.dvi.gz "$outdir/"
307 ls -l "$outdir/$PACKAGE.dvi.gz"
308
309 cmd="$SETLANG $TEXI2DVI --pdf $dirargs $texarg \"$srcfile\""
310 printf "\nGenerating pdf... ($cmd)\n"
311 eval "$cmd"
312 pdf_size=`calcsize $PACKAGE.pdf`
313 mv $PACKAGE.pdf "$outdir/"
314 ls -l "$outdir/$PACKAGE.pdf"
315fi # end tex (dvi + pdf)
316
317#
318if $generate_ascii; then
319 opt="-o $PACKAGE.txt --no-split --no-headers $commonarg"
320 cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
321 printf "\nGenerating ascii... ($cmd)\n"
322 eval "$cmd"
323 ascii_size=`calcsize $PACKAGE.txt`
324 gzip -f -9 -c $PACKAGE.txt >"$outdir/$PACKAGE.txt.gz"
325 ascii_gz_size=`calcsize "$outdir/$PACKAGE.txt.gz"`
326 mv $PACKAGE.txt "$outdir/"
327 ls -l "$outdir/$PACKAGE.txt" "$outdir/$PACKAGE.txt.gz"
328fi
329
330#
331
332if $generate_html; then
333# Split HTML at level $1. Used for texi2html.
334html_split()
335{
336 opt="--split=$1 --node-files $commonarg $htmlarg"
337 cmd="$SETLANG $TEXI2HTML --output $PACKAGE.html $opt \"$srcfile\""
338 printf "\nGenerating html by $1... ($cmd)\n"
339 eval "$cmd"
340 split_html_dir=$PACKAGE.html
341 (
342 cd ${split_html_dir} || exit 1
343 ln -sf ${PACKAGE}.html index.html
344 tar -czf "$abs_outdir/${PACKAGE}.html_$1.tar.gz" -- *.html
345 )
346 eval html_$1_tgz_size=`calcsize "$outdir/${PACKAGE}.html_$1.tar.gz"`
347 rm -f "$outdir"/html_$1/*.html
348 mkdir -p "$outdir/html_$1/"
349 mv ${split_html_dir}/*.html "$outdir/html_$1/"
350 rmdir ${split_html_dir}
351}
352
353if test -z "$use_texi2html"; then
354 opt="--no-split --html -o $PACKAGE.html $commonarg $htmlarg"
355 cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
356 printf "\nGenerating monolithic html... ($cmd)\n"
357 rm -rf $PACKAGE.html # in case a directory is left over
358 eval "$cmd"
359 html_mono_size=`calcsize $PACKAGE.html`
360 gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
361 html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
362 copy_images "$outdir/" $PACKAGE.html
363 mv $PACKAGE.html "$outdir/"
364 ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz"
365
366 # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option,
367 # it just always split by node. So if we're splitting by node anyway,
368 # leave it out.
369 if test "x$split" = xnode; then
370 split_arg=
371 else
372 split_arg=--split=$split
373 fi
374 #
375 opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg"
376 cmd="$SETLANG $MAKEINFO $opt \"$srcfile\""
377 printf "\nGenerating html by $split... ($cmd)\n"
378 eval "$cmd"
379 split_html_dir=$PACKAGE.html
380 copy_images $split_html_dir/ $split_html_dir/*.html
381 (
382 cd $split_html_dir || exit 1
383 tar -czf "$abs_outdir/$PACKAGE.html_$split.tar.gz" -- *
384 )
385 eval \
386 html_${split}_tgz_size=`calcsize "$outdir/$PACKAGE.html_$split.tar.gz"`
387 rm -rf "$outdir/html_$split/"
388 mv $split_html_dir "$outdir/html_$split/"
389 du -s "$outdir/html_$split/"
390 ls -l "$outdir/$PACKAGE.html_$split.tar.gz"
391
392else # use texi2html:
393 opt="--output $PACKAGE.html $commonarg $htmlarg"
394 cmd="$SETLANG $TEXI2HTML $opt \"$srcfile\""
395 printf "\nGenerating monolithic html with texi2html... ($cmd)\n"
396 rm -rf $PACKAGE.html # in case a directory is left over
397 eval "$cmd"
398 html_mono_size=`calcsize $PACKAGE.html`
399 gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz"
400 html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"`
401 mv $PACKAGE.html "$outdir/"
402
403 html_split node
404 html_split chapter
405 html_split section
406fi
407fi # end html
408
409#
410printf "\nMaking .tar.gz for sources...\n"
411d=`dirname $srcfile`
412(
413 cd "$d"
414 srcfiles=`ls -d *.texinfo *.texi *.txi *.eps $source_extra 2>/dev/null` || true
415 tar czfh "$abs_outdir/$PACKAGE.texi.tar.gz" $srcfiles
416 ls -l "$abs_outdir/$PACKAGE.texi.tar.gz"
417)
418texi_tgz_size=`calcsize "$outdir/$PACKAGE.texi.tar.gz"`
419
420#
421# Do everything again through docbook.
422if test -n "$docbook"; then
423 opt="-o - --docbook $commonarg"
424 cmd="$SETLANG $MAKEINFO $opt \"$srcfile\" >${srcdir}/$PACKAGE-db.xml"
425 printf "\nGenerating docbook XML... ($cmd)\n"
426 eval "$cmd"
427 docbook_xml_size=`calcsize $PACKAGE-db.xml`
428 gzip -f -9 -c $PACKAGE-db.xml >"$outdir/$PACKAGE-db.xml.gz"
429 docbook_xml_gz_size=`calcsize "$outdir/$PACKAGE-db.xml.gz"`
430 mv $PACKAGE-db.xml "$outdir/"
431
432 split_html_db_dir=html_node_db
433 opt="$commonarg -o $split_html_db_dir"
434 cmd="$DOCBOOK2HTML $opt \"${outdir}/$PACKAGE-db.xml\""
435 printf "\nGenerating docbook HTML... ($cmd)\n"
436 eval "$cmd"
437 (
438 cd ${split_html_db_dir} || exit 1
439 tar -czf "$abs_outdir/${PACKAGE}.html_node_db.tar.gz" -- *.html
440 )
441 html_node_db_tgz_size=`calcsize "$outdir/${PACKAGE}.html_node_db.tar.gz"`
442 rm -f "$outdir"/html_node_db/*.html
443 mkdir -p "$outdir/html_node_db"
444 mv ${split_html_db_dir}/*.html "$outdir/html_node_db/"
445 rmdir ${split_html_db_dir}
446
447 cmd="$DOCBOOK2TXT \"${outdir}/$PACKAGE-db.xml\""
448 printf "\nGenerating docbook ASCII... ($cmd)\n"
449 eval "$cmd"
450 docbook_ascii_size=`calcsize $PACKAGE-db.txt`
451 mv $PACKAGE-db.txt "$outdir/"
452
453 cmd="$DOCBOOK2PDF \"${outdir}/$PACKAGE-db.xml\""
454 printf "\nGenerating docbook PDF... ($cmd)\n"
455 eval "$cmd"
456 docbook_pdf_size=`calcsize $PACKAGE-db.pdf`
457 mv $PACKAGE-db.pdf "$outdir/"
458fi
459
460#
461printf "\nMaking index.html for $PACKAGE...\n"
462if test -z "$use_texi2html"; then
463 CONDS="/%%IF *HTML_SECTION%%/,/%%ENDIF *HTML_SECTION%%/d;\
464 /%%IF *HTML_CHAPTER%%/,/%%ENDIF *HTML_CHAPTER%%/d"
465else
466 # should take account of --split here.
467 CONDS="/%%ENDIF.*%%/d;/%%IF *HTML_SECTION%%/d;/%%IF *HTML_CHAPTER%%/d"
468fi
469
470curdate=`$SETLANG date '+%B %d, %Y'`
471sed \
472 -e "s!%%TITLE%%!$MANUAL_TITLE!g" \
473 -e "s!%%EMAIL%%!$EMAIL!g" \
474 -e "s!%%PACKAGE%%!$PACKAGE!g" \
475 -e "s!%%DATE%%!$curdate!g" \
476 -e "s!%%HTML_MONO_SIZE%%!$html_mono_size!g" \
477 -e "s!%%HTML_MONO_GZ_SIZE%%!$html_mono_gz_size!g" \
478 -e "s!%%HTML_NODE_TGZ_SIZE%%!$html_node_tgz_size!g" \
479 -e "s!%%HTML_SECTION_TGZ_SIZE%%!$html_section_tgz_size!g" \
480 -e "s!%%HTML_CHAPTER_TGZ_SIZE%%!$html_chapter_tgz_size!g" \
481 -e "s!%%INFO_TGZ_SIZE%%!$info_tgz_size!g" \
482 -e "s!%%DVI_GZ_SIZE%%!$dvi_gz_size!g" \
483 -e "s!%%PDF_SIZE%%!$pdf_size!g" \
484 -e "s!%%ASCII_SIZE%%!$ascii_size!g" \
485 -e "s!%%ASCII_GZ_SIZE%%!$ascii_gz_size!g" \
486 -e "s!%%TEXI_TGZ_SIZE%%!$texi_tgz_size!g" \
487 -e "s!%%DOCBOOK_HTML_NODE_TGZ_SIZE%%!$html_node_db_tgz_size!g" \
488 -e "s!%%DOCBOOK_ASCII_SIZE%%!$docbook_ascii_size!g" \
489 -e "s!%%DOCBOOK_PDF_SIZE%%!$docbook_pdf_size!g" \
490 -e "s!%%DOCBOOK_XML_SIZE%%!$docbook_xml_size!g" \
491 -e "s!%%DOCBOOK_XML_GZ_SIZE%%!$docbook_xml_gz_size!g" \
492 -e "s,%%SCRIPTURL%%,$scripturl,g" \
493 -e "s!%%SCRIPTNAME%%!$prog!g" \
494 -e "$CONDS" \
495$GENDOCS_TEMPLATE_DIR/gendocs_template >"$outdir/index.html"
496
497echo "Done, see $outdir/ subdirectory for new files."
498
499# Local variables:
500# eval: (add-hook 'write-file-hooks 'time-stamp)
501# time-stamp-start: "scriptversion="
502# time-stamp-format: "%:y-%02m-%02d.%02H"
503# time-stamp-end: "$"
504# End:
diff --git a/doc/documentation/gendocs_template b/doc/documentation/gendocs_template
deleted file mode 100644
index 178f6cb4c..000000000
--- a/doc/documentation/gendocs_template
+++ /dev/null
@@ -1,91 +0,0 @@
1<!--#include virtual="/server/header.html" -->
2<!-- Parent-Version: 1.77 -->
3<title>%%TITLE%% - GNU Project - Free Software Foundation</title>
4<!--#include virtual="/server/banner.html" -->
5<h2>%%TITLE%%</h2>
6
7<address>Free Software Foundation</address>
8<address>last updated %%DATE%%</address>
9
10<p>This manual (%%PACKAGE%%) is available in the following formats:</p>
11
12<ul>
13<li><a href="%%PACKAGE%%.html">HTML
14 (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
15<li><a href="html_node/index.html">HTML</a> - with one web page per
16 node.</li>
17%%IF HTML_SECTION%%
18<li><a href="html_section/index.html">HTML</a> - with one web page per
19 section.</li>
20%%ENDIF HTML_SECTION%%
21%%IF HTML_CHAPTER%%
22<li><a href="html_chapter/index.html">HTML</a> - with one web page per
23 chapter.</li>
24%%ENDIF HTML_CHAPTER%%
25<li><a href="%%PACKAGE%%.html.gz">HTML compressed
26 (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
27 one web page.</li>
28<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
29 (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
30 with one web page per node.</li>
31%%IF HTML_SECTION%%
32<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
33 (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
34 with one web page per section.</li>
35%%ENDIF HTML_SECTION%%
36%%IF HTML_CHAPTER%%
37<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
38 (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
39 with one web page per chapter.</li>
40%%ENDIF HTML_CHAPTER%%
41<li><a href="%%PACKAGE%%.info.tar.gz">Info document
42 (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li>
43<li><a href="%%PACKAGE%%.txt">ASCII text
44 (%%ASCII_SIZE%%K bytes)</a>.</li>
45<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed
46 (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li>
47<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file
48 (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li>
49<li><a href="%%PACKAGE%%.pdf">PDF file
50 (%%PDF_SIZE%%K bytes)</a>.</li>
51<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source
52 (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li>
53</ul>
54
55<p>You can <a href="http://shop.fsf.org/">buy printed copies of
56some manuals</a> (among other items) from the Free Software Foundation;
57this helps support FSF activities.</p>
58
59<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
60script</a>.)</p>
61
62<!-- If needed, change the copyright block at the bottom. In general,
63 all pages on the GNU web server should have the section about
64 verbatim copying. Please do NOT remove this without talking
65 with the webmasters first.
66 Please make sure the copyright date is consistent with the document
67 and that it is like this: "2001, 2002", not this: "2001-2002". -->
68</div><!-- for id="content", starts in the include above -->
69<!--#include virtual="/server/footer.html" -->
70<div id="footer">
71<div class="unprintable">
72
73<p>Please send general FSF &amp; GNU inquiries to
74<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
75There are also <a href="/contact/">other ways to contact</a>
76the FSF. Broken links and other corrections or suggestions can be sent
77to <a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
78</div>
79
80<p>Copyright &copy; 2017 Free Software Foundation, Inc.</p>
81
82<p>This page is licensed under a <a rel="license"
83href="http://creativecommons.org/licenses/by-nd/3.0/us/">Creative
84Commons Attribution-NoDerivs 3.0 United States License</a>.</p>
85
86<!--#include virtual="/server/bottom-notes.html" -->
87
88</div>
89</div>
90</body>
91</html>
diff --git a/doc/documentation/gendocs_template_min b/doc/documentation/gendocs_template_min
deleted file mode 100644
index 112fa3bfb..000000000
--- a/doc/documentation/gendocs_template_min
+++ /dev/null
@@ -1,93 +0,0 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
5
6<head>
7<title>%%TITLE%% - GNU Project - Free Software Foundation</title>
8<meta http-equiv="content-type" content='text/html; charset=utf-8' />
9<link rel="stylesheet" type="text/css" href="/gnu.css" />
10</head>
11
12<body>
13
14<h3>%%TITLE%%</h3>
15
16<address>Free Software Foundation</address>
17<address>last updated %%DATE%%</address>
18<p>
19<a href="/graphics/gnu-head.jpg">
20 <img src="/graphics/gnu-head-sm.jpg"
21 alt=" [image of the head of a GNU] " width="129" height="122"/>
22</a>
23</p>
24<hr />
25
26<p>This manual (%%PACKAGE%%) is available in the following formats:</p>
27
28<ul>
29<li><a href="%%PACKAGE%%.html">HTML
30 (%%HTML_MONO_SIZE%%K bytes)</a> - entirely on one web page.</li>
31<li><a href="html_node/index.html">HTML</a> - with one web page per
32 node.</li>
33%%IF HTML_SECTION%%
34<li><a href="html_section/index.html">HTML</a> - with one web page per
35 section.</li>
36%%ENDIF HTML_SECTION%%
37%%IF HTML_CHAPTER%%
38<li><a href="html_chapter/index.html">HTML</a> - with one web page per
39 chapter.</li>
40%%ENDIF HTML_CHAPTER%%
41<li><a href="%%PACKAGE%%.html.gz">HTML compressed
42 (%%HTML_MONO_GZ_SIZE%%K gzipped characters)</a> - entirely on
43 one web page.</li>
44<li><a href="%%PACKAGE%%.html_node.tar.gz">HTML compressed
45 (%%HTML_NODE_TGZ_SIZE%%K gzipped tar file)</a> -
46 with one web page per node.</li>
47%%IF HTML_SECTION%%
48<li><a href="%%PACKAGE%%.html_section.tar.gz">HTML compressed
49 (%%HTML_SECTION_TGZ_SIZE%%K gzipped tar file)</a> -
50 with one web page per section.</li>
51%%ENDIF HTML_SECTION%%
52%%IF HTML_CHAPTER%%
53<li><a href="%%PACKAGE%%.html_chapter.tar.gz">HTML compressed
54 (%%HTML_CHAPTER_TGZ_SIZE%%K gzipped tar file)</a> -
55 with one web page per chapter.</li>
56%%ENDIF HTML_CHAPTER%%
57<li><a href="%%PACKAGE%%.info.tar.gz">Info document
58 (%%INFO_TGZ_SIZE%%K bytes gzipped tar file)</a>.</li>
59<li><a href="%%PACKAGE%%.txt">ASCII text
60 (%%ASCII_SIZE%%K bytes)</a>.</li>
61<li><a href="%%PACKAGE%%.txt.gz">ASCII text compressed
62 (%%ASCII_GZ_SIZE%%K bytes gzipped)</a>.</li>
63<li><a href="%%PACKAGE%%.dvi.gz">TeX dvi file
64 (%%DVI_GZ_SIZE%%K bytes gzipped)</a>.</li>
65<li><a href="%%PACKAGE%%.pdf">PDF file
66 (%%PDF_SIZE%%K bytes)</a>.</li>
67<li><a href="%%PACKAGE%%.texi.tar.gz">Texinfo source
68 (%%TEXI_TGZ_SIZE%%K bytes gzipped tar file).</a></li>
69</ul>
70
71<p>(This page generated by the <a href="%%SCRIPTURL%%">%%SCRIPTNAME%%
72script</a>.)</p>
73
74<div id="footer" class="copyright">
75
76<p>Please send general FSF &amp; GNU inquiries to
77<a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
78There are also <a href="/contact/">other ways to contact</a>
79the FSF. Broken links and other corrections or suggestions can be sent
80to <a href="mailto:%%EMAIL%%">&lt;%%EMAIL%%&gt;</a>.</p>
81</div>
82
83<p>Copyright &copy; 2017 Free Software Foundation, Inc.</p>
84
85<p>This page is licensed under a <a rel="license"
86href="http://creativecommons.org/licenses/by-nd/3.0/us/">Creative
87Commons Attribution-NoDerivs 3.0 United States License</a>.</p>
88
89<!--#include virtual="/server/bottom-notes.html" -->
90
91</div>
92</body>
93</html>
diff --git a/doc/documentation/gnunet-c-tutorial.texi b/doc/documentation/gnunet-c-tutorial.texi
deleted file mode 100644
index b3bcdf18a..000000000
--- a/doc/documentation/gnunet-c-tutorial.texi
+++ /dev/null
@@ -1,1559 +0,0 @@
1\input texinfo
2@c %**start of header
3@setfilename gnunet-c-tutorial.info
4@documentencoding UTF-8
5@settitle GNUnet C Tutorial
6@c @exampleindent 2
7@c %**end of header
8
9@include version.texi
10
11@copying
12Copyright @copyright{} 2001-2018 GNUnet e.V.
13
14Permission is granted to copy, distribute and/or modify this document
15under the terms of the GNU Free Documentation License, Version 1.3 or
16any later version published by the Free Software Foundation; with no
17Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
18copy of the license is included in the section entitled ``GNU Free
19Documentation License''.
20
21A copy of the license is also available from the Free Software
22Foundation Web site at @url{http://www.gnu.org/licenses/fdl.html}.
23
24Alternately, this document is also available under the General
25Public License, version 3 or later, as published by the Free Software
26Foundation. A copy of the license is included in the section entitled
27``GNU General Public License''.
28
29A copy of the license is also available from the Free Software
30Foundation Web site at @url{http://www.gnu.org/licenses/gpl.html}.
31@end copying
32
33@dircategory Tutorial
34@direntry
35* GNUnet-C-Tutorial: (gnunet-c-tutorial). C Tutorial for GNunet
36@end direntry
37
38
39@titlepage
40@title GNUnet C Tutorial
41@subtitle A Tutorial for GNUnet @value{VERSION} (C version)
42@author The GNUnet Developers
43
44@page
45@vskip 0pt plus 1filll
46
47@insertcopying
48@end titlepage
49
50@contents
51
52@c **** TODO
53@c 1. Update content?
54@c 2. Either reference main documentation or
55@c 3. Merge this into main documentation
56
57@node Top
58@top Introduction
59
60This tutorials explains how to install GNUnet on a
61GNU/Linux system and gives an introduction on how
62GNUnet can be used to develop a Peer-to-Peer application.
63Detailed installation instructions for
64various operating systems and a detailed list of all
65dependencies can be found on our website at
66@uref{https://gnunet.org/installation} and in our
67Reference Documentation (GNUnet Handbook).
68
69Please read this tutorial carefully since every single step is
70important, and do not hesitate to contact the GNUnet team if you have
71any questions or problems! Visit this link in your webbrowser to learn
72how to contact the GNUnet team:
73@uref{https://gnunet.org/contact_information}
74
75@menu
76
77* Installing GNUnet:: Installing GNUnet
78* Introduction to GNUnet Architecture:: Introduction to GNUnet Architecture
79* First Steps with GNUnet:: First Steps with GNUnet
80* Developing Applications:: Developing Applications
81
82@detailmenu
83 --- The Detailed Node Listing ---
84
85Installing GNUnet
86
87* Obtaining a stable version::
88* Installing Build Tool Chain and Dependencies::
89* Obtaining the latest version from Git::
90* Compiling and Installing GNUnet::
91* Common Issues - Check your GNUnet installation::
92
93Introduction to GNUnet Architecture
94
95First Steps with GNUnet
96
97* Configure your peer::
98* Start a peer::
99* Monitor a peer::
100* Starting Two Peers by Hand::
101* Starting Peers Using the Testbed Service::
102
103Developing Applications
104
105* gnunet-ext::
106* Adapting the Template::
107* Writing a Client Application::
108* Writing a Service::
109* Interacting directly with other Peers using the CORE Service::
110* Storing peer-specific data using the PEERSTORE service::
111* Using the DHT::
112* Debugging with gnunet-arm::
113
114@end detailmenu
115@end menu
116
117@node Installing GNUnet
118@chapter Installing GNUnet
119
120First of all you have to install a current version of GNUnet.
121You can download a tarball of a stable version from GNU FTP mirrors
122or obtain the latest development version from our Git repository.
123
124Most of the time you should prefer to download the stable version
125since with the latest development version things can be broken,
126functionality can be changed or tests can fail. You should only use
127the development version if you know that you require a certain
128feature or a certain issue has been fixed since the last release.
129
130@menu
131* Obtaining a stable version::
132* Installing Build Tool Chain and Dependencies::
133* Obtaining the latest version from Git::
134* Compiling and Installing GNUnet::
135* Common Issues - Check your GNUnet installation::
136@end menu
137
138@node Obtaining a stable version
139@section Obtaining a stable version
140
141Download the tarball from
142@indicateurl{https://ftp.gnu.org/gnu/gnunet/gnunet-@value{VERSION}.tar.gz}.
143
144Make sure to download the associated @file{.sig} file and to verify the
145authenticity of the tarball against it, like this:
146
147@example
148$ wget https://ftp.gnu.org/gnu/gnunet/gnunet-@value{VERSION}.tar.gz.sig
149$ gpg --verify-files gnunet-@value{VERSION}.tar.gz.sig
150@end example
151
152@noindent
153If this command fails because you do not have the required public key,
154then you need to run the following command to import it:
155
156@example
157$ gpg --keyserver keys.gnupg.net --recv-keys 48426C7E
158@end example
159
160@noindent
161and rerun the @code{gpg --verify-files} command.
162
163@b{Note:}@
164@b{The pub key to sign the 0.10.1 release has been
165revoked}. You will get an error message stating that
166@b{there is no known public key or that it has been revoked}.
167The next release of GNUnet will have a valid signature
168again. We are sorry for the inconvenience this causes.
169Another possible source you could use is our
170"gnunet" git repository which, since the change from SVN to git in 2016,
171has mandatory signed commits by every developer.
172
173After verifying the signature you can extract the tarball.
174The resulting directory will be renamed to @file{gnunet}, which we will
175be using in the remainder of this document to refer to the
176root of the source directory.
177
178@example
179$ tar xvzf gnunet-@value{VERSION}.tar.gz
180$ mv gnunet-@value{VERSION} gnunet
181@end example
182
183@c FIXME: This can be irritating for the reader - First we say git should
184@c be avoid unless it is really required, and then we write this
185@c paragraph:
186@noindent
187However, please note that stable versions can be very outdated.
188As a developer you are @b{strongly} encouraged to use the version
189from @uref{https://gnunet.org/git/, git}.
190
191@node Installing Build Tool Chain and Dependencies
192@section Installing Build Tool Chain and Dependencies
193
194To successfully compile GNUnet, you need the tools to build GNUnet and
195the required dependencies. Please take a look at the
196GNUnet Reference Documentation
197(@pxref{Dependencies, The GNUnet Reference Documentation,, gnunet, The GNUnet Reference Documentation})
198for a list of required dependencies and
199(@pxref{Generic installation instructions, The GNUnet Reference Documentation,, gnunet, The GNUnet Reference Documentation})
200read its Installation chapter for specific instructions for
201your Operating System.
202Please check the notes at the end of the configure process about
203required dependencies.
204
205For GNUnet bootstrapping support and the HTTP(S) plugin you should
206install @uref{https://gnunet.org/gnurl, libgnurl}.
207For the filesharing service you should install at least one of the
208datastore backends (MySQL, SQlite and PostgreSQL are supported).
209
210@node Obtaining the latest version from Git
211@section Obtaining the latest version from Git
212
213The latest development version can be obtained from our Git repository.
214To get the code you need to have @code{Git} installed. Usually your
215Operating System package manager should provide a suitable distribution
216of git (otherwise check out Guix or Nix). If you are using an Operating
217System based on Debian's apt:
218
219@example
220$ sudo apt-get install git
221@end example
222
223This is required for obtaining the repository, which is achieved with
224the following command:
225
226@example
227$ git clone https://gnunet.org/git/gnunet
228@end example
229
230@noindent
231After cloning the repository, you have to execute the @file{bootstrap}
232script in the new directory:
233
234@example
235$ cd gnunet
236$ ./bootstrap
237@end example
238
239@noindent
240The remainder of this tutorial will assume that you have the
241Git branch ``master'' checked out.
242
243@node Compiling and Installing GNUnet
244@section Compiling and Installing GNUnet
245
246Note: This section is a duplication of the more in depth
247@pxref{GNUnet Installation Handbook, The GNUnet Reference Documentation,, gnunet, The GNUnet Reference Documentation}.
248
249First, you need to install libgnupgerror @geq{} 1.27 and
250libgcrypt @geq{} 1.7.6:
251
252@example
253$ export GNUPGFTP="https://www.gnupg.org/ftp/gcrypt"
254$ wget $GNUPGFTP/libgpg-error/libgpg-error-1.27.tar.bz2
255$ tar xf libgpg-error-1.27.tar.bz2
256$ cd libgpg-error-1.27
257$ ./configure
258$ make
259$ sudo make install
260$ cd ..
261@end example
262
263@example
264$ export GNUPGFTP="https://www.gnupg.org/ftp/gcrypt"
265$ wget $GNUPGFTP/libgcrypt/libgcrypt-1.7.6.tar.bz2
266$ tar xf libgcrypt-1.7.6.tar.bz2
267$ cd libgcrypt-1.7.6
268$ ./configure
269$ make
270$ sudo make install
271$ cd ..
272@end example
273
274@menu
275* Installation::
276@end menu
277
278@node Installation
279@subsection Installation
280Assuming all dependencies are installed, the following commands will
281compile and install GNUnet in your home directory. You can specify the
282directory where GNUnet will be installed by changing the
283@code{--prefix} value when calling @command{./configure}. If
284you do not specifiy a prefix, GNUnet is installed in the directory
285@file{/usr/local}. When developing new applications you may want
286to enable verbose logging by adding @code{--enable-logging=verbose}:
287
288@example
289$ export PREFIX=$HOME
290$ ./configure --prefix=$PREFIX --enable-logging
291$ make
292$ make install
293@end example
294
295@noindent
296After installing GNUnet you have to add your GNUnet installation
297to your path environmental variable. In addition you have to
298create the @file{.config} directory in your home directory
299(unless it already exists) where GNUnet stores its data and an
300empty GNUnet configuration file:
301
302@example
303$ export PATH=$PATH:$PREFIX/bin
304$ echo export PATH=$PREFIX/bin:\\$PATH >> ~/.bashrc
305$ mkdir ~/.config/
306$ touch ~/.config/gnunet.conf
307@end example
308
309@node Common Issues - Check your GNUnet installation
310@section Common Issues - Check your GNUnet installation
311
312You should check your installation to ensure that installing GNUnet
313was successful up to this point. You should be able to access GNUnet's
314binaries and run GNUnet's self check.
315
316@example
317$ which gnunet-arm
318$PREFIX/bin/gnunet-arm
319@end example
320
321@noindent
322should return $PREFIX/bin/gnunet-arm (where $PREFIX is the location
323you have set earlier). It should be located in your
324GNUnet installation and the output should not be empty.
325
326If you see an output like:
327
328@example
329$ which gnunet-arm
330@end example
331
332@noindent
333check your PATH variable to ensure GNUnet's @file{bin} directory is
334included.
335
336GNUnet provides tests for all of its subcomponents. Assuming you have
337successfully built GNUnet, run
338
339@example
340$ cd gnunet
341$ make check
342@end example
343
344@noindent
345to execute tests for all components. @command{make check} traverses all
346subdirectories in @file{src}. For every subdirectory you should
347get a message like this:
348
349@example
350make[2]: Entering directory `/home/$USER/gnunet/contrib'
351PASS: test_gnunet_prefix
352=============
3531 test passed
354=============
355@end example
356
357@node Introduction to GNUnet Architecture
358@chapter Introduction to GNUnet Architecture
359
360GNUnet is organized in layers and services. Each service is composed of a
361main service implementation and a client library for other programs to use
362the service's functionality, described by an API.
363@c This approach is shown in
364@c FIXME: enable this once the commented block below works:
365@c figure~\ref fig:service.
366Some services provide an additional command line tool to enable the user
367to interact with the service.
368
369Very often it is other GNUnet services that will use these APIs to build
370the higher layers of GNUnet on top of the lower ones. Each layer expands
371or extends the functionality of the service below (for instance, to build
372a mesh on top of a DHT).
373@c FXIME: See comment above.
374@c See figure ~\ref fig:interaction for an illustration of this approach.
375
376@c ** @image filename[, width[, height[, alttext[, extension]]]]
377@c FIXME: Texlive (?) 20112 makes the assumption that this means
378@c 'images/OBJECTNAME.txt' but later versions of it (2017) use this
379@c syntax as described below.
380@c TODO: Checkout the makedoc script Guile uses.
381
382@c FIXME!!!
383@c @image{images/gnunet-tutorial-service,,5in,Service with API and network protocol,.png}
384@c @image{images/gnunet-tutorial-system,,5in,The layered system architecture of GNUnet,.png}
385
386@c \begin{figure}[!h]
387@c \begin{center}
388@c % \begin{subfigure}
389@c \begin{subfigure}[b]{0.3\textwidth}
390@c \centering
391@c \includegraphics[width=\textwidth]{figs/Service.pdf}
392@c \caption{Service with API and network protocol}
393@c \label{fig:service}
394@c \end{subfigure}
395@c ~~~~~~~~~~
396@c \begin{subfigure}[b]{0.3\textwidth}
397@c \centering
398@c \includegraphics[width=\textwidth]{figs/System.pdf}
399@c \caption{Service interaction}
400@c \label{fig:interaction}
401@c \end{subfigure}
402@c \end{center}
403@c \caption{GNUnet's layered system architecture}
404@c \end{figure}
405
406The main service implementation runs as a standalone process in the
407Operating System and the client code runs as part of the client program,
408so crashes of a client do not affect the service process or other clients.
409The service and the clients communicate via a message protocol to be
410defined and implemented by the programmer.
411
412@node First Steps with GNUnet
413@chapter First Steps with GNUnet
414
415@menu
416* Configure your peer::
417* Start a peer::
418* Monitor a peer::
419* Starting Two Peers by Hand::
420* Starting Peers Using the Testbed Service::
421@end menu
422
423@node Configure your peer
424@section Configure your peer
425
426First of all we need to configure your peer. Each peer is started with
427a configuration containing settings for GNUnet itself and its services.
428This configuration is based on the default configuration shipped with
429GNUnet and can be modified. The default configuration is located in the
430@file{$PREFIX/share/gnunet/config.d} directory. When starting a peer, you
431can specify a customized configuration using the the @command{-c} command
432line switch when starting the ARM service and all other services. When
433using a modified configuration the default values are loaded and only
434values specified in the configuration file will replace the default
435values.
436
437Since we want to start additional peers later, we need some modifications
438from the default configuration. We need to create a separate service
439home and a file containing our modifications for this peer:
440
441@example
442$ mkdir ~/gnunet1/
443$ touch peer1.conf
444@end example
445
446@noindent
447Now add the following lines to @file{peer1.conf} to use this directory.
448For simplified usage we want to prevent the peer to connect to the GNUnet
449network since this could lead to confusing output. This modifications
450will replace the default settings:
451
452@example
453[PATHS]
454# Use this directory to store GNUnet data
455GNUNET_HOME = ~/gnunet1/
456[hostlist]
457# prevent bootstrapping
458SERVERS =
459@end example
460
461@node Start a peer
462@section Start a peer
463Each GNUnet instance (called peer) has an identity (peer ID) based on a
464cryptographic public private key pair. The peer ID is the printable hash
465of the public key.
466
467GNUnet services are controlled by a master service, the so called
468@dfn{Automatic Restart Manager} (ARM). ARM starts, stops and even
469restarts services automatically or on demand when a client connects.
470You interact with the ARM service using the @command{gnunet-arm} tool.
471GNUnet can then be started with @command{gnunet-arm -s} and stopped with
472@command{gnunet-arm -e}. An additional service not automatically started
473can be started using @command{gnunet-arm -i <service name>} and stopped
474using @command{gnunet-arm -k <servicename>}.
475
476Once you have started your peer, you can use many other GNUnet commands
477to interact with it. For example, you can run:
478
479@example
480$ gnunet-peerinfo -s
481@end example
482
483@noindent
484to obtain the public key of your peer.
485
486You should see an output containing the peer ID similar to:
487
488@example
489I am peer `0PA02UVRKQTS2C .. JL5Q78F6H0B1ACPV1CJI59MEQUMQCC5G'.
490@end example
491
492@node Monitor a peer
493@section Monitor a peer
494
495In this section, we will monitor the behaviour of our peer's DHT
496service with respect to a specific key. First we will start
497GNUnet and then start the DHT service and use the DHT monitor tool
498to monitor the PUT and GET commands we issue ussing the
499@command{gnunet-dht-put} and @command{gnunet-dht-get} commands.
500Using the ``monitor'' line given below, you can observe the behavior
501of your own peer's DHT with respect to the specified KEY:
502
503@example
504# start gnunet with all default services:
505$ gnunet-arm -c ~/peer1.conf -s
506# start DHT service:
507$ gnunet-arm -c ~/peer1.conf -i dht
508$ cd ~/gnunet/src/dht;
509$ ./gnunet-dht-monitor -c ~/peer1.conf -k KEY
510@end example
511
512@noindent
513Now open a separate terminal and change again to
514the @file{gnunet/src/dht} directory:
515
516@example
517$ cd ~/gnunet/src/dht
518# put VALUE under KEY in the DHT:
519$ ./gnunet-dht-put -c ~/peer1.conf -k KEY -d VALUE
520# get key KEY from the DHT:
521$ ./gnunet/src/dht/gnunet-dht-get -c ~/peer1.conf -k KEY
522# print statistics about current GNUnet state:
523$ gnunet-statistics -c ~/peer1.conf
524# print statistics about DHT service:
525$ gnunet-statistics -c ~/peer1.conf -s dht
526@end example
527
528@node Starting Two Peers by Hand
529@section Starting Two Peers by Hand
530
531This section describes how to start two peers on the same machine by hand.
532The process is rather painful, but the description is somewhat
533instructive. In practice, you might prefer the automated method
534(@pxref{Starting Peers Using the Testbed Service}).
535
536@menu
537* Setup a second peer::
538* Start the second peer and connect the peers::
539* How to connect manually::
540@end menu
541
542@node Setup a second peer
543@subsection Setup a second peer
544We will now start a second peer on your machine.
545For the second peer, you will need to manually create a modified
546configuration file to avoid conflicts with ports and directories.
547A peers configuration file is by default located
548in @file{~/.gnunet/gnunet.conf}. This file is typically very short
549or even empty as only the differences to the defaults need to be
550specified. The defaults are located in many files in the
551@file{$PREFIX/share/gnunet/config.d} directory.
552
553To configure the second peer, use the files
554@file{$PREFIX/share/gnunet/config.d} as a template for your main
555configuration file:
556
557@example
558$ cat $PREFIX/share/gnunet/config.d/*.conf > peer2.conf
559@end example
560
561@noindent
562Now you have to edit @file{peer2.conf} and change:
563
564@itemize
565@item @code{GNUNET\_TEST\_HOME} under @code{PATHS}
566@item Every (uncommented) value for ``@code{PORT}'' (add 10000) in any
567section (the option may be commented out if @code{PORT} is
568prefixed by "\#", in this case, UNIX domain sockets are used
569and the PORT option does not need to be touched)
570@item Every value for ``@code{UNIXPATH}'' in any section
571(e.g. by adding a "-p2" suffix)
572@end itemize
573
574to a fresh, unique value. Make sure that the PORT numbers stay
575below 65536. From now on, whenever you interact with the second peer,
576you need to specify @command{-c peer2.conf} as an additional
577command line argument.
578
579Now, generate the 2nd peer's private key:
580
581@example
582$ gnunet-peerinfo -s -c peer2.conf
583@end example
584
585@noindent
586This may take a while, generate entropy using your keyboard or mouse
587as needed. Also, make sure the output is different from the
588gnunet-peerinfo output for the first peer (otherwise you made an
589error in the configuration).
590
591@node Start the second peer and connect the peers
592@subsection Start the second peer and connect the peers
593
594Then, you can start a second peer using:
595
596@example
597$ gnunet-arm -c peer2.conf -s
598$ gnunet-arm -c peer2.conf -i dht
599$ ~/gnunet/src/dht/gnunet-dht-put -c peer2.conf -k KEY -d VALUE
600$ ~/gnunet/src/dht/gnunet-dht-get -c peer2.conf -k KEY
601@end example
602
603If you want the two peers to connect, you have multiple options:
604
605@itemize
606@item UDP neighbour discovery (automatic)
607@item Setup a bootstrap server
608@item Connect manually
609@end itemize
610
611To setup peer 1 as bootstrapping server change the configuration of
612the first one to be a hostlist server by adding the following lines to
613@file{peer1.conf} to enable bootstrapping server:
614
615@example
616[hostlist]
617OPTIONS = -p
618@end example
619
620@noindent
621Then change @file{peer2.conf} and replace the ``@code{SERVERS}''
622line in the ``@code{[hostlist]}'' section with
623``@code{http://localhost:8080/}''. Restart both peers using:
624
625@example
626# stop first peer
627$ gnunet-arm -c peer1.conf -e
628# start first peer
629$ gnunet-arm -c peer1.conf -s
630# start second peer
631$ gnunet-arm -c peer2.conf -s
632@end example
633
634@noindent
635Note that if you start your peers without changing these settings, they
636will use the ``global'' hostlist servers of the GNUnet P2P network and
637likely connect to those peers. At that point, debugging might become
638tricky as you're going to be connected to many more peers and would
639likely observe traffic and behaviors that are not explicitly controlled
640by you.
641
642@node How to connect manually
643@subsection How to connect manually
644
645If you want to use the @code{peerinfo} tool to connect your
646peers, you should:
647
648@itemize
649@item Set @code{IMMEDIATE_START = NO} in section @code{hostlist}
650(to not connect to the global GNUnet)
651@item Start both peers running @command{gnunet-arm -c peer1.conf -s}
652and @command{gnunet-arm -c peer2.conf -s}
653@item Get @code{HELLO} message of the first peer running
654@command{gnunet-peerinfo -c peer1.conf -g}
655@item Give the output to the second peer by running
656@command{gnunet-peerinfo -c peer2.conf -p '<output>'}
657@end itemize
658
659Check that they are connected using @command{gnunet-core -c peer1.conf},
660which should give you the other peer's peer identity:
661
662@example
663$ gnunet-core -c peer1.conf
664Peer `9TVUCS8P5A7ILLBGO6 [...shortened...] 1KNBJ4NGCHP3JPVULDG'
665@end example
666
667@node Starting Peers Using the Testbed Service
668@section Starting Peers Using the Testbed Service
669@c \label{sec:testbed}
670
671GNUnet's testbed service is used for testing scenarios where
672a number of peers are to be started. The testbed can manage peers
673on a single host or on multiple hosts in a distributed fashion.
674On a single affordable computer, it should be possible to run
675around tens of peers without drastically increasing the load on the
676system.
677
678The testbed service can be access through its API
679@file{include/gnunet\_testbed\_service.h}. The API provides many
680routines for managing a group of peers. It also provides a helper
681function @code{GNUNET\_TESTBED\_test\_run()} to quickly setup a
682minimalistic testing environment on a single host.
683
684This function takes a configuration file which will be used as a
685template configuration for the peers. The testbed takes care of
686modifying relevant options in the peers' configuration such as
687@code{SERVICEHOME}, @code{PORT}, @code{UNIXPATH} to unique values
688so that peers run without running into conflicts. It also checks
689and assigns the ports in configurations only if they are free.
690
691Additionally, the testbed service also reads its options from the
692same configuration file. Various available options and details
693about them can be found in the testbed default configuration file
694@file{src/testbed/testbed.conf}.
695
696With the testbed API, a sample test case can be structured as follows:
697
698@example
699@verbatiminclude testbed_test.c
700@end example
701
702@noindent
703The source code for the above listing can be found at
704@uref{https://gnunet.org/git/gnunet.git/tree/doc/
705documentation/testbed_test.c}
706or in the @file{doc/documentation/} folder of your repository check-out.
707After installing GNUnet, the above source code can be compiled as:
708
709@example
710$ export CPPFLAGS="-I/path/to/gnunet/headers"
711$ export LDFLAGS="-L/path/to/gnunet/libraries"
712$ gcc $CPPFLAGS $LDFLAGS -o testbed-test testbed_test.c \
713 -lgnunettestbed -lgnunetdht -lgnunetutil
714# Generate (empty) configuration
715$ touch template.conf
716# run it (press CTRL-C to stop)
717$ ./testbed-test
718@end example
719
720@noindent
721The @code{CPPFLAGS} and @code{LDFLAGS} are necessary if GNUnet
722is installed into a different directory other than @file{/usr/local}.
723
724All of testbed API's peer management functions treat management
725actions as operations and return operation handles. It is expected
726that the operations begin immediately, but they may get delayed (to
727balance out load on the system). The program using the API then has
728to take care of marking the operation as ``done'' so that its
729associated resources can be freed immediately and other waiting
730operations can be executed. Operations will be canceled if they are
731marked as ``done'' before their completion.
732
733An operation is treated as completed when it succeeds or fails.
734Completion of an operation is either conveyed as events through
735@dfn{controller event callback} or through respective
736@dfn{operation completion callbacks}.
737In functions which support completion notification
738through both controller event callback and operation
739completion callback, first the controller event callback will be
740called. If the operation is not marked as done in that callback
741or if the callback is given as NULL when creating the operation,
742the operation completion callback will be called. The API
743documentation shows which event are to be expected in the
744controller event notifications. It also documents any exceptional
745behaviour.
746
747Once the peers are started, test cases often need to connect
748some of the peers' services. Normally, opening a connect to
749a peer's service requires the peer's configuration. While using
750testbed, the testbed automatically generates per-peer configuration.
751Accessing those configurations directly through file system is
752discouraged as their locations are dynamically created and will be
753different among various runs of testbed. To make access to these
754configurations easy, testbed API provides the function
755@code{GNUNET\_TESTBED\_service\_connect()}. This function fetches
756the configuration of a given peer and calls the @dfn{Connect Adapter}.
757In the example code, it is the @code{dht\_ca}. A connect adapter is
758expected to open the connection to the needed service by using the
759provided configuration and return the created service connection handle.
760Successful connection to the needed service is signaled through
761@code{service\_connect\_comp\_cb}.
762
763A dual to connect adapter is the @dfn{Disconnect Adapter}. This callback
764is called after the connect adapter has been called when the operation
765from @code{GNUNET\_TESTBED\_service\_connect()} is marked as ``done''.
766It has to disconnect from the service with the provided service
767handle (@code{op\_result}).
768
769Exercise: Find out how many peers you can run on your system.
770
771Exercise: Find out how to create a 2D torus topology by changing the
772options in the configuration file.
773@xref{Supported Topologies, The GNUnet Reference Documentation ,, gnunet, The GNUnet Reference Documentation},
774then use the DHT API to store and retrieve values in the network.
775
776@node Developing Applications
777@chapter Developing Applications
778
779@menu
780* gnunet-ext::
781* Adapting the Template::
782* Writing a Client Application::
783* Writing a Service::
784* Interacting directly with other Peers using the CORE Service::
785* Storing peer-specific data using the PEERSTORE service::
786* Using the DHT::
787* Debugging with gnunet-arm::
788@end menu
789
790@node gnunet-ext
791@section gnunet-ext
792To develop a new peer-to-peer application or to extend GNUnet we provide
793a template build system for writing GNUnet extensions in C. It can be
794obtained as follows:
795
796@example
797$ git clone https://gnunet.org/git/gnunet-ext
798$ cd gnunet-ext/
799$ ./bootstrap
800$ ./configure --prefix=$PREFIX --with-gnunet=$PREFIX
801$ make
802$ make install
803$ make check
804@end example
805
806@noindent
807The GNUnet ext template includes examples and a working buildsystem
808for a new GNUnet service. A common GNUnet service consists of the
809following parts which will be discussed in detail in the remainder
810of this document. The functionality of a GNUnet service is implemented in:
811
812@itemize
813@item the GNUnet service (gnunet-ext/src/ext/gnunet-service-ext.c)
814@item the client API (gnunet-ext/src/ext/ext_api.c)
815@item the client application using the service API
816(gnunet-ext/src/ext/gnunet-ext.c)
817@end itemize
818
819The interfaces for these entities are defined in:
820
821@itemize
822@item client API interface (gnunet-ext/src/ext/ext.h)
823@item the service interface (gnunet-ext/src/include/gnunet_service_SERVICE.h)
824@item the P2P protocol (gnunet-ext/src/include/gnunet_protocols_ext.h)
825@end itemize
826
827
828In addition the ext systems provides:
829
830@itemize
831@item a test testing the API (gnunet-ext/src/ext/test_ext_api.c)
832@item a configuration template for the service
833(gnunet-ext/src/ext/ext.conf.in)
834@end itemize
835
836@node Adapting the Template
837@section Adapting the Template
838
839The first step for writing any extension with a new service is to
840ensure that the @file{ext.conf.in} file contains entries for the
841@code{UNIXPATH}, @code{PORT} and @code{BINARY} for the service in a
842section named after the service.
843
844If you want to adapt the template rename the @file{ext.conf.in} to
845match your services name, you have to modify the @code{AC\_OUTPUT}
846section in @file{configure.ac} in the @file{gnunet-ext} root.
847
848@node Writing a Client Application
849@section Writing a Client Application
850
851When writing any client application (for example, a command-line
852tool), the basic structure is to start with the
853@code{GNUNET\_PROGRAM\_run} function. This function will parse
854command-line options, setup the scheduler and then invoke the
855@code{run} function (with the remaining non-option arguments)
856and a handle to the parsed configuration (and the configuration
857file name that was used, which is typically not needed):
858
859@example
860@verbatiminclude tutorial-examples/001.c
861@end example
862
863@menu
864* Handling command-line options::
865* Writing a Client Library::
866* Writing a user interface::
867@end menu
868
869@node Handling command-line options
870@subsection Handling command-line options
871
872Options can then be added easily by adding global variables and
873expanding the @code{options} array. For example, the following would
874add a string-option and a binary flag (defaulting to @code{NULL} and
875@code{GNUNET\_NO} respectively):
876
877@example
878@verbatiminclude tutorial-examples/002.c
879@end example
880
881Issues such as displaying some helpful text describing options using
882the @code{--help} argument and error handling are taken care of when
883using this approach. Other @code{GNUNET\_GETOPT\_}-functions can be used
884to obtain integer value options, increment counters, etc. You can
885even write custom option parsers for special circumstances not covered
886by the available handlers. To check if an argument was specified by the
887user you initialize the variable with a specific value (e.g. NULL for
888a string and GNUNET\_SYSERR for a integer) and check after parsing
889happened if the values were modified.
890
891Inside the @code{run} method, the program would perform the
892application-specific logic, which typically involves initializing and
893using some client library to interact with the service. The client
894library is supposed to implement the IPC whereas the service provides
895more persistent P2P functions.
896
897Exercise: Add a few command-line options and print them inside
898of @code{run}. What happens if the user gives invalid arguments?
899
900@node Writing a Client Library
901@subsection Writing a Client Library
902
903The first and most important step in writing a client library is to
904decide on an API for the library. Typical API calls include
905connecting to the service, performing application-specific requests
906and cleaning up. Many examples for such service APIs can be found
907in the @file{gnunet/src/include/gnunet\_*\_service.h} files.
908
909Then, a client-service protocol needs to be designed. This typically
910involves defining various message formats in a header that will be
911included by both the service and the client library (but is otherwise
912not shared and hence located within the service's directory and not
913installed by @command{make install}). Each message must start with a
914@code{struct GNUNET\_MessageHeader} and must be shorter than 64k. By
915convention, all fields in IPC (and P2P) messages must be in big-endian
916format (and thus should be read using @code{ntohl} and similar
917functions and written using @code{htonl} and similar functions).
918Unique message types must be defined for each message struct in the
919@file{gnunet\_protocols.h} header (or an extension-specific include
920file).
921
922@menu
923* Connecting to the Service::
924* Sending messages::
925* Receiving Replies from the Service::
926@end menu
927
928@node Connecting to the Service
929@subsubsection Connecting to the Service
930
931Before a client library can implement the application-specific protocol
932with the service, a connection must be created:
933
934@example
935@verbatiminclude tutorial-examples/003.c
936@end example
937
938@noindent
939As a result a @code{GNUNET\_MQ\_Handle} is returned
940which can to used henceforth to transmit messages to the service.
941The complete MQ API can be found in @file{gnunet\_mq\_lib.h}.
942The @code{hanlders} array in the example above is incomplete.
943Here is where you will define which messages you expect to
944receive from the service, and which functions handle them.
945The @code{error\_cb} is a function that is to be called whenever
946there are errors communicating with the service.
947
948@node Sending messages
949@subsubsection Sending messages
950
951In GNUnet, messages are always sent beginning with a
952@code{struct GNUNET\_MessageHeader} in big endian format.
953This header defines the size and the type of the
954message, the payload follows after this header.
955
956@example
957@verbatiminclude tutorial-examples/004.c
958@end example
959
960@noindent
961Existing message types are defined in @file{gnunet\_protocols.h}.
962A common way to create a message is with an envelope:
963
964@example
965@verbatiminclude tutorial-examples/005.c
966@end example
967
968@noindent
969Exercise: Define a message struct that includes a 32-bit
970unsigned integer in addition to the standard GNUnet MessageHeader.
971Add a C struct and define a fresh protocol number for your message.
972Protocol numbers in gnunet-ext are defined
973in @file{gnunet-ext/src/include/gnunet_protocols_ext.h}
974
975Exercise: Find out how you can determine the number of messages
976in a message queue.
977
978Exercise: Find out how you can determine when a message you
979have queued was actually transmitted.
980
981Exercise: Define a helper function to transmit a 32-bit
982unsigned integer (as payload) to a service using some given client
983handle.
984
985@node Receiving Replies from the Service
986@subsubsection Receiving Replies from the Service
987
988Clients can receive messages from the service using the handlers
989specified in the @code{handlers} array we specified when connecting
990to the service. Entries in the the array are usually created using
991one of two macros, depending on whether the message is fixed size
992or variable size. Variable size messages are managed using two
993callbacks, one to check that the message is well-formed, the other
994to actually process the message. Fixed size messages are fully
995checked by the MQ-logic, and thus only need to provide the handler
996to process the message. Note that the prefixes @code{check\_}
997and @code{handle\_} are mandatory.
998
999@example
1000@verbatiminclude tutorial-examples/006.c
1001@end example
1002
1003@noindent
1004Exercise: Expand your helper function to receive a response message
1005(for example, containing just the @code{struct GNUnet MessageHeader}
1006without any payload). Upon receiving the service's response, you
1007should call a callback provided to your helper function's API.
1008
1009Exercise: Figure out where you can pass values to the
1010closures (@code{cls}).
1011
1012@node Writing a user interface
1013@subsection Writing a user interface
1014
1015Given a client library, all it takes to access a service now is to
1016combine calls to the client library with parsing command-line
1017options.
1018
1019Exercise: Call your client API from your @code{run()} method in your
1020client application to send a request to the service. For example,
1021send a 32-bit integer value based on a number given at the
1022command-line to the service.
1023
1024@node Writing a Service
1025@section Writing a Service
1026
1027Before you can test the client you've written so far, you'll
1028need to also implement the corresponding service.
1029
1030@menu
1031* Code Placement::
1032* Starting a Service::
1033@end menu
1034
1035@node Code Placement
1036@subsection Code Placement
1037
1038New services are placed in their own subdirectory under
1039@file{gnunet/src}. This subdirectory should contain the API
1040implementation file @file{SERVICE\_api.c}, the description of
1041the client-service protocol @file{SERVICE.h} and P2P protocol
1042@file{SERVICE\_protocol.h}, the implementation of the service itself
1043@file{gnunet-service-SERVICE.h} and several files for tests,
1044including test code and configuration files.
1045
1046@node Starting a Service
1047@subsection Starting a Service
1048
1049The key API definition for creating a service is the
1050@code{GNUNET\_SERVICE\_MAIN} macro:
1051
1052@example
1053@verbatiminclude tutorial-examples/007.c
1054@end example
1055
1056@noindent
1057In addition to the service name and flags, the macro takes three
1058functions, typically called @code{run}, @code{client\_connect\_cb} and
1059@code{client\_disconnect\_cb} as well as an array of message handlers
1060that will be called for incoming messages from clients.
1061
1062A minimal version of the three central service funtions would look
1063like this:
1064
1065@example
1066@verbatiminclude tutorial-examples/008.c
1067@end example
1068
1069@noindent
1070Exercise: Write a stub service that processes no messages at all
1071in your code. Create a default configuration for it, integrate it
1072with the build system and start the service from
1073@command{gnunet-service-arm} using @command{gnunet-arm -i NAME}.
1074
1075Exercise: Figure out how to set the closure (@code{cls}) for handlers
1076of a service.
1077
1078Exercise: Figure out how to send messages from the service back to the
1079client.
1080
1081Each handler function in the service @b{must} eventually (possibly in some
1082asynchronous continuation) call
1083@code{GNUNET\_SERVICE\_client\_continue()}. Only after this call
1084additional messages from the same client may
1085be processed. This way, the service can throttle processing messages
1086from the same client.
1087
1088Exercise: Change the service to ``handle'' the message from your
1089client (for now, by printing a message). What happens if you
1090forget to call @code{GNUNET\_SERVICE\_client\_continue()}?
1091
1092@node Interacting directly with other Peers using the CORE Service
1093@section Interacting directly with other Peers using the CORE Service
1094
1095FIXME: This section still needs to be updated to the lastest API!
1096
1097One of the most important services in GNUnet is the @code{CORE} service
1098managing connections between peers and handling encryption between peers.
1099
1100One of the first things any service that extends the P2P protocol
1101typically does is connect to the @code{CORE} service using:
1102
1103@example
1104@verbatiminclude tutorial-examples/009.c
1105@end example
1106
1107@menu
1108* New P2P connections::
1109* Receiving P2P Messages::
1110* Sending P2P Messages::
1111* End of P2P connections::
1112@end menu
1113
1114@node New P2P connections
1115@subsection New P2P connections
1116
1117Before any traffic with a different peer can be exchanged, the peer must
1118be known to the service. This is notified by the @code{CORE}
1119@code{connects} callback, which communicates the identity of the new
1120peer to the service:
1121
1122@example
1123@verbatiminclude tutorial-examples/010.c
1124@end example
1125
1126@noindent
1127Note that whatever you return from @code{connects} is given as the
1128@code{cls} argument to the message handlers for messages from
1129the respective peer.
1130
1131Exercise: Create a service that connects to the @code{CORE}. Then
1132start (and connect) two peers and print a message once your connect
1133callback is invoked.
1134
1135@node Receiving P2P Messages
1136@subsection Receiving P2P Messages
1137
1138To receive messages from @code{CORE}, you pass the desired
1139@code{handlers} to the @code{GNUNET\_CORE\_connect()} function,
1140just as we showed for services.
1141
1142It is your responsibility to process messages fast enough or
1143to implement flow control. If an application does not process
1144CORE messages fast enough, CORE will randomly drop messages
1145to not keep a very long queue in memory.
1146
1147Exercise: Start one peer with a new service that has a message
1148handler and start a second peer that only has your ``old'' service
1149without message handlers. Which ``connect'' handlers are invoked when
1150the two peers are connected? Why?
1151
1152@node Sending P2P Messages
1153@subsection Sending P2P Messages
1154
1155You can transmit messages to other peers using the @code{mq} you were
1156given during the @code{connect} callback. Note that the @code{mq}
1157automatically is released upon @code{disconnect} and that you must
1158not use it afterwards.
1159
1160It is your responsibility to not over-fill the message queue, GNUnet
1161will send the messages roughly in the order given as soon as possible.
1162
1163Exercise: Write a service that upon connect sends messages as
1164fast as possible to the other peer (the other peer should run a
1165service that ``processes'' those messages). How fast is the
1166transmission? Count using the STATISTICS service on both ends. Are
1167messages lost? How can you transmit messages faster? What happens if
1168you stop the peer that is receiving your messages?
1169
1170@node End of P2P connections
1171@subsection End of P2P connections
1172
1173If a message handler returns @code{GNUNET\_SYSERR}, the remote
1174peer shuts down or there is an unrecoverable network
1175disconnection, CORE notifies the service that the peer disconnected.
1176After this notification no more messages will be received from the
1177peer and the service is no longer allowed to send messages to the peer.
1178The disconnect callback looks like the following:
1179
1180@example
1181@verbatiminclude tutorial-examples/011.c
1182@end example
1183
1184@noindent
1185Exercise: Fix your service to handle peer disconnects.
1186
1187@node Storing peer-specific data using the PEERSTORE service
1188@section Storing peer-specific data using the PEERSTORE service
1189
1190GNUnet's PEERSTORE service offers a persistorage for arbitrary
1191peer-specific data. Other GNUnet services can use the PEERSTORE
1192to store, retrieve and monitor data records. Each data record
1193stored with PEERSTORE contains the following fields:
1194
1195@itemize
1196@item subsystem: Name of the subsystem responsible for the record.
1197@item peerid: Identity of the peer this record is related to.
1198@item key: a key string identifying the record.
1199@item value: binary record value.
1200@item expiry: record expiry date.
1201@end itemize
1202
1203The first step is to start a connection to the PEERSTORE service:
1204@example
1205@verbatiminclude tutorial-examples/012.c
1206@end example
1207
1208The service handle @code{peerstore_handle} will be needed for
1209all subsequent PEERSTORE operations.
1210
1211@menu
1212* Storing records::
1213* Retrieving records::
1214* Monitoring records::
1215* Disconnecting from PEERSTORE::
1216@end menu
1217
1218@node Storing records
1219@subsection Storing records
1220
1221To store a new record, use the following function:
1222
1223@example
1224@verbatiminclude tutorial-examples/013.c
1225@end example
1226
1227@noindent
1228The @code{options} parameter can either be
1229@code{GNUNET_PEERSTORE_STOREOPTION_MULTIPLE} which means that multiple
1230values can be stored under the same key combination
1231(subsystem, peerid, key), or @code{GNUNET_PEERSTORE_STOREOPTION_REPLACE}
1232which means that PEERSTORE will replace any existing values under the
1233given key combination (subsystem, peerid, key) with the new given value.
1234
1235The continuation function @code{cont} will be called after the store
1236request is successfully sent to the PEERSTORE service. This does not
1237guarantee that the record is successfully stored, only that it was
1238received by the service.
1239
1240The @code{GNUNET_PEERSTORE_store} function returns a handle to the store
1241operation. This handle can be used to cancel the store operation only
1242before the continuation function is called:
1243
1244@example
1245@verbatiminclude tutorial-examples/013.1.c
1246@end example
1247
1248@node Retrieving records
1249@subsection Retrieving records
1250
1251To retrieve stored records, use the following function:
1252
1253@example
1254@verbatiminclude tutorial-examples/014.c
1255@end example
1256
1257@noindent
1258The values of @code{peer} and @code{key} can be @code{NULL}. This
1259allows the iteration over values stored under any of the following
1260key combinations:
1261
1262@itemize
1263@item (subsystem)
1264@item (subsystem, peerid)
1265@item (subsystem, key)
1266@item (subsystem, peerid, key)
1267@end itemize
1268
1269The @code{callback} function will be called once with each retrieved
1270record and once more with a @code{NULL} record to signal the end of
1271results.
1272
1273The @code{GNUNET_PEERSTORE_iterate} function returns a handle to the
1274iterate operation. This handle can be used to cancel the iterate
1275operation only before the callback function is called with a
1276@code{NULL} record.
1277
1278@node Monitoring records
1279@subsection Monitoring records
1280
1281PEERSTORE offers the functionality of monitoring for new records
1282stored under a specific key combination (subsystem, peerid, key).
1283To start the monitoring, use the following function:
1284
1285@example
1286@verbatiminclude tutorial-examples/015.c
1287@end example
1288
1289@noindent
1290Whenever a new record is stored under the given key combination,
1291the @code{callback} function will be called with this new
1292record. This will continue until the connection to the PEERSTORE
1293service is broken or the watch operation is canceled:
1294
1295@example
1296@verbatiminclude tutorial-examples/016.c
1297@end example
1298
1299@node Disconnecting from PEERSTORE
1300@subsection Disconnecting from PEERSTORE
1301
1302When the connection to the PEERSTORE service is no longer needed,
1303disconnect using the following function:
1304
1305@example
1306@verbatiminclude tutorial-examples/017.c
1307@end example
1308
1309@noindent
1310If the @code{sync_first} flag is set to @code{GNUNET_YES},
1311the API will delay the disconnection until all store requests
1312are received by the PEERSTORE service. Otherwise, it will
1313disconnect immediately.
1314
1315@node Using the DHT
1316@section Using the DHT
1317
1318The DHT allows to store data so other peers in the P2P network can
1319access it and retrieve data stored by any peers in the network.
1320This section will explain how to use the DHT. Of course, the first
1321thing to do is to connect to the DHT service:
1322
1323@example
1324@verbatiminclude tutorial-examples/018.c
1325@end example
1326
1327@noindent
1328The second parameter indicates how many requests in parallel to expect.
1329It is not a hard limit, but a good approximation will make the DHT more
1330efficient.
1331
1332@menu
1333* Storing data in the DHT::
1334* Obtaining data from the DHT::
1335* Implementing a block plugin::
1336* Monitoring the DHT::
1337@end menu
1338
1339@node Storing data in the DHT
1340@subsection Storing data in the DHT
1341Since the DHT is a dynamic environment (peers join and leave frequently)
1342the data that we put in the DHT does not stay there indefinitely. It is
1343important to ``refresh'' the data periodically by simply storing it
1344again, in order to make sure other peers can access it.
1345
1346The put API call offers a callback to signal that the PUT request has been
1347sent. This does not guarantee that the data is accessible to others peers,
1348or even that is has been stored, only that the service has requested to
1349a neighboring peer the retransmission of the PUT request towards its final
1350destination. Currently there is no feedback about whether or not the data
1351has been sucessfully stored or where it has been stored. In order to
1352improve the availablilty of the data and to compensate for possible
1353errors, peers leaving and other unfavorable events, just make several
1354PUT requests!
1355
1356@example
1357@verbatiminclude tutorial-examples/019.c
1358@end example
1359
1360@noindent
1361Exercise: Store a value in the DHT periodically to make sure it
1362is available over time. You might consider using the function
1363@code{GNUNET\_SCHEDULER\_add\_delayed} and call
1364@code{GNUNET\_DHT\_put} from inside a helper function.
1365
1366@node Obtaining data from the DHT
1367@subsection Obtaining data from the DHT
1368
1369As we saw in the previous example, the DHT works in an asynchronous mode.
1370Each request to the DHT is executed ``in the background'' and the API
1371calls return immediately. In order to receive results from the DHT, the
1372API provides a callback. Once started, the request runs in the service,
1373the service will try to get as many results as possible (filtering out
1374duplicates) until the timeout expires or we explicitly stop the request.
1375It is possible to give a ``forever'' timeout with
1376@code{GNUNET\_TIME\_UNIT\_FOREVER\_REL}.
1377
1378If we give a route option @code{GNUNET\_DHT\_RO\_RECORD\_ROUTE}
1379the callback will get a list of all the peers the data has travelled,
1380both on the PUT path and on the GET path.
1381
1382@example
1383@verbatiminclude tutorial-examples/020.c
1384@end example
1385
1386@noindent
1387Exercise: Store a value in the DHT and after a while retrieve it.
1388Show the IDs of all the peers the requests have gone through.
1389In order to convert a peer ID to a string, use the function
1390@code{GNUNET\_i2s}. Pay attention to the route option parameters
1391in both calls!
1392
1393@node Implementing a block plugin
1394@subsection Implementing a block plugin
1395
1396In order to store data in the DHT, it is necessary to provide a block
1397plugin. The DHT uses the block plugin to ensure that only well-formed
1398requests and replies are transmitted over the network.
1399
1400The block plugin should be put in a file @file{plugin\_block\_SERVICE.c}
1401in the service's respective directory. The
1402mandatory functions that need to be implemented for a block plugin are
1403described in the following sections.
1404
1405@menu
1406* Validating requests and replies::
1407* Deriving a key from a reply::
1408* Initialization of the plugin::
1409* Shutdown of the plugin::
1410* Integration of the plugin with the build system::
1411@end menu
1412
1413@node Validating requests and replies
1414@subsubsection Validating requests and replies
1415
1416The evaluate function should validate a reply or a request. It returns
1417a @code{GNUNET\_BLOCK\_EvaluationResult}, which is an enumeration. All
1418possible answers are in @file{gnunet\_block\_lib.h}. The function will
1419be called with a @code{reply\_block} argument of @code{NULL} for
1420requests. Note that depending on how @code{evaluate} is called, only
1421some of the possible return values are valid. The specific meaning of
1422the @code{xquery} argument is application-specific. Applications that
1423do not use an extended query should check that the @code{xquery\_size}
1424is zero. The block group is typically used to filter duplicate
1425replies.
1426
1427@example
1428@verbatiminclude tutorial-examples/021.c
1429@end example
1430
1431@noindent
1432Note that it is mandatory to detect duplicate replies in this function
1433and return the respective status code. Duplicate detection is
1434typically done using the Bloom filter block group provided by
1435@file{libgnunetblockgroup.so}. Failure to do so may cause replies to
1436circle in the network.
1437
1438@node Deriving a key from a reply
1439@subsubsection Deriving a key from a reply
1440
1441The DHT can operate more efficiently if it is possible to derive a key
1442from the value of the corresponding block. The @code{get\_key}
1443function is used to obtain the key of a block --- for example, by
1444means of hashing. If deriving the key is not possible, the function
1445should simply return @code{GNUNET\_SYSERR} (the DHT will still work
1446just fine with such blocks).
1447
1448@example
1449@verbatiminclude tutorial-examples/022.c
1450@end example
1451
1452@node Initialization of the plugin
1453@subsubsection Initialization of the plugin
1454
1455The plugin is realized as a shared C library. The library must export
1456an initialization function which should initialize the plugin. The
1457initialization function specifies what block types the plugin cares
1458about and returns a struct with the functions that are to be used for
1459validation and obtaining keys (the ones just defined above).
1460
1461@example
1462@verbatiminclude tutorial-examples/023.c
1463@end example
1464
1465@node Shutdown of the plugin
1466@subsubsection Shutdown of the plugin
1467
1468Following GNUnet's general plugin API concept, the plugin must
1469export a second function for cleaning up. It usually does very
1470little.
1471
1472@example
1473@verbatiminclude tutorial-examples/024.c
1474@end example
1475
1476@node Integration of the plugin with the build system
1477@subsubsection Integration of the plugin with the build system
1478
1479In order to compile the plugin, the @file{Makefile.am} file for the
1480service SERVICE should contain a rule similar to this:
1481@c Actually this is a Makefile not C. But the whole structure of examples
1482@c must be improved.
1483
1484@example
1485@verbatiminclude tutorial-examples/025.Makefile.am
1486@end example
1487
1488@noindent
1489Exercise: Write a block plugin that accepts all queries
1490and all replies but prints information about queries and replies
1491when the respective validation hooks are called.
1492
1493@node Monitoring the DHT
1494@subsection Monitoring the DHT
1495
1496It is possible to monitor the functioning of the local
1497DHT service. When monitoring the DHT, the service will
1498alert the monitoring program of any events, both started
1499locally or received for routing from another peer.
1500The are three different types of events possible: a
1501GET request, a PUT request or a response (a reply to a GET).
1502
1503Since the different events have different associated data,
1504the API gets 3 different callbacks (one for each message type)
1505and optional type and key parameters, to allow for filtering of
1506messages. When an event happens, the appropiate callback is
1507called with all the information about the event.
1508
1509@example
1510@verbatiminclude tutorial-examples/026.c
1511@end example
1512
1513@node Debugging with gnunet-arm
1514@section Debugging with gnunet-arm
1515
1516Even if services are managed by @command{gnunet-arm}, you can
1517start them with @command{gdb} or @command{valgrind}. For
1518example, you could add the following lines to your
1519configuration file to start the DHT service in a @command{gdb}
1520session in a fresh @command{xterm}:
1521
1522@example
1523[dht]
1524PREFIX=xterm -e gdb --args
1525@end example
1526
1527@noindent
1528Alternatively, you can stop a service that was started via
1529ARM and run it manually:
1530
1531@example
1532$ gnunet-arm -k dht
1533$ gdb --args gnunet-service-dht -L DEBUG
1534$ valgrind gnunet-service-dht -L DEBUG
1535@end example
1536
1537@noindent
1538Assuming other services are well-written, they will automatically
1539re-integrate the restarted service with the peer.
1540
1541GNUnet provides a powerful logging mechanism providing log
1542levels @code{ERROR}, @code{WARNING}, @code{INFO} and @code{DEBUG}.
1543The current log level is configured using the @code{$GNUNET_FORCE_LOG}
1544environmental variable. The @code{DEBUG} level is only available if
1545@command{--enable-logging=verbose} was used when running
1546@command{configure}. More details about logging can be found under
1547@uref{https://gnunet.org/logging}.
1548
1549You should also probably enable the creation of core files, by setting
1550@code{ulimit}, and echo'ing @code{1} into
1551@file{/proc/sys/kernel/core\_uses\_pid}. Then you can investigate the
1552core dumps with @command{gdb}, which is often the fastest method to
1553find simple errors.
1554
1555Exercise: Add a memory leak to your service and obtain a trace
1556pointing to the leak using @command{valgrind} while running the service
1557from @command{gnunet-service-arm}.
1558
1559@bye
diff --git a/doc/documentation/gnunet.texi b/doc/documentation/gnunet.texi
deleted file mode 100644
index 05522d7d0..000000000
--- a/doc/documentation/gnunet.texi
+++ /dev/null
@@ -1,247 +0,0 @@
1\input texinfo
2@c -*-texinfo-*-
3@setfilename gnunet.info
4@documentencoding UTF-8
5@settitle GNUnet Reference Manual
6@c @exampleindent 2
7
8@c Set Versions which might be used in more than one place:
9@set GNUFTP-URL https://ftp.gnu.org/gnu/gnunet
10@set PYPI-URL https://pypi.python.org/packages/source
11@set GNURL-VERSION-CURRENT 7.55.1
12@set GNUNET-DIST-URL https://gnunet.org/sites/default/files/
13@include version.texi
14@c @set OPENPGP-SIGNING-KEY-ID
15
16@copying
17Copyright @copyright{} 2001-2018 GNUnet e.V.
18
19Permission is granted to copy, distribute and/or modify this document
20under the terms of the GNU Free Documentation License, Version 1.3 or
21any later version published by the Free Software Foundation; with no
22Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A
23copy of the license is included in the section entitled ``GNU Free
24Documentation License''.
25
26A copy of the license is also available from the Free Software
27Foundation Web site at @url{http://www.gnu.org/licenses/fdl.html}.
28
29Alternately, this document is also available under the General
30Public License, version 3 or later, as published by the Free Software
31Foundation. A copy of the license is included in the section entitled
32``GNU General Public License''.
33
34A copy of the license is also available from the Free Software
35Foundation Web site at @url{http://www.gnu.org/licenses/gpl.html}.
36@end copying
37
38@c TODO: Improve this and improve https://directory.fsf.org/wiki/Gnunet
39@c NOTE FOR TRANSLATORS: Due to en.wikipedia.org being the wikipedia
40@c which is more up to date than others, refrain
41@c from using localized wikipedia unless you are
42@c sure the articles content is good enough. For
43@c example the german wikipedia entry for GNUnet
44@c is in a terrible shape, but the en.wikipedia.org
45@c entry is still acceptable (although in need of
46@c updates).
47
48@dircategory Networking
49@direntry
50* GNUnet: (gnunet). Framework for secure peer-to-peer networking
51@end direntry
52
53@titlepage
54@title GNUnet Reference Manual
55@subtitle Installing, configuring, using and contributing to GNUnet
56@author The GNUnet Developers
57
58@page
59@vskip 0pt plus 1filll
60Edition @value{EDITION} @*
61
62@insertcopying
63@end titlepage
64
65@summarycontents
66@contents
67
68@node Top
69@top Introduction
70
71This document is the Reference Manual for GNUnet version @value{VERSION}.
72
73@menu
74
75* Preface:: Chapter 0
76* Philosophy:: About GNUnet
77* Key Concepts:: Key concepts of GNUnet
78@c * Vocabulary:: Vocabulary
79* Installing GNUnet:: Installing GNUnet
80* Using GNUnet:: Using GNUnet
81@c * Configuration Handbook:: Configuring GNUnet
82* GNUnet Contributors Handbook:: Contributing to GNUnet
83* GNUnet Developer Handbook:: Developing GNUnet
84* GNU Free Documentation License:: The license of this manual
85* GNU General Public License::
86* GNU Affero General Public License::
87* Concept Index:: Concepts
88* Programming Index:: Data types, functions, and variables
89
90@detailmenu
91 --- The Detailed Node Listing ---
92
93Preface
94
95* About this book
96* Contributing to this book
97* Introduction
98* Typography::
99
100Philosophy
101
102* Design Principles::
103* Privacy and Anonymity::
104* Practicality::
105
106Key Concepts
107
108* Authentication::
109* Accounting to Encourage Resource Sharing::
110* Confidentiality::
111* Anonymity::
112* Deniability::
113* Peer Identities::
114* Zones in the GNU Name System (GNS Zones)::
115* Egos::
116* Backup of Identities and Egos::
117* Revocation::
118
119Installing GNUnet
120* Installing dependencies::
121* Getting the Source Code::
122* Create @code{gnunet} user and group::
123* Preparing and Compiling the Source Code::
124* Installation::
125* MOVED FROM USER Checking the Installation::
126* MOVED FROM USER The graphical configuration interface::
127* MOVED FROM USER Config Leftovers::
128
129Using GNUnet
130
131* Start and stop GNUnet::
132* First steps - Using the GNU Name System::
133* First steps - Using GNUnet Conversation::
134* First steps - Using the GNUnet VPN::
135* File-sharing::
136* The GNU Name System::
137* Using the Virtual Public Network::
138
139GNUnet Contributors Handbook
140
141* Contributing to GNUnet::
142* Licenses of contributions::
143* Copyright Assignment::
144* Contributing to the Reference Manual::
145* Contributing testcases::
146
147GNUnet Developer Handbook
148
149* Developer Introduction::
150* Internal dependencies::
151* Code overview::
152* System Architecture::
153* Subsystem stability::
154* Naming conventions and coding style guide::
155* Build-system::
156* Developing extensions for GNUnet using the gnunet-ext template::
157* Writing testcases::
158* Building GNUnet and its dependencies::
159* TESTING library::
160* Performance regression analysis with Gauger::
161* TESTBED Subsystem::
162* libgnunetutil::
163* Automatic Restart Manager (ARM)::
164* TRANSPORT Subsystem::
165* NAT library::
166* Distance-Vector plugin::
167* SMTP plugin::
168* Bluetooth plugin::
169* WLAN plugin::
170* ATS Subsystem::
171* CORE Subsystem::
172* CADET Subsystem::
173* NSE Subsystem::
174* HOSTLIST Subsystem::
175* IDENTITY Subsystem::
176* NAMESTORE Subsystem::
177* PEERINFO Subsystem::
178* PEERSTORE Subsystem::
179* SET Subsystem::
180* STATISTICS Subsystem::
181* Distributed Hash Table (DHT)::
182* GNU Name System (GNS)::
183* GNS Namecache::
184* REVOCATION Subsystem::
185* File-sharing (FS) Subsystem::
186* REGEX Subsystem::
187
188@end detailmenu
189@end menu
190
191@c *********************************************************************
192@include chapters/preface.texi
193@c *********************************************************************
194
195@c *********************************************************************
196@include chapters/philosophy.texi
197@c *********************************************************************
198
199@c *********************************************************************
200@include chapters/keyconcepts.texi
201@c *********************************************************************
202
203@c *********************************************************************
204@include chapters/installation.texi
205@c *********************************************************************
206
207@c *********************************************************************
208@include chapters/user.texi
209@c *********************************************************************
210
211@include chapters/contributing.texi
212
213@c *********************************************************************
214@include chapters/developer.texi
215@c *********************************************************************
216
217@c *********************************************************************
218@node GNU Free Documentation License
219@appendix GNU Free Documentation License
220@cindex license, GNU Free Documentation License
221@include fdl-1.3.texi
222
223@c *********************************************************************
224@node GNU General Public License
225@appendix GNU General Public License
226@cindex license, GNU General Public License
227@include gpl-3.0.texi
228
229@c *********************************************************************
230@node GNU Affero General Public License
231@appendix GNU Affero General Public License
232@cindex license, GNU Affero General Public License
233@include agpl-3.0.texi
234
235@c *********************************************************************
236@node Concept Index
237@unnumbered Concept Index
238@printindex cp
239
240@node Programming Index
241@unnumbered Programming Index
242@syncodeindex tp fn
243@syncodeindex vr fn
244@syncodeindex pg fn
245@printindex fn
246
247@bye
diff --git a/doc/documentation/gpl-3.0.texi b/doc/documentation/gpl-3.0.texi
deleted file mode 100644
index 0e2e212ac..000000000
--- a/doc/documentation/gpl-3.0.texi
+++ /dev/null
@@ -1,717 +0,0 @@
1@c The GNU General Public License.
2@center Version 3, 29 June 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{http://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 General Public License is a free, copyleft license for
17software and other kinds of works.
18
19The licenses for most software and other practical works are designed
20to take away your freedom to share and change the works. By contrast,
21the GNU General Public License is intended to guarantee your freedom
22to share and change all versions of a program---to make sure it remains
23free software for all its users. We, the Free Software Foundation,
24use the GNU General Public License for most of our software; it
25applies also to any other work released this way by its authors. You
26can apply it to your programs, too.
27
28When we speak of free software, we are referring to freedom, not
29price. Our General Public Licenses are designed to make sure that you
30have the freedom to distribute copies of free software (and charge for
31them if you wish), that you receive source code or can get it if you
32want it, that you can change the software or use pieces of it in new
33free programs, and that you know you can do these things.
34
35To protect your rights, we need to prevent others from denying you
36these rights or asking you to surrender the rights. Therefore, you
37have certain responsibilities if you distribute copies of the
38software, or if you modify it: responsibilities to respect the freedom
39of others.
40
41For example, if you distribute copies of such a program, whether
42gratis or for a fee, you must pass on to the recipients the same
43freedoms that you received. You must make sure that they, too,
44receive or can get the source code. And you must show them these
45terms so they know their rights.
46
47Developers that use the GNU GPL protect your rights with two steps:
48(1) assert copyright on the software, and (2) offer you this License
49giving you legal permission to copy, distribute and/or modify it.
50
51For the developers' and authors' protection, the GPL clearly explains
52that there is no warranty for this free software. For both users' and
53authors' sake, the GPL requires that modified versions be marked as
54changed, so that their problems will not be attributed erroneously to
55authors of previous versions.
56
57Some devices are designed to deny users access to install or run
58modified versions of the software inside them, although the
59manufacturer can do so. This is fundamentally incompatible with the
60aim of protecting users' freedom to change the software. The
61systematic pattern of such abuse occurs in the area of products for
62individuals to use, which is precisely where it is most unacceptable.
63Therefore, we have designed this version of the GPL to prohibit the
64practice for those products. If such problems arise substantially in
65other domains, we stand ready to extend this provision to those
66domains in future versions of the GPL, as needed to protect the
67freedom of users.
68
69Finally, every program is threatened constantly by software patents.
70States should not allow patents to restrict development and use of
71software on general-purpose computers, but in those that do, we wish
72to avoid the special danger that patents applied to a free program
73could make it effectively proprietary. To prevent this, the GPL
74assures that patents cannot be used to render the program non-free.
75
76The precise terms and conditions for copying, distribution and
77modification follow.
78
79@heading TERMS AND CONDITIONS
80
81@enumerate 0
82@item Definitions.
83
84``This License'' refers to version 3 of the GNU General Public License.
85
86``Copyright'' also means copyright-like laws that apply to other kinds
87of works, such as semiconductor masks.
88
89``The Program'' refers to any copyrightable work licensed under this
90License. Each licensee is addressed as ``you''. ``Licensees'' and
91``recipients'' may be individuals or organizations.
92
93To ``modify'' a work means to copy from or adapt all or part of the work
94in a fashion requiring copyright permission, other than the making of
95an exact copy. The resulting work is called a ``modified version'' of
96the earlier work or a work ``based on'' the earlier work.
97
98A ``covered work'' means either the unmodified Program or a work based
99on the Program.
100
101To ``propagate'' a work means to do anything with it that, without
102permission, would make you directly or secondarily liable for
103infringement under applicable copyright law, except executing it on a
104computer or modifying a private copy. Propagation includes copying,
105distribution (with or without modification), making available to the
106public, and in some countries other activities as well.
107
108To ``convey'' a work means any kind of propagation that enables other
109parties to make or receive copies. Mere interaction with a user
110through a computer network, with no transfer of a copy, is not
111conveying.
112
113An interactive user interface displays ``Appropriate Legal Notices'' to
114the extent that it includes a convenient and prominently visible
115feature that (1) displays an appropriate copyright notice, and (2)
116tells the user that there is no warranty for the work (except to the
117extent that warranties are provided), that licensees may convey the
118work under this License, and how to view a copy of this License. If
119the interface presents a list of user commands or options, such as a
120menu, a prominent item in the list meets this criterion.
121
122@item Source Code.
123
124The ``source code'' for a work means the preferred form of the work for
125making modifications to it. ``Object code'' means any non-source form
126of a work.
127
128A ``Standard Interface'' means an interface that either is an official
129standard defined by a recognized standards body, or, in the case of
130interfaces specified for a particular programming language, one that
131is widely used among developers working in that language.
132
133The ``System Libraries'' of an executable work include anything, other
134than the work as a whole, that (a) is included in the normal form of
135packaging a Major Component, but which is not part of that Major
136Component, and (b) serves only to enable use of the work with that
137Major Component, or to implement a Standard Interface for which an
138implementation is available to the public in source code form. A
139``Major Component'', in this context, means a major essential component
140(kernel, window system, and so on) of the specific operating system
141(if any) on which the executable work runs, or a compiler used to
142produce the work, or an object code interpreter used to run it.
143
144The ``Corresponding Source'' for a work in object code form means all
145the source code needed to generate, install, and (for an executable
146work) run the object code and to modify the work, including scripts to
147control those activities. However, it does not include the work's
148System Libraries, or general-purpose tools or generally available free
149programs which are used unmodified in performing those activities but
150which are not part of the work. For example, Corresponding Source
151includes interface definition files associated with source files for
152the work, and the source code for shared libraries and dynamically
153linked subprograms that the work is specifically designed to require,
154such as by intimate data communication or control flow between those
155subprograms and other parts of the work.
156
157The Corresponding Source need not include anything that users can
158regenerate automatically from other parts of the Corresponding Source.
159
160The Corresponding Source for a work in source code form is that same
161work.
162
163@item Basic Permissions.
164
165All rights granted under this License are granted for the term of
166copyright on the Program, and are irrevocable provided the stated
167conditions are met. This License explicitly affirms your unlimited
168permission to run the unmodified Program. The output from running a
169covered work is covered by this License only if the output, given its
170content, constitutes a covered work. This License acknowledges your
171rights of fair use or other equivalent, as provided by copyright law.
172
173You may make, run and propagate covered works that you do not convey,
174without conditions so long as your license otherwise remains in force.
175You may convey covered works to others for the sole purpose of having
176them make modifications exclusively for you, or provide you with
177facilities for running those works, provided that you comply with the
178terms of this License in conveying all material for which you do not
179control copyright. Those thus making or running the covered works for
180you must do so exclusively on your behalf, under your direction and
181control, on terms that prohibit them from making any copies of your
182copyrighted material outside their relationship with you.
183
184Conveying under any other circumstances is permitted solely under the
185conditions stated below. Sublicensing is not allowed; section 10
186makes it unnecessary.
187
188@item Protecting Users' Legal Rights From Anti-Circumvention Law.
189
190No covered work shall be deemed part of an effective technological
191measure under any applicable law fulfilling obligations under article
19211 of the WIPO copyright treaty adopted on 20 December 1996, or
193similar laws prohibiting or restricting circumvention of such
194measures.
195
196When you convey a covered work, you waive any legal power to forbid
197circumvention of technological measures to the extent such
198circumvention is effected by exercising rights under this License with
199respect to the covered work, and you disclaim any intention to limit
200operation or modification of the work as a means of enforcing, against
201the work's users, your or third parties' legal rights to forbid
202circumvention of technological measures.
203
204@item Conveying Verbatim Copies.
205
206You may convey verbatim copies of the Program's source code as you
207receive it, in any medium, provided that you conspicuously and
208appropriately publish on each copy an appropriate copyright notice;
209keep intact all notices stating that this License and any
210non-permissive terms added in accord with section 7 apply to the code;
211keep intact all notices of the absence of any warranty; and give all
212recipients a copy of this License along with the Program.
213
214You may charge any price or no price for each copy that you convey,
215and you may offer support or warranty protection for a fee.
216
217@item Conveying Modified Source Versions.
218
219You may convey a work based on the Program, or the modifications to
220produce it from the Program, in the form of source code under the
221terms of section 4, provided that you also meet all of these
222conditions:
223
224@enumerate a
225@item
226The work must carry prominent notices stating that you modified it,
227and giving a relevant date.
228
229@item
230The work must carry prominent notices stating that it is released
231under this License and any conditions added under section 7. This
232requirement modifies the requirement in section 4 to ``keep intact all
233notices''.
234
235@item
236You must license the entire work, as a whole, under this License to
237anyone who comes into possession of a copy. This License will
238therefore apply, along with any applicable section 7 additional terms,
239to the whole of the work, and all its parts, regardless of how they
240are packaged. This License gives no permission to license the work in
241any other way, but it does not invalidate such permission if you have
242separately received it.
243
244@item
245If the work has interactive user interfaces, each must display
246Appropriate Legal Notices; however, if the Program has interactive
247interfaces that do not display Appropriate Legal Notices, your work
248need not make them do so.
249@end enumerate
250
251A compilation of a covered work with other separate and independent
252works, which are not by their nature extensions of the covered work,
253and which are not combined with it such as to form a larger program,
254in or on a volume of a storage or distribution medium, is called an
255``aggregate'' if the compilation and its resulting copyright are not
256used to limit the access or legal rights of the compilation's users
257beyond what the individual works permit. Inclusion of a covered work
258in an aggregate does not cause this License to apply to the other
259parts of the aggregate.
260
261@item Conveying Non-Source Forms.
262
263You may convey a covered work in object code form under the terms of
264sections 4 and 5, provided that you also convey the machine-readable
265Corresponding Source under the terms of this License, in one of these
266ways:
267
268@enumerate a
269@item
270Convey the object code in, or embodied in, a physical product
271(including a physical distribution medium), accompanied by the
272Corresponding Source fixed on a durable physical medium customarily
273used for software interchange.
274
275@item
276Convey the object code in, or embodied in, a physical product
277(including a physical distribution medium), accompanied by a written
278offer, valid for at least three years and valid for as long as you
279offer spare parts or customer support for that product model, to give
280anyone who possesses the object code either (1) a copy of the
281Corresponding Source for all the software in the product that is
282covered by this License, on a durable physical medium customarily used
283for software interchange, for a price no more than your reasonable
284cost of physically performing this conveying of source, or (2) access
285to copy the Corresponding Source from a network server at no charge.
286
287@item
288Convey individual copies of the object code with a copy of the written
289offer to provide the Corresponding Source. This alternative is
290allowed only occasionally and noncommercially, and only if you
291received the object code with such an offer, in accord with subsection
2926b.
293
294@item
295Convey the object code by offering access from a designated place
296(gratis or for a charge), and offer equivalent access to the
297Corresponding Source in the same way through the same place at no
298further charge. You need not require recipients to copy the
299Corresponding Source along with the object code. If the place to copy
300the object code is a network server, the Corresponding Source may be
301on a different server (operated by you or a third party) that supports
302equivalent copying facilities, provided you maintain clear directions
303next to the object code saying where to find the Corresponding Source.
304Regardless of what server hosts the Corresponding Source, you remain
305obligated to ensure that it is available for as long as needed to
306satisfy these requirements.
307
308@item
309Convey the object code using peer-to-peer transmission, provided you
310inform other peers where the object code and Corresponding Source of
311the work are being offered to the general public at no charge under
312subsection 6d.
313
314@end enumerate
315
316A separable portion of the object code, whose source code is excluded
317from the Corresponding Source as a System Library, need not be
318included in conveying the object code work.
319
320A ``User Product'' is either (1) a ``consumer product'', which means any
321tangible personal property which is normally used for personal,
322family, or household purposes, or (2) anything designed or sold for
323incorporation into a dwelling. In determining whether a product is a
324consumer product, doubtful cases shall be resolved in favor of
325coverage. For a particular product received by a particular user,
326``normally used'' refers to a typical or common use of that class of
327product, regardless of the status of the particular user or of the way
328in which the particular user actually uses, or expects or is expected
329to use, the product. A product is a consumer product regardless of
330whether the product has substantial commercial, industrial or
331non-consumer uses, unless such uses represent the only significant
332mode of use of the product.
333
334``Installation Information'' for a User Product means any methods,
335procedures, authorization keys, or other information required to
336install and execute modified versions of a covered work in that User
337Product from a modified version of its Corresponding Source. The
338information must suffice to ensure that the continued functioning of
339the modified object code is in no case prevented or interfered with
340solely because modification has been made.
341
342If you convey an object code work under this section in, or with, or
343specifically for use in, a User Product, and the conveying occurs as
344part of a transaction in which the right of possession and use of the
345User Product is transferred to the recipient in perpetuity or for a
346fixed term (regardless of how the transaction is characterized), the
347Corresponding Source conveyed under this section must be accompanied
348by the Installation Information. But this requirement does not apply
349if neither you nor any third party retains the ability to install
350modified object code on the User Product (for example, the work has
351been installed in ROM).
352
353The requirement to provide Installation Information does not include a
354requirement to continue to provide support service, warranty, or
355updates for a work that has been modified or installed by the
356recipient, or for the User Product in which it has been modified or
357installed. Access to a network may be denied when the modification
358itself materially and adversely affects the operation of the network
359or violates the rules and protocols for communication across the
360network.
361
362Corresponding Source conveyed, and Installation Information provided,
363in accord with this section must be in a format that is publicly
364documented (and with an implementation available to the public in
365source code form), and must require no special password or key for
366unpacking, reading or copying.
367
368@item Additional Terms.
369
370``Additional permissions'' are terms that supplement the terms of this
371License by making exceptions from one or more of its conditions.
372Additional permissions that are applicable to the entire Program shall
373be treated as though they were included in this License, to the extent
374that they are valid under applicable law. If additional permissions
375apply only to part of the Program, that part may be used separately
376under those permissions, but the entire Program remains governed by
377this License without regard to the additional permissions.
378
379When you convey a copy of a covered work, you may at your option
380remove any additional permissions from that copy, or from any part of
381it. (Additional permissions may be written to require their own
382removal in certain cases when you modify the work.) You may place
383additional permissions on material, added by you to a covered work,
384for which you have or can give appropriate copyright permission.
385
386Notwithstanding any other provision of this License, for material you
387add to a covered work, you may (if authorized by the copyright holders
388of that material) supplement the terms of this License with terms:
389
390@enumerate a
391@item
392Disclaiming warranty or limiting liability differently from the terms
393of sections 15 and 16 of this License; or
394
395@item
396Requiring preservation of specified reasonable legal notices or author
397attributions in that material or in the Appropriate Legal Notices
398displayed by works containing it; or
399
400@item
401Prohibiting misrepresentation of the origin of that material, or
402requiring that modified versions of such material be marked in
403reasonable ways as different from the original version; or
404
405@item
406Limiting the use for publicity purposes of names of licensors or
407authors of the material; or
408
409@item
410Declining to grant rights under trademark law for use of some trade
411names, trademarks, or service marks; or
412
413@item
414Requiring indemnification of licensors and authors of that material by
415anyone who conveys the material (or modified versions of it) with
416contractual assumptions of liability to the recipient, for any
417liability that these contractual assumptions directly impose on those
418licensors and authors.
419@end enumerate
420
421All other non-permissive additional terms are considered ``further
422restrictions'' within the meaning of section 10. If the Program as you
423received it, or any part of it, contains a notice stating that it is
424governed by this License along with a term that is a further
425restriction, you may remove that term. If a license document contains
426a further restriction but permits relicensing or conveying under this
427License, you may add to a covered work material governed by the terms
428of that license document, provided that the further restriction does
429not survive such relicensing or conveying.
430
431If you add terms to a covered work in accord with this section, you
432must place, in the relevant source files, a statement of the
433additional terms that apply to those files, or a notice indicating
434where to find the applicable terms.
435
436Additional terms, permissive or non-permissive, may be stated in the
437form of a separately written license, or stated as exceptions; the
438above requirements apply either way.
439
440@item Termination.
441
442You may not propagate or modify a covered work except as expressly
443provided under this License. Any attempt otherwise to propagate or
444modify it is void, and will automatically terminate your rights under
445this License (including any patent licenses granted under the third
446paragraph of section 11).
447
448However, if you cease all violation of this License, then your license
449from a particular copyright holder is reinstated (a) provisionally,
450unless and until the copyright holder explicitly and finally
451terminates your license, and (b) permanently, if the copyright holder
452fails to notify you of the violation by some reasonable means prior to
45360 days after the cessation.
454
455Moreover, your license from a particular copyright holder is
456reinstated permanently if the copyright holder notifies you of the
457violation by some reasonable means, this is the first time you have
458received notice of violation of this License (for any work) from that
459copyright holder, and you cure the violation prior to 30 days after
460your receipt of the notice.
461
462Termination of your rights under this section does not terminate the
463licenses of parties who have received copies or rights from you under
464this License. If your rights have been terminated and not permanently
465reinstated, you do not qualify to receive new licenses for the same
466material under section 10.
467
468@item Acceptance Not Required for Having Copies.
469
470You are not required to accept this License in order to receive or run
471a copy of the Program. Ancillary propagation of a covered work
472occurring solely as a consequence of using peer-to-peer transmission
473to receive a copy likewise does not require acceptance. However,
474nothing other than this License grants you permission to propagate or
475modify any covered work. These actions infringe copyright if you do
476not accept this License. Therefore, by modifying or propagating a
477covered work, you indicate your acceptance of this License to do so.
478
479@item Automatic Licensing of Downstream Recipients.
480
481Each time you convey a covered work, the recipient automatically
482receives a license from the original licensors, to run, modify and
483propagate that work, subject to this License. You are not responsible
484for enforcing compliance by third parties with this License.
485
486An ``entity transaction'' is a transaction transferring control of an
487organization, or substantially all assets of one, or subdividing an
488organization, or merging organizations. If propagation of a covered
489work results from an entity transaction, each party to that
490transaction who receives a copy of the work also receives whatever
491licenses to the work the party's predecessor in interest had or could
492give under the previous paragraph, plus a right to possession of the
493Corresponding Source of the work from the predecessor in interest, if
494the predecessor has it or can get it with reasonable efforts.
495
496You may not impose any further restrictions on the exercise of the
497rights granted or affirmed under this License. For example, you may
498not impose a license fee, royalty, or other charge for exercise of
499rights granted under this License, and you may not initiate litigation
500(including a cross-claim or counterclaim in a lawsuit) alleging that
501any patent claim is infringed by making, using, selling, offering for
502sale, or importing the Program or any portion of it.
503
504@item Patents.
505
506A ``contributor'' is a copyright holder who authorizes use under this
507License of the Program or a work on which the Program is based. The
508work thus licensed is called the contributor's ``contributor version''.
509
510A contributor's ``essential patent claims'' are all patent claims owned
511or controlled by the contributor, whether already acquired or
512hereafter acquired, that would be infringed by some manner, permitted
513by this License, of making, using, or selling its contributor version,
514but do not include claims that would be infringed only as a
515consequence of further modification of the contributor version. For
516purposes of this definition, ``control'' includes the right to grant
517patent sublicenses in a manner consistent with the requirements of
518this License.
519
520Each contributor grants you a non-exclusive, worldwide, royalty-free
521patent license under the contributor's essential patent claims, to
522make, use, sell, offer for sale, import and otherwise run, modify and
523propagate the contents of its contributor version.
524
525In the following three paragraphs, a ``patent license'' is any express
526agreement or commitment, however denominated, not to enforce a patent
527(such as an express permission to practice a patent or covenant not to
528sue for patent infringement). To ``grant'' such a patent license to a
529party means to make such an agreement or commitment not to enforce a
530patent against the party.
531
532If you convey a covered work, knowingly relying on a patent license,
533and the Corresponding Source of the work is not available for anyone
534to copy, free of charge and under the terms of this License, through a
535publicly available network server or other readily accessible means,
536then you must either (1) cause the Corresponding Source to be so
537available, or (2) arrange to deprive yourself of the benefit of the
538patent license for this particular work, or (3) arrange, in a manner
539consistent with the requirements of this License, to extend the patent
540license to downstream recipients. ``Knowingly relying'' means you have
541actual knowledge that, but for the patent license, your conveying the
542covered work in a country, or your recipient's use of the covered work
543in a country, would infringe one or more identifiable patents in that
544country that you have reason to believe are valid.
545
546If, pursuant to or in connection with a single transaction or
547arrangement, you convey, or propagate by procuring conveyance of, a
548covered work, and grant a patent license to some of the parties
549receiving the covered work authorizing them to use, propagate, modify
550or convey a specific copy of the covered work, then the patent license
551you grant is automatically extended to all recipients of the covered
552work and works based on it.
553
554A patent license is ``discriminatory'' if it does not include within the
555scope of its coverage, prohibits the exercise of, or is conditioned on
556the non-exercise of one or more of the rights that are specifically
557granted under this License. You may not convey a covered work if you
558are a party to an arrangement with a third party that is in the
559business of distributing software, under which you make payment to the
560third party based on the extent of your activity of conveying the
561work, and under which the third party grants, to any of the parties
562who would receive the covered work from you, a discriminatory patent
563license (a) in connection with copies of the covered work conveyed by
564you (or copies made from those copies), or (b) primarily for and in
565connection with specific products or compilations that contain the
566covered work, unless you entered into that arrangement, or that patent
567license was granted, prior to 28 March 2007.
568
569Nothing in this License shall be construed as excluding or limiting
570any implied license or other defenses to infringement that may
571otherwise be available to you under applicable patent law.
572
573@item No Surrender of Others' Freedom.
574
575If conditions are imposed on you (whether by court order, agreement or
576otherwise) that contradict the conditions of this License, they do not
577excuse you from the conditions of this License. If you cannot convey
578a covered work so as to satisfy simultaneously your obligations under
579this License and any other pertinent obligations, then as a
580consequence you may not convey it at all. For example, if you agree
581to terms that obligate you to collect a royalty for further conveying
582from those to whom you convey the Program, the only way you could
583satisfy both those terms and this License would be to refrain entirely
584from conveying the Program.
585
586@item Use with the GNU Affero General Public License.
587
588Notwithstanding any other provision of this License, you have
589permission to link or combine any covered work with a work licensed
590under version 3 of the GNU Affero General Public License into a single
591combined work, and to convey the resulting work. The terms of this
592License will continue to apply to the part which is the covered work,
593but the special requirements of the GNU Affero General Public License,
594section 13, concerning interaction through a network will apply to the
595combination as such.
596
597@item Revised Versions of this License.
598
599The Free Software Foundation may publish revised and/or new versions
600of the GNU General Public License from time to time. Such new
601versions will be similar in spirit to the present version, but may
602differ in detail to address new problems or concerns.
603
604Each version is given a distinguishing version number. If the Program
605specifies that a certain numbered version of the GNU General Public
606License ``or any later version'' applies to it, you have the option of
607following the terms and conditions either of that numbered version or
608of any later version published by the Free Software Foundation. If
609the Program does not specify a version number of the GNU General
610Public License, you may choose any version ever published by the Free
611Software Foundation.
612
613If the Program specifies that a proxy can decide which future versions
614of the GNU General Public License can be used, that proxy's public
615statement of acceptance of a version permanently authorizes you to
616choose that version for the Program.
617
618Later license versions may give you additional or different
619permissions. However, no additional obligations are imposed on any
620author or copyright holder as a result of your choosing to follow a
621later version.
622
623@item Disclaimer of Warranty.
624
625THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
626APPLICABLE LAW@. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
627HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM ``AS IS'' WITHOUT
628WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT
629LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
630A PARTICULAR PURPOSE@. THE ENTIRE RISK AS TO THE QUALITY AND
631PERFORMANCE OF THE PROGRAM IS WITH YOU@. SHOULD THE PROGRAM PROVE
632DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
633CORRECTION.
634
635@item Limitation of Liability.
636
637IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
638WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR
639CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
640INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES
641ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT
642NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR
643LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM
644TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER
645PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
646
647@item Interpretation of Sections 15 and 16.
648
649If the disclaimer of warranty and limitation of liability provided
650above cannot be given local legal effect according to their terms,
651reviewing courts shall apply local law that most closely approximates
652an absolute waiver of all civil liability in connection with the
653Program, unless a warranty or assumption of liability accompanies a
654copy of the Program in return for a fee.
655
656@end enumerate
657
658@heading END OF TERMS AND CONDITIONS
659
660@heading How to Apply These Terms to Your New Programs
661
662If you develop a new program, and you want it to be of the greatest
663possible use to the public, the best way to achieve this is to make it
664free software which everyone can redistribute and change under these
665terms.
666
667To do so, attach the following notices to the program. It is safest
668to attach them to the start of each source file to most effectively
669state the exclusion of warranty; and each file should have at least
670the ``copyright'' line and a pointer to where the full notice is found.
671
672@smallexample
673@var{one line to give the program's name and a brief idea of what it does.}
674Copyright (C) @var{year} @var{name of author}
675
676This program is free software: you can redistribute it and/or modify
677it under the terms of the GNU General Public License as published by
678the Free Software Foundation, either version 3 of the License, or (at
679your option) any later version.
680
681This program is distributed in the hope that it will be useful, but
682WITHOUT ANY WARRANTY; without even the implied warranty of
683MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE@. See the GNU
684General Public License for more details.
685
686You should have received a copy of the GNU General Public License
687along with this program. If not, see @url{http://www.gnu.org/licenses/}.
688@end smallexample
689
690Also add information on how to contact you by electronic and paper mail.
691
692If the program does terminal interaction, make it output a short
693notice like this when it starts in an interactive mode:
694
695@smallexample
696@var{program} Copyright (C) @var{year} @var{name of author}
697This program comes with ABSOLUTELY NO WARRANTY; for details type @samp{show w}.
698This is free software, and you are welcome to redistribute it
699under certain conditions; type @samp{show c} for details.
700@end smallexample
701
702The hypothetical commands @samp{show w} and @samp{show c} should show
703the appropriate parts of the General Public License. Of course, your
704program's commands might be different; for a GUI interface, you would
705use an ``about box''.
706
707You should also get your employer (if you work as a programmer) or school,
708if any, to sign a ``copyright disclaimer'' for the program, if necessary.
709For more information on this, and how to apply and follow the GNU GPL, see
710@url{http://www.gnu.org/licenses/}.
711
712The GNU General Public License does not permit incorporating your
713program into proprietary programs. If your program is a subroutine
714library, you may consider it more useful to permit linking proprietary
715applications with the library. If this is what you want to do, use
716the GNU Lesser General Public License instead of this License. But
717first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}.
diff --git a/doc/documentation/htmlxref.cnf b/doc/documentation/htmlxref.cnf
deleted file mode 100644
index a4928f6fe..000000000
--- a/doc/documentation/htmlxref.cnf
+++ /dev/null
@@ -1,668 +0,0 @@
1# htmlxref.cnf - reference file for free Texinfo manuals on the web.
2# Modified by Ludovic Courtès <ludo@gnu.org> for the GNU Guix manual.
3# Modified by ng0 <ng0@gnunet.org> for the GNUnet manual.
4
5htmlxrefversion=2017-10-26.06; # UTC
6
7# Copyright 2010, 2011, 2012, 2013, 2014, 2015 Free Software Foundation, Inc.
8#
9# Copying and distribution of this file, with or without modification,
10# are permitted in any medium without royalty provided the copyright
11# notice and this notice are preserved.
12#
13# The latest version of this file is available at
14# http://ftpmirror.gnu.org/texinfo/htmlxref.cnf.
15# Email corrections or additions to bug-texinfo@gnu.org.
16# The primary goal is to list all relevant GNU manuals;
17# other free manuals are also welcome.
18#
19# To be included in this list, a manual must:
20#
21# - have a generic url, e.g., no version numbers;
22# - have a unique file name (e.g., manual identifier), i.e., be related to the
23# package name. Things like "refman" or "tutorial" don't work.
24# - follow the naming convention for nodes described at
25# http://www.gnu.org/software/texinfo/manual/texinfo/html_node/HTML-Xref.html
26# This is what makeinfo and texi2html implement.
27#
28# Unless the above criteria are met, it's not possible to generate
29# reliable cross-manual references.
30#
31# For information on automatically generating all the useful formats for
32# a manual to put on the web, see
33# http://www.gnu.org/prep/maintain/html_node/Manuals-on-Web-Pages.html.
34
35# For people editing this file: when a manual named foo is related to a
36# package named bar, the url should contain a variable reference ${BAR}.
37# Otherwise, the gnumaint scripts have no way of knowing they are
38# associated, and thus gnu.org/manual can't include them.
39
40# shorten references to manuals on www.gnu.org.
41G = https://www.gnu.org
42GS = ${G}/software
43
443dldf mono ${GS}/3dldf/manual/user_ref/3DLDF.html
453dldf node ${GS}/3dldf/manual/user_ref/
46
47alive mono ${GS}/alive/manual/alive.html
48alive node ${GS}/alive/manual/html_node/
49
50anubis chapter ${GS}/anubis/manual/html_chapter/
51anubis section ${GS}/anubis/manual/html_section/
52anubis node ${GS}/anubis/manual/html_node/
53
54artanis mono ${GS}/artanis/manual/artanis.html
55artanis node ${GS}/artanis/manual/html_node/
56
57aspell section http://aspell.net/man-html/index.html
58
59auctex mono ${GS}/auctex/manual/auctex.html
60auctex node ${GS}/auctex/manual/auctex/
61
62autoconf mono ${GS}/autoconf/manual/autoconf.html
63autoconf node ${GS}/autoconf/manual/html_node/
64
65autogen mono ${GS}/autogen/manual/html_mono/autogen.html
66autogen chapter ${GS}/autogen/manual/html_chapter/
67autogen node ${GS}/autoconf/manual/html_node/
68
69automake mono ${GS}/automake/manual/automake.html
70automake node ${GS}/automake/manual/html_node/
71
72avl node http://www.stanford.edu/~blp/avl/libavl.html/
73
74bash mono ${GS}/bash/manual/bash.html
75bash node ${GS}/bash/manual/html_node/
76
77BINUTILS = http://sourceware.org/binutils/docs
78binutils node ${BINUTILS}/binutils/
79 as node ${BINUTILS}/as/
80 bfd node ${BINUTILS}/bfd/
81 gprof node ${BINUTILS}/gprof/
82 ld node ${BINUTILS}/ld/
83
84bison mono ${GS}/bison/manual/bison.html
85bison node ${GS}/bison/manual/html_node/
86
87bpel2owfn mono ${GS}/bpel2owfn/manual/2.0.x/bpel2owfn.html
88
89ccd2cue mono ${GS}/ccd2cue/manual/ccd2cue.html
90ccd2cue node ${GS}/ccd2cue/manual/html_node/
91
92cflow mono ${GS}/cflow/manual/cflow.html
93cflow node ${GS}/cflow/manual/html_node/
94
95chess mono ${GS}/chess/manual/gnuchess.html
96chess node ${GS}/chess/manual/html_node/
97
98combine mono ${GS}/combine/manual/combine.html
99combine chapter ${GS}/combine/manual/html_chapter/
100combine section ${GS}/combine/manual/html_section/
101combine node ${GS}/combine/manual/html_node/
102
103complexity mono ${GS}/complexity/manual/complexity.html
104complexity node ${GS}/complexity/manual/html_node/
105
106coreutils mono ${GS}/coreutils/manual/coreutils
107coreutils node ${GS}/coreutils/manual/html_node/
108
109cpio mono ${GS}/cpio/manual/cpio
110cpio node ${GS}/cpio/manual/html_node/
111
112cssc node ${GS}/cssc/manual/
113
114#cvs cannot be handled here; see http://ximbiot.com/cvs/manual.
115
116ddd mono ${GS}/ddd/manual/html_mono/ddd.html
117
118ddrescue mono ${GS}/ddrescue/manual/ddrescue_manual.html
119
120DICO = http://puszcza.gnu.org.ua/software/dico/manual
121dico mono ${DICO}/dico.html
122dico chapter ${DICO}/html_chapter/
123dico section ${DICO}/html_section/
124dico node ${DICO}/html_node/
125
126diffutils mono ${GS}/diffutils/manual/diffutils
127diffutils node ${GS}/diffutils/manual/html_node/
128
129ed mono ${GS}/ed/manual/ed_manual.html
130
131EMACS = ${GS}/emacs/manual
132emacs mono ${EMACS}/html_mono/emacs.html
133emacs node ${EMACS}/html_node/emacs/
134 #
135 ada-mode mono ${EMACS}/html_mono/ada-mode.html
136 ada-mode node ${EMACS}/html_node/ada-mode/
137 #
138 autotype mono ${EMACS}/html_mono/autotype.html
139 autotype node ${EMACS}/html_node/autotype/
140 #
141 ccmode mono ${EMACS}/html_mono/ccmode.html
142 ccmode node ${EMACS}/html_node/ccmode/
143 #
144 cl mono ${EMACS}/html_mono/cl.html
145 cl node ${EMACS}/html_node/cl/
146 #
147 ebrowse mono ${EMACS}/html_mono/ebrowse.html
148 ebrowse node ${EMACS}/html_node/ebrowse/
149 #
150 ediff mono ${EMACS}/html_mono/ediff.html
151 ediff node ${EMACS}/html_node/ediff/
152 #
153 eieio mono ${EMACS}/html_mono/eieio.html
154 eieio node ${EMACS}/html_node/eieio/
155 #
156 elisp mono ${EMACS}/html_mono/elisp.html
157 elisp node ${EMACS}/html_node/elisp/
158 #
159 epa mono ${EMACS}/html_mono/epa.html
160 epa node ${EMACS}/html_node/epa/
161 #
162 erc mono ${EMACS}/html_mono/erc.html
163 erc node ${EMACS}/html_node/erc/
164 #
165 dired-x mono ${EMACS}/html_mono/dired-x.html
166 dired-x node ${EMACS}/html_node/dired-x/
167 #
168 eshell mono ${EMACS}/html_mono/eshell.html
169 eshell node ${EMACS}/html_node/eshell/
170 #
171 flymake mono ${EMACS}/html_mono/flymake.html
172 flymake node ${EMACS}/html_node/flymake/
173 #
174 gnus mono ${EMACS}/html_mono/gnus.html
175 gnus node ${EMACS}/html_node/gnus/
176 #
177 idlwave mono ${EMACS}/html_mono/idlwave.html
178 idlwave node ${EMACS}/html_node/idlwave/
179 #
180 message mono ${EMACS}/html_mono/message.html
181 message node ${EMACS}/html_node/message/
182 #
183 mh-e mono ${EMACS}/html_mono/mh-e.html
184 mh-e node ${EMACS}/html_node/mh-e/
185 #
186 nxml-mode mono ${EMACS}/html_mono/nxml-mode.html
187 nxml-mode node ${EMACS}/html_node/nxml-mode/
188 #
189 org mono ${EMACS}/html_mono/org.html
190 org node ${EMACS}/html_node/org/
191 #
192 pcl-cvs mono ${EMACS}/html_mono/pcl-cvs.html
193 pcl-cvs node ${EMACS}/html_node/pcl-cvs/
194 #
195 rcirc mono ${EMACS}/html_mono/rcirc.html
196 rcirc node ${EMACS}/html_node/rcirc/
197 #
198 semantic mono ${EMACS}/html_mono/semantic.html
199 semantic node ${EMACS}/html_node/semantic/
200 #
201 smtp mono ${EMACS}/html_mono/smtpmail.html
202 smtp node ${EMACS}/html_node/smtpmail/
203 #
204 speedbar mono ${EMACS}/html_mono/speedbar.html
205 speedbar node ${EMACS}/html_node/speedbar/
206 #
207 tramp mono ${EMACS}/html_mono/tramp.html
208 tramp node ${EMACS}/html_node/tramp/
209 #
210 vip mono ${EMACS}/html_mono/vip.html
211 vip node ${EMACS}/html_node/vip/
212 #
213 viper mono ${EMACS}/html_mono/viper.html
214 viper node ${EMACS}/html_node/viper/
215 #
216 woman mono ${EMACS}/html_mono/woman.html
217 woman node ${EMACS}/html_node/woman/
218 # (end emacs manuals)
219
220easejs mono ${GS}/easejs/manual/easejs.html
221easejs node ${GS}/easejs/manual/
222
223EMACS_GUIX = https://alezost.github.io/guix.el/manual/latest
224emacs-guix mono ${EMACS_GUIX}/emacs-guix.html
225emacs-guix node ${EMACS_GUIX}/html_node/
226
227emacs-muse node ${GS}/emacs-muse/manual/muse.html
228emacs-muse node ${GS}/emacs-muse/manual/html_node/
229
230emms node ${GS}/emms/manual/
231
232# The file is called 'find.info' but the package is 'findutils'.
233find mono ${GS}/findutils/manual/html_mono/find.html
234find node ${GS}/findutils/manual/html_node/find_html
235findutils mono ${GS}/findutils/manual/html_mono/find.html
236findutils node ${GS}/findutils/manual/html_node/find_html
237
238FLEX = http://flex.sourceforge.net
239flex node ${FLEX}/manual/
240
241gama mono ${GS}/gama/manual/gama.html
242gama node ${GS}/gama/manual/html_node/
243
244GAWK = ${GS}/gawk/manual
245gawk mono ${GAWK}/gawk.html
246gawk node ${GAWK}/html_node/
247 gawkinet mono ${GAWK}/gawkinet/gawkinet.html
248 gawkinet node ${GAWK}/gawkinet/html_node/
249
250gcal mono ${GS}/gcal/manual/gcal.html
251gcal node ${GS}/gcal/manual/html_node/
252
253GCC = http://gcc.gnu.org/onlinedocs
254gcc node ${GCC}/gcc/
255 cpp node ${GCC}/cpp/
256 gcj node ${GCC}/gcj/
257 gfortran node ${GCC}/gfortran/
258 gnat_rm node ${GCC}/gnat_rm/
259 gnat_ugn_unw node ${GCC}/gnat_ugn_unw/
260 libgomp node ${GCC}/libgomp/
261 libstdc++ node ${GCC}/libstdc++/
262 #
263 gccint node ${GCC}/gccint/
264 cppinternals node ${GCC}/cppinternals/
265 gfc-internals node ${GCC}/gfc-internals/
266 gnat-style node ${GCC}/gnat-style/
267 libiberty node ${GCC}/libiberty/
268
269GDB = http://sourceware.org/gdb/current/onlinedocs
270gdb node ${GDB}/gdb/
271 stabs node ${GDB}/stabs/
272
273GDBM = http://www.gnu.org.ua/software/gdbm/manual
274gdbm mono ${GDBM}/gdbm.html
275gdbm chapter ${GDBM}/html_chapter/
276gdbm section ${GDBM}/html_section/
277gdbm node ${GDBM}/html_node/
278
279gettext mono ${GS}/gettext/manual/gettext.html
280gettext node ${GS}/gettext/manual/html_node/
281
282gforth node http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/
283
284global mono ${GS}/global/manual/global.html
285
286gmediaserver node ${GS}/gmediaserver/manual/
287
288gmp node http://www.gmplib.org/manual/
289
290gnu-arch node ${GS}/gnu-arch/tutorial/
291
292gnu-c-manual mono ${GS}/gnu-c-manual/gnu-c-manual.html
293
294gnu-crypto node ${GS}/gnu-crypto/manual/
295
296gnubg mono ${GS}/gnubg/manual/gnubg.html
297gnubg node ${GS}/gnubg/manual/html_node/
298
299gnubik mono ${GS}/gnubik/manual/gnubik.html
300gnubik node ${GS}/gnubik/manual/html_node/
301
302gnulib mono ${GS}/gnulib/manual/gnulib.html
303gnulib node ${GS}/gnulib/manual/html_node/
304
305GNUN = ${GS}/trans-coord/manual
306gnun mono ${GNUN}/gnun/gnun.html
307gnun node ${GNUN}/gnun/html_node/
308 web-trans mono ${GNUN}/web-trans/web-trans.html
309 web-trans node ${GNUN}/web-trans/html_node/
310
311GNUNET = https://docs.gnunet.org/manuals
312gnunet node ${GNUNET}/gnunet/
313 gnunet-c-tutorial node ${GNUNET}/gnunet-c-tutorial/
314 gnunet-java-tutorial node ${GNUNET}/gnunet-java-tutorial/
315
316GNUPG = http://www.gnupg.org/documentation/manuals
317gnupg node ${GNUPG}/gnupg/
318 dirmngr node ${GNUPG}/dirmngr/
319 gcrypt node ${GNUPG}/gcrypt/
320 libgcrypt node ${GNUPG}/gcrypt/
321 ksba node ${GNUPG}/ksba/
322 assuan node ${GNUPG}/assuan/
323 gpgme node ${GNUPG}/gpgme/
324
325gnuprologjava node ${GS}/gnuprologjava/manual/
326
327gnuschool mono ${GS}/gnuschool/gnuschool.html
328
329GNUSTANDARDS = ${G}/prep
330 maintain mono ${GNUSTANDARDS}/maintain/maintain.html
331 maintain node ${GNUSTANDARDS}/maintain/html_node/
332 #
333 standards mono ${GNUSTANDARDS}/standards/standards.html
334 standards node ${GNUSTANDARDS}/standards/html_node/
335
336gnutls mono http://gnutls.org/manual/gnutls.html
337gnutls node http://gnutls.org/manual/html_node/
338
339gnutls-guile mono http://gnutls.org/manual/gnutls-guile.html
340gnutls-guile node http://gnutls.org/manual/gnutls-guile/
341
342gperf mono ${GS}/gperf/manual/gperf.html
343gperf node ${GS}/gperf/manual/html_node/
344
345grep mono ${GS}/grep/manual/grep.html
346grep node ${GS}/grep/manual/html_node/
347
348groff node ${GS}/groff/manual/html_node/
349
350GRUB = ${GS}/grub/manual
351 grub mono ${GRUB}/grub.html
352 grub node ${GRUB}/html_node/
353 #
354 multiboot mono ${GRUB}/multiboot/multiboot.html
355 multiboot node ${GRUB}/multiboot/html_node/
356
357gsasl mono ${GS}/gsasl/manual/gsasl.html
358gsasl node ${GS}/gsasl/manual/html_node/
359
360gsl node ${GS}/gsl/manual/html_node/
361
362gsrc mono ${GS}/gsrc/manual/gsrc.html
363gsrc node ${GS}/gsrc/manual/html_node/
364
365gss mono ${GS}/gss/manual/gss.html
366gss node ${GS}/gss/manual/html_node/
367
368gtypist mono ${GS}/gtypist/doc/
369
370guile mono ${GS}/guile/manual/guile.html
371guile node ${GS}/guile/manual/html_node/
372
373guile-avahi mono http://nongnu.org/guile-avahi/doc/guile-avahi.html
374
375GUILE_GNOME = ${GS}/guile-gnome/docs
376 gobject node ${GUILE_GNOME}/gobject/html/
377 glib node ${GUILE_GNOME}/glib/html/
378 atk node ${GUILE_GNOME}/atk/html/
379 pango node ${GUILE_GNOME}/pango/html/
380 pangocairo node ${GUILE_GNOME}/pangocairo/html/
381 gdk node ${GUILE_GNOME}/gdk/html/
382 gtk node ${GUILE_GNOME}/gtk/html/
383 libglade node ${GUILE_GNOME}/libglade/html/
384 gnome-vfs node ${GUILE_GNOME}/gnome-vfs/html/
385 libgnomecanvas node ${GUILE_GNOME}/libgnomecanvas/html/
386 gconf node ${GUILE_GNOME}/gconf/html/
387 libgnome node ${GUILE_GNOME}/libgnome/html/
388 libgnomeui node ${GUILE_GNOME}/libgnomeui/html/
389 corba node ${GUILE_GNOME}/corba/html/
390 clutter node ${GUILE_GNOME}/clutter/html/
391 clutter-glx node ${GUILE_GNOME}/clutter-glx/html/
392
393guile-gtk node ${GS}/guile-gtk/docs/guile-gtk/
394
395guile-rpc mono ${GS}/guile-rpc/manual/guile-rpc.html
396guile-rpc node ${GS}/guile-rpc/manual/html_node/
397
398guix mono ${GS}/guix/manual/guix.html
399guix node ${GS}/guix/manual/html_node/
400
401gv mono ${GS}/gv/manual/gv.html
402gv node ${GS}/gv/manual/html_node/
403
404gzip mono ${GS}/gzip/manual/gzip.html
405gzip node ${GS}/gzip/manual/html_node/
406
407hello mono ${GS}/hello/manual/hello.html
408hello node ${GS}/hello/manual/html_node/
409
410help2man mono ${GS}/help2man/help2man.html
411
412idutils mono ${GS}/idutils/manual/idutils.html
413idutils node ${GS}/idutils/manual/html_node/
414
415inetutils mono ${GS}/inetutils/manual/inetutils.html
416inetutils node ${GS}/inetutils/manual/html_node/
417
418jwhois mono ${GS}/jwhois/manual/jwhois.html
419jwhois node ${GS}/jwhois/manual/html_node/
420
421libc mono ${GS}/libc/manual/html_mono/libc.html
422libc node ${GS}/libc/manual/html_node/
423
424LIBCDIO = ${GS}/libcdio
425 libcdio mono ${LIBCDIO}/libcdio.html
426 cd-text mono ${LIBCDIO}/cd-text-format.html
427
428libextractor mono ${GS}/libextractor/manual/libextractor.html
429libextractor node ${GS}/libextractor/manual/html_node/
430
431libidn mono ${GS}/libidn/manual/libidn.html
432libidn node ${GS}/libidn/manual/html_node/
433
434librejs mono ${GS}/librejs/manual/librejs.html
435librejs node ${GS}/librejs/manual/html_node/
436
437libmatheval mono ${GS}/libmatheval/manual/libmatheval.html
438
439LIBMICROHTTPD = ${GS}/libmicrohttpd
440libmicrohttpd mono ${LIBMICROHTTPD}/manual/libmicrohttpd.html
441libmicrohttpd node ${LIBMICROHTTPD}/manual/html_node/
442 microhttpd-tutorial mono ${LIBMICROHTTPD}/tutorial.html
443
444libtasn1 mono ${GS}/libtasn1/manual/libtasn1.html
445libtasn1 node ${GS}/libtasn1/manual/html_node/
446
447libtool mono ${GS}/libtool/manual/libtool.html
448libtool node ${GS}/libtool/manual/html_node/
449
450lightning mono ${GS}/lightning/manual/lightning.html
451lightning node ${GS}/lightning/manual/html_node/
452
453# The stable/ url redirects immediately, but that's ok.
454# The .html extension is omitted on their web site, but it works if given.
455LILYPOND = http://lilypond.org/doc/stable/Documentation
456 lilypond-internals node ${LILYPOND}/internals/
457 lilypond-learning node ${LILYPOND}/learning/
458 lilypond-notation node ${LILYPOND}/notation/
459 lilypond-snippets node ${LILYPOND}/snippets/
460 lilypond-usage node ${LILYPOND}/usage/
461 lilypond-web node ${LILYPOND}/web/
462 music-glossary node ${LILYPOND}/music-glossary/
463
464liquidwar6 mono ${GS}/liquidwar6/manual/liquidwar6.html
465liquidwar6 node ${GS}/liquidwar6/manual/html_node/
466
467lispintro mono ${GS}/emacs/emacs-lisp-intro/html_mono/emacs-lisp-intro.html
468lispintro node ${GS}/emacs/emacs-lisp-intro/html_node/index.html
469
470LSH = http://www.lysator.liu.se/~nisse/lsh
471 lsh mono ${LSH}/lsh.html
472
473m4 mono ${GS}/m4/manual/m4.html
474m4 node ${GS}/m4/manual/html_node/
475
476mailutils mono ${GS}/mailutils/manual/mailutils.html
477mailutils chapter ${GS}/mailutils/manual/html_chapter/
478mailutils section ${GS}/mailutils/manual/html_section/
479mailutils node ${GS}/mailutils/manual/html_node/
480
481make mono ${GS}/make/manual/make.html
482make node ${GS}/make/manual/html_node/
483
484mcron mono ${GS}/mcron/manual/mcron.html
485mcron node ${GS}/mcron/manual/html_node/
486
487mdk mono ${GS}/mdk/manual/mdk.html
488mdk node ${GS}/mdk/manual/html_node/
489
490METAEXCHANGE = http://ftp.gwdg.de/pub/gnu2/iwfmdh/doc/texinfo
491 iwf_mh node ${METAEXCHANGE}/iwf_mh.html
492 scantest node ${METAEXCHANGE}/scantest.html
493
494MIT_SCHEME = ${GS}/mit-scheme/documentation
495 mit-scheme-ref node ${MIT_SCHEME}/mit-scheme-ref/
496 mit-scheme-user node ${MIT_SCHEME}/mit-scheme-user/
497 sos node ${MIT_SCHEME}/mit-scheme-sos/
498 mit-scheme-imail node ${MIT_SCHEME}/mit-scheme-imail/
499
500moe mono ${GS}/moe/manual/moe_manual.html
501
502motti node ${GS}/motti/manual/
503
504mpc node http://www.multiprecision.org/index.php?prog=mpc&page=html
505
506mpfr mono http://www.mpfr.org/mpfr-current/mpfr.html
507
508mtools mono ${GS}/mtools/manual/mtools.html
509
510myserver node http://www.myserverproject.net/documentation/
511
512nano mono http://www.nano-editor.org/dist/latest/nano.html
513
514nettle chapter http://www.lysator.liu.se/~nisse/nettle/nettle.html
515
516ocrad mono ${GS}/ocrad/manual/ocrad_manual.html
517
518parted mono ${GS}/parted/manual/parted.html
519parted node ${GS}/parted/manual/html_node/
520
521pascal mono http://www.gnu-pascal.de/gpc/
522
523# can't use pcb since url's contain dates --30nov10
524
525perl mono ${GS}/perl/manual/perldoc-all.html
526
527PIES = http://www.gnu.org.ua/software/pies/manual
528pies mono ${PIES}/pies.html
529pies chapter ${PIES}/html_chapter/
530pies section ${PIES}/html_section/
531pies node ${PIES}/html_node/
532
533plotutils mono ${GS}/plotutils/manual/en/plotutils.html
534plotutils node ${GS}/plotutils/manual/en/html_node/
535
536proxyknife mono ${GS}/proxyknife/manual/proxyknife.html
537proxyknife node ${GS}/proxyknife/manual/html_node/
538
539pspp mono ${GS}/pspp/manual/pspp.html
540pspp node ${GS}/pspp/manual/html_node/
541
542pyconfigure mono ${GS}/pyconfigure/manual/pyconfigure.html
543pyconfigure node ${GS}/pyconfigure/manual/html_node/
544
545R = http://cran.r-project.org/doc/manuals
546 R-intro mono ${R}/R-intro.html
547 R-lang mono ${R}/R-lang.html
548 R-exts mono ${R}/R-exts.html
549 R-data mono ${R}/R-data.html
550 R-admin mono ${R}/R-admin.html
551 R-ints mono ${R}/R-ints.html
552
553rcs mono ${GS}/rcs/manual/rcs.html
554rcs node ${GS}/rcs/manual/html_node/
555
556READLINE = http://cnswww.cns.cwru.edu/php/chet/readline
557readline mono ${READLINE}/readline.html
558 rluserman mono ${READLINE}/rluserman.html
559 history mono ${READLINE}/history.html
560
561recode mono http://recode.progiciels-bpi.ca/manual/index.html
562
563recutils mono ${GS}/recutils/manual/recutils.html
564recutils node ${GS}/recutils/manual/html_node/
565
566reftex mono ${GS}/auctex/manual/reftex.html
567reftex node ${GS}/auctex/manual/reftex/
568
569remotecontrol mono ${GS}/remotecontrol/manual/remotecontrol.html
570remotecontrol node ${GS}/remotecontrol/manual/html_node/
571
572rottlog mono ${GS}/rottlog/manual/rottlog.html
573rottlog node ${GS}/rottlog/manual/html_node/
574
575RUSH = http://www.gnu.org.ua/software/rush/manual
576rush mono ${RUSH}/rush.html
577rush chapter ${RUSH}/html_chapter/
578rush section ${RUSH}/html_section/
579rush node ${RUSH}/html_node/
580
581screen mono ${GS}/screen/manual/screen.html
582screen node ${GS}/screen/manual/html_node/
583
584sed mono ${GS}/sed/manual/sed.html
585sed node ${GS}/sed/manual/html_node/
586
587sharutils mono ${GS}/sharutils/manual/html_mono/sharutils.html
588sharutils chapter ${GS}/sharutils/manual/html_chapter/
589sharutils node ${GS}/sharutils/manual/html_node/
590
591shepherd mono ${GS}/shepherd/manual/shepherd.html
592shepherd node ${GS}/shepherd/manual/html_node/
593
594# can't use mono files since they have generic names
595SMALLTALK = ${GS}/smalltalk
596smalltalk node ${SMALLTALK}/manual/html_node/
597 smalltalk-base node ${SMALLTALK}/manual-base/html_node/
598 smalltalk-libs node ${SMALLTALK}/manual-libs/html_node/
599
600sourceinstall mono ${GS}/sourceinstall/manual/sourceinstall.html
601sourceinstall node ${GS}/sourceinstall/manual/html_node/
602
603sqltutor mono ${GS}/sqltutor/manual/sqltutor.html
604sqltutor node ${GS}/sqltutor/manual/html_node/
605
606src-highlite mono ${GS}/src-highlite/source-highlight.html
607
608swbis mono ${GS}/swbis/manual.html
609
610tar mono ${GS}/tar/manual/tar.html
611tar chapter ${GS}/tar/manual/html_chapter/
612tar section ${GS}/tar/manual/html_section/
613tar node ${GS}/autoconf/manual/html_node/
614
615teseq mono ${GS}/teseq/teseq.html
616teseq node ${GS}/teseq/html_node/
617
618TEXINFO = ${GS}/texinfo/manual
619texinfo mono ${TEXINFO}/texinfo/texinfo.html
620texinfo node ${TEXINFO}/texinfo/html_node/
621 #
622 info mono ${TEXINFO}/info/info.html
623 info node ${TEXINFO}/info/html_node/
624 #
625 info-stnd mono ${TEXINFO}/info-stnd/info-stnd.html
626 info-stnd node ${TEXINFO}/info-stnd/html_node/
627
628thales node ${GS}/thales/manual/
629
630units mono ${GS}/units/manual/units.html
631units node ${GS}/units/manual/html_node/
632
633vc-dwim mono ${GS}/vc-dwim/manual/vc-dwim.html
634vc-dwim node ${GS}/vc-dwim/manual/html_node/
635
636wdiff mono ${GS}/wdiff/manual/wdiff.html
637wdiff node ${GS}/wdiff/manual/html_node/
638
639websocket4j mono ${GS}/websocket4j/manual/websocket4j.html
640websocket4j node ${GS}/websocket4j/manual/html_node/
641
642wget mono ${GS}/wget/manual/wget.html
643wget node ${GS}/wget/manual/html_node/
644
645xboard mono ${GS}/xboard/manual/xboard.html
646xboard node ${GS}/xboard/manual/html_node/
647
648# emacs-page
649# Free TeX-related Texinfo manuals on tug.org.
650
651T = http://tug.org/texinfohtml
652
653dvipng mono ${T}/dvipng.html
654dvips mono ${T}/dvips.html
655eplain mono ${T}/eplain.html
656kpathsea mono ${T}/kpathsea.html
657latex2e mono ${T}/latex2e.html
658tlbuild mono ${T}/tlbuild.html
659web2c mono ${T}/web2c.html
660
661
662# Local Variables:
663# eval: (add-hook 'write-file-hooks 'time-stamp)
664# time-stamp-start: "htmlxrefversion="
665# time-stamp-format: "%:y-%02m-%02d.%02H"
666# time-stamp-time-zone: "UTC"
667# time-stamp-end: "; # UTC"
668# End:
diff --git a/doc/documentation/images/daemon_lego_block.png b/doc/documentation/images/daemon_lego_block.png
deleted file mode 100644
index 5a088b532..000000000
--- a/doc/documentation/images/daemon_lego_block.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/daemon_lego_block.svg b/doc/documentation/images/daemon_lego_block.svg
deleted file mode 100644
index 38ad90d13..000000000
--- a/doc/documentation/images/daemon_lego_block.svg
+++ /dev/null
@@ -1,126 +0,0 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:cc="http://creativecommons.org/ns#"
7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8 xmlns:svg="http://www.w3.org/2000/svg"
9 xmlns="http://www.w3.org/2000/svg"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 width="744.09448819"
13 height="1052.3622047"
14 id="svg6781"
15 version="1.1"
16 inkscape:version="0.48.2 r9819"
17 sodipodi:docname="New document 58">
18 <defs
19 id="defs6783" />
20 <sodipodi:namedview
21 id="base"
22 pagecolor="#ffffff"
23 bordercolor="#666666"
24 borderopacity="1.0"
25 inkscape:pageopacity="0.0"
26 inkscape:pageshadow="2"
27 inkscape:zoom="0.35"
28 inkscape:cx="375"
29 inkscape:cy="520"
30 inkscape:document-units="px"
31 inkscape:current-layer="layer1"
32 showgrid="false"
33 inkscape:window-width="1366"
34 inkscape:window-height="721"
35 inkscape:window-x="-2"
36 inkscape:window-y="-3"
37 inkscape:window-maximized="1" />
38 <metadata
39 id="metadata6786">
40 <rdf:RDF>
41 <cc:Work
42 rdf:about="">
43 <dc:format>image/svg+xml</dc:format>
44 <dc:type
45 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
46 <dc:title></dc:title>
47 </cc:Work>
48 </rdf:RDF>
49 </metadata>
50 <g
51 inkscape:label="Layer 1"
52 inkscape:groupmode="layer"
53 id="layer1">
54 <g
55 transform="translate(-4.5298577,-148.04661)"
56 id="g6746">
57 <path
58 style="fill:#5fd38d;fill-opacity:1;stroke:#faf6a2;stroke-width:1.99014676;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
59 d="m 183.84284,595.7683 350.8064,0 0,202.04036 -350.8064,0 z"
60 id="path6693"
61 inkscape:connector-curvature="0" />
62 <rect
63 style="fill:#ffffff;fill-opacity:1;stroke:#faf6a2;stroke-width:2.22747946;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
64 id="rect6695"
65 width="66.670067"
66 height="75.18058"
67 x="223.74881"
68 y="737.19458" />
69 <rect
70 y="737.19458"
71 x="331.83514"
72 height="67.323441"
73 width="66.670067"
74 id="rect6697"
75 style="fill:#ffffff;fill-opacity:1;stroke:#faf6a2;stroke-width:2.10787106;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
76 <rect
77 style="fill:#ffffff;fill-opacity:1;stroke:#faf6a2;stroke-width:2.06117821;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
78 id="rect6699"
79 width="66.670067"
80 height="64.373825"
81 x="434.8707"
82 y="737.19458" />
83 <path
84 style="fill:#37c871;fill-opacity:1;stroke:#faf6a2;stroke-width:0.98368376;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
85 d="m 223.60976,736.21851 67.23534,0.38374 0,23.63648 -67.23534,37.13818 z"
86 id="path6701"
87 inkscape:connector-curvature="0"
88 sodipodi:nodetypes="ccccc" />
89 <path
90 sodipodi:nodetypes="ccccc"
91 inkscape:connector-curvature="0"
92 id="path6703"
93 d="m 331.69608,736.21851 67.23534,0.3894 0,23.98466 -67.23534,37.68524 z"
94 style="fill:#37c871;fill-opacity:1;stroke:#faf6a2;stroke-width:0.99090236;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
95 <path
96 style="fill:#37c871;fill-opacity:1;stroke:#faf6a2;stroke-width:0.98368376;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
97 d="m 434.73164,736.21851 67.23534,0.38374 0,23.63648 -67.23534,37.13818 z"
98 id="path6705"
99 inkscape:connector-curvature="0"
100 sodipodi:nodetypes="ccccc" />
101 <path
102 style="fill:#37c871;fill-opacity:1;stroke:#faf6a2;stroke-width:1.92068994;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
103 d="m 533.72659,595.02309 56.12366,-29.34622 -1.01015,190.24271 -55.11351,41.45733 z"
104 id="path6707"
105 inkscape:connector-curvature="0"
106 sodipodi:nodetypes="ccccc" />
107 <path
108 style="fill:#37c871;fill-opacity:1;stroke:#faf6a2;stroke-width:1.99424875;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
109 d="m 245.46708,566.47881 345.46203,-1.01015 -56.56854,31.31472 -349.50264,-1.01014 z"
110 id="path6709"
111 inkscape:connector-curvature="0"
112 sodipodi:nodetypes="ccccc" />
113 <text
114 sodipodi:linespacing="125%"
115 id="text6715"
116 y="677.59558"
117 x="234.35539"
118 style="font-size:36px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
119 xml:space="preserve"><tspan
120 y="677.59558"
121 x="234.35539"
122 id="tspan6717"
123 sodipodi:role="line">User Interface</tspan></text>
124 </g>
125 </g>
126</svg>
diff --git a/doc/documentation/images/gns.dot b/doc/documentation/images/gns.dot
deleted file mode 100644
index 55b05d482..000000000
--- a/doc/documentation/images/gns.dot
+++ /dev/null
@@ -1,42 +0,0 @@
1// house = interface towards application
2// circle (default) = storage
3// diamond = stateless tool
4// box = legacy system
5
6// this is what we have...o
7digraph dataflow {
8splines = true;
9
10 DNS [shape="box"];
11 import [label="gnunet-zoneimport", shape="diamond"];
12 namestore;
13 namecache;
14 gns [shape="diamond"];
15 dns2gns [shape="house"];
16 cmdline [label="gnunet-gns", shape="house"];
17 libnss_gns [shape="house"];
18 proxy [label="gnunet-gns-proxy", shape="house"];
19 dht;
20 zonemaster [shape="diamond"];
21
22 DNS -> import [label="import"];
23 import -> namestore [label="export"];
24
25 namestore -> zonemaster [label="notifies"];
26 zonemaster -> dht [label="publishes"];
27
28 namestore -> namecache [label="pre-populates"];
29
30
31
32 libnss_gns -> cmdline [label="invokes"];
33 cmdline -> gns [label="lookup"];
34
35 dns2gns -> gns [label="lookup"];
36
37 proxy -> gns [label="lookup"];
38
39 gns -> namecache [label="uses"];
40 gns -> dht [label="queries"];
41
42}
diff --git a/doc/documentation/images/gns.eps b/doc/documentation/images/gns.eps
deleted file mode 100644
index 3f3c28d98..000000000
--- a/doc/documentation/images/gns.eps
+++ /dev/null
@@ -1,585 +0,0 @@
1%!PS-Adobe-3.0 EPSF-3.0
2%%Creator: graphviz version 2.40.1 (20161225.0304)
3%%Title: dataflow
4%%Pages: 1
5%%BoundingBox: 36 36 722 428
6%%EndComments
7save
8%%BeginProlog
9/DotDict 200 dict def
10DotDict begin
11
12/setupLatin1 {
13mark
14/EncodingVector 256 array def
15 EncodingVector 0
16
17ISOLatin1Encoding 0 255 getinterval putinterval
18EncodingVector 45 /hyphen put
19
20% Set up ISO Latin 1 character encoding
21/starnetISO {
22 dup dup findfont dup length dict begin
23 { 1 index /FID ne { def }{ pop pop } ifelse
24 } forall
25 /Encoding EncodingVector def
26 currentdict end definefont
27} def
28/Times-Roman starnetISO def
29/Times-Italic starnetISO def
30/Times-Bold starnetISO def
31/Times-BoldItalic starnetISO def
32/Helvetica starnetISO def
33/Helvetica-Oblique starnetISO def
34/Helvetica-Bold starnetISO def
35/Helvetica-BoldOblique starnetISO def
36/Courier starnetISO def
37/Courier-Oblique starnetISO def
38/Courier-Bold starnetISO def
39/Courier-BoldOblique starnetISO def
40cleartomark
41} bind def
42
43%%BeginResource: procset graphviz 0 0
44/coord-font-family /Times-Roman def
45/default-font-family /Times-Roman def
46/coordfont coord-font-family findfont 8 scalefont def
47
48/InvScaleFactor 1.0 def
49/set_scale {
50 dup 1 exch div /InvScaleFactor exch def
51 scale
52} bind def
53
54% styles
55/solid { [] 0 setdash } bind def
56/dashed { [9 InvScaleFactor mul dup ] 0 setdash } bind def
57/dotted { [1 InvScaleFactor mul 6 InvScaleFactor mul] 0 setdash } bind def
58/invis {/fill {newpath} def /stroke {newpath} def /show {pop newpath} def} bind def
59/bold { 2 setlinewidth } bind def
60/filled { } bind def
61/unfilled { } bind def
62/rounded { } bind def
63/diagonals { } bind def
64/tapered { } bind def
65
66% hooks for setting color
67/nodecolor { sethsbcolor } bind def
68/edgecolor { sethsbcolor } bind def
69/graphcolor { sethsbcolor } bind def
70/nopcolor {pop pop pop} bind def
71
72/beginpage { % i j npages
73 /npages exch def
74 /j exch def
75 /i exch def
76 /str 10 string def
77 npages 1 gt {
78 gsave
79 coordfont setfont
80 0 0 moveto
81 (\() show i str cvs show (,) show j str cvs show (\)) show
82 grestore
83 } if
84} bind def
85
86/set_font {
87 findfont exch
88 scalefont setfont
89} def
90
91% draw text fitted to its expected width
92/alignedtext { % width text
93 /text exch def
94 /width exch def
95 gsave
96 width 0 gt {
97 [] 0 setdash
98 text stringwidth pop width exch sub text length div 0 text ashow
99 } if
100 grestore
101} def
102
103/boxprim { % xcorner ycorner xsize ysize
104 4 2 roll
105 moveto
106 2 copy
107 exch 0 rlineto
108 0 exch rlineto
109 pop neg 0 rlineto
110 closepath
111} bind def
112
113/ellipse_path {
114 /ry exch def
115 /rx exch def
116 /y exch def
117 /x exch def
118 matrix currentmatrix
119 newpath
120 x y translate
121 rx ry scale
122 0 0 1 0 360 arc
123 setmatrix
124} bind def
125
126/endpage { showpage } bind def
127/showpage { } def
128
129/layercolorseq
130 [ % layer color sequence - darkest to lightest
131 [0 0 0]
132 [.2 .8 .8]
133 [.4 .8 .8]
134 [.6 .8 .8]
135 [.8 .8 .8]
136 ]
137def
138
139/layerlen layercolorseq length def
140
141/setlayer {/maxlayer exch def /curlayer exch def
142 layercolorseq curlayer 1 sub layerlen mod get
143 aload pop sethsbcolor
144 /nodecolor {nopcolor} def
145 /edgecolor {nopcolor} def
146 /graphcolor {nopcolor} def
147} bind def
148
149/onlayer { curlayer ne {invis} if } def
150
151/onlayers {
152 /myupper exch def
153 /mylower exch def
154 curlayer mylower lt
155 curlayer myupper gt
156 or
157 {invis} if
158} def
159
160/curlayer 0 def
161
162%%EndResource
163%%EndProlog
164%%BeginSetup
16514 default-font-family set_font
166% /arrowlength 10 def
167% /arrowwidth 5 def
168
169% make sure pdfmark is harmless for PS-interpreters other than Distiller
170/pdfmark where {pop} {userdict /pdfmark /cleartomark load put} ifelse
171% make '<<' and '>>' safe on PS Level 1 devices
172/languagelevel where {pop languagelevel}{1} ifelse
1732 lt {
174 userdict (<<) cvn ([) cvn load put
175 userdict (>>) cvn ([) cvn load put
176} if
177
178%%EndSetup
179setupLatin1
180%%Page: 1 1
181%%PageBoundingBox: 36 36 722 428
182%%PageOrientation: Portrait
1830 0 1 beginpage
184gsave
18536 36 686 392 boxprim clip newpath
1861 1 set_scale 0 rotate 40 40 translate
187% DNS
188gsave
1891 setlinewidth
1900 0 0 nodecolor
191newpath 137.2989 384 moveto
19283.2989 384 lineto
19383.2989 348 lineto
194137.2989 348 lineto
195closepath stroke
1960 0 0 nodecolor
19714 /Times-Roman set_font
19896.2989 362.3 moveto 28 (DNS) alignedtext
199grestore
200% import
201gsave
2021 setlinewidth
2030 0 0 nodecolor
204newpath 110.2989 297 moveto
205.2008 279 lineto
206110.2989 261 lineto
207220.397 279 lineto
208closepath stroke
2090 0 0 nodecolor
21014 /Times-Roman set_font
21158.2989 275.3 moveto 104 (gnunet-zoneimport) alignedtext
212grestore
213% DNS->import
214gsave
2151 setlinewidth
2160 0 0 edgecolor
217newpath 110.2989 347.9735 moveto
218110.2989 336.1918 110.2989 320.5607 110.2989 307.1581 curveto
219stroke
2200 0 0 edgecolor
221newpath 113.799 307.0033 moveto
222110.2989 297.0034 lineto
223106.799 307.0034 lineto
224closepath fill
2251 setlinewidth
226solid
2270 0 0 edgecolor
228newpath 113.799 307.0033 moveto
229110.2989 297.0034 lineto
230106.799 307.0034 lineto
231closepath stroke
2320 0 0 edgecolor
23314 /Times-Roman set_font
234110.2989 318.8 moveto 37 (import) alignedtext
235grestore
236% namestore
237gsave
2381 setlinewidth
2390 0 0 nodecolor
240159.2989 192 47.3916 18 ellipse_path stroke
2410 0 0 nodecolor
24214 /Times-Roman set_font
243130.7989 188.3 moveto 57 (namestore) alignedtext
244grestore
245% import->namestore
246gsave
2471 setlinewidth
2480 0 0 edgecolor
249newpath 119.7466 262.2255 moveto
250126.7274 249.831 136.3701 232.7103 144.3867 218.4767 curveto
251stroke
2520 0 0 edgecolor
253newpath 147.5178 220.0495 moveto
254149.3756 209.6188 lineto
255141.4186 216.6143 lineto
256closepath fill
2571 setlinewidth
258solid
2590 0 0 edgecolor
260newpath 147.5178 220.0495 moveto
261149.3756 209.6188 lineto
262141.4186 216.6143 lineto
263closepath stroke
2640 0 0 edgecolor
26514 /Times-Roman set_font
266138.2989 231.8 moveto 35 (export) alignedtext
267grestore
268% namecache
269gsave
2701 setlinewidth
2710 0 0 nodecolor
272300.2989 105 50.0912 18 ellipse_path stroke
2730 0 0 nodecolor
27414 /Times-Roman set_font
275269.7989 101.3 moveto 61 (namecache) alignedtext
276grestore
277% namestore->namecache
278gsave
2791 setlinewidth
2800 0 0 edgecolor
281newpath 184.1823 176.6464 moveto
282206.9544 162.5955 240.8544 141.6785 266.1545 126.0678 curveto
283stroke
2840 0 0 edgecolor
285newpath 268.04 129.0171 moveto
286274.7125 120.7873 lineto
287264.3642 123.0598 lineto
288closepath fill
2891 setlinewidth
290solid
2910 0 0 edgecolor
292newpath 268.04 129.0171 moveto
293274.7125 120.7873 lineto
294264.3642 123.0598 lineto
295closepath stroke
2960 0 0 edgecolor
29714 /Times-Roman set_font
298238.2989 144.8 moveto 74 (pre-populates) alignedtext
299grestore
300% zonemaster
301gsave
3021 setlinewidth
3030 0 0 nodecolor
304newpath 159.2989 123 moveto
30586.5718 105 lineto
306159.2989 87 lineto
307232.0259 105 lineto
308closepath stroke
3090 0 0 nodecolor
31014 /Times-Roman set_font
311127.7989 101.3 moveto 63 (zonemaster) alignedtext
312grestore
313% namestore->zonemaster
314gsave
3151 setlinewidth
3160 0 0 edgecolor
317newpath 159.2989 173.9735 moveto
318159.2989 162.1918 159.2989 146.5607 159.2989 133.1581 curveto
319stroke
3200 0 0 edgecolor
321newpath 162.799 133.0033 moveto
322159.2989 123.0034 lineto
323155.799 133.0034 lineto
324closepath fill
3251 setlinewidth
326solid
3270 0 0 edgecolor
328newpath 162.799 133.0033 moveto
329159.2989 123.0034 lineto
330155.799 133.0034 lineto
331closepath stroke
3320 0 0 edgecolor
33314 /Times-Roman set_font
334159.2989 144.8 moveto 41 (notifies) alignedtext
335grestore
336% gns
337gsave
3381 setlinewidth
3390 0 0 nodecolor
340newpath 386.2989 210 moveto
341353.957 192 lineto
342386.2989 174 lineto
343418.6408 192 lineto
344closepath stroke
3450 0 0 nodecolor
34614 /Times-Roman set_font
347376.7989 188.3 moveto 19 (gns) alignedtext
348grestore
349% gns->namecache
350gsave
3511 setlinewidth
3520 0 0 edgecolor
353newpath 373.8052 180.5028 moveto
354366.3078 173.5201 356.6389 164.3674 348.2989 156 curveto
355339.8869 147.5605 330.8812 138.1087 322.969 129.6563 curveto
356stroke
3570 0 0 edgecolor
358newpath 325.434 127.1675 moveto
359316.0586 122.2327 lineto
360320.3103 131.937 lineto
361closepath fill
3621 setlinewidth
363solid
3640 0 0 edgecolor
365newpath 325.434 127.1675 moveto
366316.0586 122.2327 lineto
367320.3103 131.937 lineto
368closepath stroke
3690 0 0 edgecolor
37014 /Times-Roman set_font
371348.2989 144.8 moveto 24 (uses) alignedtext
372grestore
373% dht
374gsave
3751 setlinewidth
3760 0 0 nodecolor
377272.2989 18 27 18 ellipse_path stroke
3780 0 0 nodecolor
37914 /Times-Roman set_font
380263.2989 14.3 moveto 18 (dht) alignedtext
381grestore
382% gns->dht
383gsave
3841 setlinewidth
3850 0 0 edgecolor
386newpath 385.181 174.2737 moveto
387383.0587 152.2164 376.9318 114.1509 359.2989 87 curveto
388344.9772 64.9477 321.2191 46.8067 302.1458 34.6694 curveto
389stroke
3900 0 0 edgecolor
391newpath 303.8469 31.6069 moveto
392293.4925 29.3628 lineto
393300.1875 37.5742 lineto
394closepath fill
3951 setlinewidth
396solid
3970 0 0 edgecolor
398newpath 303.8469 31.6069 moveto
399293.4925 29.3628 lineto
400300.1875 37.5742 lineto
401closepath stroke
4020 0 0 edgecolor
40314 /Times-Roman set_font
404376.2989 101.3 moveto 40 (queries) alignedtext
405grestore
406% dns2gns
407gsave
4081 setlinewidth
4090 0 0 nodecolor
410newpath 336.3104 284.5623 moveto
411287.2989 297 lineto
412238.2874 284.5623 lineto
413238.3331 264.4377 lineto
414336.2646 264.4377 lineto
415closepath stroke
4160 0 0 nodecolor
41714 /Times-Roman set_font
418264.7989 275.3 moveto 45 (dns2gns) alignedtext
419grestore
420% dns2gns->gns
421gsave
4221 setlinewidth
4230 0 0 edgecolor
424newpath 304.0929 264.2416 moveto
425321.1237 249.2751 347.504 226.0924 365.7671 210.0431 curveto
426stroke
4270 0 0 edgecolor
428newpath 368.323 212.4564 moveto
429373.5243 203.2262 lineto
430363.7022 207.1983 lineto
431closepath fill
4321 setlinewidth
433solid
4340 0 0 edgecolor
435newpath 368.323 212.4564 moveto
436373.5243 203.2262 lineto
437363.7022 207.1983 lineto
438closepath stroke
4390 0 0 edgecolor
44014 /Times-Roman set_font
441343.2989 231.8 moveto 38 (lookup) alignedtext
442grestore
443% cmdline
444gsave
4451 setlinewidth
4460 0 0 nodecolor
447newpath 478.0186 284.5623 moveto
448416.2989 297 lineto
449354.5791 284.5623 lineto
450354.6367 264.4377 lineto
451477.961 264.4377 lineto
452closepath stroke
4530 0 0 nodecolor
45414 /Times-Roman set_font
455385.7989 275.3 moveto 61 (gnunet-gns) alignedtext
456grestore
457% cmdline->gns
458gsave
4591 setlinewidth
4600 0 0 edgecolor
461newpath 411.2098 264.2416 moveto
462406.7547 251.3219 400.1883 232.2795 394.9156 216.9885 curveto
463stroke
4640 0 0 edgecolor
465newpath 398.0825 215.4359 moveto
466391.5138 207.1232 lineto
467391.4649 217.7179 lineto
468closepath fill
4691 setlinewidth
470solid
4710 0 0 edgecolor
472newpath 398.0825 215.4359 moveto
473391.5138 207.1232 lineto
474391.4649 217.7179 lineto
475closepath stroke
4760 0 0 edgecolor
47714 /Times-Roman set_font
478403.2989 231.8 moveto 38 (lookup) alignedtext
479grestore
480% libnss_gns
481gsave
4821 setlinewidth
4830 0 0 nodecolor
484newpath 475.6981 371.5623 moveto
485416.2989 384 lineto
486356.8996 371.5623 lineto
487356.9551 351.4377 lineto
488475.6427 351.4377 lineto
489closepath stroke
4900 0 0 nodecolor
49114 /Times-Roman set_font
492387.2989 362.3 moveto 58 (libnss_gns) alignedtext
493grestore
494% libnss_gns->cmdline
495gsave
4961 setlinewidth
4970 0 0 edgecolor
498newpath 416.2989 351.2416 moveto
499416.2989 339.2263 416.2989 321.9156 416.2989 307.2516 curveto
500stroke
5010 0 0 edgecolor
502newpath 419.799 307.1553 moveto
503416.2989 297.1553 lineto
504412.799 307.1553 lineto
505closepath fill
5061 setlinewidth
507solid
5080 0 0 edgecolor
509newpath 419.799 307.1553 moveto
510416.2989 297.1553 lineto
511412.799 307.1553 lineto
512closepath stroke
5130 0 0 edgecolor
51414 /Times-Roman set_font
515416.2989 318.8 moveto 43 (invokes) alignedtext
516grestore
517% proxy
518gsave
5191 setlinewidth
5200 0 0 nodecolor
521newpath 677.8617 284.5623 moveto
522587.2989 297 lineto
523496.7361 284.5623 lineto
524496.8206 264.4377 lineto
525677.7771 264.4377 lineto
526closepath stroke
5270 0 0 nodecolor
52814 /Times-Roman set_font
529538.7989 275.3 moveto 97 (gnunet-gns-proxy) alignedtext
530grestore
531% proxy->gns
532gsave
5331 setlinewidth
5340 0 0 edgecolor
535newpath 553.202 264.2416 moveto
536513.9908 247.2697 450.3696 219.7321 414.0521 204.0126 curveto
537stroke
5380 0 0 edgecolor
539newpath 415.1432 200.6711 moveto
540404.5757 199.9109 lineto
541412.3626 207.0952 lineto
542closepath fill
5431 setlinewidth
544solid
5450 0 0 edgecolor
546newpath 415.1432 200.6711 moveto
547404.5757 199.9109 lineto
548412.3626 207.0952 lineto
549closepath stroke
5500 0 0 edgecolor
55114 /Times-Roman set_font
552499.2989 231.8 moveto 38 (lookup) alignedtext
553grestore
554% zonemaster->dht
555gsave
5561 setlinewidth
5570 0 0 edgecolor
558newpath 177.2041 91.2146 moveto
559195.8835 76.8331 225.3438 54.1513 246.5248 37.8438 curveto
560stroke
5610 0 0 edgecolor
562newpath 248.689 40.5947 moveto
563254.4775 31.7209 lineto
564244.4186 35.0482 lineto
565closepath fill
5661 setlinewidth
567solid
5680 0 0 edgecolor
569newpath 248.689 40.5947 moveto
570254.4775 31.7209 lineto
571244.4186 35.0482 lineto
572closepath stroke
5730 0 0 edgecolor
57414 /Times-Roman set_font
575223.2989 57.8 moveto 52 (publishes) alignedtext
576grestore
577endpage
578showpage
579grestore
580%%PageTrailer
581%%EndPage: 1
582%%Trailer
583end
584restore
585%%EOF
diff --git a/doc/documentation/images/gns.jpg b/doc/documentation/images/gns.jpg
deleted file mode 100644
index d71109b95..000000000
--- a/doc/documentation/images/gns.jpg
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-0-10-peerinfo.png b/doc/documentation/images/gnunet-0-10-peerinfo.png
deleted file mode 100644
index c5e711aff..000000000
--- a/doc/documentation/images/gnunet-0-10-peerinfo.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-fs-gtk-0-10-star-tab.png b/doc/documentation/images/gnunet-fs-gtk-0-10-star-tab.png
deleted file mode 100644
index d7993cc46..000000000
--- a/doc/documentation/images/gnunet-fs-gtk-0-10-star-tab.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-download-area.png b/doc/documentation/images/gnunet-gtk-0-10-download-area.png
deleted file mode 100644
index 8500d46c9..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-download-area.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs-menu.png b/doc/documentation/images/gnunet-gtk-0-10-fs-menu.png
deleted file mode 100644
index dc20c45a9..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs-menu.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs-publish-editing.png b/doc/documentation/images/gnunet-gtk-0-10-fs-publish-editing.png
deleted file mode 100644
index 6f9f75ea6..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs-publish-editing.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs-publish-select.png b/doc/documentation/images/gnunet-gtk-0-10-fs-publish-select.png
deleted file mode 100644
index 50672e379..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs-publish-select.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs-publish-with-file.png b/doc/documentation/images/gnunet-gtk-0-10-fs-publish-with-file.png
deleted file mode 100644
index b46542563..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs-publish-with-file.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs-publish-with-file_0.png b/doc/documentation/images/gnunet-gtk-0-10-fs-publish-with-file_0.png
deleted file mode 100644
index b46542563..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs-publish-with-file_0.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs-publish.png b/doc/documentation/images/gnunet-gtk-0-10-fs-publish.png
deleted file mode 100644
index 033b38fa5..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs-publish.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs-published.png b/doc/documentation/images/gnunet-gtk-0-10-fs-published.png
deleted file mode 100644
index fbd3dd6a3..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs-published.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs-search.png b/doc/documentation/images/gnunet-gtk-0-10-fs-search.png
deleted file mode 100644
index bb64ab92e..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs-search.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-fs.png b/doc/documentation/images/gnunet-gtk-0-10-fs.png
deleted file mode 100644
index c7a294878..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-fs.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-gns-a-done.png b/doc/documentation/images/gnunet-gtk-0-10-gns-a-done.png
deleted file mode 100644
index f8231b3a6..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-gns-a-done.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-gns-a.png b/doc/documentation/images/gnunet-gtk-0-10-gns-a.png
deleted file mode 100644
index 39858d72c..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-gns-a.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-gns.png b/doc/documentation/images/gnunet-gtk-0-10-gns.png
deleted file mode 100644
index c71a2bd7b..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-gns.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-identity.png b/doc/documentation/images/gnunet-gtk-0-10-identity.png
deleted file mode 100644
index d0b426098..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-identity.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-search-selected.png b/doc/documentation/images/gnunet-gtk-0-10-search-selected.png
deleted file mode 100644
index da1ad4d31..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-search-selected.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-gtk-0-10-traffic.png b/doc/documentation/images/gnunet-gtk-0-10-traffic.png
deleted file mode 100644
index 76458f717..000000000
--- a/doc/documentation/images/gnunet-gtk-0-10-traffic.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-namestore-gtk-phone.png b/doc/documentation/images/gnunet-namestore-gtk-phone.png
deleted file mode 100644
index 3bb859629..000000000
--- a/doc/documentation/images/gnunet-namestore-gtk-phone.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-namestore-gtk-vpn.png b/doc/documentation/images/gnunet-namestore-gtk-vpn.png
deleted file mode 100644
index c716729ba..000000000
--- a/doc/documentation/images/gnunet-namestore-gtk-vpn.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-setup-exit.png b/doc/documentation/images/gnunet-setup-exit.png
deleted file mode 100644
index 66bd972bc..000000000
--- a/doc/documentation/images/gnunet-setup-exit.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-tutorial-service.png b/doc/documentation/images/gnunet-tutorial-service.png
deleted file mode 100644
index 6daed2f35..000000000
--- a/doc/documentation/images/gnunet-tutorial-service.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/gnunet-tutorial-system.png b/doc/documentation/images/gnunet-tutorial-system.png
deleted file mode 100644
index 8b54e16cf..000000000
--- a/doc/documentation/images/gnunet-tutorial-system.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/iceweasel-preferences.png b/doc/documentation/images/iceweasel-preferences.png
deleted file mode 100644
index e62c2c4d9..000000000
--- a/doc/documentation/images/iceweasel-preferences.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/iceweasel-proxy.png b/doc/documentation/images/iceweasel-proxy.png
deleted file mode 100644
index 9caad4508..000000000
--- a/doc/documentation/images/iceweasel-proxy.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/lego_stack.svg b/doc/documentation/images/lego_stack.svg
deleted file mode 100644
index a0e8017c3..000000000
--- a/doc/documentation/images/lego_stack.svg
+++ /dev/null
@@ -1,737 +0,0 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
6 xmlns:dc="http://purl.org/dc/elements/1.1/"
7 xmlns:cc="http://creativecommons.org/ns#"
8 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9 xmlns:svg="http://www.w3.org/2000/svg"
10 xmlns="http://www.w3.org/2000/svg"
11 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13 width="744.09448819"
14 height="1052.3622047"
15 id="svg2"
16 version="1.1"
17 inkscape:version="0.48.1 r9760"
18 sodipodi:docname="System.svg">
19 <defs
20 id="defs4">
21 <linearGradient
22 id="linearGradient6602">
23 <stop
24 style="stop-color:#df8060;stop-opacity:1;"
25 offset="0"
26 id="stop6604" />
27 <stop
28 style="stop-color:#df8002;stop-opacity:0;"
29 offset="1"
30 id="stop6606" />
31 </linearGradient>
32 <linearGradient
33 id="linearGradient4392"
34 osb:paint="solid">
35 <stop
36 style="stop-color:#faf6a6;stop-opacity:1;"
37 offset="0"
38 id="stop4394" />
39 </linearGradient>
40 <inkscape:perspective
41 sodipodi:type="inkscape:persp3d"
42 inkscape:vp_x="883.99395 : 559.99673 : 1"
43 inkscape:vp_y="13.319386 : 993.87659 : 0"
44 inkscape:vp_z="285.3157 : 504.79962 : 1"
45 inkscape:persp3d-origin="481.39556 : 281.96355 : 1"
46 id="perspective3070" />
47 <inkscape:perspective
48 sodipodi:type="inkscape:persp3d"
49 inkscape:vp_x="76.097926 : 349.87282 : 1"
50 inkscape:vp_y="-13.319386 : 979.366 : 0"
51 inkscape:vp_z="752.55793 : 376.31441 : 1"
52 inkscape:persp3d-origin="373.64045 : 350.98006 : 1"
53 id="perspective3012" />
54 </defs>
55 <sodipodi:namedview
56 id="base"
57 pagecolor="#ffffff"
58 bordercolor="#666666"
59 borderopacity="1.0"
60 inkscape:pageopacity="0.0"
61 inkscape:pageshadow="2"
62 inkscape:zoom="0.98994949"
63 inkscape:cx="322.06882"
64 inkscape:cy="568.82291"
65 inkscape:document-units="px"
66 inkscape:current-layer="layer1"
67 showgrid="false"
68 inkscape:window-width="846"
69 inkscape:window-height="963"
70 inkscape:window-x="59"
71 inkscape:window-y="0"
72 inkscape:window-maximized="0" />
73 <metadata
74 id="metadata7">
75 <rdf:RDF>
76 <cc:Work
77 rdf:about="">
78 <dc:format>image/svg+xml</dc:format>
79 <dc:type
80 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
81 <dc:title />
82 </cc:Work>
83 </rdf:RDF>
84 </metadata>
85 <g
86 inkscape:label="Layer 1"
87 inkscape:groupmode="layer"
88 id="layer1">
89 <text
90 xml:space="preserve"
91 style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
92 x="352.03815"
93 y="-190.12544"
94 id="text6623"
95 sodipodi:linespacing="125%"><tspan
96 sodipodi:role="line"
97 id="tspan6625"
98 x="352.03815"
99 y="-190.12544" /></text>
100 <text
101 xml:space="preserve"
102 style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
103 x="338.40109"
104 y="-300.73715"
105 id="text6627"
106 sodipodi:linespacing="125%"><tspan
107 sodipodi:role="line"
108 id="tspan6629"
109 x="338.40109"
110 y="-300.73715" /></text>
111 <g
112 style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
113 id="text6643" />
114 <text
115 xml:space="preserve"
116 style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
117 x="71.720833"
118 y="95.747719"
119 id="text6648"
120 sodipodi:linespacing="125%"><tspan
121 sodipodi:role="line"
122 id="tspan6650"
123 x="71.720833"
124 y="95.747719" /></text>
125 <text
126 xml:space="preserve"
127 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
128 x="262.63965"
129 y="666.48389"
130 id="text6711"
131 sodipodi:linespacing="125%"><tspan
132 sodipodi:role="line"
133 id="tspan6713"
134 x="262.63965"
135 y="666.48389" /></text>
136 <path
137 inkscape:connector-curvature="0"
138 id="path3506"
139 d="m 198.00647,673.76257 236.93358,0 0,158.2919 -236.93358,0 z"
140 style="fill:#000000;fill-opacity:1;stroke:#faf6a2;stroke-width:1.44768786;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
141 <path
142 sodipodi:nodetypes="ccccc"
143 inkscape:connector-curvature="0"
144 id="path3432"
145 d="m 169.32669,654.90334 464.83332,-2.26992 -33.76593,25.73079 -483.97287,-0.12904 z"
146 style="fill:#deaa87;fill-opacity:1;stroke:#faf6a2;stroke-width:2.18398547;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
147 <rect
148 style="fill:#000000;fill-opacity:1;stroke:#59000c;stroke-width:1.35822594;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0.48230088;stroke-dasharray:none;stroke-dashoffset:0"
149 id="rect3416"
150 width="28.495705"
151 height="172.2845"
152 x="464.19418"
153 y="518.96954" />
154 <rect
155 style="fill:#000000;fill-opacity:1;stroke:#59000c;stroke-width:1.36876941;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0.48230088;stroke-dasharray:none;stroke-dashoffset:0"
156 id="rect3414"
157 width="34.729141"
158 height="170.67587"
159 x="340.86124"
160 y="517.93475" />
161 <path
162 style="fill:#deaa87;fill-opacity:1;stroke:#faf6a2;stroke-width:2.04969239;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
163 d="m 246.8138,499.06358 386.50295,-0.94821 -41.88736,26.04231 -413.96081,0 z"
164 id="rect6568-0"
165 inkscape:connector-curvature="0"
166 sodipodi:nodetypes="ccccc" />
167 <path
168 style="fill:#ffdd55;fill-opacity:1;stroke:#faf6a2;stroke-width:1.49989259;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
169 d="m 276.05867,399.52042 323.05541,0 0,124.61741 -323.05541,0 z"
170 id="rect5973"
171 inkscape:connector-curvature="0" />
172 <path
173 style="fill:#ffcc00;fill-opacity:1;stroke:#faf6a2;stroke-width:1.19094384;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
174 d="m 599.16863,399.06078 34.35465,-18.10059 0,117.34068 -34.35465,25.57066 z"
175 id="rect6542"
176 inkscape:connector-curvature="0"
177 sodipodi:nodetypes="ccccc" />
178 <rect
179 style="fill:#c87137;fill-opacity:1;stroke:#c48069;stroke-width:1.50087094;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
180 id="rect6557"
181 width="322.88623"
182 height="30.529778"
183 x="276.67755"
184 y="368.99368" />
185 <path
186 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:0.50882494;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
187 d="m 598.94047,368.99367 34.58281,-16.82253 0,28.66061 -34.58281,18.06864 z"
188 id="rect6561"
189 inkscape:connector-curvature="0"
190 sodipodi:nodetypes="ccccc" />
191 <path
192 sodipodi:nodetypes="ccccc"
193 inkscape:connector-curvature="0"
194 id="path6564"
195 d="m 598.94047,369.07046 34.30741,-17.12981 0,29.18412 -34.30741,18.39868 z"
196 style="fill:#c87137;fill-opacity:1;stroke:#faf6a2;stroke-width:0.51140249;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
197 inkscape:transform-center-x="-70.147578"
198 inkscape:transform-center-y="15.429055" />
199 <path
200 style="fill:#d38d5f;fill-opacity:1;stroke:#faf6a2;stroke-width:1.47079194;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
201 d="m 330.2508,353.23478 302.87005,-0.62306 -38.33414,16.82253 -318.87597,0 z"
202 id="rect6568"
203 inkscape:connector-curvature="0"
204 sodipodi:nodetypes="ccccc" />
205 <text
206 xml:space="preserve"
207 style="font-size:22.32217598px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
208 x="391.63083"
209 y="461.858"
210 id="text6656"
211 sodipodi:linespacing="125%"
212 transform="scale(1.0052948,0.9947331)"><tspan
213 sodipodi:role="line"
214 id="tspan6658"
215 x="391.63083"
216 y="461.858">Service</tspan></text>
217 <path
218 sodipodi:nodetypes="ccccc"
219 inkscape:connector-curvature="0"
220 id="path6707"
221 d="m 598.75503,244.83802 34.98432,-18.10059 0.26082,125.2709 -35.24514,17.64044 z"
222 style="fill:#37c871;fill-opacity:1;stroke:#faf6a2;stroke-width:1.19094384;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
223 <path
224 sodipodi:nodetypes="ccccc"
225 inkscape:connector-curvature="0"
226 id="path6709"
227 d="m 419.07032,228.1132 214.71185,-1.24611 -34.63196,19.9378 L 381.29,246.18184 z"
228 style="fill:#37c871;fill-opacity:1;stroke:#faf6a2;stroke-width:1.23655474;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
229 <rect
230 style="fill:#5fd38d;fill-opacity:1;stroke:#c48069;stroke-width:1.23640049;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
231 id="rect7224"
232 width="217.86653"
233 height="122.74216"
234 x="381.70358"
235 y="246.25151" />
236 <text
237 xml:space="preserve"
238 style="font-size:22.32217598px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
239 x="409.16376"
240 y="302.05649"
241 id="text6715"
242 sodipodi:linespacing="125%"
243 transform="scale(1.0052948,0.9947331)"><tspan
244 sodipodi:role="line"
245 id="tspan6717"
246 x="409.16376"
247 y="302.05649">User Interface</tspan></text>
248 <g
249 id="g7219"
250 transform="matrix(0.62334353,0,0,0.61679464,281.18563,257.70936)">
251 <rect
252 y="119.99139"
253 x="198.49498"
254 height="60.609154"
255 width="66.670067"
256 id="rect6571"
257 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
258 <text
259 sodipodi:linespacing="125%"
260 id="text6631"
261 y="160.39748"
262 x="206.07112"
263 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
264 xml:space="preserve"><tspan
265 y="160.39748"
266 x="206.07112"
267 id="tspan6633"
268 sodipodi:role="line">API</tspan></text>
269 </g>
270 <g
271 transform="matrix(0.62334353,0,0,0.61679464,344.78251,257.70936)"
272 id="g7226">
273 <rect
274 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
275 id="rect7228"
276 width="66.670067"
277 height="60.609154"
278 x="198.49498"
279 y="119.99139" />
280 <text
281 xml:space="preserve"
282 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
283 x="206.07112"
284 y="160.39748"
285 id="text7230"
286 sodipodi:linespacing="125%"><tspan
287 sodipodi:role="line"
288 id="tspan7232"
289 x="206.07112"
290 y="160.39748">API</tspan></text>
291 </g>
292 <g
293 id="g7234"
294 transform="matrix(0.62334353,0,0,0.61679464,409.3239,257.70936)">
295 <rect
296 y="119.99139"
297 x="198.49498"
298 height="60.609154"
299 width="66.670067"
300 id="rect7236"
301 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
302 <text
303 sodipodi:linespacing="125%"
304 id="text7238"
305 y="160.39748"
306 x="206.07112"
307 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
308 xml:space="preserve"><tspan
309 y="160.39748"
310 x="206.07112"
311 id="tspan7240"
312 sodipodi:role="line">API</tspan></text>
313 </g>
314 <g
315 transform="matrix(0.62334353,0,0,0.61679464,175.75806,412.85048)"
316 id="g7242">
317 <rect
318 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
319 id="rect7244"
320 width="66.670067"
321 height="60.609154"
322 x="198.49498"
323 y="119.99139" />
324 <text
325 xml:space="preserve"
326 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
327 x="206.07112"
328 y="160.39748"
329 id="text7246"
330 sodipodi:linespacing="125%"><tspan
331 sodipodi:role="line"
332 id="tspan7248"
333 x="206.07112"
334 y="160.39748">API</tspan></text>
335 </g>
336 <g
337 id="g7250"
338 transform="matrix(0.62334353,0,0,0.61679464,240.79871,413.29105)">
339 <rect
340 y="119.99139"
341 x="198.49498"
342 height="60.609154"
343 width="66.670067"
344 id="rect7252"
345 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
346 <text
347 sodipodi:linespacing="125%"
348 id="text7254"
349 y="160.39748"
350 x="206.07112"
351 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
352 xml:space="preserve"><tspan
353 y="160.39748"
354 x="206.07112"
355 id="tspan7256"
356 sodipodi:role="line">API</tspan></text>
357 </g>
358 <g
359 transform="matrix(0.62334353,0,0,0.61679464,303.79756,412.40991)"
360 id="g7258">
361 <rect
362 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
363 id="rect7260"
364 width="66.670067"
365 height="60.609154"
366 x="198.49498"
367 y="119.99139" />
368 <text
369 xml:space="preserve"
370 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
371 x="206.07112"
372 y="160.39748"
373 id="text7262"
374 sodipodi:linespacing="125%"><tspan
375 sodipodi:role="line"
376 id="tspan7264"
377 x="206.07112"
378 y="160.39748">API</tspan></text>
379 </g>
380 <g
381 id="g7266"
382 transform="matrix(0.62334353,0,0,0.61679464,369.88148,412.40991)">
383 <rect
384 y="119.99139"
385 x="198.49498"
386 height="60.609154"
387 width="66.670067"
388 id="rect7268"
389 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
390 <text
391 sodipodi:linespacing="125%"
392 id="text7270"
393 y="160.39748"
394 x="206.07112"
395 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
396 xml:space="preserve"><tspan
397 y="160.39748"
398 x="206.07112"
399 id="tspan7272"
400 sodipodi:role="line">API</tspan></text>
401 </g>
402 <path
403 style="fill:#ffeeaa;fill-opacity:1;stroke:#faf6a2;stroke-width:0.91879815;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
404 d="m 478.56081,554.09281 121.22633,0 0,124.61741 -121.22633,0 z"
405 id="rect5973-1"
406 inkscape:connector-curvature="0" />
407 <g
408 transform="matrix(0.62334353,0,0,0.61679464,422.424,566.60858)"
409 id="g3474">
410 <rect
411 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
412 id="rect3476"
413 width="66.670067"
414 height="60.609154"
415 x="198.49498"
416 y="119.99139" />
417 <text
418 xml:space="preserve"
419 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
420 x="206.07112"
421 y="160.39748"
422 id="text3478"
423 sodipodi:linespacing="125%"><tspan
424 sodipodi:role="line"
425 id="tspan3480"
426 x="206.07112"
427 y="160.39748">API</tspan></text>
428 </g>
429 <path
430 style="fill:#ffe680;fill-opacity:1;stroke:#faf6a2;stroke-width:1.18771458;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
431 d="m 599.60339,554.02055 33.72575,-29.55535 0.88568,128.35487 -34.61143,26.01123 z"
432 id="rect6542-8"
433 inkscape:connector-curvature="0"
434 sodipodi:nodetypes="ccccc" />
435 <path
436 sodipodi:nodetypes="ccccc"
437 inkscape:connector-curvature="0"
438 id="path6564-2"
439 d="m 598.92998,524.03024 34.30741,-25.94116 0,26.5407 -34.30741,29.85344 z"
440 style="fill:#d38d5f;fill-opacity:1;stroke:#faf6a2;stroke-width:0.51140249;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
441 inkscape:transform-center-x="-70.147578"
442 inkscape:transform-center-y="15.429055" />
443 <path
444 inkscape:transform-center-y="15.492457"
445 inkscape:transform-center-x="-70.147578"
446 style="fill:#c87137;fill-opacity:1;stroke:#faf6a2;stroke-width:0.51245213;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
447 d="m 598.92998,524.13683 34.30741,-26.04775 0,26.64977 -34.30741,29.97611 z"
448 id="path3402"
449 inkscape:connector-curvature="0"
450 sodipodi:nodetypes="ccccc" />
451 <path
452 sodipodi:nodetypes="ccccc"
453 inkscape:connector-curvature="0"
454 id="path3404"
455 d="m 599.82047,678.2289 34.30741,-25.94116 0,26.5407 -34.30741,34.25912 z"
456 style="fill:#c87137;fill-opacity:1;stroke:#faf6a2;stroke-width:0.51140249;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
457 inkscape:transform-center-x="-70.147578"
458 inkscape:transform-center-y="15.429055" />
459 <path
460 sodipodi:nodetypes="ccccc"
461 inkscape:connector-curvature="0"
462 id="path3406"
463 d="m 600.04863,707.77865 33.90941,-29.55535 0.89049,128.35487 -34.7999,26.01123 z"
464 style="fill:#37c837;fill-opacity:1;stroke:#faf6a2;stroke-width:1.19094384;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
465 <path
466 inkscape:connector-curvature="0"
467 id="path3410"
468 d="m 356.56358,554.09281 120.92249,0 0,124.19268 -120.92249,0 z"
469 style="fill:#ffeeaa;fill-opacity:1;stroke:#faf6a2;stroke-width:0.91608089;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
470 <path
471 style="fill:#ffeeaa;fill-opacity:1;stroke:#faf6a2;stroke-width:1.11023378;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
472 d="m 177.52518,554.09281 177.51841,0 0,124.25702 -177.51841,0 z"
473 id="path3412"
474 inkscape:connector-curvature="0" />
475 <rect
476 style="fill:#c87137;fill-opacity:1;stroke:#c48069;stroke-width:1.11264122;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
477 id="rect6557-7"
478 width="177.44882"
479 height="30.529778"
480 x="177.65657"
481 y="523.95343" />
482 <rect
483 y="678.1521"
484 x="116.73995"
485 height="29.53463"
486 width="177.54182"
487 id="rect3408"
488 style="fill:#c87137;fill-opacity:1;stroke:#c48069;stroke-width:1.09464383;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
489 <rect
490 y="523.95343"
491 x="356.55023"
492 height="30.529778"
493 width="120.86897"
494 id="rect3420"
495 style="fill:#c87137;fill-opacity:1;stroke:#c48069;stroke-width:0.91828173;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
496 <rect
497 style="fill:#c87137;fill-opacity:1;stroke:#c48069;stroke-width:0.91828173;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
498 id="rect3422"
499 width="120.86897"
500 height="30.529778"
501 x="478.54919"
502 y="523.95343" />
503 <text
504 xml:space="preserve"
505 style="font-size:22.32217598px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
506 x="372.34232"
507 y="622.53217"
508 id="text6656-2"
509 sodipodi:linespacing="125%"
510 transform="scale(1.0052948,0.9947331)"><tspan
511 sodipodi:role="line"
512 id="tspan6658-2"
513 x="372.34232"
514 y="622.53217">Service</tspan></text>
515 <text
516 sodipodi:linespacing="125%"
517 id="text3424"
518 y="622.53217"
519 x="220.56013"
520 style="font-size:22.32217598px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
521 xml:space="preserve"
522 transform="scale(1.0052948,0.9947331)"><tspan
523 y="622.53217"
524 x="220.56013"
525 id="tspan3426"
526 sodipodi:role="line">Service</tspan></text>
527 <text
528 xml:space="preserve"
529 style="font-size:22.32217598px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
530 x="493.85532"
531 y="622.54492"
532 id="text3428"
533 sodipodi:linespacing="125%"
534 transform="scale(1.0052948,0.9947331)"><tspan
535 sodipodi:role="line"
536 id="tspan3430"
537 x="493.85532"
538 y="622.54492">Service</tspan></text>
539 <g
540 id="g3434"
541 transform="matrix(0.62334353,0,0,0.61679464,120.10238,566.60858)">
542 <rect
543 y="119.99139"
544 x="198.49498"
545 height="60.609154"
546 width="66.670067"
547 id="rect3436"
548 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
549 <text
550 sodipodi:linespacing="125%"
551 id="text3438"
552 y="160.39748"
553 x="206.07112"
554 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
555 xml:space="preserve"><tspan
556 y="160.39748"
557 x="206.07112"
558 id="tspan3440"
559 sodipodi:role="line">API</tspan></text>
560 </g>
561 <g
562 transform="matrix(0.62334353,0,0,0.61679464,181.54625,566.60858)"
563 id="g3442">
564 <rect
565 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
566 id="rect3444"
567 width="66.670067"
568 height="60.609154"
569 x="198.49498"
570 y="119.99139" />
571 <text
572 xml:space="preserve"
573 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
574 x="206.07112"
575 y="160.39748"
576 id="text3446"
577 sodipodi:linespacing="125%"><tspan
578 sodipodi:role="line"
579 id="tspan3448"
580 x="206.07112"
581 y="160.39748">API</tspan></text>
582 </g>
583 <g
584 id="g3450"
585 transform="matrix(0.62334353,0,0,0.61679464,242.09962,566.60858)">
586 <rect
587 y="119.99139"
588 x="198.49498"
589 height="60.609154"
590 width="66.670067"
591 id="rect3452"
592 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
593 <text
594 sodipodi:linespacing="125%"
595 id="text3454"
596 y="160.39748"
597 x="206.07112"
598 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
599 xml:space="preserve"><tspan
600 y="160.39748"
601 x="206.07112"
602 id="tspan3456"
603 sodipodi:role="line">API</tspan></text>
604 </g>
605 <g
606 transform="matrix(0.62334353,0,0,0.61679464,303.54348,566.60858)"
607 id="g3458">
608 <rect
609 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
610 id="rect3460"
611 width="66.670067"
612 height="60.609154"
613 x="198.49498"
614 y="119.99139" />
615 <text
616 xml:space="preserve"
617 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
618 x="206.07112"
619 y="160.39748"
620 id="text3462"
621 sodipodi:linespacing="125%"><tspan
622 sodipodi:role="line"
623 id="tspan3464"
624 x="206.07112"
625 y="160.39748">API</tspan></text>
626 </g>
627 <g
628 id="g3466"
629 transform="matrix(0.62334353,0,0,0.61679464,362.76112,566.60858)">
630 <rect
631 y="119.99139"
632 x="198.49498"
633 height="60.609154"
634 width="66.670067"
635 id="rect3468"
636 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
637 <text
638 sodipodi:linespacing="125%"
639 id="text3470"
640 y="160.39748"
641 x="206.07112"
642 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
643 xml:space="preserve"><tspan
644 y="160.39748"
645 x="206.07112"
646 id="tspan3472"
647 sodipodi:role="line">API</tspan></text>
648 </g>
649 <path
650 style="fill:#5fd35f;fill-opacity:1;stroke:#faf6a2;stroke-width:1.11993289;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
651 d="m 420.2626,707.53388 180.11119,0 0,124.61741 -180.11119,0 z"
652 id="path3490"
653 inkscape:connector-curvature="0" />
654 <g
655 transform="matrix(0.62334353,0,0,0.61679464,62.665728,566.60858)"
656 id="g3492">
657 <rect
658 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
659 id="rect3494"
660 width="66.670067"
661 height="60.609154"
662 x="198.49498"
663 y="119.99139" />
664 <text
665 xml:space="preserve"
666 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
667 x="206.07112"
668 y="160.39748"
669 id="text3496"
670 sodipodi:linespacing="125%"><tspan
671 sodipodi:role="line"
672 id="tspan3498"
673 x="206.07112"
674 y="160.39748">API</tspan></text>
675 </g>
676 <path
677 inkscape:connector-curvature="0"
678 id="path3500"
679 d="m 116.52597,707.54132 177.63643,0 0,124.61741 -177.63643,0 z"
680 style="fill:#5fd35f;fill-opacity:1;stroke:#faf6a2;stroke-width:1.11221218;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
681 <path
682 style="fill:#5fd35f;fill-opacity:1;stroke:#faf6a2;stroke-width:0.92545629;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
683 d="m 295.65636,707.63061 122.98965,0 0,124.61741 -122.98965,0 z"
684 id="path3502"
685 inkscape:connector-curvature="0" />
686 <text
687 xml:space="preserve"
688 style="font-size:22.32217598px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
689 x="162.54019"
690 y="779.76184"
691 id="text3508"
692 sodipodi:linespacing="125%"
693 transform="scale(1.0052948,0.9947331)"><tspan
694 sodipodi:role="line"
695 id="tspan3510"
696 x="162.54019"
697 y="779.76184">Service</tspan></text>
698 <text
699 sodipodi:linespacing="125%"
700 id="text3512"
701 y="779.7619"
702 x="313.56918"
703 style="font-size:22.32217598px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
704 xml:space="preserve"
705 transform="scale(1.0052948,0.9947331)"><tspan
706 y="779.7619"
707 x="313.56918"
708 id="tspan3514"
709 sodipodi:role="line">Service</tspan></text>
710 <text
711 xml:space="preserve"
712 style="font-size:22.32217598px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
713 x="465.48401"
714 y="779.7619"
715 id="text3516"
716 sodipodi:linespacing="125%"
717 transform="scale(1.0052948,0.9947331)"><tspan
718 sodipodi:role="line"
719 id="tspan3518"
720 x="465.48401"
721 y="779.7619">Service</tspan></text>
722 <rect
723 style="fill:#c87137;fill-opacity:1;stroke:#c48069;stroke-width:0.91063529;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
724 id="rect3520"
725 width="122.86946"
726 height="29.53463"
727 x="295.75125"
728 y="678.1521" />
729 <rect
730 y="678.1521"
731 x="420.27423"
732 height="29.53463"
733 width="179.80205"
734 id="rect3522"
735 style="fill:#c87137;fill-opacity:1;stroke:#c48069;stroke-width:1.10158956;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
736 </g>
737</svg>
diff --git a/doc/documentation/images/service_lego_block.png b/doc/documentation/images/service_lego_block.png
deleted file mode 100644
index 56caf6b9c..000000000
--- a/doc/documentation/images/service_lego_block.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/service_lego_block.svg b/doc/documentation/images/service_lego_block.svg
deleted file mode 100644
index ef0d0234f..000000000
--- a/doc/documentation/images/service_lego_block.svg
+++ /dev/null
@@ -1,345 +0,0 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:osb="http://www.openswatchbook.org/uri/2009/osb"
6 xmlns:dc="http://purl.org/dc/elements/1.1/"
7 xmlns:cc="http://creativecommons.org/ns#"
8 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
9 xmlns:svg="http://www.w3.org/2000/svg"
10 xmlns="http://www.w3.org/2000/svg"
11 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
12 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
13 width="744.09448819"
14 height="1052.3622047"
15 id="svg2"
16 version="1.1"
17 inkscape:version="0.48.2 r9819"
18 sodipodi:docname="Lego block 3.svg">
19 <defs
20 id="defs4">
21 <linearGradient
22 id="linearGradient6602">
23 <stop
24 style="stop-color:#df8060;stop-opacity:1;"
25 offset="0"
26 id="stop6604" />
27 <stop
28 style="stop-color:#df8002;stop-opacity:0;"
29 offset="1"
30 id="stop6606" />
31 </linearGradient>
32 <linearGradient
33 id="linearGradient4392"
34 osb:paint="solid">
35 <stop
36 style="stop-color:#faf6a6;stop-opacity:1;"
37 offset="0"
38 id="stop4394" />
39 </linearGradient>
40 <inkscape:perspective
41 sodipodi:type="inkscape:persp3d"
42 inkscape:vp_x="883.99395 : 559.99673 : 1"
43 inkscape:vp_y="13.319386 : 993.87659 : 0"
44 inkscape:vp_z="285.3157 : 504.79962 : 1"
45 inkscape:persp3d-origin="481.39556 : 281.96355 : 1"
46 id="perspective3070" />
47 <inkscape:perspective
48 sodipodi:type="inkscape:persp3d"
49 inkscape:vp_x="76.097926 : 349.87282 : 1"
50 inkscape:vp_y="-13.319386 : 979.366 : 0"
51 inkscape:vp_z="752.55793 : 376.31441 : 1"
52 inkscape:persp3d-origin="373.64045 : 350.98006 : 1"
53 id="perspective3012" />
54 </defs>
55 <sodipodi:namedview
56 id="base"
57 pagecolor="#ffffff"
58 bordercolor="#666666"
59 borderopacity="1.0"
60 inkscape:pageopacity="0.0"
61 inkscape:pageshadow="2"
62 inkscape:zoom="0.49497475"
63 inkscape:cx="385.59974"
64 inkscape:cy="826.03166"
65 inkscape:document-units="px"
66 inkscape:current-layer="layer1"
67 showgrid="false"
68 inkscape:window-width="1366"
69 inkscape:window-height="721"
70 inkscape:window-x="-2"
71 inkscape:window-y="-3"
72 inkscape:window-maximized="1" />
73 <metadata
74 id="metadata7">
75 <rdf:RDF>
76 <cc:Work
77 rdf:about="">
78 <dc:format>image/svg+xml</dc:format>
79 <dc:type
80 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
81 <dc:title></dc:title>
82 </cc:Work>
83 </rdf:RDF>
84 </metadata>
85 <g
86 inkscape:label="Layer 1"
87 inkscape:groupmode="layer"
88 id="layer1">
89 <path
90 style="fill:#ffdd55;fill-opacity:1;stroke:#faf6a2;stroke-width:2.26315212;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
91 d="m 74.934278,230.09308 453.654042,0 0,202.04036 -453.654042,0 z"
92 id="rect5973"
93 inkscape:connector-curvature="0" />
94 <path
95 style="fill:#ffcc00;fill-opacity:1;stroke:#faf6a2;stroke-width:1.92068994;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
96 d="m 528.67583,229.34787 55.11351,-29.34622 0,190.24271 -55.11351,41.45733 z"
97 id="rect6542"
98 inkscape:connector-curvature="0"
99 sodipodi:nodetypes="ccccc" />
100 <rect
101 style="fill:#d38d5f;fill-opacity:1;stroke:#c48069;stroke-width:2.2674458;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
102 id="rect6557"
103 width="454.54535"
104 height="49.497475"
105 x="74.764442"
106 y="180.60052" />
107 <path
108 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:0.8206054;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
109 d="m 528.30981,180.60052 55.47954,-27.27412 0,46.46702 -55.47954,29.29442 z"
110 id="rect6561"
111 inkscape:connector-curvature="0"
112 sodipodi:nodetypes="ccccc" />
113 <path
114 sodipodi:nodetypes="ccccc"
115 inkscape:connector-curvature="0"
116 id="path6564"
117 d="m 528.30981,180.72501 55.03773,-27.7723 0,47.31578 -55.03773,29.8295 z"
118 style="fill:#d38d5f;fill-opacity:1;stroke:#faf6a2;stroke-width:0.82476228;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
119 inkscape:transform-center-x="-70.147578"
120 inkscape:transform-center-y="15.429055" />
121 <path
122 style="fill:#deaa87;fill-opacity:1;stroke:#faf6a2;stroke-width:2.23265362;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
123 d="m 153.39374,154.33657 430.4643,-1.01015 -54.4837,27.27411 -453.213248,0 z"
124 id="rect6568"
125 inkscape:connector-curvature="0"
126 sodipodi:nodetypes="ccccc" />
127 <text
128 xml:space="preserve"
129 style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
130 x="352.03815"
131 y="-190.12544"
132 id="text6623"
133 sodipodi:linespacing="125%"><tspan
134 sodipodi:role="line"
135 id="tspan6625"
136 x="352.03815"
137 y="-190.12544" /></text>
138 <text
139 xml:space="preserve"
140 style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
141 x="338.40109"
142 y="-300.73715"
143 id="text6627"
144 sodipodi:linespacing="125%"><tspan
145 sodipodi:role="line"
146 id="tspan6629"
147 x="338.40109"
148 y="-300.73715" /></text>
149 <rect
150 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
151 id="rect6571"
152 width="66.670067"
153 height="60.609154"
154 x="198.49498"
155 y="119.99139" />
156 <path
157 style="fill:#ff6600;fill-opacity:1;stroke:#faf6a2;stroke-width:1.98413372;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
158 d="m 265.16503,119.45792 44.95179,-22.465406 0,57.057986 -44.95179,26.55003 z"
159 id="path6600"
160 inkscape:connector-curvature="0"
161 sodipodi:nodetypes="ccccc" />
162 <path
163 style="fill:#ff6600;fill-opacity:1;stroke:#c48069;stroke-width:1.99687159;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
164 d="m 243.06977,97.26295 66.86223,10e-7 -45.08135,22.728439 -66.3557,0 z"
165 id="path6617"
166 inkscape:connector-curvature="0"
167 sodipodi:nodetypes="ccccc" />
168 <text
169 xml:space="preserve"
170 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
171 x="206.07112"
172 y="160.39748"
173 id="text6631"
174 sodipodi:linespacing="125%"><tspan
175 sodipodi:role="line"
176 id="tspan6633"
177 x="206.07112"
178 y="160.39748">API</tspan></text>
179 <rect
180 y="119.99139"
181 x="313.65237"
182 height="60.609154"
183 width="66.670067"
184 id="rect6573"
185 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
186 <path
187 sodipodi:nodetypes="ccccc"
188 inkscape:connector-curvature="0"
189 id="path6598"
190 d="m 379.81735,119.56755 44.95179,-22.425126 0,56.955676 -44.95179,26.50243 z"
191 style="fill:#ff6600;fill-opacity:1;stroke:#faf6a2;stroke-width:1.98235416;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
192 <path
193 sodipodi:nodetypes="ccccc"
194 inkscape:connector-curvature="0"
195 id="path6615"
196 d="m 358.25117,97.26295 66.89824,10e-7 -45.10563,22.728439 -66.39143,0 z"
197 style="fill:#ff6600;fill-opacity:1;stroke:#c48069;stroke-width:1.99740911;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
198 <text
199 sodipodi:linespacing="125%"
200 id="text6635"
201 y="160.39748"
202 x="322.23865"
203 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
204 xml:space="preserve"><tspan
205 y="160.39748"
206 x="322.23865"
207 id="tspan6637"
208 sodipodi:role="line">API</tspan></text>
209 <rect
210 style="fill:#ff9955;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
211 id="rect6575"
212 width="66.670067"
213 height="60.609154"
214 x="428.80978"
215 y="119.99139" />
216 <path
217 style="fill:#ff6600;fill-opacity:1;stroke:#faf6a2;stroke-width:1.98960423;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
218 d="m 494.97474,119.62537 44.95179,-22.589454 0,57.373054 -44.95179,26.69664 z"
219 id="rect6595"
220 inkscape:connector-curvature="0"
221 sodipodi:nodetypes="ccccc" />
222 <path
223 style="fill:#ff6600;fill-opacity:1;stroke:#c48069;stroke-width:1.99399996;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
224 d="m 473.25645,97.26295 66.67007,10e-7 -44.95179,22.728439 -66.16499,0 z"
225 id="rect6612"
226 inkscape:connector-curvature="0"
227 sodipodi:nodetypes="ccccc" />
228 <text
229 xml:space="preserve"
230 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
231 x="439.41635"
232 y="159.89241"
233 id="text6639"
234 sodipodi:linespacing="125%"><tspan
235 sodipodi:role="line"
236 id="tspan6641"
237 x="439.41635"
238 y="159.89241">API</tspan></text>
239 <g
240 style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
241 id="text6643" />
242 <text
243 xml:space="preserve"
244 style="font-size:24px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
245 x="71.720833"
246 y="95.747719"
247 id="text6648"
248 sodipodi:linespacing="125%"><tspan
249 sodipodi:role="line"
250 id="tspan6650"
251 x="71.720833"
252 y="95.747719" /></text>
253 <text
254 xml:space="preserve"
255 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
256 x="176.77669"
257 y="216.96603"
258 id="text6652"
259 sodipodi:linespacing="125%"><tspan
260 sodipodi:role="line"
261 id="tspan6654"
262 x="176.77669"
263 y="216.96603">Network Protocol</tspan></text>
264 <text
265 xml:space="preserve"
266 style="font-size:36px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
267 x="233.34526"
268 y="312.93051"
269 id="text6656"
270 sodipodi:linespacing="125%"><tspan
271 sodipodi:role="line"
272 id="tspan6658"
273 x="233.34526"
274 y="312.93051">Service</tspan></text>
275 <rect
276 style="fill:#ffffff;fill-opacity:1;stroke:#faf6a2;stroke-width:2.09665918;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
277 id="rect6660"
278 width="66.670067"
279 height="66.609154"
280 x="216.67773"
281 y="371.51938" />
282 <rect
283 y="371.51938"
284 x="322.74374"
285 height="64.373825"
286 width="66.670067"
287 id="rect6662"
288 style="fill:#ffffff;fill-opacity:1;stroke:#faf6a2;stroke-width:2.06117821;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
289 <rect
290 style="fill:#ffffff;fill-opacity:1;stroke:#faf6a2;stroke-width:2;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0"
291 id="rect6664"
292 width="66.670067"
293 height="60.609154"
294 x="423.75903"
295 y="372.52951" />
296 <path
297 sodipodi:nodetypes="ccccc"
298 inkscape:connector-curvature="0"
299 id="path6666"
300 d="m 423.61996,372.56359 67.23534,-0.62641 0,19.59587 -68.24549,41.17879 z"
301 style="fill:#ffcc00;fill-opacity:1;stroke:#faf6a2;stroke-width:0.98368376;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
302 <path
303 style="fill:#ffcc00;fill-opacity:1;stroke:#faf6a2;stroke-width:0.98368376;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
304 d="m 322.60471,371.55344 67.23534,0.38374 0,23.63648 -67.23534,37.13818 z"
305 id="path6668"
306 inkscape:connector-curvature="0"
307 sodipodi:nodetypes="ccccc" />
308 <path
309 sodipodi:nodetypes="ccccc"
310 inkscape:connector-curvature="0"
311 id="path6670"
312 d="m 322.60471,371.55344 67.23534,0.38374 0,23.63648 -67.23534,37.13818 z"
313 style="fill:#ffcc00;fill-opacity:1;stroke:#faf6a2;stroke-width:0.98368376;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
314 <path
315 style="fill:#ffcc00;fill-opacity:1;stroke:#faf6a2;stroke-width:0.98368376;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0"
316 d="m 216.53869,371.55344 67.23534,0.38374 0,23.63648 -67.23534,37.13818 z"
317 id="path6672"
318 inkscape:connector-curvature="0"
319 sodipodi:nodetypes="ccccc" />
320 <text
321 xml:space="preserve"
322 style="font-size:32px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
323 x="262.63965"
324 y="666.48389"
325 id="text6711"
326 sodipodi:linespacing="125%"><tspan
327 sodipodi:role="line"
328 id="tspan6713"
329 x="262.63965"
330 y="666.48389" /></text>
331 <rect
332 y="371.51938"
333 x="111.62187"
334 height="70.798637"
335 width="66.670067"
336 id="rect6721"
337 style="fill:#ffffff;fill-opacity:1;stroke:#faf6a2;stroke-width:2.1615901;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dasharray:none;stroke-dashoffset:0" />
338 <path
339 sodipodi:nodetypes="ccccc"
340 inkscape:connector-curvature="0"
341 id="path6723"
342 d="m 111.48283,370.54329 67.23534,0.38374 0,23.63648 -67.23534,37.13818 z"
343 style="fill:#ffcc00;fill-opacity:1;stroke:#faf6a2;stroke-width:0.98368376;stroke-linejoin:bevel;stroke-miterlimit:4;stroke-opacity:0;stroke-dashoffset:0" />
344 </g>
345</svg>
diff --git a/doc/documentation/images/service_stack.png b/doc/documentation/images/service_stack.png
deleted file mode 100644
index 747d087b2..000000000
--- a/doc/documentation/images/service_stack.png
+++ /dev/null
Binary files differ
diff --git a/doc/documentation/images/structure.dot b/doc/documentation/images/structure.dot
deleted file mode 100644
index a53db90b8..000000000
--- a/doc/documentation/images/structure.dot
+++ /dev/null
@@ -1,124 +0,0 @@
1// house = application
2// circle (default) = service
3// box = daemon
4// diamond = library
5// black line = dependency
6// blue line = extension via plugin
7// red line = possibly useful
8// dashed = in planning
9
10// this is what we have...o
11digraph dependencies {
12splines = true;
13
14 voting [shape=house];
15 voting -> consensus;
16 voting -> identity;
17 voting -> cadet;
18 voting -> secretsharing;
19 secretsharing -> consensus;
20
21 fs [shape=house];
22 fs -> dht;
23 fs -> core;
24 fs -> datastore;
25 fs -> cadet;
26 fs -> ats;
27 fs -> block [style=dotted,color=blue];
28 fs -> identity;
29 exit [shape=box];
30 exit -> cadet;
31 exit -> tun;
32 exit -> dnsstub;
33 vpn -> cadet;
34 vpn -> regex;
35 vpn -> tun;
36 pt [shape=house];
37 pt -> cadet;
38 pt -> vpn;
39 pt -> dns;
40 pt -> dnsparser;
41 dns -> tun;
42 dns -> dnsstub;
43 zonemaster [shape=house];
44 zonemaster -> namestore;
45 zonemaster -> dht;
46 gns -> dns;
47 gns -> dht;
48 gns -> block [style=dotted,color=blue];
49 gns -> revocation;
50 gns -> vpn;
51 gns -> dnsparser;
52 gns -> dnsstub;
53 gns -> identity;
54 revocation -> core;
55 revocation -> set;
56 namestore -> identity;
57 namestore -> gnsrecord;
58 dnsparser -> gnsrecord [style=dotted,color=blue];
59 conversation -> gnsrecord [style=dotted,color=blue];
60 gns -> gnsrecord;
61 dht -> core;
62 dht -> nse;
63 dht -> block;
64 dht -> datacache;
65 dht -> peerinfo;
66 dht -> hello;
67 nse -> core;
68 regex -> block [style=dotted,color=blue];
69 block [shape=diamond];
70 datacache [shape=diamond];
71 cadet -> core [weight=2];
72 cadet -> dht;
73 cadet -> block [style=dotted,color=blue];
74 conversation [shape=house];
75 conversation -> cadet;
76 conversation -> gns;
77 conversation -> speaker;
78 conversation -> microphone;
79 speaker [shape=diamond];
80 microphone [shape=diamond];
81 regex -> dht;
82 core -> transport;
83 topology [shape=box];
84 topology -> peerinfo;
85 topology -> transport;
86 topology -> core;
87 topology -> hello;
88 hostlist [shape=box];
89 hostlist -> core;
90 hostlist -> peerinfo;
91 hostlist -> hello;
92 transport -> ats;
93 transport -> hello;
94 transport -> peerinfo;
95 transport -> nat;
96 transport -> fragmentation;
97 consensus -> set;
98 consensus -> cadet;
99 scalarproduct -> set;
100 scalarproduct -> cadet;
101 set -> cadet;
102 peerinfo -> hello;
103 fragmentation [shape=diamond];
104 hello [shape=diamond];
105 nat [shape=diamond];
106 tun [shape=diamond];
107 dnsparser [shape=diamond];
108 dnsstub [shape=diamond];
109
110 secushare [shape=house];
111 multicast;
112 psyc;
113 social -> psyc;
114 social -> gns;
115 psyc -> psycstore;
116 psycstore;
117 social;
118 secushare -> social;
119 psyc -> multicast;
120 multicast -> cadet;
121
122 rps;
123 rps -> core;
124}
diff --git a/doc/documentation/index.html b/doc/documentation/index.html
deleted file mode 100644
index 1bd6da033..000000000
--- a/doc/documentation/index.html
+++ /dev/null
@@ -1,58 +0,0 @@
1<html>
2 <head>
3 <title>GNUnet - GNUnet Manuals and Handbooks</title>
4 <meta charset="utf-8">
5 <meta name="keywords" content="gnunet,GNUnet,Manual,Manuals,preview,developer-preview,inofficial,GNU">
6 <meta name="description" content="The GNUnet Manuals">
7 <meta name="viewport" content="width=device-width, initial-scale=1">
8 </head>
9
10 <body>
11 <h2>GNUnet - GNUnet Manuals and Handbooks</h2>
12
13 <blockquote><address>
14 GNUnet e.V.<br/>
15 Fakultät für Informatik -- I8<br/>
16 Technische Universität München<br/>
17 Boltzmannstraße 3<br/>
18 85748 Garching<br/>
19 GERMANY<br/>
20 </address></blockquote>
21
22 <p>The following handbooks and manuals are available:</p>
23
24 <ul>
25 <li><a href="gnunet/index.html">GNUnet Reference Manual</li>
26 <li><a href="gnunet-c-tutorial/index.html">GNUnet C Tutorial</li>
27 </ul>
28
29 <div id="footer">
30 <div class="unprintable">
31
32 <p>Please send general FSF &amp; GNU inquiries to
33 <a href="mailto:gnu@gnu.org">&lt;gnu@gnu.org&gt;</a>.
34 There are also <a href="/contact/">other ways to contact</a>
35 the FSF. Broken links and other corrections or suggestions can be sent
36 to <a href="mailto:gnunet-developers@gnu.org">&lt;gnunet-developers@gnu.org&gt;</a>.</p>
37 </div>
38
39 <p>Copyright &copy; 2001 - 2018 GNUnet e.V.</p>
40
41 <p>
42 <a rel="license" href="http://creativecommons.org/licenses/by-nd/4.0/">
43 <img alt="Creative Commons License"
44 style="border-width:0"
45 src="https://i.creativecommons.org/l/by-nd/4.0/88x31.png" />
46 </a>
47 <br />
48 This page is licensed under a
49 <a rel="license"
50 href="http://creativecommons.org/licenses/by-nd/4.0/">
51 Creative Commons Attribution-NoDerivatives 4.0 International License
52 </a>. Individual Manuals are licensed under the licenses mentioned within
53 the books (GNU Free Documentation License, GNU General Public License).
54 </p>
55 </div>
56
57 </body>
58</html>
diff --git a/doc/documentation/run-gendocs.sh b/doc/documentation/run-gendocs.sh
deleted file mode 100755
index 5e60a2d0f..000000000
--- a/doc/documentation/run-gendocs.sh
+++ /dev/null
@@ -1,18 +0,0 @@
1#!/bin/sh
2
3make version.texi/replacement
4
5./gendocs.sh --email gnunet-developers@gnu.org gnunet-c-tutorial "GNUnet C Tutorial" -o "manual/gnunet-c-tutorial"
6#cd manual
7#mkdir gnunet-c-tutorial
8#mv * gnunet-c-tutorial/
9#cd ..
10./gendocs.sh --email gnunet-developers@gnu.org gnunet "GNUnet Reference Manual" -o "manual/gnunet"
11#cd manual
12#mkdir handbook
13#mkdir ../tmp-gnunet
14#mv gnunet ../tmp-gnunet
15#mv * handbook/
16#mv ../tmp-gnunet gnunet
17cp "index.html" manual/
18printf "Success"
diff --git a/doc/documentation/testbed_test.c b/doc/documentation/testbed_test.c
deleted file mode 100644
index 1696234b0..000000000
--- a/doc/documentation/testbed_test.c
+++ /dev/null
@@ -1,99 +0,0 @@
1#include <unistd.h>
2#include <gnunet/platform.h>
3#include <gnunet/gnunet_util_lib.h>
4#include <gnunet/gnunet_testbed_service.h>
5#include <gnunet/gnunet_dht_service.h>
6
7#define NUM_PEERS 20
8
9static struct GNUNET_TESTBED_Operation *dht_op;
10
11static struct GNUNET_DHT_Handle *dht_handle;
12
13
14struct MyContext
15{
16 int ht_len;
17} ctxt;
18
19
20static int result;
21
22
23static void
24shutdown_task (void *cls)
25{
26 if (NULL != dht_op)
27 {
28 GNUNET_TESTBED_operation_done (dht_op);
29 dht_op = NULL;
30 dht_handle = NULL;
31 }
32 result = GNUNET_OK;
33}
34
35
36static void
37service_connect_comp (void *cls,
38 struct GNUNET_TESTBED_Operation *op,
39 void *ca_result,
40 const char *emsg)
41{
42 GNUNET_assert (op == dht_op);
43 dht_handle = ca_result;
44 // Do work here...
45 GNUNET_SCHEDULER_shutdown ();
46}
47
48
49static void *
50dht_ca (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg)
51{
52 struct MyContext *ctxt = cls;
53
54 dht_handle = GNUNET_DHT_connect (cfg, ctxt->ht_len);
55 return dht_handle;
56}
57
58
59static void
60dht_da (void *cls, void *op_result)
61{
62 struct MyContext *ctxt = cls;
63
64 GNUNET_DHT_disconnect ((struct GNUNET_DHT_Handle *) op_result);
65 dht_handle = NULL;
66}
67
68
69static void
70test_master (void *cls,
71 struct GNUNET_TESTBED_RunHandle *h,
72 unsigned int num_peers,
73 struct GNUNET_TESTBED_Peer **peers,
74 unsigned int links_succeeded,
75 unsigned int links_failed)
76{
77 ctxt.ht_len = 10;
78 dht_op = GNUNET_TESTBED_service_connect
79 (NULL, peers[0], "dht",
80 &service_connect_comp, NULL,
81 &dht_ca, &dht_da, &ctxt);
82 GNUNET_SCHEDULER_add_shutdown (&shutdown_task, NULL);
83}
84
85
86int
87main (int argc, char **argv)
88{
89 int ret;
90
91 result = GNUNET_SYSERR;
92 ret = GNUNET_TESTBED_test_run
93 ("awesome-test", "template.conf",
94 NUM_PEERS, 0LL,
95 NULL, NULL, &test_master, NULL);
96 if ( (GNUNET_OK != ret) || (GNUNET_OK != result) )
97 return 1;
98 return 0;
99}
diff --git a/doc/documentation/tutorial-examples/001.c b/doc/documentation/tutorial-examples/001.c
deleted file mode 100644
index 7f6699dd2..000000000
--- a/doc/documentation/tutorial-examples/001.c
+++ /dev/null
@@ -1,29 +0,0 @@
1#include <gnunet/platform.h>
2#include <gnunet/gnunet_util_lib.h>
3
4static int ret;
5
6static void
7run (void *cls,
8 char *const *args,
9 const char *cfgfile,
10 const struct GNUNET_CONFIGURATION_Handle *cfg)
11{
12 // main code here
13 ret = 0;
14}
15
16int
17main (int argc, char *const *argv)
18{
19 struct GNUNET_GETOPT_CommandLineOption options[] = {
20 GNUNET_GETOPT_OPTION_END
21 };
22 return (GNUNET_OK ==
23 GNUNET_PROGRAM_run (argc,
24 argv,
25 "binary-name",
26 gettext_noop ("binary description text"),
27 options, &run, NULL)) ? ret : 1;
28}
29
diff --git a/doc/documentation/tutorial-examples/002.c b/doc/documentation/tutorial-examples/002.c
deleted file mode 100644
index 02233fd61..000000000
--- a/doc/documentation/tutorial-examples/002.c
+++ /dev/null
@@ -1,17 +0,0 @@
1static char *string_option;
2static int a_flag;
3
4// ...
5 struct GNUNET_GETOPT_CommandLineOption options[] = {
6 GNUNET_GETOPT_option_string ('s', "name", "SOMESTRING",
7 gettext_noop ("text describing the string_option NAME"),
8 &string_option},
9 GNUNET_GETOPT_option_flag ('f', "flag",
10 gettext_noop ("text describing the flag option"),
11 &a_flag),
12 GNUNET_GETOPT_OPTION_END
13 };
14 string_option = NULL;
15 a_flag = GNUNET_SYSERR;
16// ...
17
diff --git a/doc/documentation/tutorial-examples/003.c b/doc/documentation/tutorial-examples/003.c
deleted file mode 100644
index d158d7e75..000000000
--- a/doc/documentation/tutorial-examples/003.c
+++ /dev/null
@@ -1,11 +0,0 @@
1struct GNUNET_MQ_MessageHandlers handlers[] = {
2 // ...
3 GNUNET_MQ_handler_end ()
4};
5struct GNUNET_MQ_Handle *mq;
6
7mq = GNUNET_CLIENT_connect (cfg,
8 "service-name",
9 handlers,
10 &error_cb,
11 NULL);
diff --git a/doc/documentation/tutorial-examples/004.c b/doc/documentation/tutorial-examples/004.c
deleted file mode 100644
index 0ef007907..000000000
--- a/doc/documentation/tutorial-examples/004.c
+++ /dev/null
@@ -1,5 +0,0 @@
1struct GNUNET_MessageHeader
2{
3 uint16_t size GNUNET_PACKED;
4 uint16_t type GNUNET_PACKED;
5};
diff --git a/doc/documentation/tutorial-examples/005.c b/doc/documentation/tutorial-examples/005.c
deleted file mode 100644
index 1b59f85a6..000000000
--- a/doc/documentation/tutorial-examples/005.c
+++ /dev/null
@@ -1,9 +0,0 @@
1struct GNUNET_MQ_Envelope *env;
2struct GNUNET_MessageHeader *msg;
3
4env = GNUNET_MQ_msg_extra (msg, payload_size, GNUNET_MY_MESSAGE_TYPE);
5GNUNET_memcpy (&msg[1],
6 &payload,
7 payload_size);
8// Send message via message queue 'mq'
9GNUNET_mq_send (mq, env);
diff --git a/doc/documentation/tutorial-examples/006.c b/doc/documentation/tutorial-examples/006.c
deleted file mode 100644
index 944d2b18c..000000000
--- a/doc/documentation/tutorial-examples/006.c
+++ /dev/null
@@ -1,31 +0,0 @@
1static void
2handle_fix (void *cls, const struct MyMessage *msg)
3{
4 // process 'msg'
5}
6
7static int
8check_var (void *cls, const struct MyVarMessage *msg)
9{
10 // check 'msg' is well-formed
11 return GNUNET_OK;
12}
13
14static void
15handle_var (void *cls, const struct MyVarMessage *msg)
16{
17 // process 'msg'
18}
19
20struct GNUNET_MQ_MessageHandler handlers[] = {
21 GNUNET_MQ_hd_fixed_size (fix,
22 GNUNET_MESSAGE_TYPE_MY_FIX,
23 struct MyMessage,
24 NULL),
25 GNUNET_MQ_hd_fixed_size (var,
26 GNUNET_MESSAGE_TYPE_MY_VAR,
27 struct MyVarMessage,
28 NULL),
29
30 GNUNET_MQ_handler_end ()
31};
diff --git a/doc/documentation/tutorial-examples/007.c b/doc/documentation/tutorial-examples/007.c
deleted file mode 100644
index 096539e43..000000000
--- a/doc/documentation/tutorial-examples/007.c
+++ /dev/null
@@ -1,10 +0,0 @@
1GNUNET_SERVICE_MAIN
2("service-name",
3 GNUNET_SERVICE_OPTION_NONE,
4 &run,
5 &client_connect_cb,
6 &client_disconnect_cb,
7 NULL,
8 GNUNET_MQ_hd_fixed_size (...),
9 GNUNET_MQ_hd_var_size (...),
10 GNUNET_MQ_handler_end ());
diff --git a/doc/documentation/tutorial-examples/008.c b/doc/documentation/tutorial-examples/008.c
deleted file mode 100644
index 2dffe2cf9..000000000
--- a/doc/documentation/tutorial-examples/008.c
+++ /dev/null
@@ -1,22 +0,0 @@
1static void
2run (void *cls,
3 const struct GNUNET_CONFIGURATION_Handle *c,
4 struct GNUNET_SERVICE_Handle *service)
5{
6}
7
8static void *
9client_connect_cb (void *cls,
10 struct GNUNET_SERVICE_Client *c,
11 struct GNUNET_MQ_Handle *mq)
12{
13 return c;
14}
15
16static void
17client_disconnect_cb (void *cls,
18 struct GNUNET_SERVICE_Client *c,
19 void *internal_cls)
20{
21 GNUNET_assert (c == internal_cls);
22}
diff --git a/doc/documentation/tutorial-examples/009.c b/doc/documentation/tutorial-examples/009.c
deleted file mode 100644
index 26d918fb0..000000000
--- a/doc/documentation/tutorial-examples/009.c
+++ /dev/null
@@ -1,9 +0,0 @@
1#include <gnunet/gnunet_core_service.h>
2
3struct GNUNET_CORE_Handle *
4GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
5 void *cls,
6 GNUNET_CORE_StartupCallback init,
7 GNUNET_CORE_ConnectEventHandler connects,
8 GNUNET_CORE_DisconnectEventHandler disconnects,
9 const struct GNUNET_MQ_MessageHandler *handlers);
diff --git a/doc/documentation/tutorial-examples/010.c b/doc/documentation/tutorial-examples/010.c
deleted file mode 100644
index 33494490d..000000000
--- a/doc/documentation/tutorial-examples/010.c
+++ /dev/null
@@ -1,8 +0,0 @@
1void *
2connects (void *cls,
3 const struct GNUNET_PeerIdentity *peer,
4 struct GNUNET_MQ_Handle *mq)
5{
6 return mq;
7}
8
diff --git a/doc/documentation/tutorial-examples/011.c b/doc/documentation/tutorial-examples/011.c
deleted file mode 100644
index 23bc051de..000000000
--- a/doc/documentation/tutorial-examples/011.c
+++ /dev/null
@@ -1,8 +0,0 @@
1void
2disconnects (void *cls,
3 const struct GNUNET_PeerIdentity * peer)
4{
5 /* Remove peer's identity from known peers */
6 /* Make sure no messages are sent to peer from now on */
7}
8
diff --git a/doc/documentation/tutorial-examples/012.c b/doc/documentation/tutorial-examples/012.c
deleted file mode 100644
index cb21d78ab..000000000
--- a/doc/documentation/tutorial-examples/012.c
+++ /dev/null
@@ -1,4 +0,0 @@
1#include "gnunet_peerstore_service.h"
2
3peerstore_handle = GNUNET_PEERSTORE_connect (cfg);
4
diff --git a/doc/documentation/tutorial-examples/013.1.c b/doc/documentation/tutorial-examples/013.1.c
deleted file mode 100644
index fa5212868..000000000
--- a/doc/documentation/tutorial-examples/013.1.c
+++ /dev/null
@@ -1,3 +0,0 @@
1void
2GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext
3 *sc);
diff --git a/doc/documentation/tutorial-examples/013.c b/doc/documentation/tutorial-examples/013.c
deleted file mode 100644
index 6792417e1..000000000
--- a/doc/documentation/tutorial-examples/013.c
+++ /dev/null
@@ -1,12 +0,0 @@
1struct GNUNET_PEERSTORE_StoreContext *
2GNUNET_PEERSTORE_store (struct GNUNET_PEERSTORE_Handle *h,
3 const char *sub_system,
4 const struct GNUNET_PeerIdentity *peer,
5 const char *key,
6 const void *value,
7 size_t size,
8 struct GNUNET_TIME_Absolute expiry,
9 enum GNUNET_PEERSTORE_StoreOption options,
10 GNUNET_PEERSTORE_Continuation cont,
11 void *cont_cls);
12
diff --git a/doc/documentation/tutorial-examples/014.c b/doc/documentation/tutorial-examples/014.c
deleted file mode 100644
index ce204f795..000000000
--- a/doc/documentation/tutorial-examples/014.c
+++ /dev/null
@@ -1,9 +0,0 @@
1struct GNUNET_PEERSTORE_IterateContext *
2GNUNET_PEERSTORE_iterate (struct GNUNET_PEERSTORE_Handle *h,
3 const char *sub_system,
4 const struct GNUNET_PeerIdentity *peer,
5 const char *key,
6 struct GNUNET_TIME_Relative timeout,
7 GNUNET_PEERSTORE_Processor callback,
8 void *callback_cls);
9
diff --git a/doc/documentation/tutorial-examples/015.c b/doc/documentation/tutorial-examples/015.c
deleted file mode 100644
index 0dd267e8e..000000000
--- a/doc/documentation/tutorial-examples/015.c
+++ /dev/null
@@ -1,8 +0,0 @@
1struct GNUNET_PEERSTORE_WatchContext *
2GNUNET_PEERSTORE_watch (struct GNUNET_PEERSTORE_Handle *h,
3 const char *sub_system,
4 const struct GNUNET_PeerIdentity *peer,
5 const char *key,
6 GNUNET_PEERSTORE_Processor callback,
7 void *callback_cls);
8
diff --git a/doc/documentation/tutorial-examples/016.c b/doc/documentation/tutorial-examples/016.c
deleted file mode 100644
index d169da16d..000000000
--- a/doc/documentation/tutorial-examples/016.c
+++ /dev/null
@@ -1,4 +0,0 @@
1void
2GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext
3 *wc);
4
diff --git a/doc/documentation/tutorial-examples/017.c b/doc/documentation/tutorial-examples/017.c
deleted file mode 100644
index c86fbcd1f..000000000
--- a/doc/documentation/tutorial-examples/017.c
+++ /dev/null
@@ -1,4 +0,0 @@
1void
2GNUNET_PEERSTORE_disconnect (struct GNUNET_PEERSTORE_Handle *h,
3 int sync_first);
4
diff --git a/doc/documentation/tutorial-examples/018.c b/doc/documentation/tutorial-examples/018.c
deleted file mode 100644
index 3fc22584c..000000000
--- a/doc/documentation/tutorial-examples/018.c
+++ /dev/null
@@ -1,2 +0,0 @@
1dht_handle = GNUNET_DHT_connect (cfg, parallel_requests);
2
diff --git a/doc/documentation/tutorial-examples/019.c b/doc/documentation/tutorial-examples/019.c
deleted file mode 100644
index aaf001516..000000000
--- a/doc/documentation/tutorial-examples/019.c
+++ /dev/null
@@ -1,18 +0,0 @@
1message_sent_cont (void *cls,
2 const struct GNUNET_SCHEDULER_TaskContext *tc)
3{
4 // Request has left local node
5}
6
7struct GNUNET_DHT_PutHandle *
8GNUNET_DHT_put (struct GNUNET_DHT_Handle *handle,
9 const struct GNUNET_HashCode *key,
10 uint32_t desired_replication_level,
11 enum GNUNET_DHT_RouteOption options,
12 enum GNUNET_BLOCK_Type type,
13 size_t size,
14 const void *data,
15 struct GNUNET_TIME_Absolute exp,
16 struct GNUNET_TIME_Relative timeout,
17 GNUNET_DHT_PutContinuation cont, void *cont_cls)
18
diff --git a/doc/documentation/tutorial-examples/020.c b/doc/documentation/tutorial-examples/020.c
deleted file mode 100644
index 596db3069..000000000
--- a/doc/documentation/tutorial-examples/020.c
+++ /dev/null
@@ -1,25 +0,0 @@
1static void
2get_result_iterator (void *cls, struct GNUNET_TIME_Absolute expiration,
3 const struct GNUNET_HashCode *key,
4 const struct GNUNET_PeerIdentity *get_path,
5 unsigned int get_path_length,
6 const struct GNUNET_PeerIdentity *put_path,
7 unsigned int put_path_length,
8 enum GNUNET_BLOCK_Type type, size_t size,
9 const void *data)
10{
11 // Optionally:
12 GNUNET_DHT_get_stop (get_handle);
13}
14
15get_handle =
16 GNUNET_DHT_get_start (dht_handle,
17 block_type,
18 &key,
19 replication,
20 GNUNET_DHT_RO_NONE,
21 NULL,
22 0,
23 &get_result_iterator,
24 cls)
25
diff --git a/doc/documentation/tutorial-examples/021.c b/doc/documentation/tutorial-examples/021.c
deleted file mode 100644
index 688a31fe0..000000000
--- a/doc/documentation/tutorial-examples/021.c
+++ /dev/null
@@ -1,13 +0,0 @@
1static enum GNUNET_BLOCK_EvaluationResult
2block_plugin_SERVICE_evaluate (void *cls,
3 enum GNUNET_BLOCK_Type type,
4 struct GNUNET_BlockGroup *bg,
5 const GNUNET_HashCode *query,
6 const void *xquery,
7 size_t xquery_size,
8 const void *reply_block,
9 size_t reply_block_size)
10{
11 // Verify type, block and bg
12}
13
diff --git a/doc/documentation/tutorial-examples/022.c b/doc/documentation/tutorial-examples/022.c
deleted file mode 100644
index a373619bd..000000000
--- a/doc/documentation/tutorial-examples/022.c
+++ /dev/null
@@ -1,8 +0,0 @@
1static int
2block_plugin_SERVICE_get_key (void *cls, enum GNUNET_BLOCK_Type type,
3 const void *block, size_t block_size,
4 struct GNUNET_HashCode *key)
5{
6 // Store the key in the key argument, return GNUNET_OK on success.
7}
8
diff --git a/doc/documentation/tutorial-examples/023.c b/doc/documentation/tutorial-examples/023.c
deleted file mode 100644
index 820c38b10..000000000
--- a/doc/documentation/tutorial-examples/023.c
+++ /dev/null
@@ -1,17 +0,0 @@
1void *
2libgnunet_plugin_block_SERVICE_init (void *cls)
3{
4 static enum GNUNET_BLOCK_Type types[] =
5 {
6 GNUNET_BLOCK_TYPE_SERVICE_BLOCKYPE,
7 GNUNET_BLOCK_TYPE_ANY
8 };
9 struct GNUNET_BLOCK_PluginFunctions *api;
10
11 api = GNUNET_new (struct GNUNET_BLOCK_PluginFunctions);
12 api->evaluate = &block_plugin_SERICE_evaluate;
13 api->get_key = &block_plugin_SERVICE_get_key;
14 api->types = types;
15 return api;
16}
17
diff --git a/doc/documentation/tutorial-examples/024.c b/doc/documentation/tutorial-examples/024.c
deleted file mode 100644
index 2e84b5905..000000000
--- a/doc/documentation/tutorial-examples/024.c
+++ /dev/null
@@ -1,9 +0,0 @@
1void *
2libgnunet_plugin_block_SERVICE_done (void *cls)
3{
4 struct GNUNET_TRANSPORT_PluginFunctions *api = cls;
5
6 GNUNET_free (api);
7 return NULL;
8}
9
diff --git a/doc/documentation/tutorial-examples/025.Makefile.am b/doc/documentation/tutorial-examples/025.Makefile.am
deleted file mode 100644
index 66d4f80ec..000000000
--- a/doc/documentation/tutorial-examples/025.Makefile.am
+++ /dev/null
@@ -1,15 +0,0 @@
1 plugindir = $(libdir)/gnunet
2
3 plugin_LTLIBRARIES = \
4 libgnunet_plugin_block_ext.la
5 libgnunet_plugin_block_ext_la_SOURCES = \
6 plugin_block_ext.c
7 libgnunet_plugin_block_ext_la_LIBADD = \
8 $(prefix)/lib/libgnunethello.la \
9 $(prefix)/lib/libgnunetblock.la \
10 $(prefix)/lib/libgnunetutil.la
11 libgnunet_plugin_block_ext_la_LDFLAGS = \
12 $(GN_PLUGIN_LDFLAGS)
13 libgnunet_plugin_block_ext_la_DEPENDENCIES = \
14 $(prefix)/lib/libgnunetblock.la
15
diff --git a/doc/documentation/tutorial-examples/026.c b/doc/documentation/tutorial-examples/026.c
deleted file mode 100644
index 264e0b6b9..000000000
--- a/doc/documentation/tutorial-examples/026.c
+++ /dev/null
@@ -1,52 +0,0 @@
1static void
2get_callback (void *cls,
3 enum GNUNET_DHT_RouteOption options,
4 enum GNUNET_BLOCK_Type type,
5 uint32_t hop_count,
6 uint32_t desired_replication_level,
7 unsigned int path_length,
8 const struct GNUNET_PeerIdentity *path,
9 const struct GNUNET_HashCode * key)
10{
11}
12
13
14static void
15get_resp_callback (void *cls,
16 enum GNUNET_BLOCK_Type type,
17 const struct GNUNET_PeerIdentity *get_path,
18 unsigned int get_path_length,
19 const struct GNUNET_PeerIdentity *put_path,
20 unsigned int put_path_length,
21 struct GNUNET_TIME_Absolute exp,
22 const struct GNUNET_HashCode * key,
23 const void *data,
24 size_t size)
25{
26}
27
28
29static void
30put_callback (void *cls,
31 enum GNUNET_DHT_RouteOption options,
32 enum GNUNET_BLOCK_Type type,
33 uint32_t hop_count,
34 uint32_t desired_replication_level,
35 unsigned int path_length,
36 const struct GNUNET_PeerIdentity *path,
37 struct GNUNET_TIME_Absolute exp,
38 const struct GNUNET_HashCode * key,
39 const void *data,
40 size_t size)
41{
42}
43
44
45monitor_handle = GNUNET_DHT_monitor_start (dht_handle,
46 block_type,
47 key,
48 &get_callback,
49 &get_resp_callback,
50 &put_callback,
51 cls);
52