aboutsummaryrefslogtreecommitdiff
path: root/doc/gnunet-exercise.tex
blob: 692b03c9931a8a5f8d2440ba9fc9c5598b1a10ea (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
\documentclass[10pt]{article}
\usepackage[ansinew]{inputenc}
\usepackage{makeidx,amsmath,amssymb,exscale,multicol,epsfig,graphics,verbatim,ulem}
\usepackage{epsfig,geometry,url,listings}
\geometry{headsep=3ex,hscale=0.9}
\usepackage{hyperref}
\hypersetup{
  pdftitle={gnunet-java tutorial},
  pdfsubject={gnunet-java},
  pdfauthor={Florian Dold <dold@in.tum.de>},
  pdfkeywords={gnunet,java},
  colorlinks=true,
  urlcolor=blue
}

\title{Introduction to gnunet-java}
\author{Florian Dold}
\date{}

\begin{document}

\maketitle


\section{Prerequisites}
This tutorial assumes that you have gnunet$\geq$0.9.2 installed on your system.
Instructions on how to do this can be found at \url{https://gnunet.org/installation}.

TODO: ./configure --enable-javaports

Make sure that the default gnunet services are running by typing
\begin{lstlisting}
gnunet-arm -I
\end{lstlisting}
on your command line.

\section{Installing gnunet-java}
You can either check out the latest version of gnunet-java with
\lstset{language=bash}
\begin{lstlisting}
svn checkout https://gnunet.org/svn/gnunet-java/
\end{lstlisting}
or download a more convenient installer at \url{http://example.com/gnunet-java-installer.jar}.
You can start the installer by double-clicking on it, or running
\begin{lstlisting}
java -jar gnunet-java-installer.jar
\end{lstlisting}
on your command line.

\section{First Steps}
Programs to communicate with gnunet are located unter the bin/ directory. You can add this directory to your path,
otherwise you have to prefix every command with this directory.

To test if everything is working, try to run the program gnunet-nse. This should show you the estimated current size
of the network.

\subsection{Project Layout}
(explanation of the directory structure: src, test, bin, tools, gnunet-java-ext)

\section{Creating an extension}
(copying gnunet-java-ext, setting variables / the gnunet-java path in the bash wrapper)

\section{A simple gnunet-java program}
\lstset{language=java}
\begin{lstlisting}
public class HelloGnunet {
    public static void main(String[] args) {
            new Program(args) {
                public void run() {
                    System.out.println("Hello, gnunet");
                }
            }.start();
}
\end{lstlisting}

\subsection{Adding and using command line arguments}
Command line options are added by annotating members of your org.gnunet.util.Program-subclass
with the \@Option-annotation.


\subsection{Using an existing service API}
In this section we will use the gnunet statistics api to track how often the HelloGnunet program
has been run.

\section {Overview of useful APIs}
statistics, dht, core

\section{Communicating with a Service directly}
\subsection{Using the client API}
\subsection{Defining a new message type}
(example, annotations, running gnunet-java-update-msgtypes)
\section{Writing a gnunet service}

\end{document}