[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] branch master updated (0e0e6e359 -> 292cc51b3)
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] branch master updated (0e0e6e359 -> 292cc51b3) |
Date: |
Wed, 06 Sep 2017 12:07:03 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a change to branch master
in repository gnunet.
from 0e0e6e359 doc: gnunet-c-tutorial: comment the included images/pdfs for
now.
new c0445ad12 doc: Makefile: Add gnunet-c-tutorial.
new d5224cf48 doc: gnunet-c-tutorial.texi, chapters/installation.texi: fix
compilation warnings.
new 6a2067a3a doc: gnunet-c-tutorial: Add nodes.
new ade2178e2 doc: gnunet-c-tutorial: fix warnings.
new 292cc51b3 doc: gnunet-c-tutorial: add @chapter's.
The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
doc/Makefile.am | 45 ++++++--
doc/chapters/installation.texi | 226 ++++++++++++-----------------------------
doc/gnunet-c-tutorial.texi | 142 +++++++++++++++++---------
3 files changed, 196 insertions(+), 217 deletions(-)
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 8caacb2bd..1e5a12321 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -32,11 +32,37 @@ gnunet_doc_images = \
images/service_stack.png \
images/gnunet-gtk-0-10-fs-search.png
-info_TEXINFOS = \
- gnunet.texi
+gnunet_tutorial_examples = \
+ 001.c \
+ 002.c \
+ 003.c \
+ 004.c \
+ 005.c \
+ 006.c \
+ 007.c \
+ 008.c \
+ 009.c \
+ 010.c \
+ 011.c \
+ 012.c \
+ 013.c \
+ 014.c \
+ 015.c \
+ 016.c \
+ 017.c \
+ 018.c \
+ 019.c \
+ 020.c \
+ 021.c \
+ 022.c \
+ 023.c \
+ 024.c \
+ 025.c \
+ 026.c
-# FIXME: include this file in the documentation:
-# gnunet-c-tutorial.tex
+info_TEXINFOS = \
+ gnunet.texi \
+ gnunet-c-tutorial.texi
gnunet_TEXINFOS = \
chapters/developer.texi \
@@ -48,7 +74,8 @@ gnunet_TEXINFOS = \
EXTRA_DIST = \
$(gnunet_TEXINFOS) \
- $(gnunet_doc_images)
+ $(gnunet_doc_images) \
+ $(gnunet_tutorial_examples)
version.texi:
echo "@set UPDATED $(date +'%d %B %Y')" > $@
@@ -58,17 +85,23 @@ version.texi:
doc-pdf: version.texi
@makeinfo --pdf --quiet gnunet.texi
+doc-pdf-tutorial: version.texi
+ @makeinfo --pdf --quiet gnunet-c-tutorial.texi
doc-html: version.texi
@makeinfo --html gnunet.texi
+doc-html-tutorial: version.texi
+ @makeinfo --html gnunet-c-tutorial.texi
doc-info: version.texi
@makeinfo --no-split gnunet.texi
+doc-info-tutorial: version.texi
+ @makeinfo --no-split gnunet-c-tutorial.texi
# FIXME: rm *.html and *.pdf
doc-clean:
@rm *.aux *.log *.toc *.cp *.cps
-doc-all: doc-pdf doc-html doc-info
+doc-all: doc-pdf doc-html doc-info doc-pdf-tutorial doc-html-tutorial
doc-info-tutorial
.PHONY: version.texi
diff --git a/doc/chapters/installation.texi b/doc/chapters/installation.texi
index a04478878..be458981f 100644
--- a/doc/chapters/installation.texi
+++ b/doc/chapters/installation.texi
@@ -49,21 +49,14 @@ These packages must be installed before a typical GNUnet
installation
can be performed:
@table @asis
address@hidden
-GNU libmicrohttpd 0.9.30 or higher
address@hidden
-GNU libextractor 1.0 or higher
address@hidden
-GNU libtool 2.2 or higher
address@hidden
-GNU libunistring 0.9.1.1 or higher
address@hidden
-GNU libidn 1.0.0 or higher
address@hidden
address@hidden://gnupg.org/software/libgcrypt/index.html, GNU libgcrypt}
address@hidden GNU libmicrohttpd 0.9.30 or higher
address@hidden GNU libextractor 1.0 or higher
address@hidden GNU libtool 2.2 or higher
address@hidden GNU libunistring 0.9.1.1 or higher
address@hidden GNU libidn 1.0.0 or higher
address@hidden @uref{https://gnupg.org/software/libgcrypt/index.html, GNU
libgcrypt}
@uref{https://gnupg.org/ftp/gcrypt/libgcrypt/, 1.6.0} or higher
address@hidden
address@hidden://gnutls.org/, GnuTLS}
address@hidden @uref{https://gnutls.org/, GnuTLS}
@uref{https://www.gnupg.org/ftp/gcrypt/gnutls/v3.2/, 3.2.7} or higher,
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
@@ -72,41 +65,27 @@ 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)).
address@hidden
address@hidden://gnunet.org/gnurl, gnURL} libgnurl 7.34.0 or higher,
address@hidden @uref{https://gnunet.org/gnurl, gnURL} libgnurl 7.34.0 or higher,
must be compiled after @code{GnuTLS}
address@hidden
-libglpk 4.45 or higher
address@hidden
address@hidden://www.openssl.org/, OpenSSL} (binary) 1.0 or higher
address@hidden
-TeX Live 2012 or higher, optional (for gnunet-bcd)
address@hidden
-libpulse 2.0 or higher, optional (for gnunet-conversation)
address@hidden
-libopus 1.0.1 or higher, optional (for gnunet-conversation)
address@hidden
-libogg 1.3.0 or higher, optional (for gnunet-conversation)
address@hidden
-certool (binary)
address@hidden libglpk 4.45 or higher
address@hidden @uref{http://www.openssl.org/, OpenSSL} (binary) 1.0 or higher
address@hidden TeX Live 2012 or higher, optional (for gnunet-bcd)
address@hidden libpulse 2.0 or higher, optional (for gnunet-conversation)
address@hidden libopus 1.0.1 or higher, optional (for gnunet-conversation)
address@hidden libogg 1.3.0 or higher, optional (for gnunet-conversation)
address@hidden certool (binary)
optional for convenient installation of the GNS proxy
(available as part of Debian's libnss3-tools)
address@hidden
-python-zbar 0.10 or higher, optional (for gnunet-qr)
address@hidden
-libsqlite 3.8.0 or higher (note that the code will compile and often work with
lower
address@hidden python-zbar 0.10 or higher, optional (for gnunet-qr)
address@hidden libsqlite 3.8.0 or higher (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)
address@hidden
-zlib any version we tested worked
address@hidden
-Gtk+ 3.0 or higher, optional (for gnunet-gtk)
address@hidden
-libgladeui must match Gtk+ version, optional (for gnunet-gtk)
address@hidden
-libqrencode 3.0 or higher, optional (for gnunet-namestore-gtk)
address@hidden zlib any version we tested worked
address@hidden Gtk+ 3.0 or higher, optional (for gnunet-gtk)
address@hidden libgladeui must match Gtk+ version, optional (for gnunet-gtk)
address@hidden libqrencode 3.0 or higher, optional (for gnunet-namestore-gtk)
@end table
@@ -147,30 +126,18 @@ In terms of internal dependencies, a minimum file-sharing
system consists of
the following GNUnet processes (in order of dependency):
@itemize @bullet
address@hidden
-gnunet-service-arm
address@hidden
-gnunet-service-resolver (required by all)
address@hidden
-gnunet-service-statistics (required by all)
address@hidden
-gnunet-service-peerinfo
address@hidden
-gnunet-service-transport (requires peerinfo)
address@hidden
-gnunet-service-core (requires transport)
address@hidden
-gnunet-daemon-hostlist (requires core)
address@hidden
-gnunet-daemon-topology (requires hostlist, peerinfo)
address@hidden
-gnunet-service-datastore
address@hidden
-gnunet-service-dht (requires core)
address@hidden
-gnunet-service-identity
address@hidden
-gnunet-service-fs (requires identity, mesh, dht, datastore, core)
address@hidden gnunet-service-arm
address@hidden gnunet-service-resolver (required by all)
address@hidden gnunet-service-statistics (required by all)
address@hidden gnunet-service-peerinfo
address@hidden gnunet-service-transport (requires peerinfo)
address@hidden gnunet-service-core (requires transport)
address@hidden gnunet-daemon-hostlist (requires core)
address@hidden gnunet-daemon-topology (requires hostlist, peerinfo)
address@hidden gnunet-service-datastore
address@hidden gnunet-service-dht (requires core)
address@hidden gnunet-service-identity
address@hidden gnunet-service-fs (requires identity, mesh, dht, datastore, core)
@end itemize
@@ -178,92 +145,39 @@ A minimum VPN system consists of the following GNUnet
processes (in order of
dependency):
@itemize @bullet
address@hidden
-gnunet-service-arm
-
address@hidden
-gnunet-service-resolver (required by all)
-
address@hidden
-gnunet-service-statistics (required by all)
-
address@hidden
-gnunet-service-peerinfo
-
address@hidden
-gnunet-service-transport (requires peerinfo)
-
address@hidden
-gnunet-service-core (requires transport)
-
address@hidden
-gnunet-daemon-hostlist (requires core)
-
address@hidden
-gnunet-service-dht (requires core)
-
address@hidden
-gnunet-service-mesh (requires dht, core)
-
address@hidden
-gnunet-service-dns (requires dht)
-
address@hidden
-gnunet-service-regex (requires dht)
-
address@hidden
-gnunet-service-vpn (requires regex, dns, mesh, dht)
address@hidden gnunet-service-arm
address@hidden gnunet-service-resolver (required by all)
address@hidden gnunet-service-statistics (required by all)
address@hidden gnunet-service-peerinfo
address@hidden gnunet-service-transport (requires peerinfo)
address@hidden gnunet-service-core (requires transport)
address@hidden gnunet-daemon-hostlist (requires core)
address@hidden gnunet-service-dht (requires core)
address@hidden gnunet-service-mesh (requires dht, core)
address@hidden gnunet-service-dns (requires dht)
address@hidden gnunet-service-regex (requires dht)
address@hidden gnunet-service-vpn (requires regex, dns, mesh, dht)
@end itemize
A minimum GNS system consists of the following GNUnet processes (in order of
dependency):
@itemize @bullet
-
address@hidden
-gnunet-service-arm
-
address@hidden
-gnunet-service-resolver (required by all)
-
address@hidden
-gnunet-service-statistics (required by all)
-
address@hidden
-gnunet-service-peerinfo
-
address@hidden
-gnunet-service-transport (requires peerinfo)
-
address@hidden
-gnunet-service-core (requires transport)
-
address@hidden
-gnunet-daemon-hostlist (requires core)
-
address@hidden
-gnunet-service-dht (requires core)
-
address@hidden
-gnunet-service-mesh (requires dht, core)
-
address@hidden
-gnunet-service-dns (requires dht)
-
address@hidden
-gnunet-service-regex (requires dht)
-
address@hidden
-gnunet-service-vpn (requires regex, dns, mesh, dht)
-
address@hidden
-gnunet-service-identity
-
address@hidden
-gnunet-service-namestore (requires identity)
-
address@hidden
-gnunet-service-gns (requires vpn, dns, dht, namestore, identity)
address@hidden gnunet-service-arm
address@hidden gnunet-service-resolver (required by all)
address@hidden gnunet-service-statistics (required by all)
address@hidden gnunet-service-peerinfo
address@hidden gnunet-service-transport (requires peerinfo)
address@hidden gnunet-service-core (requires transport)
address@hidden gnunet-daemon-hostlist (requires core)
address@hidden gnunet-service-dht (requires core)
address@hidden gnunet-service-mesh (requires dht, core)
address@hidden gnunet-service-dns (requires dht)
address@hidden gnunet-service-regex (requires dht)
address@hidden gnunet-service-vpn (requires regex, dns, mesh, dht)
address@hidden gnunet-service-identity
address@hidden gnunet-service-namestore (requires identity)
address@hidden gnunet-service-gns (requires vpn, dns, dht, namestore, identity)
@end itemize
@node Pre-installation notes
@@ -284,21 +198,11 @@ GNU/Linux distribution requires you to install the
following
dependencies (ideally in this order):
@itemize @bullet
-
address@hidden
-libgpgerror and libgcrypt
-
address@hidden
-libnettle and libunbound (possibly from distribution), GnuTLS
-
address@hidden
-libgnurl (read the README)
-
address@hidden
-GNU libmicrohttpd
-
address@hidden
-GNU libextractor (make sure to first install the various mandatory and optional
address@hidden libgpgerror and libgcrypt
address@hidden libnettle and libunbound (possibly from distribution), GnuTLS
address@hidden libgnurl (read the README)
address@hidden GNU libmicrohttpd
address@hidden GNU libextractor (make sure to first install the various
mandatory and optional
dependencies including development headers from your distribution)
@end itemize
diff --git a/doc/gnunet-c-tutorial.texi b/doc/gnunet-c-tutorial.texi
index 3b3e90e4f..2e4bd9a45 100644
--- a/doc/gnunet-c-tutorial.texi
+++ b/doc/gnunet-c-tutorial.texi
@@ -58,8 +58,8 @@ important and do not hesitate to contact the GNUnet team if
you have
any questions or problems! Check here how to contact the GNUnet
team: @uref{https://gnunet.org/contact_information}
-
address@hidden Installing GNUnet
address@hidden Installing GNUnet
address@hidden Installing GNUnet
First of all you have to install a current version of GNUnet. You can download
a
tarball of a stable version from GNU FTP mirrors or obtain the latest
development
@@ -70,7 +70,8 @@ latest development version things can be broken,
functionality can be changed or
can fail. You should only use the development version if you know that you
require a
certain feature or a certain issue has been fixed since the last release.
address@hidden Obtaining a stable version
address@hidden Obtaining a stable version
address@hidden Obtaining a stable version
You can download the latest stable version of GNUnet from GNU FTP mirrors:
@uref{https://ftp.gnu.org/gnu/gnunet/gnunet-0.10.x.tar.gz}
@@ -95,7 +96,8 @@ $ cd gnunet
However, please note that stable versions can be very outdated, as a developer
you are strongly encouraged to use the version from
@uref{https://gnunet.org/git/}.
address@hidden Installing Build Tool Chain and Dependencies
address@hidden Installing Build Tool Chain and Dependencies
address@hidden Installing Build Tool Chain and Dependencies
To successfully compile GNUnet you need the tools to build GNUnet and the
required dependencies.
Please have a look at @uref{https://gnunet.org/dependencies} for a list of
required dependencies
@@ -107,7 +109,8 @@ For GNUnet bootstrapping support and the http(s) plugin you
should install libgn
For the filesharing service you should install at least one of the datastore
backends mysql,
sqlite or postgresql.
address@hidden Obtaining the latest version from Git
address@hidden Obtaining the latest version from Git
address@hidden Obtaining the latest version from Git
The latest development version can obtained from our Git repository. To obtain
the code you need Git installed and checkout the repository using:
@@ -122,7 +125,8 @@ $ ./bootstrap
The remainder of this tutorial assumes that you have Git branch ``master''
checked out.
address@hidden Compiling and Installing GNUnet
address@hidden Compiling and Installing GNUnet
address@hidden Compiling and Installing GNUnet
First, you need to install at least libgnupgerror version 1.27
@uref{https://www.gnupg.org/ftp/gcrypt/libgpg-error/libgpg-error-1.27.tar.bz2}
@@ -146,7 +150,8 @@ $ sudo make install
$ cd ..
@end example
address@hidden Installing GNUnet
address@hidden Installation
address@hidden Installation
Assuming all dependencies are installed, the following commands will
compile and install GNUnet in your home directory. You can specify the
directory where GNUnet will be installed by changing the
@@ -171,9 +176,10 @@ $ export PATH=$PATH:$PREFIX/bin
$ echo export PATH=$PREFIX/bin:\\$PATH >> ~/.bashrc
$ mkdir ~/.config/
$ touch ~/.config/gnunet.conf
address@hidden
address@hidden example
address@hidden Common Issues - Check your GNUnet installation
address@hidden Common Issues - Check your GNUnet installation
address@hidden Common Issues - Check your GNUnet installation
You should check your installation to ensure that installing GNUnet
was successful up to this point. You should be able to access GNUnet's
@@ -202,21 +208,25 @@ PASS: test_gnunet_prefix
=============
1 test passed
=============
address@hidden
-
address@hidden example
address@hidden Background: GNUnet Architecture
address@hidden Background: GNUnet Architecture
address@hidden Background: GNUnet Architecture
GNUnet is organized in layers and services. Each service is composed of a
main service implementation and a client library for other programs to use
the service's functionality, described by an API. This approach is shown in
-figure~\ref{fig:service}. Some services provide an additional command line
-tool to enable the user to interact with the service.
address@hidden FIXME: enable this once the commented block below works:
address@hidden figure~\ref{fig:service}.
+Some services provide an additional command line tool to enable the user to
+interact with the service.
Very often it is other GNUnet services that will use these APIs to build the
higher layers of GNUnet on top of the lower ones. Each layer expands or extends
the functionality of the service below (for instance, to build a mesh on top of
-a DHT). See figure ~\ref{fig:interaction} for an illustration of this approach.
+a DHT).
address@hidden FXIME: See comment above.
address@hidden See figure ~\ref{fig:interaction} for an illustration of this
approach.
@c \begin{figure}[!h]
@c \begin{center}
@@ -244,10 +254,11 @@ client do not affect the service process or other
clients. The service and the
clients communicate via a message protocol to be defined and implemented by
the programmer.
address@hidden First Steps with GNUnet
address@hidden First Steps with GNUnet
address@hidden First Steps with GNUnet
-
address@hidden Configure your peer
address@hidden Configure your peer
address@hidden Configure your peer
First of all we need to configure your peer. Each peer is started with a
configuration
containing settings for GNUnet itself and its services. This configuration is
based on the
@@ -277,7 +288,8 @@ GNUNET_HOME = ~/gnunet1/ # Use this directory to store
GNUnet data
SERVERS = # prevent bootstrapping
@end example
address@hidden Start a peer
address@hidden Start a peer
address@hidden Start a peer
Each GNUnet instance (called peer) has an identity (peer ID) based on a
cryptographic public private key pair. The peer ID is the printable hash of the
public key.
@@ -301,8 +313,8 @@ You should see an output containing the peer ID similar to:
I am peer `0PA02UVRKQTS2C .. JL5Q78F6H0B1ACPV1CJI59MEQUMQCC5G'.
@end example
-
address@hidden Monitor a peer
address@hidden Monitor a peer
address@hidden Monitor a peer
In this section, we will monitor the behaviour of our peer's DHT service with
respect to a
specific key. First we will start GNUnet and then start the DHT service and
use the DHT monitor tool
@@ -325,15 +337,16 @@ $ gnunet-statistics -c ~/peer1.conf # print
statistics about current GNUnet sta
$ gnunet-statistics -c ~/peer1.conf -s dht # print statistics about DHT
service
@end example
-
address@hidden Starting Two Peers by Hand}
address@hidden Starting Two Peers by Hand
address@hidden Starting Two Peers by Hand
This section describes how to start two peers on the same machine by hand.
The process is rather painful, but the description is somewhat instructive.
In practice, you might prefer the automated method
(@pxref{Starting Peers Using the Testbed Service}).
address@hidden Setup a second peer
address@hidden Setup a second peer
address@hidden Setup a second peer
We will now start a second peer on your machine.
For the second peer, you will need to manually create a modified
configuration file to avoid conflicts with ports and directories.
@@ -351,7 +364,7 @@ $ cat $PREFIX/share/gnunet/config.d/*.conf > peer2.conf
Now you have to edit @file{peer2.conf} and change:
@itemize
@item @code{GNUNET\_TEST\_HOME} under @code{PATHS}
address@hidden Every (uncommented) value for address@hidden'' (add 10000) in any
address@hidden Every (uncommented) value for address@hidden'' (add 10000) in any
section (the option may be commented out if @code{PORT} is
prefixed by "\#", in this case, UNIX domain sockets are used
and the PORT option does not need to be touched)
@@ -372,7 +385,8 @@ as needed. Also, make sure the output is different from the
gnunet-peerinfo output for the first peer (otherwise you made an
error in the configuration).
address@hidden Start the second peer and connect the peers
address@hidden Start the second peer and connect the peers
address@hidden Start the second peer and connect the peers
Then, you can start a second peer using:
@example
@@ -410,7 +424,8 @@ tricky as you're going to be connected to many more peers
and would
likely observe traffic and behaviors that are not explicitly controlled
by you.
address@hidden How to connect manually
address@hidden How to connect manually
address@hidden How to connect manually
If you want to use the @code{peerinfo} tool to connect your peers, you should:
@itemize
@@ -427,7 +442,8 @@ $ gnunet-core -c peer1.conf
Peer `9TVUCS8P5A7ILLBGO6 [...shortened...] 1KNBJ4NGCHP3JPVULDG'
@end example
address@hidden Starting Peers Using the Testbed Service
address@hidden Starting Peers Using the Testbed Service
address@hidden Starting Peers Using the Testbed Service
@c \label{sec:testbed}
GNUnet's testbed service is used for testing scenarios where a number of peers
@@ -515,10 +531,11 @@ options in the configuration file. See
@uref{https://gnunet.org/supported-topolo
Then use the DHT API to store and retrieve values in the
network.
address@hidden Developing Applications
address@hidden Developing Applications
address@hidden Developing Applications
-
address@hidden gnunet-ext
address@hidden gnunet-ext
address@hidden gnunet-ext
To develop a new peer-to-peer application or to extend GNUnet we provide
a template build system for writing GNUnet extensions in C. It can be
obtained as follows:
@@ -557,7 +574,8 @@ In addition the ext systems provides:
@item a configuration template for the service (gnunet-ext/src/ext/ext.conf.in)
@end itemize
address@hidden Adapting the Template
address@hidden Adapting the Template
address@hidden Adapting the Template
The first step for writing any extension with a new service is to
ensure that the @file{ext.conf.in} file contains entries for the
@@ -568,6 +586,7 @@ If you want to adapt the template rename the
@file{ext.conf.in} to match your
services name, you have to modify the @code{AC\_OUTPUT} section in
@file{configure.ac}
in the @file{gnunet-ext} root.
address@hidden Writing a Client Application
@section Writing a Client Application
When writing any client application (for example, a command-line
@@ -580,10 +599,11 @@ used, which is typically not needed):
@verbatiminclude tutorial-examples/001.c
@end example
address@hidden Handling command-line options}
address@hidden Handling command-line options
address@hidden Handling command-line options
Options can then be added easily by adding global variables and
-expanding the {\tt options} array. For example, the following would
+expanding the @code{options} array. For example, the following would
add a string-option and a binary flag (defaulting to @code{NULL} and
@code{GNUNET\_NO} respectively):
@example
@@ -609,7 +629,8 @@ more persistent P2P functions.
Exercise: Add a few command-line options and print them inside
of @code{run}. What happens if the user gives invalid arguments?
address@hidden Writing a Client Library}
address@hidden Writing a Client Library
address@hidden Writing a Client Library
The first and most important step in writing a client library is to
decide on an API for the library. Typical API calls include
@@ -630,7 +651,8 @@ Unique message types must be defined for each message
struct in the
@file{gnunet\_protocols.h} header (or an extension-specific include
file).
address@hidden Connecting to the Service}
address@hidden Connecting to the Service
address@hidden Connecting to the Service
Before a client library can implement the application-specific protocol
with the service, a connection must be created:
@@ -647,7 +669,8 @@ receive from the service, and which functions handle them.
The @code{error\_cb} is a function that is to be called whenever
there are errors communicating with the service.
address@hidden Sending messages}
address@hidden Sending messages
address@hidden Sending messages
In GNUnet, messages are always sent beginning with a @code{struct
GNUNET\_MessageHeader}
in big endian format. This header defines the size and the type of the
@@ -675,8 +698,8 @@ Exercise: Define a helper function to transmit a 32-bit
unsigned integer (as payload) to a service using some given client
handle.
-
address@hidden Receiving Replies from the Service}
address@hidden Receiving Replies from the Service
address@hidden Receiving Replies from the Service
Clients can receive messages from the service using the handlers
specified in the @code{handlers} array we specified when connecting
@@ -699,8 +722,8 @@ should call a callback provided to your helper function's
API.
Exercise: Figure out where you can pass values to the closures (@code{cls}).
-
address@hidden Writing a user interface}
address@hidden Writing a user interface
address@hidden Writing a user interface
Given a client library, all it takes to access a service now is to
combine calls to the client library with parsing command-line
@@ -711,11 +734,13 @@ client application to send a request to the service. For
example,
send a 32-bit integer value based on a number given at the
command-line to the service.
address@hidden Writing a Service
@section Writing a Service
Before you can test the client you've written so far, you'll need to also
implement the corresponding service.
address@hidden Code Placement
@subsection Code Placement
New services are placed in their own subdirectory under @file{gnunet/src}.
@@ -725,7 +750,8 @@ the description of the client-service protocol
@file{SERVICE.h} and P2P protocol
@file{gnunet-service-SERVICE.h} and several files for tests, including test
code
and configuration files.
address@hidden Starting a Service}
address@hidden Starting a Service
address@hidden Starting a Service
The key API definition for creating a service is the
@code{GNUNET\_SERVICE\_MAIN} macro:
@example
@@ -764,7 +790,7 @@ Exercise: Change the service to ``handle'' the message from
your
client (for now, by printing a message). What happens if you
forget to call @code{GNUNET\_SERVICE\_client\_continue()}?
-
address@hidden Interacting directly with other Peers using the CORE Service
@section Interacting directly with other Peers using the CORE Service
FIXME: This section still needs to be updated to the lastest API!
@@ -778,7 +804,8 @@ is connect to the @code{CORE} service using:
@verbatiminclude tutorial-examples/009.c
@end example
address@hidden New P2P connections}
address@hidden New P2P connections
address@hidden New P2P connections
Before any traffic with a different peer can be exchanged, the peer must be
known to the service. This is notified by the @code{CORE} @code{connects}
callback,
@@ -795,6 +822,7 @@ Exercise: Create a service that connects to the
@code{CORE}. Then
start (and connect) two peers and print a message once your connect
callback is invoked.
address@hidden Receiving P2P Messages
@subsection Receiving P2P Messages
To receive messages from @code{CORE}, you pass the desired
@@ -811,7 +839,7 @@ handler and start a second peer that only has your ``old''
service
without message handlers. Which ``connect'' handlers are invoked when
the two peers are connected? Why?
-
address@hidden Sending P2P Messages
@subsection Sending P2P Messages
You can transmit messages to other peers using the @i{mq} you were
@@ -829,8 +857,8 @@ transmission? Count using the STATISTICS service on both
ends. Are
messages lost? How can you transmit messages faster? What happens if
you stop the peer that is receiving your messages?
-
address@hidden End of P2P connections}
address@hidden End of P2P connections
address@hidden End of P2P connections
If a message handler returns @code{GNUNET\_SYSERR}, the remote peer shuts down
or
there is an unrecoverable network disconnection, CORE notifies the service that
@@ -843,6 +871,7 @@ The disconnect callback looks like the following:
Exercise: Fix your service to handle peer disconnects.
address@hidden Storing peer-specific data using the PEERSTORE service
@section Storing peer-specific data using the PEERSTORE service
GNUnet's PEERSTORE service offers a persistorage for arbitrary peer-specific
data.
@@ -865,7 +894,8 @@ The first step is to start a connection to the PEERSTORE
service:
The service handle @code{peerstore_handle} will be needed for all subsequent
PEERSTORE operations.
address@hidden Storing records}
address@hidden Storing records
address@hidden Storing records
To store a new record, use the following function:
@example
@@ -888,6 +918,7 @@ void
GNUNET_PEERSTORE_store_cancel (struct GNUNET_PEERSTORE_StoreContext *sc);
@end example
address@hidden Retrieving records
@subsection Retrieving records
To retrieve stored records, use the following function:
@@ -911,6 +942,7 @@ The @code{GNUNET_PEERSTORE_iterate} function returns a
handle to the iterate ope
handle can be used to cancel the iterate operation only before the callback
function is called with
a @code{NULL} record.
address@hidden Monitoring records
@subsection Monitoring records
PEERSTORE offers the functionality of monitoring for new records stored under
a specific key
@@ -926,6 +958,7 @@ is broken or the watch operation is canceled:
@verbatiminclude tutorial-examples/016.c
@end example
address@hidden Disconnecting from PEERSTORE
@subsection Disconnecting from PEERSTORE
When the connection to the PEERSTORE service is no longer needed, disconnect
using the following
@@ -938,7 +971,7 @@ If the @code{sync_first} flag is set to @code{GNUNET_YES},
the API will delay th
disconnection until all store requests are received by the PEERSTORE service.
Otherwise,
it will disconnect immediately.
-
address@hidden Using the DHT
@section Using the DHT
The DHT allows to store data so other peers in the P2P network can
@@ -953,6 +986,7 @@ 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.
address@hidden Storing data in the DHT
@subsection Storing data in the DHT
Since the DHT is a dynamic environment (peers join and leave frequently)
the data that we put in the DHT does not stay there indefinitely. It is
@@ -975,7 +1009,7 @@ Exercise: Store a value in the DHT periodically to make
sure it is available
over time. You might consider using the function
@code{GNUNET\_SCHEDULER\_add\_delayed}
and call @code{GNUNET\_DHT\_put} from inside a helper function.
-
address@hidden Obtaining data from the DHT
@subsection Obtaining data from the DHT
As we saw in the previous example, the DHT works in an asynchronous mode.
Each request to the DHT is executed ``in the background'' and the API
@@ -997,6 +1031,7 @@ Exercise: Store a value in the DHT and after a while
retrieve it. Show the IDs o
the peers the requests have gone through. In order to convert a peer ID to a
string, use
the function @code{GNUNET\_i2s}. Pay attention to the route option parameters
in both calls!
address@hidden Implementing a block plugin
@subsection Implementing a block plugin
In order to store data in the DHT, it is necessary to provide a block
@@ -1008,6 +1043,7 @@ in the service's respective directory. The
mandatory functions that need to be implemented for a block plugin are
described in the following sections.
address@hidden Validating requests and replies
@subsubsection Validating requests and replies
The evaluate function should validate a reply or a request. It returns
@@ -1030,6 +1066,7 @@ typically done using the Bloom filter block group
provided by
@file{libgnunetblockgroup.so}. Failure to do so may cause replies to
circle in the network.
address@hidden Deriving a key from a reply
@subsubsection Deriving a key from a reply
The DHT can operate more efficiently if it is possible to derive a key
@@ -1042,6 +1079,7 @@ just fine with such blocks).
@verbatiminclude tutorial-examples/022.c
@end example
address@hidden Initialization of the plugin
@subsubsection Initialization of the plugin
The plugin is realized as a shared C library. The library must export
@@ -1053,6 +1091,7 @@ validation and obtaining keys (the ones just defined
above).
@verbatiminclude tutorial-examples/023.c
@end example
address@hidden Shutdown of the plugin
@subsubsection Shutdown of the plugin
Following GNUnet's general plugin API concept, the plugin must
@@ -1062,6 +1101,7 @@ little.
@verbatiminclude tutorial-examples/024.c
@end example
address@hidden Integration of the plugin with the build system
@subsubsection Integration of the plugin with the build system
In order to compile the plugin, the @file{Makefile.am} file for the
@@ -1076,6 +1116,7 @@ Exercise: Write a block plugin that accepts all queries
and all replies but prints information about queries and replies
when the respective validation hooks are called.
address@hidden Monitoring the DHT
@subsection Monitoring the DHT
It is possible to monitor the functioning of the local DHT service. When
monitoring
the DHT, the service will alert the monitoring program of any events,
@@ -1091,6 +1132,7 @@ is called with all the information about the event.
@verbatiminclude tutorial-examples/026.c
@end example
address@hidden Debugging with gnunet-arm
@section Debugging with gnunet-arm
Even if services are managed by @command{gnunet-arm}, you can start them with
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] branch master updated (0e0e6e359 -> 292cc51b3),
gnunet <=
- [GNUnet-SVN] [gnunet] 01/05: doc: Makefile: Add gnunet-c-tutorial., gnunet, 2017/09/06
- [GNUnet-SVN] [gnunet] 04/05: doc: gnunet-c-tutorial: fix warnings., gnunet, 2017/09/06
- [GNUnet-SVN] [gnunet] 05/05: doc: gnunet-c-tutorial: add @chapter's., gnunet, 2017/09/06
- [GNUnet-SVN] [gnunet] 03/05: doc: gnunet-c-tutorial: Add nodes., gnunet, 2017/09/06
- [GNUnet-SVN] [gnunet] 02/05: doc: gnunet-c-tutorial.texi, chapters/installation.texi: fix compilation warnings., gnunet, 2017/09/06