aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/gnunet/dht
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2013-08-27 17:16:18 +0000
committerFlorian Dold <florian.dold@gmail.com>2013-08-27 17:16:18 +0000
commita942ffadee0fe9fd385decdf818ad6baae8c99b3 (patch)
treed500fbdba7379631b0591a19417c7c3f3df29194 /src/main/java/org/gnunet/dht
parent6be9a1ed1b7847c795cb700e3e0bd87824fc0573 (diff)
downloadgnunet-java-a942ffadee0fe9fd385decdf818ad6baae8c99b3.tar.gz
gnunet-java-a942ffadee0fe9fd385decdf818ad6baae8c99b3.zip
- adapted source tree structure to gradle/maven conventions
- added gradle wrapper - fixes to adapt to GNUnet changes (new time unit, ...) - helper process in util - started implementing testbed - skeleton for voting tools - use new mq api - implemented some more transport api - mesh
Diffstat (limited to 'src/main/java/org/gnunet/dht')
-rw-r--r--src/main/java/org/gnunet/dht/BlockType.java81
-rw-r--r--src/main/java/org/gnunet/dht/ClientGetMessage.java51
-rw-r--r--src/main/java/org/gnunet/dht/ClientGetStopMessage.java45
-rw-r--r--src/main/java/org/gnunet/dht/ClientPutConfirmationMessage.java38
-rw-r--r--src/main/java/org/gnunet/dht/ClientPutMessage.java54
-rw-r--r--src/main/java/org/gnunet/dht/ClientResultMessage.java56
-rw-r--r--src/main/java/org/gnunet/dht/DistributedHashTable.java449
-rw-r--r--src/main/java/org/gnunet/dht/MonitorGetHandler.java30
-rw-r--r--src/main/java/org/gnunet/dht/MonitorGetMessage.java75
-rw-r--r--src/main/java/org/gnunet/dht/MonitorGetRespMessage.java72
-rw-r--r--src/main/java/org/gnunet/dht/MonitorGetResponseHandler.java31
-rw-r--r--src/main/java/org/gnunet/dht/MonitorPutHandler.java31
-rw-r--r--src/main/java/org/gnunet/dht/MonitorPutMessage.java82
-rw-r--r--src/main/java/org/gnunet/dht/MonitorStartStop.java70
-rw-r--r--src/main/java/org/gnunet/dht/ResultCallback.java46
-rw-r--r--src/main/java/org/gnunet/dht/RouteOption.java55
-rw-r--r--src/main/java/org/gnunet/dht/package-info.java24
17 files changed, 1290 insertions, 0 deletions
diff --git a/src/main/java/org/gnunet/dht/BlockType.java b/src/main/java/org/gnunet/dht/BlockType.java
new file mode 100644
index 0000000..cf00d38
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/BlockType.java
@@ -0,0 +1,81 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23/**
24 * Information on how to interpret a block of data.
25 */
26public enum BlockType {
27 /**
28 * Any type of block, used as a wildcard when searching. Should
29 * never be attached to a specific block.
30 */
31 ANY(0),
32 /**
33 * Data block (leaf) in the CHK tree.
34 */
35 DBLOCK(1),
36 /**
37 * Inner block in the CHK tree.
38 */
39 IBLOCK(2),
40 /**
41 * Type of a block representing a keyword search result. Note that
42 * the values for KBLOCK, SBLOCK and NBLOCK must be consecutive.
43 */
44 KBLOCK(3),
45 /**
46 * Type of a block that is used to advertise content in a namespace.
47 */
48 SBLOCK(4),
49 /**
50 * Type of a block that is used to advertise a namespace.
51 */
52 NBLOCK(5),
53 /**
54 * Type of a block representing a block to be encoded on demand from disk.
55 * Should never appear on the network directly.
56 */
57 FS_ONDEMAND(6),
58 /**
59 * Type of a block that contains a HELLO for a peer (for
60 * DHT find-peer operations).
61 */
62 DHT_HELLO(7),
63 /**
64 * Block for testing.
65 */
66 TEST(8),
67 /**
68 * Block for storing .gnunet-domains
69 */
70 DNS(10),
71 /**
72 * Block for storing record data
73 */
74 NAMERECORD(11);
75
76 public final int val;
77
78 BlockType(int val) {
79 this.val = val;
80 }
81}
diff --git a/src/main/java/org/gnunet/dht/ClientGetMessage.java b/src/main/java/org/gnunet/dht/ClientGetMessage.java
new file mode 100644
index 0000000..cd317fb
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/ClientGetMessage.java
@@ -0,0 +1,51 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.*;
24import org.gnunet.util.GnunetMessage;
25import org.gnunet.util.HashCode;
26
27/**
28* Created with IntelliJ IDEA.
29* User: dold
30* Date: 5/2/12
31* Time: 7:05 PM
32* To change this template use File | Settings | File Templates.
33*/
34@UnionCase(143)
35public class ClientGetMessage implements GnunetMessage.Body {
36 /**
37 * Combination of RouteOption.*
38 */
39 @UInt32
40 public int options;
41 @UInt32
42 public int desiredReplicationLevel;
43 @UInt32
44 public int type;
45 @NestedMessage
46 public HashCode key;
47 @UInt64
48 public long uniqueId;
49 @FillWith @UInt8
50 public byte[] xquery;
51}
diff --git a/src/main/java/org/gnunet/dht/ClientGetStopMessage.java b/src/main/java/org/gnunet/dht/ClientGetStopMessage.java
new file mode 100644
index 0000000..4cdee12
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/ClientGetStopMessage.java
@@ -0,0 +1,45 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.NestedMessage;
24import org.gnunet.construct.UInt32;
25import org.gnunet.construct.UInt64;
26import org.gnunet.construct.UnionCase;
27import org.gnunet.util.GnunetMessage;
28import org.gnunet.util.HashCode;
29
30/**
31* Created with IntelliJ IDEA.
32* User: dold
33* Date: 5/2/12
34* Time: 7:05 PM
35* To change this template use File | Settings | File Templates.
36*/
37@UnionCase(144)
38public class ClientGetStopMessage implements GnunetMessage.Body {
39 @UInt32
40 public int reserved = 0;
41 @UInt64
42 public long unique_id;
43 @NestedMessage
44 public HashCode key;
45}
diff --git a/src/main/java/org/gnunet/dht/ClientPutConfirmationMessage.java b/src/main/java/org/gnunet/dht/ClientPutConfirmationMessage.java
new file mode 100644
index 0000000..45bbe60
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/ClientPutConfirmationMessage.java
@@ -0,0 +1,38 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.UInt32;
24import org.gnunet.construct.UInt64;
25import org.gnunet.construct.UnionCase;
26import org.gnunet.util.GnunetMessage;
27
28
29@UnionCase(155)
30public class ClientPutConfirmationMessage implements GnunetMessage.Body {
31 @UInt32
32 public int reserved;
33 /**
34 * UID used to identify request with the response
35 */
36 @UInt64
37 public long uid;
38}
diff --git a/src/main/java/org/gnunet/dht/ClientPutMessage.java b/src/main/java/org/gnunet/dht/ClientPutMessage.java
new file mode 100644
index 0000000..4b63e92
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/ClientPutMessage.java
@@ -0,0 +1,54 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.*;
24import org.gnunet.util.AbsoluteTimeMessage;
25import org.gnunet.util.GnunetMessage;
26import org.gnunet.util.HashCode;
27
28
29@UnionCase(142)
30public class ClientPutMessage implements GnunetMessage.Body {
31 /**
32 * Type of data to insert, one of BlockType.*
33 */
34 @UInt32
35 public int type;
36 /**
37 * Combination of RouteOption.*
38 */
39 @UInt32
40 public int options;
41 @UInt32
42 public int desiredReplicationLevel;
43 /**
44 * UID used to identify request with the response
45 */
46 @UInt64
47 public long uid;
48 @NestedMessage
49 public AbsoluteTimeMessage expiration;
50 @NestedMessage
51 public HashCode hash;
52 @FillWith @UInt8
53 public byte[] data;
54}
diff --git a/src/main/java/org/gnunet/dht/ClientResultMessage.java b/src/main/java/org/gnunet/dht/ClientResultMessage.java
new file mode 100644
index 0000000..fab614f
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/ClientResultMessage.java
@@ -0,0 +1,56 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.*;
24import org.gnunet.util.AbsoluteTimeMessage;
25import org.gnunet.util.GnunetMessage;
26import org.gnunet.util.HashCode;
27import org.gnunet.util.PeerIdentity;
28
29/**
30* Created with IntelliJ IDEA.
31* User: dold
32* Date: 5/2/12
33* Time: 7:06 PM
34* To change this template use File | Settings | File Templates.
35*/
36@UnionCase(145)
37public class ClientResultMessage implements GnunetMessage.Body {
38 @UInt32
39 public int type;
40 @UInt32
41 public int putPathLength;
42 @UInt32
43 public int getPathLength;
44 @UInt64
45 public long uid;
46 @NestedMessage
47 public AbsoluteTimeMessage expiration;
48 @NestedMessage
49 public HashCode key;
50 @VariableSizeArray(lengthField = "putPathLength")
51 public PeerIdentity[] putPath;
52 @VariableSizeArray(lengthField = "getPathLength")
53 public PeerIdentity[] getPath;
54 @FillWith @UInt8
55 public byte[] data;
56}
diff --git a/src/main/java/org/gnunet/dht/DistributedHashTable.java b/src/main/java/org/gnunet/dht/DistributedHashTable.java
new file mode 100644
index 0000000..0a561bf
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/DistributedHashTable.java
@@ -0,0 +1,449 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import com.google.common.base.Charsets;
24import org.gnunet.mq.Envelope;
25import org.gnunet.requests.MatchingRequestContainer;
26import org.gnunet.requests.RequestContainer;
27import org.gnunet.requests.SequentialRequestContainer;
28import org.gnunet.util.*;
29import org.gnunet.util.getopt.Argument;
30import org.gnunet.util.getopt.ArgumentAction;
31import org.slf4j.Logger;
32import org.slf4j.LoggerFactory;
33
34import java.util.*;
35
36/**
37 * API for the gnunet dht service.
38 * <p/>
39 * Stores data under a key, distributed across the network.
40 * <p/>
41 */
42public class DistributedHashTable {
43 private static final Logger logger = LoggerFactory
44 .getLogger(DistributedHashTable.class);
45
46 private Client client;
47
48 /**
49 * next UID used on get/monitor requests, incremented after each use.
50 */
51 private long nextUID = 1;
52
53 private MatchingRequestContainer<Long, PutRequest> putRequests;
54 private MatchingRequestContainer<Long, GetRequest> getRequests;
55 private SequentialRequestContainer<MonitorRequest> monitorRequests;
56
57 private class PutRequest extends RequestContainer.Request {
58 public byte[] data;
59 public HashCode key;
60 public int replicationLevel;
61 public AbsoluteTime expiration;
62 public int type;
63 public Continuation cont;
64 public long uid;
65
66 public PutRequest() {
67 this.uid = nextUID++;
68 }
69
70 @Override
71 public Envelope assembleRequest() {
72 final ClientPutMessage cpm = new ClientPutMessage();
73 cpm.data = data;
74 cpm.hash = key;
75 cpm.desiredReplicationLevel = replicationLevel;
76 cpm.expiration = expiration.asMessage();
77 cpm.type = type;
78 cpm.uid = uid;
79 return new Envelope(cpm);
80 }
81
82 public void cancel() {
83 }
84 }
85
86
87 private class GetRequest extends RequestContainer.Request {
88 public long uid;
89 public HashCode key;
90 public ResultCallback cb;
91 public int type;
92 public int replication;
93 public byte[] xquery;
94
95 public GetRequest() {
96 uid = DistributedHashTable.this.nextUID++;
97 }
98
99 @Override
100 public Envelope assembleRequest() {
101 ClientGetMessage gm = new ClientGetMessage();
102 gm.desiredReplicationLevel = replication;
103 gm.type = type;
104 gm.xquery = xquery == null ? new byte[0] : xquery;
105 gm.key = key;
106 gm.uniqueId = uid;
107 return new Envelope(gm);
108 }
109 public void cancel() {
110
111 }
112 }
113
114 private class MonitorRequest extends RequestContainer.Request {
115 public int blockType;
116 public HashCode key;
117 public MonitorGetHandler getHandler;
118 public MonitorGetResponseHandler getResponseHandler;
119 public MonitorPutHandler putHandler;
120
121 @Override
122 public Envelope assembleRequest() {
123 MonitorStartStop mss = new MonitorStartStop();
124 if (key != null) {
125 mss.filter_key = 1;
126 mss.key = key;
127 } else {
128 mss.key = new HashCode();
129 }
130 if (getHandler != null) {
131 mss.get = 1;
132 }
133 if (getResponseHandler != null) {
134 mss.getResp = 1;
135 }
136 if (putHandler != null) {
137 mss.put = 1;
138 }
139 mss.type = blockType;
140 return new Envelope(mss);
141 }
142
143 public void cancel() {
144 // todo: use priority requests
145 MonitorRequest cancelRequest = new MonitorRequest();
146 cancelRequest.getHandler = null;
147 cancelRequest.getResponseHandler = null;
148 cancelRequest.putHandler = null;
149 monitorRequests.addRequest(cancelRequest);
150
151 monitorRequests.addRequest(cancelRequest);
152 }
153 }
154
155 private class DHTMessageReceiver extends RunaboutMessageReceiver {
156 public void visit(ClientPutConfirmationMessage pcm) {
157 PutRequest thePutRequest = putRequests.getRequest(pcm.uid);
158 if (thePutRequest == null) {
159 logger.warn("request UID not found");
160 return;
161 }
162 if (thePutRequest.cont != null) {
163 thePutRequest.cont.cont(true);
164 }
165 }
166
167 public void visit(ClientResultMessage rm) {
168 GetRequest theGetRequest = getRequests.getRequest(rm.uid);
169 if (theGetRequest == null) {
170 logger.warn("request UID not found");
171 return;
172 }
173 theGetRequest.cb.handleResult(AbsoluteTime.fromNetwork(rm.expiration), rm.key, null, null,
174 BlockType.TEST,
175 rm.data);
176 }
177
178 public void visit(MonitorGetMessage monitorGetMessage) {
179 for (MonitorRequest monitorRequest : monitorRequests.iter()) {
180 boolean type_ok = (monitorGetMessage.type == BlockType.ANY.val)
181 || (monitorGetMessage.type == monitorRequest.blockType);
182 boolean key_ok = monitorGetMessage.key.isAllZero()
183 || monitorGetMessage.key.equals(monitorRequest.key);
184
185 if (key_ok && type_ok && monitorRequest.getHandler != null) {
186 monitorRequest.getHandler.onGet(monitorGetMessage.options, monitorGetMessage.type,
187 monitorGetMessage.hop_count, monitorGetMessage.desired_replication_level, monitorGetMessage.getPath,
188 monitorGetMessage.key);
189 }
190 }
191 }
192
193 public void visit(MonitorGetRespMessage monitorGetRespMessage) {
194 for (MonitorRequest monitorRequest : monitorRequests.iter()) {
195 boolean type_ok = (monitorGetRespMessage.type == BlockType.ANY.val)
196 || (monitorGetRespMessage.type == monitorRequest.blockType);
197 boolean key_ok = monitorGetRespMessage.key.isAllZero()
198 || monitorGetRespMessage.key.equals(monitorRequest.key);
199
200 if (key_ok && type_ok && monitorRequest.getResponseHandler != null) {
201 monitorRequest.getResponseHandler.onGetResponse(
202 monitorGetRespMessage.type,
203 monitorGetRespMessage.getPath,
204 monitorGetRespMessage.putPath,
205 monitorGetRespMessage.expiration,
206 monitorGetRespMessage.key,
207 monitorGetRespMessage.data);
208 }
209 }
210
211 }
212
213 public void visit(MonitorPutMessage monitorPutMessage) {
214 for (MonitorRequest monitorRequest : monitorRequests.iter()) {
215 boolean type_ok = (monitorPutMessage.type == BlockType.ANY.val)
216 || (monitorPutMessage.type == monitorRequest.blockType);
217 boolean key_ok = monitorPutMessage.key.isAllZero()
218 || monitorPutMessage.key.equals(monitorRequest.key);
219
220 if (key_ok && type_ok && monitorRequest.putHandler != null) {
221 monitorRequest.putHandler.onPut(monitorPutMessage.options, monitorPutMessage.type,
222 monitorPutMessage.hop_count, monitorPutMessage.expirationTime,
223 monitorPutMessage.putPath, monitorPutMessage.key, monitorPutMessage.data);
224 }
225 }
226 }
227
228 @Override
229 public void handleError() {
230 }
231 }
232
233
234 /**
235 * Create a connection with the DHT service.
236 *
237 * @param cfg the configuration to use
238 */
239 public DistributedHashTable(Configuration cfg) {
240 client = new Client("dht", cfg);
241 client.installReceiver(new DHTMessageReceiver());
242 putRequests = new MatchingRequestContainer<Long, PutRequest>(client);
243 getRequests = new MatchingRequestContainer<Long, GetRequest>(client);
244 monitorRequests = new SequentialRequestContainer<MonitorRequest>(client);
245 }
246
247 /**
248 * Put data into the dht.
249 *
250 * @param key key key to store the data under
251 * @param data data data to store
252 * @param replicationLevel how many peers should store this value
253 * @param routeOptions additional options
254 * @param type type of the data to store
255 * @param expiration how long should the value be stored? TODO: what is the maximum?
256 * @param timeout how long after we give up on storing the value?
257 * @param cont called after the put operation failed or succeeded
258 */
259 public void put(HashCode key, byte[] data, int replicationLevel, Set<RouteOption> routeOptions,
260 int type, AbsoluteTime expiration,
261 RelativeTime timeout, final Continuation cont) {
262 PutRequest pr = new PutRequest();
263 pr.key = key;
264 pr.data = data;
265 pr.replicationLevel = replicationLevel;
266 pr.expiration = expiration;
267 pr.type = type;
268 pr.cont = cont;
269
270 putRequests.addRequest(pr.uid, pr);
271 }
272
273
274 /**
275 * Request results from the DHT.
276 *
277 * @param timeout timeout for the request
278 * @param type which type of data do we want to query for? (the DHT does not support TYPE_ANY)
279 * @param key the key we want to query
280 * @param replication how many peers do we want to ask?
281 * @param routeOptions extra routing options, null for default
282 * @param xquery extra query parameters, defaults to null
283 * @param cb the callback object for results or failure indication
284 * @return a handle to cancel the request
285 */
286 public Cancelable startGet(RelativeTime timeout, int type, HashCode key,
287 int replication, EnumSet<RouteOption> routeOptions,
288 byte[] xquery, ResultCallback cb) {
289
290 final GetRequest getRequest = new GetRequest();
291 getRequest.key = key;
292 getRequest.cb = cb;
293 getRequest.type = type;
294 getRequest.replication = type;
295 getRequest.xquery = xquery;
296
297 return getRequests.addRequest(getRequest.uid, getRequest);
298 }
299
300 public Cancelable startMonitor(int blockType, HashCode key, MonitorGetHandler getHandler,
301 MonitorGetResponseHandler getResponseHandler,
302 MonitorPutHandler putHandler) {
303 MonitorRequest monitorRequest = new MonitorRequest();
304 monitorRequest.blockType = blockType;
305 monitorRequest.key = key;
306 monitorRequest.getHandler = getHandler;
307 monitorRequest.getResponseHandler = getResponseHandler;
308 monitorRequest.putHandler = putHandler;
309
310 return monitorRequests.addRequest(monitorRequest);
311 }
312
313
314 /**
315 * Destroy the connection to the service.
316 */
317 public void destroy() {
318 // there's nothing to sync, just destroy!
319 client.disconnect();
320 }
321
322 public static void main(String[] args) {
323 new Program(args) {
324 @Argument(action = ArgumentAction.SET,
325 shortname = "p",
326 longname = "put",
327 description = "set a value in the DHT; default is get")
328 boolean modePut = false;
329
330 @Argument(action = ArgumentAction.SET,
331 shortname = "m",
332 longname = "monitor",
333 description = "monitor requests going to the local DHT")
334 boolean monitor = false;
335
336
337 @Argument(action = ArgumentAction.STORE_STRING,
338 shortname = "d",
339 longname = "data",
340 description = "data (only used with --put)")
341 String data = null;
342
343 @Argument(action = ArgumentAction.STORE_STRING,
344 shortname = "k",
345 longname = "key",
346 description = "key used for the operation")
347 String key = null;
348
349
350 // todo: implement the following options
351 /*
352 @Argument(action = ArgumentAction.STORE_STRING,
353 shortname = "t",
354 longname = "type",
355 description = "type of data used in this operation")
356 String type = null;
357
358 @Argument(action = ArgumentAction.STORE_STRING,
359 shortname = "e",
360 longname = "expire",
361 description = "expiration (ony use with --put)")
362 String expiration = null;
363 */
364
365
366 @Argument(action = ArgumentAction.STORE_NUMBER,
367 shortname = "r",
368 longname = "replication",
369 description = "desired replication (only used with --put)")
370 int replication = 5;
371
372
373 public void run() {
374 if (modePut) {
375
376 if (key == null) {
377 System.out.println("key required");
378 return;
379 }
380
381 if (data == null) {
382 System.out.println("data required on put");
383 return;
384 }
385 final DistributedHashTable dht = new DistributedHashTable(cfg);
386
387 dht.put(new HashCode(key), data.getBytes(), replication, EnumSet.of(RouteOption.NONE),
388 BlockType.TEST.val, AbsoluteTime.now().add(RelativeTime.HOUR),
389 RelativeTime.SECOND, new Continuation() {
390 @Override
391 public void cont(boolean success) {
392 if (success) {
393 System.out.println("put request sent");
394 } else {
395 System.out.println("error");
396 }
397 dht.destroy();
398 }
399 });
400 } else if (monitor) {
401 final DistributedHashTable dht = new DistributedHashTable(cfg);
402 dht.startMonitor(BlockType.TEST.val, null,
403 new MonitorGetHandler() {
404 @Override
405 public void onGet(int options, int type, int hop_count,
406 int desired_replication_level, PeerIdentity[] getPath, HashCode key) {
407 System.out.println("get monitored");
408 }
409 },
410 new MonitorGetResponseHandler() {
411 @Override
412 public void onGetResponse(int type, PeerIdentity[] getPath, PeerIdentity[] putPath,
413 AbsoluteTimeMessage expiration, HashCode key, byte[] data) {
414 System.out.println("get response monitored");
415 }
416 },
417 new MonitorPutHandler() {
418 @Override
419 public void onPut(int options, int type, int hop_count, AbsoluteTimeMessage
420 expirationTime, PeerIdentity[] putPath, HashCode key, byte[] data) {
421 System.out.println("put monitored");
422 }
423 });
424 } else { // get
425 if (key == null) {
426 System.out.println("key required");
427 return;
428 }
429 if (data != null) {
430 System.out.println("get does not take data as an option");
431 return;
432 }
433
434 final DistributedHashTable dht = new DistributedHashTable(cfg);
435
436 dht.startGet(RelativeTime.SECOND, BlockType.TEST.val, new HashCode(key), replication, null,
437 new byte[0], new ResultCallback() {
438 @Override
439 public void handleResult(AbsoluteTime expiration, HashCode key, List<PeerIdentity>
440 getPath, List<PeerIdentity> putPath, BlockType type, byte[] data) {
441 System.out.println("got result:");
442 System.out.println(new String(data, Charsets.UTF_8));
443 }
444 });
445 }
446 }
447 }.start();
448 }
449}
diff --git a/src/main/java/org/gnunet/dht/MonitorGetHandler.java b/src/main/java/org/gnunet/dht/MonitorGetHandler.java
new file mode 100644
index 0000000..c7dad7c
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/MonitorGetHandler.java
@@ -0,0 +1,30 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.util.HashCode;
24import org.gnunet.util.PeerIdentity;
25
26
27public interface MonitorGetHandler {
28 void onGet(int options, int type, int hop_count, int desired_replication_level, PeerIdentity[] getPath,
29 HashCode key);
30}
diff --git a/src/main/java/org/gnunet/dht/MonitorGetMessage.java b/src/main/java/org/gnunet/dht/MonitorGetMessage.java
new file mode 100644
index 0000000..e96ec96
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/MonitorGetMessage.java
@@ -0,0 +1,75 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.NestedMessage;
24import org.gnunet.construct.UInt32;
25import org.gnunet.construct.UnionCase;
26import org.gnunet.construct.VariableSizeArray;
27import org.gnunet.util.GnunetMessage;
28import org.gnunet.util.HashCode;
29import org.gnunet.util.PeerIdentity;
30
31/**
32 * Message to monitor get requests going through peer, DHT service -> clients.
33 */
34@UnionCase(149)
35public class MonitorGetMessage implements GnunetMessage.Body {
36 /**
37 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
38 */
39 @UInt32
40 public int options;
41
42 /**
43 * The type of data in the request.
44 */
45 @UInt32
46 public int type;
47
48 /**
49 * Hop count
50 */
51 @UInt32
52 public int hop_count;
53
54 /**
55 * Replication level for this message
56 */
57 @UInt32
58 public int desired_replication_level;
59
60 /**
61 * Number of peers recorded in the outgoing path from source to the
62 * storage location of this message.
63 */
64 @UInt32
65 public int get_path_length;
66
67 /**
68 * The key to store the value under.
69 */
70 @NestedMessage
71 public HashCode key;
72
73 @VariableSizeArray(lengthField = "get_path_length")
74 public PeerIdentity[] getPath;
75}
diff --git a/src/main/java/org/gnunet/dht/MonitorGetRespMessage.java b/src/main/java/org/gnunet/dht/MonitorGetRespMessage.java
new file mode 100644
index 0000000..3bf145b
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/MonitorGetRespMessage.java
@@ -0,0 +1,72 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.*;
24import org.gnunet.util.AbsoluteTimeMessage;
25import org.gnunet.util.GnunetMessage;
26import org.gnunet.util.HashCode;
27import org.gnunet.util.PeerIdentity;
28
29/**
30 * Message to monitor get results going through peer, DHT service --> clients.
31 */
32@UnionCase(150)
33public class MonitorGetRespMessage implements GnunetMessage.Body {
34 /**
35 * Content type.
36 */
37 @UInt32
38 int type;
39
40 /**
41 * Length of the PUT path that follows (if tracked).
42 */
43 @UInt32
44 int put_path_length;
45
46 /**
47 * Length of the GET path that follows (if tracked).
48 */
49 @UInt32
50 int get_path_length;
51
52 /**
53 * When does the content expire?
54 */
55 @NestedMessage
56 public AbsoluteTimeMessage expiration;
57
58 /**
59 * The key of the corresponding GET request.
60 */
61 @NestedMessage
62 public HashCode key;
63
64 @VariableSizeArray(lengthField = "put_path_length")
65 public PeerIdentity[] putPath;
66
67 @VariableSizeArray(lengthField = "get_path_length")
68 public PeerIdentity[] getPath;
69
70 @FillWith @UInt8
71 public byte[] data;
72}
diff --git a/src/main/java/org/gnunet/dht/MonitorGetResponseHandler.java b/src/main/java/org/gnunet/dht/MonitorGetResponseHandler.java
new file mode 100644
index 0000000..ff03cce
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/MonitorGetResponseHandler.java
@@ -0,0 +1,31 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.util.AbsoluteTimeMessage;
24import org.gnunet.util.HashCode;
25import org.gnunet.util.PeerIdentity;
26
27
28public interface MonitorGetResponseHandler {
29 void onGetResponse(int type, PeerIdentity[] getPath, PeerIdentity[] putPath, AbsoluteTimeMessage expiration,
30 HashCode key, byte[] data);
31}
diff --git a/src/main/java/org/gnunet/dht/MonitorPutHandler.java b/src/main/java/org/gnunet/dht/MonitorPutHandler.java
new file mode 100644
index 0000000..0abb79b
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/MonitorPutHandler.java
@@ -0,0 +1,31 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.util.AbsoluteTimeMessage;
24import org.gnunet.util.HashCode;
25import org.gnunet.util.PeerIdentity;
26
27
28public interface MonitorPutHandler {
29 void onPut(int options, int type, int hop_count, AbsoluteTimeMessage expirationTime, PeerIdentity[] putPath,
30 HashCode key, byte[] data);
31}
diff --git a/src/main/java/org/gnunet/dht/MonitorPutMessage.java b/src/main/java/org/gnunet/dht/MonitorPutMessage.java
new file mode 100644
index 0000000..103c05b
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/MonitorPutMessage.java
@@ -0,0 +1,82 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.*;
24import org.gnunet.util.AbsoluteTimeMessage;
25import org.gnunet.util.GnunetMessage;
26import org.gnunet.util.HashCode;
27import org.gnunet.util.PeerIdentity;
28
29/**
30 * Message to monitor put requests going through peer, DHT service --> clients.
31 */
32@UnionCase(151)
33public class MonitorPutMessage implements GnunetMessage.Body {
34 /**
35 * Message options, actually an 'enum GNUNET_DHT_RouteOption' value.
36 */
37 @UInt32
38 public int options;
39
40 /**
41 * The type of data in the request.
42 */
43 @UInt32
44 public int type;
45
46 /**
47 * Hop count so far.
48 */
49 @UInt32
50 public int hop_count;
51
52 /**
53 * Replication level for this message
54 */
55 @UInt32
56 public int desired_replication_level;
57
58 /**
59 * Number of peers recorded in the outgoing path from source to the
60 * storage location of this message.
61 */
62 @UInt32
63 public int put_path_length;
64
65 /**
66 * How long should this data persist?
67 */
68 @NestedMessage
69 public AbsoluteTimeMessage expirationTime;
70
71 /**
72 * The key to store the value under.
73 */
74 @NestedMessage
75 public HashCode key;
76
77 @VariableSizeArray(lengthField = "put_path_length")
78 public PeerIdentity[] putPath;
79
80 @FillWith @UInt8
81 public byte[] data;
82}
diff --git a/src/main/java/org/gnunet/dht/MonitorStartStop.java b/src/main/java/org/gnunet/dht/MonitorStartStop.java
new file mode 100644
index 0000000..b3f3268
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/MonitorStartStop.java
@@ -0,0 +1,70 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.construct.NestedMessage;
24import org.gnunet.construct.UInt16;
25import org.gnunet.construct.UInt32;
26import org.gnunet.construct.UnionCase;
27import org.gnunet.util.GnunetMessage;
28import org.gnunet.util.HashCode;
29
30/**
31 * Message to request monitoring messages, clients --> DHT service.
32 */
33@UnionCase(153)
34public class MonitorStartStop implements GnunetMessage.Body {
35 /**
36 * The type of data desired, GNUNET_BLOCK_TYPE_ANY for all.
37 */
38 @UInt32
39 public int type;
40
41 /**
42 * Flag whether to notify about GET messages.
43 */
44 @UInt16
45 public int get;
46
47 /**
48 * Flag whether to notify about GET_REPONSE messages.
49 */
50 @UInt16
51 public int getResp;
52
53 /**
54 * Flag whether to notify about PUT messages.
55 */
56 @UInt16
57 public int put;
58
59 /**
60 * Flag whether to use the provided key to filter messages.
61 */
62 @UInt16
63 public int filter_key;
64
65 /*
66 The key to filter messages by.
67 */
68 @NestedMessage
69 public HashCode key;
70}
diff --git a/src/main/java/org/gnunet/dht/ResultCallback.java b/src/main/java/org/gnunet/dht/ResultCallback.java
new file mode 100644
index 0000000..fa5c7ef
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/ResultCallback.java
@@ -0,0 +1,46 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23import org.gnunet.util.AbsoluteTime;
24import org.gnunet.util.HashCode;
25import org.gnunet.util.PeerIdentity;
26
27import java.util.List;
28
29/**
30 * Callback object for requests to the dht
31 */
32public interface ResultCallback {
33 /**
34 * Called when the dht returns a result
35 *
36 * @param expiration expiration of the returned entry
37 * @param key key of the returned entry
38 * @param getPath put path of the returned entry
39 * @param putPath put path of the returned entry
40 * @param type type of data in the entry
41 * @param data data of the returned entry
42 */
43 public void handleResult(AbsoluteTime expiration, HashCode key,
44 List<PeerIdentity> getPath, List<PeerIdentity> putPath,
45 BlockType type, byte[] data);
46}
diff --git a/src/main/java/org/gnunet/dht/RouteOption.java b/src/main/java/org/gnunet/dht/RouteOption.java
new file mode 100644
index 0000000..b74b528
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/RouteOption.java
@@ -0,0 +1,55 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21package org.gnunet.dht;
22
23/**
24 * Options passed to the dht service for routing requests.
25 */
26enum RouteOption {
27 /**
28 * Default. Do nothing special.
29 */
30 NONE(0),
31 /**
32 * Each peer along the way should look at 'enc' (otherwise
33 * only the k-peers closest to the key should look at it).
34 */
35 DEMULTIPLEX_EVERYWHERE(1),
36 /**
37 * We should keep track of the route that the message
38 * took in the P2P network.
39 */
40 RECORD_ROUTE(2),
41 /**
42 * This is a 'FIND-PEER' request, so approximate results are fine.
43 */
44 FIND_PEER(4),
45 /**
46 * Possible message option for query key randomization.
47 */
48 BART(8);
49
50 private int val;
51
52 RouteOption(int val) {
53 this.val = val;
54 }
55}
diff --git a/src/main/java/org/gnunet/dht/package-info.java b/src/main/java/org/gnunet/dht/package-info.java
new file mode 100644
index 0000000..3d8c6ed
--- /dev/null
+++ b/src/main/java/org/gnunet/dht/package-info.java
@@ -0,0 +1,24 @@
1/*
2 This file is part of GNUnet.
3 (C) 2011, 2012 Christian Grothoff (and other contributing authors)
4
5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your
8 option) any later version.
9
10 GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA.
19 */
20
21/**
22 * API for the gnunet dht service.
23 */
24package org.gnunet.dht;