diff options
author | ng0 <ng0@infotropique.org> | 2017-09-05 11:12:59 +0000 |
---|---|---|
committer | ng0 <ng0@infotropique.org> | 2017-09-05 11:12:59 +0000 |
commit | a6d5bda2f35a59397d7ace53cd2aea0eed71af35 (patch) | |
tree | 4bc52500da3d1a50eb92bfc0d8f1ea9e52774e5e /doc | |
parent | e611bc0456f78032d43c775afb35bfb31461483a (diff) | |
download | gnunet-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.texi | 54 |
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 | |||
343 | Now you have to edit peer2.conf and change: | 343 | Now 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} |
353 | to a fresh, unique value. Make sure that the PORT numbers stay | 353 | to a fresh, unique value. Make sure that the PORT numbers stay |
354 | below 65536. From now on, whenever you interact with the second | 354 | below 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} |
385 | To setup peer 1 as bootstrapping server change the configuration of | 385 | To setup peer 1 as bootstrapping server change the configuration of |
386 | the first one to be a hostlist server by adding the following lines to | 386 | the 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] |
390 | OPTIONS = -p | 390 | OPTIONS = -p |
391 | @end example | 391 | @end example |
392 | 392 | ||
393 | Then change {\tt peer2.conf} and replace the ``\texttt{SERVERS}'' line in the ``\texttt{[hostlist]}'' section with | 393 | Then 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 | ||
410 | If you want to use the \texttt{peerinfo} tool to connect your peers, you should: | 410 | If 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. | |||
435 | The testbed service can be access through its API | 435 | The 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 |
437 | managing a group of peers. It also provides a helper function | 437 | managing 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 |
439 | environment on a single host. | 439 | environment on a single host. |
440 | 440 | ||
441 | This function takes a configuration file which will be used as a template | 441 | This 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 |
466 | The \texttt{CPPFLAGS} and \texttt{LDFLAGS} are necessary if GNUnet is installed | 466 | The @code{CPPFLAGS} and @code{LDFLAGS} are necessary if GNUnet is installed |
467 | into a different directory other than @file{/usr/local}. | 467 | into a different directory other than @file{/usr/local}. |
468 | 468 | ||
469 | All of testbed API's peer management functions treat management actions as | 469 | All of testbed API's peer management functions treat management actions as |
@@ -492,17 +492,17 @@ per-peer configuration. Accessing those configurations directly through file | |||
492 | system is discouraged as their locations are dynamically created and will be | 492 | system is discouraged as their locations are dynamically created and will be |
493 | different among various runs of testbed. To make access to these configurations | 493 | different among various runs of testbed. To make access to these configurations |
494 | easy, testbed API provides the function | 494 | easy, 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 |
496 | configuration of a given peer and calls the \textit{Connect Adapter}. | 496 | configuration of a given peer and calls the \textit{Connect Adapter}. |
497 | In the example code, it is the \texttt{dht\_ca}. A connect adapter is expected | 497 | In the example code, it is the @code{dht\_ca}. A connect adapter is expected |
498 | to open the connection to the needed service by using the provided configuration | 498 | to open the connection to the needed service by using the provided configuration |
499 | and return the created service connection handle. Successful connection to the | 499 | and return the created service connection handle. Successful connection to the |
500 | needed service is signaled through \texttt{service\_connect\_comp\_cb}. | 500 | needed service is signaled through @code{service\_connect\_comp\_cb}. |
501 | 501 | ||
502 | A dual to connect adapter is the \textit{Disconnect Adapter}. This callback is | 502 | A dual to connect adapter is the \textit{Disconnect Adapter}. This callback is |
503 | called after the connect adapter has been called when the operation from | 503 | called 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 |
505 | disconnect from the service with the provided service handle (\texttt{op\_result}). | 505 | disconnect from the service with the provided service handle (@code{op\_result}). |
506 | 506 | ||
507 | Exercise: Find out how many peers you can run on your system. | 507 | Exercise: 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 | ||
558 | The first step for writing any extension with a new service is to | 558 | The first step for writing any extension with a new service is to |
559 | ensure that the @file{ext.conf.in} file contains entries for the | 559 | ensure 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 |
561 | the service. | 561 | the service. |
562 | 562 | ||
563 | If you want to adapt the template rename the @file{ext.conf.in} to match your | 563 | If you want to adapt the template rename the @file{ext.conf.in} to match your |
564 | services name, you have to modify the \texttt{AC\_OUTPUT} section in @file{configure.ac} | 564 | services name, you have to modify the @code{AC\_OUTPUT} section in @file{configure.ac} |
565 | in the @file{gnunet-ext} root. | 565 | in 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 | ||
904 | FIXME: This section still needs to be updated to the lastest API! | 904 | FIXME: This section still needs to be updated to the lastest API! |
905 | 905 | ||
906 | One of the most important services in GNUnet is the \texttt{CORE} service | 906 | One of the most important services in GNUnet is the @code{CORE} service |
907 | managing connections between peers and handling encryption between peers. | 907 | managing connections between peers and handling encryption between peers. |
908 | 908 | ||
909 | One of the first things any service that extends the P2P protocol typically does | 909 | One of the first things any service that extends the P2P protocol typically does |
910 | is connect to the \texttt{CORE} service using: | 910 | is 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 | ||
927 | Before any traffic with a different peer can be exchanged, the peer must be | 927 | Before any traffic with a different peer can be exchanged, the peer must be |
928 | known to the service. This is notified by the \texttt{CORE} {\tt connects} callback, | 928 | known to the service. This is notified by the @code{CORE} {\tt connects} callback, |
929 | which communicates the identity of the new peer to the service: | 929 | which 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 |
944 | the respective peer. | 944 | the respective peer. |
945 | 945 | ||
946 | Exercise: Create a service that connects to the \texttt{CORE}. Then | 946 | Exercise: Create a service that connects to the @code{CORE}. Then |
947 | start (and connect) two peers and print a message once your connect | 947 | start (and connect) two peers and print a message once your connect |
948 | callback is invoked.} | 948 | callback is invoked.} |
949 | 949 | ||
950 | @subsection Receiving P2P Messages | 950 | @subsection Receiving P2P Messages |
951 | 951 | ||
952 | To receive messages from \texttt{CORE}, you pass the desired | 952 | To 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, |
954 | just as we showed for services. | 954 | just as we showed for services. |
955 | 955 | ||
@@ -1449,11 +1449,11 @@ $ valgrind gnunet-service-dht -L DEBUG | |||
1449 | Assuming other services are well-written, they will automatically re-integrate the | 1449 | Assuming other services are well-written, they will automatically re-integrate the |
1450 | restarted service with the peer. | 1450 | restarted service with the peer. |
1451 | 1451 | ||
1452 | GNUnet provides a powerful logging mechanism providing log levels \texttt{ERROR}, | 1452 | GNUnet 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 |
1454 | configured using the \lstinline|$GNUNET_FORCE_LOG| environmental variable. | 1454 | configured using the \lstinline|$GNUNET_FORCE_LOG| environmental variable. |
1455 | The \texttt{DEBUG} level is only available if \lstinline|--enable-logging=verbose| was used when | 1455 | The @code{DEBUG} level is only available if \lstinline|--enable-logging=verbose| was used when |
1456 | running \texttt{configure}. More details about logging can be found under | 1456 | running @code{configure}. More details about logging can be found under |
1457 | @uref{https://gnunet.org/logging}. | 1457 | @uref{https://gnunet.org/logging}. |
1458 | 1458 | ||
1459 | You should also probably enable the creation of core files, by setting | 1459 | You should also probably enable the creation of core files, by setting |