diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-18 08:52:06 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2014-03-18 08:52:06 +0000 |
commit | 2cf276284178b7c341531092fea13cb6017015d2 (patch) | |
tree | fb28f112bca92c4d73d5fd2907b2f96c665070d1 /doc | |
parent | 2e66385bf4dc4f88db9e4e733d5870a70d6f1301 (diff) | |
download | gnunet-2cf276284178b7c341531092fea13cb6017015d2.tar.gz gnunet-2cf276284178b7c341531092fea13cb6017015d2.zip |
updated tutorial with Omar's remarks and fixes
Diffstat (limited to 'doc')
-rw-r--r-- | doc/gnunet-c-tutorial.pdf | bin | 389563 -> 391250 bytes | |||
-rw-r--r-- | doc/gnunet-c-tutorial.tex | 75 |
2 files changed, 43 insertions, 32 deletions
diff --git a/doc/gnunet-c-tutorial.pdf b/doc/gnunet-c-tutorial.pdf index 03ceed9b6..a8a98ce0c 100644 --- a/doc/gnunet-c-tutorial.pdf +++ b/doc/gnunet-c-tutorial.pdf | |||
Binary files differ | |||
diff --git a/doc/gnunet-c-tutorial.tex b/doc/gnunet-c-tutorial.tex index 70981b138..51da22db4 100644 --- a/doc/gnunet-c-tutorial.tex +++ b/doc/gnunet-c-tutorial.tex | |||
@@ -35,7 +35,7 @@ Christian Grothoff $\qquad$ Bart Polot $\qquad$ Matthias Wachs | |||
35 | 35 | ||
36 | \today | 36 | \today |
37 | \end{center} | 37 | \end{center} |
38 | This tutorials explains how to install GNUnet on a GNU/Linux system ond gives an introduction how | 38 | This tutorials explains how to install GNUnet on a GNU/Linux system and gives an introduction how |
39 | GNUnet can be used to develop a Peer-to-Peer application. Detailed installation instructions for | 39 | GNUnet can be used to develop a Peer-to-Peer application. Detailed installation instructions for |
40 | various operating systems and a detailed list of all dependencies can found on our website at | 40 | various operating systems and a detailed list of all dependencies can found on our website at |
41 | \url{https://gnunet.org/installation}. | 41 | \url{https://gnunet.org/installation}. |
@@ -74,7 +74,7 @@ $ gpg --verify gnunet-0.9.5a.tar.gz.sig gnunet-0.9.5a.tar.gz | |||
74 | After successfully verifying the integrity you can extract the tarball using | 74 | After successfully verifying the integrity you can extract the tarball using |
75 | \begin{lstlisting} | 75 | \begin{lstlisting} |
76 | $ tar xvzf gnunet-0.9.5a.tar.gz | 76 | $ tar xvzf gnunet-0.9.5a.tar.gz |
77 | $ mv gnunet-0.9.5a gnunet # we will use the directory "gnunet" in the reminder of this document | 77 | $ mv gnunet-0.9.5a gnunet # we will use the directory "gnunet" in the remainder of this document |
78 | $ cd gnunet | 78 | $ cd gnunet |
79 | \end{lstlisting} | 79 | \end{lstlisting} |
80 | 80 | ||
@@ -107,19 +107,27 @@ The remainder of this tutorial assumes that you have SVN HEAD checked out. | |||
107 | 107 | ||
108 | \subsection{Compiling and Installing GNUnet} | 108 | \subsection{Compiling and Installing GNUnet} |
109 | 109 | ||
110 | First, you need to install the latest {\tt | 110 | First, you need to install at least {\tt |
111 | libgnupgerror}\footnote{\url{ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.11.tar.bz2}} | 111 | libgnupgerror} version 1.12\footnote{\url{ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.12.tar.bz2}}and {\tt libgcrypt} version 1.6\footnote{\url{ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.0.tar.bz2}}. |
112 | and {\tt libgcrypt} version from Git. The current GNUnet code uses | ||
113 | ECC functions not available in any released version of libgcrypt. | ||
114 | 112 | ||
115 | \lstset{language=bash} | 113 | \lstset{language=bash} |
116 | \begin{lstlisting} | 114 | \begin{lstlisting} |
117 | $ git clone git://git.gnupg.org/libgcrypt.git | 115 | $ wget ftp://ftp.gnupg.org/gcrypt/libgpg-error/libgpg-error-1.12.tar.bz2 |
118 | $ cd libgcrypt | 116 | $ tar xf libgpg-error-1.12.tar.bz2 |
119 | $ ./autogen.sh | 117 | $ cd libgpg-error-1.12 |
120 | $ ./configure | 118 | $ ./configure |
121 | $ sudo make install | 119 | $ sudo make install |
122 | $ sudo ldconfig | 120 | $ cd .. |
121 | \end{lstlisting} | ||
122 | |||
123 | \lstset{language=bash} | ||
124 | \begin{lstlisting} | ||
125 | $ wget ftp://ftp.gnupg.org/gcrypt/libgcrypt/libgcrypt-1.6.0.tar.bz2 | ||
126 | $ tar xf libgcrypt-1.6.0.tar.bz2 | ||
127 | $ cd libgcrypt-1.6.0 | ||
128 | $ ./configure | ||
129 | $ sudo make install | ||
130 | $ cd .. | ||
123 | \end{lstlisting} | 131 | \end{lstlisting} |
124 | 132 | ||
125 | \label{sub:install} | 133 | \label{sub:install} |
@@ -238,10 +246,10 @@ $ touch peer1.conf | |||
238 | Now add the following lines to peer1.conf to use this directory. For simplified usage we want to prevent | 246 | Now add the following lines to peer1.conf to use this directory. For simplified usage we want to prevent |
239 | the peer to connect to the GNUnet network since this could lead to confusing output. This modifications will replace the default settings: | 247 | the peer to connect to the GNUnet network since this could lead to confusing output. This modifications will replace the default settings: |
240 | \begin{lstlisting} | 248 | \begin{lstlisting} |
241 | $ [PATHS] | 249 | [PATHS] |
242 | $ SERVICEHOME = ~/gnunet1/ # Use this directory to store GNUnet data | 250 | GNUNET_HOME = ~/gnunet1/ # Use this directory to store GNUnet data |
243 | $ [hostlist] | 251 | [hostlist] |
244 | $ SERVERS = # prevent bootstrapping | 252 | SERVERS = # prevent bootstrapping |
245 | \end{lstlisting} | 253 | \end{lstlisting} |
246 | 254 | ||
247 | \subsection{Start a peer} | 255 | \subsection{Start a peer} |
@@ -285,7 +293,7 @@ Now open a separate terminal and change again to the \lstinline|gnunet/src/dht| | |||
285 | \begin{lstlisting} | 293 | \begin{lstlisting} |
286 | $ cd ~/gnunet/src/dht | 294 | $ cd ~/gnunet/src/dht |
287 | $ ./gnunet-dht-put -c ~/peer1.conf -k KEY -d VALUE # put VALUE under KEY in the DHT | 295 | $ ./gnunet-dht-put -c ~/peer1.conf -k KEY -d VALUE # put VALUE under KEY in the DHT |
288 | $ ./gnunet/src/dht/gnunet-dht-get ~/peer1.conf -k KEY # get key KEY from the DHT | 296 | $ ./gnunet/src/dht/gnunet-dht-get -c ~/peer1.conf -k KEY # get key KEY from the DHT |
289 | $ gnunet-statistics -c ~/peer1.conf # print statistics about current GNUnet state | 297 | $ gnunet-statistics -c ~/peer1.conf # print statistics about current GNUnet state |
290 | $ gnunet-statistics -c ~/peer1.conf -s dht # print statistics about DHT service | 298 | $ gnunet-statistics -c ~/peer1.conf -s dht # print statistics about DHT service |
291 | \end{lstlisting} | 299 | \end{lstlisting} |
@@ -694,7 +702,8 @@ memcpy(&msg[1], &payload, payload_size); | |||
694 | 702 | ||
695 | \exercise{Define a message struct that includes a 32-bit | 703 | \exercise{Define a message struct that includes a 32-bit |
696 | unsigned integer in addition to the standard GNUnet MessageHeader. | 704 | unsigned integer in addition to the standard GNUnet MessageHeader. |
697 | Add a C struct and define a fresh protocol number for your message.} | 705 | Add a C struct and define a fresh protocol number for your message. |
706 | (Protocol numbers in gnunet-ext are defined in \lstinline|gnunet-ext/src/include/gnunet_protocols_ext.h|)} | ||
698 | 707 | ||
699 | 708 | ||
700 | \subsubsection{Sending Requests to the Service} | 709 | \subsubsection{Sending Requests to the Service} |
@@ -1098,10 +1107,10 @@ dht_handle = GNUNET_DHT_connect (cfg, parallel_requests); | |||
1098 | \end{lstlisting} | 1107 | \end{lstlisting} |
1099 | The second parameter indicates how many requests in parallel to expect. | 1108 | The second parameter indicates how many requests in parallel to expect. |
1100 | It is not a hard limit, but a good approximation will make the DHT more | 1109 | It is not a hard limit, but a good approximation will make the DHT more |
1101 | efficiently. | 1110 | efficient. |
1102 | 1111 | ||
1103 | \subsection{Storing data in the DHT} | 1112 | \subsection{Storing data in the DHT} |
1104 | Since the DHT is a dynamic environment (peers join a leave frequently) | 1113 | Since the DHT is a dynamic environment (peers join and leave frequently) |
1105 | the data that we put in the DHT does not stay there indefinitely. It is | 1114 | the data that we put in the DHT does not stay there indefinitely. It is |
1106 | important to ``refresh'' the data periodically by simply storing it again, | 1115 | important to ``refresh'' the data periodically by simply storing it again, |
1107 | in order to make sure other peers can access it. | 1116 | in order to make sure other peers can access it. |
@@ -1302,22 +1311,24 @@ libgnunet_plugin_block_SERVICE_done (void *cls) | |||
1302 | \subsubsection{Integration of the plugin with the build system} | 1311 | \subsubsection{Integration of the plugin with the build system} |
1303 | 1312 | ||
1304 | In order to compile the plugin, the {\tt Makefile.am} file for the | 1313 | In order to compile the plugin, the {\tt Makefile.am} file for the |
1305 | service should contain a rule similar to this: | 1314 | service \texttt{SERVICE} should contain a rule similar to this: |
1306 | 1315 | ||
1307 | \lstset{language=make} | 1316 | \lstset{language=make} |
1308 | \begin{lstlisting} | 1317 | \begin{lstlisting} |
1309 | plugin_LTLIBRARIES = \ | 1318 | plugindir = $(libdir)/gnunet |
1310 | libgnunet_plugin_block_SERVICE.la | 1319 | |
1311 | libgnunet_plugin_block_SERVICE_la_SOURCES = \ | 1320 | plugin_LTLIBRARIES = \ |
1312 | plugin_block_SERVICE.c | 1321 | libgnunet_plugin_block_ext.la |
1313 | libgnunet_plugin_block_SERVICE_la_LIBADD = \ | 1322 | libgnunet_plugin_block_ext_la_SOURCES = \ |
1314 | $(top_builddir)/src/hello/libgnunethello.la \ | 1323 | plugin_block_ext.c |
1315 | $(top_builddir)/src/block/libgnunetblock.la \ | 1324 | libgnunet_plugin_block_ext_la_LIBADD = \ |
1316 | $(top_builddir)/src/util/libgnunetutil.la | 1325 | $(prefix)/lib/libgnunethello.la \ |
1317 | libgnunet_plugin_block_SERVICE_la_LDFLAGS = \ | 1326 | $(prefix)/lib/libgnunetblock.la \ |
1318 | $(GN_PLUGIN_LDFLAGS) | 1327 | $(prefix)/lib/libgnunetutil.la |
1319 | libgnunet_plugin_block_SERVICE_la_DEPENDENCIES = \ | 1328 | libgnunet_plugin_block_ext_la_LDFLAGS = \ |
1320 | $(top_builddir)/src/block/libgnunetblock.la | 1329 | $(GN_PLUGIN_LDFLAGS) |
1330 | libgnunet_plugin_block_ext_la_DEPENDENCIES = \ | ||
1331 | $(prefix)/lib/libgnunetblock.la | ||
1321 | \end{lstlisting} | 1332 | \end{lstlisting} |
1322 | % $ | 1333 | % $ |
1323 | 1334 | ||