From 7a0a978c78054fbf4d26a96aa091d576267b07cb Mon Sep 17 00:00:00 2001 From: ng0 Date: Fri, 20 Oct 2017 16:57:29 +0000 Subject: [PATCH] fixes in installation.texi + some changes in gnunet-c-tutorial --- doc/Makefile.am | 1 + doc/chapters/installation.texi | 105 +++++++++++++++++++++++---------- doc/gnunet-c-tutorial.texi | 17 ++++-- doc/tutorial-examples/013.1.c | 3 + doc/tutorial-examples/016.c | 3 +- 5 files changed, 92 insertions(+), 37 deletions(-) create mode 100644 doc/tutorial-examples/013.1.c diff --git a/doc/Makefile.am b/doc/Makefile.am index feb0f0715..74b1300b4 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -90,6 +90,7 @@ gnunet_tutorial_examples = \ 011.c \ 012.c \ 013.c \ + 013.1.c \ 014.c \ 015.c \ 016.c \ diff --git a/doc/chapters/installation.texi b/doc/chapters/installation.texi index 1fbe20892..60861402a 100644 --- a/doc/chapters/installation.texi +++ b/doc/chapters/installation.texi @@ -1,13 +1,13 @@ @node GNUnet Installation Handbook @chapter GNUnet Installation Handbook -This handbook describes how to install (build setup, compilation) and setup -(configuration, start) GNUnet 0.10.x. After following these instructions you -should be able to install and then start user-interfaces to interact with the -network. +This handbook describes how to install (build setup, compilation) and +setup (configuration, start) GNUnet 0.10.x. After following these +instructions you should be able to install and then start user-interfaces +to interact with the network. -This manual is far from complete, and we welcome informed contributions, be it -in the form of new chapters or insightful comments. +This manual is far from complete, and we welcome informed contributions, +be it in the form of new chapters or insightful comments. @@ -30,7 +30,8 @@ in the form of new chapters or insightful comments. @section Dependencies @c %**end of header -This document lists the various known dependencies for GNUnet 0.10.x. +This section lists the various known dependencies for +GNUnet @value{EDITION}. Suggestions for missing dependencies or wrong version numbers are welcome. @@ -38,6 +39,7 @@ Suggestions for missing dependencies or wrong version numbers are welcome. @menu * External dependencies:: * Fixing libgnurl build issues:: +* Optional dependencies:: * Internal dependencies:: @end menu @@ -48,38 +50,47 @@ Suggestions for missing dependencies or wrong version numbers are welcome. These packages must be installed before a typical GNUnet installation can be performed: -@table @asis -@item GNU libmicrohttpd 0.9.30 or higher +@itemize @bullet +@item GNU libmicrohttpd 0.9.30 or higher@footnote{We recommend to build it +with a GnuTLS version that was configured with libunbound ("DANE support")} @item GNU libextractor 1.0 or higher @item GNU libtool 2.2 or higher @item GNU libunistring 0.9.1.1 or higher @item GNU libidn 1.0.0 or higher -@item @uref{https://gnupg.org/software/libgcrypt/index.html, GNU libgcrypt} @uref{https://gnupg.org/ftp/gcrypt/libgcrypt/, 1.6.0} or higher -@item @uref{https://gnutls.org/, GnuTLS} @uref{https://www.gnupg.org/ftp/gcrypt/gnutls/v3.2/, 3.2.7} or higher @footnote{compile with libunbound for DANE support; GnuTLS also requires GNU nettle 2.7 (update: GnuTLS 3.2.7 appears NOT to work against GNU nettle > 2.7, due to some API updatings done by nettle. Thus it should be compiled against nettle 2.7 and, in case you get some error on the reference to `rpl_strerror' being undefined, follow the instructions on @uref{http://lists.gnupg.org/pipermail/gnutls-devel/2013-November/006588.html, this} post (and the link inside it)).} -@item @uref{https://gnunet.org/gnurl, gnURL} libgnurl 7.34.0 or higher @footnote{must be compiled after @code{GnuTLS}} +@item @uref{https://gnupg.org/software/libgcrypt/, GNU libgcrypt} +@uref{https://gnupg.org/ftp/gcrypt/libgcrypt/, 1.6.0} or higher +@item @uref{https://gnutls.org/, GnuTLS}@footnote{We recommend to use a +GnuTLS version that was configured with libunbound ("DANE support")} +@uref{https://www.gnupg.org/ftp/gcrypt/gnutls/v3.2/, 3.2.7} or higher +@footnote{We recommend to compile with libunbound for DANE support; +GnuTLS also requires GNU nettle 2.7 (update: GnuTLS 3.2.7 appears NOT +to work against GNU nettle > 2.7, due to some API updatings done by +nettle. Thus it should be compiled against nettle 2.7 +and, in case you get some error on the reference to `rpl_strerror' being +undefined, follow the instructions on +@uref{http://lists.gnupg.org/pipermail/gnutls-devel/2013-November/006588.html, this} +post (and the link inside it)).} +@item @uref{https://gnunet.org/gnurl, gnURL} libgnurl 7.34.0 or +higher@footnote{must be compiled after @code{GnuTLS}} @item libglpk 4.45 or higher @item @uref{http://www.openssl.org/, OpenSSL} (binary) 1.0 or higher @item TeX Live 2012 or higher, optional (for gnunet-bcd) @item Texinfo 5.2 or higher (for documentation) -@item libpulse 2.0 or higher, optional (for gnunet-conversation) -@item libopus 1.0.1 or higher, optional (for gnunet-conversation) -@item libogg 1.3.0 or higher, optional (for gnunet-conversation) -@item certool (binary) optional @footnote{for convenient installation of the GNS proxy (available as part of Debian's libnss3-tools)} -@item python-zbar 0.10 or higher, optional (for gnunet-qr) -@item libsqlite 3.8.0 or higher @footnote{(note that the code will compile and often work with lower version numbers, but you may get subtle bugs with respect to quota management in certain rare cases); alternatively, MySQL or Postgres can also be installed, but those databases will require more complex configurations (not recommended for first-time users)} -@item zlib any version we tested worked -@item Gtk+ 3.0 or higher, optional (for gnunet-gtk) -@item libgladeui must match Gtk+ version, optional (for gnunet-gtk) -@item libqrencode 3.0 or higher, optional (for gnunet-namestore-gtk) -@end table - +@item libsqlite 3.8.0 or higher @footnote{(note that the code will +compile and often work with lower version numbers, but you may get subtle +bugs with respect to quota management in certain rare cases); +alternatively, MySQL or Postgres can also be installed, but those +databases will require more complex configurations (not +recommended for first-time users)} +@item zlib +@end itemize @node Fixing libgnurl build issues @subsection Fixing libgnurl build issues -If you have to compile libgnurl from source since the version included in your -distribution is to old you perhaps get an error message while running the -@file{configure} script: +If you have to compile libgnurl from source since the version included in +your distribution is to old you perhaps get an error message while +running the @file{configure} script: @example $ configure @@ -90,13 +101,32 @@ checking for 16-bit curl_off_t data type... unknown configure: error: cannot find data type for curl_off_t. @end example +@noindent Solution: Before running the configure script, set: -@code{CFLAGS="-I. -I$BUILD_ROOT/include" } +@example +CFLAGS="-I. -I$BUILD_ROOT/include" +@end example + +@node Optional dependencies +@subsection Optional dependencies +These applications must be installed for various experimental or otherwise +optional features such as @code{gnunet-conversation}, @code{gnunet-gtk}. +@itemize @bullet +@item libpulse 2.0 or higher, optional (for gnunet-conversation) +@item libopus 1.0.1 or higher, optional (for gnunet-conversation) +@item libogg 1.3.0 or higher, optional (for gnunet-conversation) +@item certool (binary) optional @footnote{for convenient installation of +the GNS proxy (available as part of Debian's libnss3-tools)} +@item python-zbar 0.10 or higher, optional (for gnunet-qr) +@item Gtk+ 3.0 or higher, optional (for gnunet-gtk) +@item libgladeui must match Gtk+ version, optional (for gnunet-gtk) +@item libqrencode 3.0 or higher, optional (for gnunet-namestore-gtk) +@end itemize @node Internal dependencies @subsection Internal dependencies @@ -1627,13 +1657,22 @@ GNUnet uses the portable POSIX thread library for multi-threading..@ @item -Save @uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86/libpthreadGC2.a, libpthreadGC2.a} (x86) or @uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x64/libpthreadGC2.a, libpthreadGC2.a} (x64) as libpthread.a into the lib directory (c:\mingw\mingw\lib\libpthread.a) +Save @uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86 +/libpthreadGC2.a, libpthreadGC2.a} (x86) or @uref{ftp://sources.redhat.c +om/pub/pthreads-win32/dll-latest/lib/x64/libpthreadGC2.a, libpthreadGC2. +a} (x64) as libpthread.a into the lib directory (c:\mingw\mingw\lib\libpt +hread.a) @item -Save @uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86/pthreadGC2.dll, pthreadGC2.dll} (x86) or @uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x64/pthreadGC2.dll, libpthreadGC2.a} (x64) into the MinGW bin directory (c:\mingw\mingw\bin) +Save @uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/lib/x86 +/pthreadGC2.dll, pthreadGC2.dll} (x86) or @uref{ftp://sources.redhat.c +om/pub/pthreads-win32/dll-latest/lib/x64/pthreadGC2.dll, libpthreadGC2.a} +(x64) into the MinGW bin directory (c:\mingw\mingw\bin) @item -Download all header files from @uref{ftp://sources.redhat.com/pub/pthreads-win32/dll-latest/include/, include/} to the include directory (c:\mingw\mingw\include) +Download all header files from @uref{ftp://sources.redhat.com/pub/pthread +s-win32/dll-latest/include/, include/} to the @file{include} directory +(c:\mingw\mingw\include) @end itemize @@ -1643,7 +1682,9 @@ Download all header files from @uref{ftp://sources.redhat.com/pub/pthreads-win32 @ GNUnet uses the GNU Multiple Precision library for special cryptographic operations.@ @ -Get the GMP binary package from the @uref{http://sourceforge.net/projects/mingwrep/, MinGW repository} and unpack it to the MinGW directory (c:\mingw\mingw) +Get the GMP binary package from the +@uref{http://sourceforge.net/projects/mingwrep/, MinGW repository} and +unpack it to the MinGW directory (c:\mingw\mingw) @item @strong{GNU Gettext}@ diff --git a/doc/gnunet-c-tutorial.texi b/doc/gnunet-c-tutorial.texi index 4949e2cce..87ae71e1e 100644 --- a/doc/gnunet-c-tutorial.texi +++ b/doc/gnunet-c-tutorial.texi @@ -200,6 +200,7 @@ $ wget https://ftp.gnu.org/gnu/gnunet/gnunet-@value{VERSION}.tar.gz.sig $ gpg --verify-files gnunet-@value{VERSION}.tar.gz.sig @end example +@noindent If this command fails because you do not have the required public key, then you need to run this command to import it: @@ -455,6 +456,7 @@ $ mkdir ~/gnunet1/ $ touch peer1.conf @end example +@noindent Now add the following lines to @file{peer1.conf} to use this directory. For simplified usage we want to prevent the peer to connect to the GNUnet network since this could lead to confusing output. This modifications @@ -1004,10 +1006,12 @@ to actually process the message. Fixed size messages are fully checked by the MQ-logic, and thus only need to provide the handler to process the message. Note that the prefixes @code{check\_} and @code{handle\_} are mandatory. + @example @verbatiminclude tutorial-examples/006.c @end example +@noindent Exercise: Expand your helper function to receive a response message (for example, containing just the @code{struct GNUnet MessageHeader} without any payload). Upon receiving the service's response, you @@ -1183,10 +1187,12 @@ disconnection, CORE notifies the service that the peer disconnected. After this notification no more messages will be received from the peer and the service is no longer allowed to send messages to the peer. The disconnect callback looks like the following: + @example @verbatiminclude tutorial-examples/011.c @end example +@noindent Exercise: Fix your service to handle peer disconnects. @node Storing peer-specific data using the PEERSTORE service @@ -1243,22 +1249,23 @@ guarantee that the record is successfully stored, only that it was received by the service. The @code{GNUNET_PEERSTORE_store} function returns a handle to the store -operation. This handle can be used to cancel the store operation only before -the continuation function is called: +operation. This handle can be used to cancel the store operation only +before the continuation function is called: @example -void -GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc); +@verbatiminclude tutorial-examples/013.1.c @end example @node Retrieving records @subsection Retrieving records To retrieve stored records, use the following function: + @example @verbatiminclude tutorial-examples/014.c @end example +@noindent The values of @code{peer} and @code{key} can be @code{NULL}. This allows the iteration over values stored under any of the following key combinations: @@ -1323,10 +1330,12 @@ The DHT allows to store data so other peers in the P2P network can access it and retrieve data stored by any peers in the network. This section will explain how to use the DHT. Of course, the first thing to do is to connect to the DHT service: + @example @verbatiminclude tutorial-examples/018.c @end example +@noindent The second parameter indicates how many requests in parallel to expect. It is not a hard limit, but a good approximation will make the DHT more efficient. diff --git a/doc/tutorial-examples/013.1.c b/doc/tutorial-examples/013.1.c new file mode 100644 index 000000000..fa5212868 --- /dev/null +++ b/doc/tutorial-examples/013.1.c @@ -0,0 +1,3 @@ +void +GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext + *sc); diff --git a/doc/tutorial-examples/016.c b/doc/tutorial-examples/016.c index d8db4b3b8..d169da16d 100644 --- a/doc/tutorial-examples/016.c +++ b/doc/tutorial-examples/016.c @@ -1,3 +1,4 @@ void -GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext *wc); +GNUNET_PEERSTORE_watch_cancel (struct GNUNET_PEERSTORE_WatchContext + *wc); -- 2.25.1