aboutsummaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorng0 <ng0@infotropique.org>2017-09-05 11:12:59 +0000
committerng0 <ng0@infotropique.org>2017-09-05 11:12:59 +0000
commita6d5bda2f35a59397d7ace53cd2aea0eed71af35 (patch)
tree4bc52500da3d1a50eb92bfc0d8f1ea9e52774e5e /doc
parente611bc0456f78032d43c775afb35bfb31461483a (diff)
downloadgnunet-a6d5bda2f35a59397d7ace53cd2aea0eed71af35.tar.gz
gnunet-a6d5bda2f35a59397d7ace53cd2aea0eed71af35.zip
doc: gnunet-c-tutorial: replace \texttt with @code.
Diffstat (limited to 'doc')
-rw-r--r--doc/gnunet-c-tutorial.texi54
1 files changed, 27 insertions, 27 deletions
diff --git a/doc/gnunet-c-tutorial.texi b/doc/gnunet-c-tutorial.texi
index e157eeceb..60188287e 100644
--- a/doc/gnunet-c-tutorial.texi
+++ b/doc/gnunet-c-tutorial.texi
@@ -343,12 +343,12 @@ $ cat $PREFIX/share/gnunet/config.d/*.conf > peer2.conf
343Now you have to edit peer2.conf and change: 343Now you have to edit peer2.conf and change:
344\begin{itemize} 344\begin{itemize}
345 \itemsep0em 345 \itemsep0em
346 \item{\texttt{GNUNET\_TEST\_HOME} under \texttt{PATHS}} 346 \item{@code{GNUNET\_TEST\_HOME} under @code{PATHS}}
347 \item{Every (uncommented) value for ``\texttt{PORT}'' (add 10000) in any 347 \item{Every (uncommented) value for ``@code{PORT}'' (add 10000) in any
348 section (the option may be commented out if \texttt{PORT} is 348 section (the option may be commented out if @code{PORT} is
349 prefixed by "\#", in this case, UNIX domain sockets are used 349 prefixed by "\#", in this case, UNIX domain sockets are used
350 and the PORT option does not need to be touched) } 350 and the PORT option does not need to be touched) }
351 \item{Every value for ``\texttt{UNIXPATH}'' in any section (e.g. by adding a "-p2" suffix)} 351 \item{Every value for ``@code{UNIXPATH}'' in any section (e.g. by adding a "-p2" suffix)}
352\end{itemize} 352\end{itemize}
353to a fresh, unique value. Make sure that the PORT numbers stay 353to a fresh, unique value. Make sure that the PORT numbers stay
354below 65536. From now on, whenever you interact with the second 354below 65536. From now on, whenever you interact with the second
@@ -384,14 +384,14 @@ If you want the two peers to connect, you have multiple options:
384\end{itemize} 384\end{itemize}
385To setup peer 1 as bootstrapping server change the configuration of 385To setup peer 1 as bootstrapping server change the configuration of
386the first one to be a hostlist server by adding the following lines to 386the first one to be a hostlist server by adding the following lines to
387\texttt{peer1.conf} to enable bootstrapping server: 387@code{peer1.conf} to enable bootstrapping server:
388 @example 388 @example
389[hostlist] 389[hostlist]
390OPTIONS = -p 390OPTIONS = -p
391@end example 391@end example
392 392
393Then change {\tt peer2.conf} and replace the ``\texttt{SERVERS}'' line in the ``\texttt{[hostlist]}'' section with 393Then change {\tt peer2.conf} and replace the ``@code{SERVERS}'' line in the ``@code{[hostlist]}'' section with
394``\texttt{http://localhost:8080/}''. Restart both peers using: 394``@code{http://localhost:8080/}''. Restart both peers using:
395@example 395@example
396$ gnunet-arm -c peer1.conf -e # stop first peer 396$ gnunet-arm -c peer1.conf -e # stop first peer
397$ gnunet-arm -c peer1.conf -s # start first peer 397$ gnunet-arm -c peer1.conf -s # start first peer
@@ -407,12 +407,12 @@ by you.
407 407
408@subsubsection How to connect manually 408@subsubsection How to connect manually
409 409
410If you want to use the \texttt{peerinfo} tool to connect your peers, you should: 410If you want to use the @code{peerinfo} tool to connect your peers, you should:
411\begin{itemize} 411\begin{itemize}
412\itemsep0em 412\itemsep0em
413 \item{Set {\tt FORCESTART = NO} in section {\tt hostlist} (to not connect to the global GNUnet)} 413 \item{Set {\tt FORCESTART = NO} in section {\tt hostlist} (to not connect to the global GNUnet)}
414 \item{Start both peers running {\tt gnunet-arm -c peer1.conf -s} and {\tt gnunet-arm -c peer2.conf -s}} 414 \item{Start both peers running {\tt gnunet-arm -c peer1.conf -s} and {\tt gnunet-arm -c peer2.conf -s}}
415 \item{Get \texttt{HELLO} message of the first peer running {\tt gnunet-peerinfo -c peer1.conf -g}} 415 \item{Get @code{HELLO} message of the first peer running {\tt gnunet-peerinfo -c peer1.conf -g}}
416 \item{Give the output to the second peer by running {\tt gnunet-peerinfo -c peer2.conf -p '<output>'}} 416 \item{Give the output to the second peer by running {\tt gnunet-peerinfo -c peer2.conf -p '<output>'}}
417\end{itemize} 417\end{itemize}
418 418
@@ -435,7 +435,7 @@ system.
435The testbed service can be access through its API 435The testbed service can be access through its API
436@file{include/gnunet\_testbed\_service.h}. The API provides many routines for 436@file{include/gnunet\_testbed\_service.h}. The API provides many routines for
437managing a group of peers. It also provides a helper function 437managing a group of peers. It also provides a helper function
438\texttt{GNUNET\_TESTBED\_test\_run()} to quickly setup a minimalistic testing 438@code{GNUNET\_TESTBED\_test\_run()} to quickly setup a minimalistic testing
439environment on a single host. 439environment on a single host.
440 440
441This function takes a configuration file which will be used as a template 441This function takes a configuration file which will be used as a template
@@ -463,7 +463,7 @@ $ gcc $CPPFLAGS $LDFLAGS -o testbed-test testbed_test.c -lgnunettestbed -lgnune
463$ touch template.conf # Generate (empty) configuration 463$ touch template.conf # Generate (empty) configuration
464$ ./testbed-test # run it (press CTRL-C to stop) 464$ ./testbed-test # run it (press CTRL-C to stop)
465@end example 465@end example
466The \texttt{CPPFLAGS} and \texttt{LDFLAGS} are necessary if GNUnet is installed 466The @code{CPPFLAGS} and @code{LDFLAGS} are necessary if GNUnet is installed
467into a different directory other than @file{/usr/local}. 467into a different directory other than @file{/usr/local}.
468 468
469All of testbed API's peer management functions treat management actions as 469All of testbed API's peer management functions treat management actions as
@@ -492,17 +492,17 @@ per-peer configuration. Accessing those configurations directly through file
492system is discouraged as their locations are dynamically created and will be 492system is discouraged as their locations are dynamically created and will be
493different among various runs of testbed. To make access to these configurations 493different among various runs of testbed. To make access to these configurations
494easy, testbed API provides the function 494easy, testbed API provides the function
495\texttt{GNUNET\_TESTBED\_service\_connect()}. This function fetches the 495@code{GNUNET\_TESTBED\_service\_connect()}. This function fetches the
496configuration of a given peer and calls the \textit{Connect Adapter}. 496configuration of a given peer and calls the \textit{Connect Adapter}.
497In the example code, it is the \texttt{dht\_ca}. A connect adapter is expected 497In the example code, it is the @code{dht\_ca}. A connect adapter is expected
498to open the connection to the needed service by using the provided configuration 498to open the connection to the needed service by using the provided configuration
499and return the created service connection handle. Successful connection to the 499and return the created service connection handle. Successful connection to the
500needed service is signaled through \texttt{service\_connect\_comp\_cb}. 500needed service is signaled through @code{service\_connect\_comp\_cb}.
501 501
502A dual to connect adapter is the \textit{Disconnect Adapter}. This callback is 502A dual to connect adapter is the \textit{Disconnect Adapter}. This callback is
503called after the connect adapter has been called when the operation from 503called after the connect adapter has been called when the operation from
504\texttt{GNUNET\_TESTBED\_service\_connect()} is marked as ``done''. It has to 504@code{GNUNET\_TESTBED\_service\_connect()} is marked as ``done''. It has to
505disconnect from the service with the provided service handle (\texttt{op\_result}). 505disconnect from the service with the provided service handle (@code{op\_result}).
506 506
507Exercise: Find out how many peers you can run on your system. 507Exercise: Find out how many peers you can run on your system.
508 508
@@ -557,11 +557,11 @@ In addition the ext systems provides:
557 557
558The first step for writing any extension with a new service is to 558The first step for writing any extension with a new service is to
559ensure that the @file{ext.conf.in} file contains entries for the 559ensure that the @file{ext.conf.in} file contains entries for the
560\texttt{UNIXPATH}, \texttt{PORT} and \texttt{BINARY} for the service in a section named after 560@code{UNIXPATH}, @code{PORT} and @code{BINARY} for the service in a section named after
561the service. 561the service.
562 562
563If you want to adapt the template rename the @file{ext.conf.in} to match your 563If you want to adapt the template rename the @file{ext.conf.in} to match your
564services name, you have to modify the \texttt{AC\_OUTPUT} section in @file{configure.ac} 564services name, you have to modify the @code{AC\_OUTPUT} section in @file{configure.ac}
565in the @file{gnunet-ext} root. 565in the @file{gnunet-ext} root.
566 566
567@section Writing a Client Application 567@section Writing a Client Application
@@ -903,11 +903,11 @@ Exercise: Change the service to ``handle'' the message from your
903 903
904FIXME: This section still needs to be updated to the lastest API! 904FIXME: This section still needs to be updated to the lastest API!
905 905
906One of the most important services in GNUnet is the \texttt{CORE} service 906One of the most important services in GNUnet is the @code{CORE} service
907managing connections between peers and handling encryption between peers. 907managing connections between peers and handling encryption between peers.
908 908
909One of the first things any service that extends the P2P protocol typically does 909One of the first things any service that extends the P2P protocol typically does
910is connect to the \texttt{CORE} service using: 910is connect to the @code{CORE} service using:
911 911
912\lstset{language=C} 912\lstset{language=C}
913\begin{lstlisting} 913\begin{lstlisting}
@@ -925,7 +925,7 @@ GNUNET_CORE_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
925@subsection New P2P connections} 925@subsection New P2P connections}
926 926
927Before any traffic with a different peer can be exchanged, the peer must be 927Before any traffic with a different peer can be exchanged, the peer must be
928known to the service. This is notified by the \texttt{CORE} {\tt connects} callback, 928known to the service. This is notified by the @code{CORE} {\tt connects} callback,
929which communicates the identity of the new peer to the service: 929which communicates the identity of the new peer to the service:
930 930
931\lstset{language=C} 931\lstset{language=C}
@@ -943,13 +943,13 @@ Note that whatever you return from {\tt connects} is given as the
943{\it cls} argument to the message handlers for messages from 943{\it cls} argument to the message handlers for messages from
944the respective peer. 944the respective peer.
945 945
946Exercise: Create a service that connects to the \texttt{CORE}. Then 946Exercise: Create a service that connects to the @code{CORE}. Then
947start (and connect) two peers and print a message once your connect 947start (and connect) two peers and print a message once your connect
948callback is invoked.} 948callback is invoked.}
949 949
950@subsection Receiving P2P Messages 950@subsection Receiving P2P Messages
951 951
952To receive messages from \texttt{CORE}, you pass the desired 952To receive messages from @code{CORE}, you pass the desired
953{\em handlers} to the {\tt GNUNET\_CORE\_connect()} function, 953{\em handlers} to the {\tt GNUNET\_CORE\_connect()} function,
954just as we showed for services. 954just as we showed for services.
955 955
@@ -1449,11 +1449,11 @@ $ valgrind gnunet-service-dht -L DEBUG
1449Assuming other services are well-written, they will automatically re-integrate the 1449Assuming other services are well-written, they will automatically re-integrate the
1450restarted service with the peer. 1450restarted service with the peer.
1451 1451
1452GNUnet provides a powerful logging mechanism providing log levels \texttt{ERROR}, 1452GNUnet provides a powerful logging mechanism providing log levels @code{ERROR},
1453\texttt{WARNING}, \texttt{INFO} and \texttt{DEBUG}. The current log level is 1453@code{WARNING}, @code{INFO} and @code{DEBUG}. The current log level is
1454configured using the \lstinline|$GNUNET_FORCE_LOG| environmental variable. 1454configured using the \lstinline|$GNUNET_FORCE_LOG| environmental variable.
1455The \texttt{DEBUG} level is only available if \lstinline|--enable-logging=verbose| was used when 1455The @code{DEBUG} level is only available if \lstinline|--enable-logging=verbose| was used when
1456running \texttt{configure}. More details about logging can be found under 1456running @code{configure}. More details about logging can be found under
1457@uref{https://gnunet.org/logging}. 1457@uref{https://gnunet.org/logging}.
1458 1458
1459You should also probably enable the creation of core files, by setting 1459You should also probably enable the creation of core files, by setting