diff options
author | Florian Dold <florian.dold@gmail.com> | 2014-04-07 00:26:06 +0000 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2014-04-07 00:26:06 +0000 |
commit | d33161cddda663720ea93c483ed6e3e7511e995b (patch) | |
tree | 7413b2aace2d2673e083369b22126d731a8fabaf /src/main/java/org | |
parent | a5a49ee6c7e87b0fb8abae6127713e8ef3c38edb (diff) | |
download | gnunet-java-d33161cddda663720ea93c483ed6e3e7511e995b.tar.gz gnunet-java-d33161cddda663720ea93c483ed6e3e7511e995b.zip |
docs / fixed fixme in crypto
Diffstat (limited to 'src/main/java/org')
37 files changed, 374 insertions, 88 deletions
diff --git a/src/main/java/org/gnunet/core/ConnectHandler.java b/src/main/java/org/gnunet/core/ConnectHandler.java index a36d798..4291acd 100644 --- a/src/main/java/org/gnunet/core/ConnectHandler.java +++ b/src/main/java/org/gnunet/core/ConnectHandler.java | |||
@@ -26,5 +26,9 @@ import org.gnunet.util.PeerIdentity; | |||
26 | * Called when a new peer (with a compatible set of messages) connects to core | 26 | * Called when a new peer (with a compatible set of messages) connects to core |
27 | */ | 27 | */ |
28 | public interface ConnectHandler { | 28 | public interface ConnectHandler { |
29 | /** | ||
30 | * Called when a new peer (with a compatible set of messages) connects to core | ||
31 | * @param peerIdentity identity of the connecting peer | ||
32 | */ | ||
29 | void onConnect(PeerIdentity peerIdentity); | 33 | void onConnect(PeerIdentity peerIdentity); |
30 | } | 34 | } |
diff --git a/src/main/java/org/gnunet/core/Core.java b/src/main/java/org/gnunet/core/Core.java index a4adb32..83e712b 100644 --- a/src/main/java/org/gnunet/core/Core.java +++ b/src/main/java/org/gnunet/core/Core.java | |||
@@ -23,6 +23,7 @@ package org.gnunet.core; | |||
23 | import com.google.common.collect.Maps; | 23 | import com.google.common.collect.Maps; |
24 | import org.gnunet.construct.Construct; | 24 | import org.gnunet.construct.Construct; |
25 | import org.gnunet.construct.MessageLoader; | 25 | import org.gnunet.construct.MessageLoader; |
26 | import org.gnunet.core.messages.*; | ||
26 | import org.gnunet.mq.Envelope; | 27 | import org.gnunet.mq.Envelope; |
27 | import org.gnunet.requests.MatchingRequestContainer; | 28 | import org.gnunet.requests.MatchingRequestContainer; |
28 | import org.gnunet.requests.Request; | 29 | import org.gnunet.requests.Request; |
@@ -36,7 +37,7 @@ import java.util.HashMap; | |||
36 | 37 | ||
37 | 38 | ||
38 | /** | 39 | /** |
39 | * API for the gnunet core service. | 40 | * API for the GNUnet core service. |
40 | * <p/> | 41 | * <p/> |
41 | * Sends messages to connected peers. | 42 | * Sends messages to connected peers. |
42 | */ | 43 | */ |
@@ -246,6 +247,11 @@ public class Core { | |||
246 | } | 247 | } |
247 | } | 248 | } |
248 | 249 | ||
250 | /** | ||
251 | * Establish a connection to the core service. | ||
252 | * | ||
253 | * @param cfg configuration to use | ||
254 | */ | ||
249 | public Core(Configuration cfg) { | 255 | public Core(Configuration cfg) { |
250 | client = new Client("core", cfg); | 256 | client = new Client("core", cfg); |
251 | client.installReceiver(new CoreReceiver()); | 257 | client.installReceiver(new CoreReceiver()); |
@@ -301,8 +307,8 @@ public class Core { | |||
301 | * Helper function to retrieve the peer identity with the given configuration via CORE. | 307 | * Helper function to retrieve the peer identity with the given configuration via CORE. |
302 | * Should <b>not</b> be used unless there is no other means to obtain the peer identity. | 308 | * Should <b>not</b> be used unless there is no other means to obtain the peer identity. |
303 | * | 309 | * |
304 | * @param cfg | 310 | * @param cfg configuration to use |
305 | * @param cont | 311 | * @param cont continuation, called with the peer identity once available |
306 | */ | 312 | */ |
307 | public static void withPeerIdentity(Configuration cfg, final PeerIdentityContinuation cont) { | 313 | public static void withPeerIdentity(Configuration cfg, final PeerIdentityContinuation cont) { |
308 | final Core core = new Core(cfg); | 314 | final Core core = new Core(cfg); |
@@ -317,28 +323,54 @@ public class Core { | |||
317 | 323 | ||
318 | /** | 324 | /** |
319 | * Observe outgoing message headers from core. | 325 | * Observe outgoing message headers from core. |
326 | * | ||
320 | * @param h callback | 327 | * @param h callback |
321 | */ | 328 | */ |
322 | public void observeOutboundHeaders(HeaderNotify h) { | 329 | public void observeOutboundHeaders(HeaderNotify h) { |
323 | this.notifyOutboundHeaders = h; | 330 | this.notifyOutboundHeaders = h; |
324 | } | 331 | } |
325 | 332 | ||
333 | /** | ||
334 | * Observe inbound headers from core. | ||
335 | * | ||
336 | * @param h callback | ||
337 | */ | ||
326 | public void observeInboundHeaders(HeaderNotify h) { | 338 | public void observeInboundHeaders(HeaderNotify h) { |
327 | this.notifyInboundHeaders = h; | 339 | this.notifyInboundHeaders = h; |
328 | } | 340 | } |
329 | 341 | ||
342 | /** | ||
343 | * Observe inbound messages from core. | ||
344 | * | ||
345 | * @param h callback | ||
346 | */ | ||
330 | public void observeInboundMessages(MessageNotify h) { | 347 | public void observeInboundMessages(MessageNotify h) { |
331 | this.notifyInboundMessages = h; | 348 | this.notifyInboundMessages = h; |
332 | } | 349 | } |
333 | 350 | ||
351 | /** | ||
352 | * Observe outbound messages from core. | ||
353 | * | ||
354 | * @param h callback | ||
355 | */ | ||
334 | public void observeOutboundMessages(MessageNotify h) { | 356 | public void observeOutboundMessages(MessageNotify h) { |
335 | this.notifyOutboundMessages = h; | 357 | this.notifyOutboundMessages = h; |
336 | } | 358 | } |
337 | 359 | ||
360 | /** | ||
361 | * Observe core connections | ||
362 | * | ||
363 | * @param connectHandler callback | ||
364 | */ | ||
338 | public void observeConnect(ConnectHandler connectHandler) { | 365 | public void observeConnect(ConnectHandler connectHandler) { |
339 | this.connectHandler = connectHandler; | 366 | this.connectHandler = connectHandler; |
340 | } | 367 | } |
341 | 368 | ||
369 | /** | ||
370 | * Observe core disconnections. | ||
371 | * | ||
372 | * @param disconnectHandler callback | ||
373 | */ | ||
342 | public void observeDisconnect(DisconnectHandler disconnectHandler) { | 374 | public void observeDisconnect(DisconnectHandler disconnectHandler) { |
343 | this.disconnectHandler = disconnectHandler; | 375 | this.disconnectHandler = disconnectHandler; |
344 | } | 376 | } |
@@ -347,6 +379,8 @@ public class Core { | |||
347 | * Handle all incoming messages with the specified runabout. | 379 | * Handle all incoming messages with the specified runabout. |
348 | * Has to be called before init, as the service has to know which messages we | 380 | * Has to be called before init, as the service has to know which messages we |
349 | * are interested in. | 381 | * are interested in. |
382 | * | ||
383 | * @param runabout the runabout that will handle received messages | ||
350 | */ | 384 | */ |
351 | public void setMessageHandler(Runabout runabout) { | 385 | public void setMessageHandler(Runabout runabout) { |
352 | if (messageHandler != null) { | 386 | if (messageHandler != null) { |
diff --git a/src/main/java/org/gnunet/core/DisconnectHandler.java b/src/main/java/org/gnunet/core/DisconnectHandler.java index c7ca407..e0fe08b 100644 --- a/src/main/java/org/gnunet/core/DisconnectHandler.java +++ b/src/main/java/org/gnunet/core/DisconnectHandler.java | |||
@@ -26,5 +26,10 @@ import org.gnunet.util.PeerIdentity; | |||
26 | * Called when a peer disconnects from the core. | 26 | * Called when a peer disconnects from the core. |
27 | */ | 27 | */ |
28 | public interface DisconnectHandler { | 28 | public interface DisconnectHandler { |
29 | /** | ||
30 | * Called when a peer disconnects from the core. | ||
31 | * | ||
32 | * @param peerIdentity identity of the peer that disconnected | ||
33 | */ | ||
29 | void onDisconnect(PeerIdentity peerIdentity); | 34 | void onDisconnect(PeerIdentity peerIdentity); |
30 | } | 35 | } |
diff --git a/src/main/java/org/gnunet/core/HeaderNotify.java b/src/main/java/org/gnunet/core/HeaderNotify.java index 4f536e3..353c576 100644 --- a/src/main/java/org/gnunet/core/HeaderNotify.java +++ b/src/main/java/org/gnunet/core/HeaderNotify.java | |||
@@ -23,8 +23,12 @@ package org.gnunet.core; | |||
23 | import org.gnunet.util.GnunetMessage; | 23 | import org.gnunet.util.GnunetMessage; |
24 | 24 | ||
25 | /** | 25 | /** |
26 | * | 26 | * Called to notify the client about a header. |
27 | */ | 27 | */ |
28 | public interface HeaderNotify { | 28 | public interface HeaderNotify { |
29 | /** | ||
30 | * Called to notify the client about a header. | ||
31 | * @param header the header | ||
32 | */ | ||
29 | void notify(GnunetMessage.Header header); | 33 | void notify(GnunetMessage.Header header); |
30 | } | 34 | } |
diff --git a/src/main/java/org/gnunet/core/InitCallback.java b/src/main/java/org/gnunet/core/InitCallback.java index 889f8cf..7b3548f 100644 --- a/src/main/java/org/gnunet/core/InitCallback.java +++ b/src/main/java/org/gnunet/core/InitCallback.java | |||
@@ -26,5 +26,11 @@ import org.gnunet.util.PeerIdentity; | |||
26 | * Called once the handshake with core was successful. | 26 | * Called once the handshake with core was successful. |
27 | */ | 27 | */ |
28 | public interface InitCallback { | 28 | public interface InitCallback { |
29 | /** | ||
30 | * Called once the handshake with core was successful. | ||
31 | * | ||
32 | * @param myIdentity the identity of the peer that runs | ||
33 | * the core service we connected to | ||
34 | */ | ||
29 | void onInit(PeerIdentity myIdentity); | 35 | void onInit(PeerIdentity myIdentity); |
30 | } | 36 | } |
diff --git a/src/main/java/org/gnunet/core/MessageNotify.java b/src/main/java/org/gnunet/core/MessageNotify.java index b14ce29..7244884 100644 --- a/src/main/java/org/gnunet/core/MessageNotify.java +++ b/src/main/java/org/gnunet/core/MessageNotify.java | |||
@@ -23,6 +23,14 @@ package org.gnunet.core; | |||
23 | import org.gnunet.util.GnunetMessage; | 23 | import org.gnunet.util.GnunetMessage; |
24 | 24 | ||
25 | 25 | ||
26 | /** | ||
27 | * Notify the client about a message. | ||
28 | */ | ||
26 | public interface MessageNotify { | 29 | public interface MessageNotify { |
30 | /** | ||
31 | * Notify the client about a message. | ||
32 | * | ||
33 | * @param messageBody the received message | ||
34 | */ | ||
27 | void notify(GnunetMessage messageBody); | 35 | void notify(GnunetMessage messageBody); |
28 | } | 36 | } |
diff --git a/src/main/java/org/gnunet/core/PeerIdentityContinuation.java b/src/main/java/org/gnunet/core/PeerIdentityContinuation.java index e29af45..2e9ada6 100644 --- a/src/main/java/org/gnunet/core/PeerIdentityContinuation.java +++ b/src/main/java/org/gnunet/core/PeerIdentityContinuation.java | |||
@@ -2,6 +2,14 @@ package org.gnunet.core; | |||
2 | 2 | ||
3 | import org.gnunet.util.PeerIdentity; | 3 | import org.gnunet.util.PeerIdentity; |
4 | 4 | ||
5 | /** | ||
6 | * Continuation that receives the peer's identity. | ||
7 | */ | ||
5 | public interface PeerIdentityContinuation { | 8 | public interface PeerIdentityContinuation { |
9 | /** | ||
10 | * Called with the peer identity. | ||
11 | * | ||
12 | * @param peerIdentity the peer identity | ||
13 | */ | ||
6 | public void cont(PeerIdentity peerIdentity); | 14 | public void cont(PeerIdentity peerIdentity); |
7 | } | 15 | } |
diff --git a/src/main/java/org/gnunet/core/package-info.java b/src/main/java/org/gnunet/core/package-info.java index 7feb82c..d078d72 100644 --- a/src/main/java/org/gnunet/core/package-info.java +++ b/src/main/java/org/gnunet/core/package-info.java | |||
@@ -19,6 +19,6 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * API for the GNUnet CORE service. | 22 | * Communication with connected peers. |
23 | */ | 23 | */ |
24 | package org.gnunet.core; | 24 | package org.gnunet.core; |
diff --git a/src/main/java/org/gnunet/dht/DistributedHashTable.java b/src/main/java/org/gnunet/dht/DistributedHashTable.java index 0246992..27bac92 100644 --- a/src/main/java/org/gnunet/dht/DistributedHashTable.java +++ b/src/main/java/org/gnunet/dht/DistributedHashTable.java | |||
@@ -21,6 +21,7 @@ | |||
21 | package org.gnunet.dht; | 21 | package org.gnunet.dht; |
22 | 22 | ||
23 | import com.google.common.base.Charsets; | 23 | import com.google.common.base.Charsets; |
24 | import org.gnunet.dht.messages.*; | ||
24 | import org.gnunet.mq.Envelope; | 25 | import org.gnunet.mq.Envelope; |
25 | import org.gnunet.requests.MatchingRequestContainer; | 26 | import org.gnunet.requests.MatchingRequestContainer; |
26 | import org.gnunet.requests.Request; | 27 | import org.gnunet.requests.Request; |
@@ -37,7 +38,7 @@ import java.util.List; | |||
37 | import java.util.Set; | 38 | import java.util.Set; |
38 | 39 | ||
39 | /** | 40 | /** |
40 | * API for the gnunet dht service. | 41 | * API for the GNUnet dht service. |
41 | * <p/> | 42 | * <p/> |
42 | * Stores data under a key, distributed across the network. | 43 | * Stores data under a key, distributed across the network. |
43 | * <p/> | 44 | * <p/> |
@@ -230,6 +231,7 @@ public class DistributedHashTable { | |||
230 | 231 | ||
231 | @Override | 232 | @Override |
232 | public void handleError() { | 233 | public void handleError() { |
234 | // FIXME | ||
233 | } | 235 | } |
234 | } | 236 | } |
235 | 237 | ||
@@ -256,12 +258,10 @@ public class DistributedHashTable { | |||
256 | * @param routeOptions additional options | 258 | * @param routeOptions additional options |
257 | * @param type type of the data to store | 259 | * @param type type of the data to store |
258 | * @param expiration how long should the value be stored? TODO: what is the maximum? | 260 | * @param expiration how long should the value be stored? TODO: what is the maximum? |
259 | * @param timeout how long after we give up on storing the value? | ||
260 | * @param cont called after the put operation failed or succeeded | 261 | * @param cont called after the put operation failed or succeeded |
261 | */ | 262 | */ |
262 | public void put(HashCode key, byte[] data, int replicationLevel, Set<RouteOption> routeOptions, | 263 | public void put(HashCode key, byte[] data, int replicationLevel, Set<RouteOption> routeOptions, |
263 | int type, AbsoluteTime expiration, | 264 | int type, AbsoluteTime expiration, final Continuation cont) { |
264 | RelativeTime timeout, final Continuation cont) { | ||
265 | PutRequest pr = new PutRequest(); | 265 | PutRequest pr = new PutRequest(); |
266 | pr.key = key; | 266 | pr.key = key; |
267 | pr.data = data; | 267 | pr.data = data; |
@@ -296,10 +296,21 @@ public class DistributedHashTable { | |||
296 | getRequest.type = type; | 296 | getRequest.type = type; |
297 | getRequest.replication = type; | 297 | getRequest.replication = type; |
298 | getRequest.xquery = xquery; | 298 | getRequest.xquery = xquery; |
299 | getRequest.replication = replication; | ||
299 | 300 | ||
300 | return getRequests.addRequest(getRequest.uid, getRequest); | 301 | return getRequests.addRequest(getRequest.uid, getRequest); |
301 | } | 302 | } |
302 | 303 | ||
304 | /** | ||
305 | * Start monitoring certain types of requests. | ||
306 | * | ||
307 | * @param blockType block type of requests we're interested in | ||
308 | * @param key key we're interested in | ||
309 | * @param getHandler listener for get requests | ||
310 | * @param getResponseHandler listener for get responses | ||
311 | * @param putHandler listener for put requests | ||
312 | * @return a handle to cancel the monitoring | ||
313 | */ | ||
303 | public Cancelable startMonitor(int blockType, HashCode key, MonitorGetHandler getHandler, | 314 | public Cancelable startMonitor(int blockType, HashCode key, MonitorGetHandler getHandler, |
304 | MonitorGetResponseHandler getResponseHandler, | 315 | MonitorGetResponseHandler getResponseHandler, |
305 | MonitorPutHandler putHandler) { | 316 | MonitorPutHandler putHandler) { |
@@ -389,17 +400,17 @@ public class DistributedHashTable { | |||
389 | 400 | ||
390 | dht.put(new HashCode(key), data.getBytes(), replication, EnumSet.of(RouteOption.NONE), | 401 | dht.put(new HashCode(key), data.getBytes(), replication, EnumSet.of(RouteOption.NONE), |
391 | BlockType.TEST.val, AbsoluteTime.now().add(RelativeTime.HOUR), | 402 | BlockType.TEST.val, AbsoluteTime.now().add(RelativeTime.HOUR), |
392 | RelativeTime.SECOND, new Continuation() { | 403 | new Continuation() { |
393 | @Override | 404 | @Override |
394 | public void cont(boolean success) { | 405 | public void cont(boolean success) { |
395 | if (success) { | 406 | if (success) { |
396 | System.out.println("put getRequestIdentifier sent"); | 407 | System.out.println("put getRequestIdentifier sent"); |
397 | } else { | 408 | } else { |
398 | System.out.println("error"); | 409 | System.out.println("error"); |
399 | } | 410 | } |
400 | dht.destroy(); | 411 | dht.destroy(); |
401 | } | 412 | } |
402 | }); | 413 | }); |
403 | } else if (monitor) { | 414 | } else if (monitor) { |
404 | final DistributedHashTable dht = new DistributedHashTable(cfg); | 415 | final DistributedHashTable dht = new DistributedHashTable(cfg); |
405 | dht.startMonitor(BlockType.TEST.val, null, | 416 | dht.startMonitor(BlockType.TEST.val, null, |
diff --git a/src/main/java/org/gnunet/dht/MonitorGetHandler.java b/src/main/java/org/gnunet/dht/MonitorGetHandler.java index d3f5d5f..d2ce36f 100644 --- a/src/main/java/org/gnunet/dht/MonitorGetHandler.java +++ b/src/main/java/org/gnunet/dht/MonitorGetHandler.java | |||
@@ -23,8 +23,20 @@ package org.gnunet.dht; | |||
23 | import org.gnunet.util.HashCode; | 23 | import org.gnunet.util.HashCode; |
24 | import org.gnunet.util.PeerIdentity; | 24 | import org.gnunet.util.PeerIdentity; |
25 | 25 | ||
26 | 26 | /** | |
27 | * Listener for monitoring get requests. | ||
28 | */ | ||
27 | public interface MonitorGetHandler { | 29 | public interface MonitorGetHandler { |
30 | /** | ||
31 | * Called when a get request happens. | ||
32 | * | ||
33 | * @param options options of the request | ||
34 | * @param type type of the request | ||
35 | * @param hopCount hop count of the request | ||
36 | * @param desiredReplicationLevel desired replication level for the request | ||
37 | * @param getPath path of the get request | ||
38 | * @param key key for the request | ||
39 | */ | ||
28 | void onGet(int options, int type, int hopCount, int desiredReplicationLevel, PeerIdentity[] getPath, | 40 | void onGet(int options, int type, int hopCount, int desiredReplicationLevel, PeerIdentity[] getPath, |
29 | HashCode key); | 41 | HashCode key); |
30 | } | 42 | } |
diff --git a/src/main/java/org/gnunet/dht/MonitorGetResponseHandler.java b/src/main/java/org/gnunet/dht/MonitorGetResponseHandler.java index ff03cce..c0710c9 100644 --- a/src/main/java/org/gnunet/dht/MonitorGetResponseHandler.java +++ b/src/main/java/org/gnunet/dht/MonitorGetResponseHandler.java | |||
@@ -25,7 +25,20 @@ import org.gnunet.util.HashCode; | |||
25 | import org.gnunet.util.PeerIdentity; | 25 | import org.gnunet.util.PeerIdentity; |
26 | 26 | ||
27 | 27 | ||
28 | /** | ||
29 | * Listener for monitoring get responses. | ||
30 | */ | ||
28 | public interface MonitorGetResponseHandler { | 31 | public interface MonitorGetResponseHandler { |
32 | /** | ||
33 | * Called when a get response happens. | ||
34 | * | ||
35 | * @param type | ||
36 | * @param getPath | ||
37 | * @param putPath | ||
38 | * @param expiration | ||
39 | * @param key | ||
40 | * @param data | ||
41 | */ | ||
29 | void onGetResponse(int type, PeerIdentity[] getPath, PeerIdentity[] putPath, AbsoluteTimeMessage expiration, | 42 | void onGetResponse(int type, PeerIdentity[] getPath, PeerIdentity[] putPath, AbsoluteTimeMessage expiration, |
30 | HashCode key, byte[] data); | 43 | HashCode key, byte[] data); |
31 | } | 44 | } |
diff --git a/src/main/java/org/gnunet/dht/MonitorPutHandler.java b/src/main/java/org/gnunet/dht/MonitorPutHandler.java index 0abb79b..1fac89e 100644 --- a/src/main/java/org/gnunet/dht/MonitorPutHandler.java +++ b/src/main/java/org/gnunet/dht/MonitorPutHandler.java | |||
@@ -24,7 +24,9 @@ import org.gnunet.util.AbsoluteTimeMessage; | |||
24 | import org.gnunet.util.HashCode; | 24 | import org.gnunet.util.HashCode; |
25 | import org.gnunet.util.PeerIdentity; | 25 | import org.gnunet.util.PeerIdentity; |
26 | 26 | ||
27 | 27 | /** | |
28 | * | ||
29 | */ | ||
28 | public interface MonitorPutHandler { | 30 | public interface MonitorPutHandler { |
29 | void onPut(int options, int type, int hop_count, AbsoluteTimeMessage expirationTime, PeerIdentity[] putPath, | 31 | void onPut(int options, int type, int hop_count, AbsoluteTimeMessage expirationTime, PeerIdentity[] putPath, |
30 | HashCode key, byte[] data); | 32 | HashCode key, byte[] data); |
diff --git a/src/main/java/org/gnunet/gns/Gns.java b/src/main/java/org/gnunet/gns/Gns.java index 2b10296..0e64ae0 100644 --- a/src/main/java/org/gnunet/gns/Gns.java +++ b/src/main/java/org/gnunet/gns/Gns.java | |||
@@ -130,6 +130,9 @@ public class Gns { | |||
130 | } | 130 | } |
131 | 131 | ||
132 | 132 | ||
133 | /** | ||
134 | * Disconnect from the GNS service. | ||
135 | */ | ||
133 | public void disconnect() { | 136 | public void disconnect() { |
134 | client.disconnect(); | 137 | client.disconnect(); |
135 | client = null; | 138 | client = null; |
diff --git a/src/main/java/org/gnunet/gns/GnsRecord.java b/src/main/java/org/gnunet/gns/GnsRecord.java index cd1108f..657d4e7 100644 --- a/src/main/java/org/gnunet/gns/GnsRecord.java +++ b/src/main/java/org/gnunet/gns/GnsRecord.java | |||
@@ -36,6 +36,9 @@ import java.lang.reflect.InvocationTargetException; | |||
36 | import java.lang.reflect.Method; | 36 | import java.lang.reflect.Method; |
37 | import java.util.Map; | 37 | import java.util.Map; |
38 | 38 | ||
39 | /** | ||
40 | * A GNS record. | ||
41 | */ | ||
39 | public class GnsRecord implements Message { | 42 | public class GnsRecord implements Message { |
40 | private static final Logger logger = LoggerFactory | 43 | private static final Logger logger = LoggerFactory |
41 | .getLogger(GnsRecord.class); | 44 | .getLogger(GnsRecord.class); |
diff --git a/src/main/java/org/gnunet/gns/GnsTool.java b/src/main/java/org/gnunet/gns/GnsTool.java index 624a5fe..0d33dc1 100644 --- a/src/main/java/org/gnunet/gns/GnsTool.java +++ b/src/main/java/org/gnunet/gns/GnsTool.java | |||
@@ -7,6 +7,9 @@ import org.gnunet.util.Program; | |||
7 | import org.gnunet.util.getopt.Argument; | 7 | import org.gnunet.util.getopt.Argument; |
8 | import org.gnunet.util.getopt.ArgumentAction; | 8 | import org.gnunet.util.getopt.ArgumentAction; |
9 | 9 | ||
10 | /** | ||
11 | * Command line tool for GNS. | ||
12 | */ | ||
10 | public class GnsTool { | 13 | public class GnsTool { |
11 | public static void main(String[] args) { | 14 | public static void main(String[] args) { |
12 | int ret = new Program() { | 15 | int ret = new Program() { |
diff --git a/src/main/java/org/gnunet/gns/RecordFlags.java b/src/main/java/org/gnunet/gns/RecordFlags.java index 58a9141..10c43b9 100644 --- a/src/main/java/org/gnunet/gns/RecordFlags.java +++ b/src/main/java/org/gnunet/gns/RecordFlags.java | |||
@@ -20,7 +20,9 @@ | |||
20 | 20 | ||
21 | package org.gnunet.gns; | 21 | package org.gnunet.gns; |
22 | 22 | ||
23 | 23 | /** | |
24 | * Flags for GNS records. | ||
25 | */ | ||
24 | public interface RecordFlags { | 26 | public interface RecordFlags { |
25 | /** | 27 | /** |
26 | * No special options. | 28 | * No special options. |
diff --git a/src/main/java/org/gnunet/identity/Identity.java b/src/main/java/org/gnunet/identity/Identity.java index ca94a20..7273ef6 100644 --- a/src/main/java/org/gnunet/identity/Identity.java +++ b/src/main/java/org/gnunet/identity/Identity.java | |||
@@ -35,6 +35,9 @@ import org.slf4j.LoggerFactory; | |||
35 | 35 | ||
36 | import java.util.List; | 36 | import java.util.List; |
37 | 37 | ||
38 | /** | ||
39 | * Make requests to the identity service. | ||
40 | */ | ||
38 | public class Identity { | 41 | public class Identity { |
39 | private static final Logger logger = LoggerFactory | 42 | private static final Logger logger = LoggerFactory |
40 | .getLogger(Identity.class); | 43 | .getLogger(Identity.class); |
@@ -46,6 +49,15 @@ public class Identity { | |||
46 | 49 | ||
47 | private static Ego anonymousEgo; | 50 | private static Ego anonymousEgo; |
48 | 51 | ||
52 | /** | ||
53 | * Look up the given ego name. | ||
54 | * | ||
55 | * @param configuration configuration to use for connecting to | ||
56 | * the identity service | ||
57 | * @param egoName ego name to look up | ||
58 | * @param identityCallback handler for lookup result | ||
59 | * @return a handle to cancel the lookup | ||
60 | */ | ||
49 | public static Cancelable lookup(Configuration configuration, | 61 | public static Cancelable lookup(Configuration configuration, |
50 | final String egoName, final IdentityCallback identityCallback) { | 62 | final String egoName, final IdentityCallback identityCallback) { |
51 | final Identity myIdentity = new Identity(); | 63 | final Identity myIdentity = new Identity(); |
@@ -106,20 +118,47 @@ public class Identity { | |||
106 | return cancellationToken; | 118 | return cancellationToken; |
107 | } | 119 | } |
108 | 120 | ||
121 | /** | ||
122 | * An ego. | ||
123 | */ | ||
109 | public static class Ego { | 124 | public static class Ego { |
110 | private String name; | 125 | private String name; |
111 | private EcdsaPrivateKey privateKey; | 126 | private EcdsaPrivateKey privateKey; |
112 | 127 | ||
128 | /** | ||
129 | * Create an ego with the given name and private key. | ||
130 | * | ||
131 | * @param egoName the ego name | ||
132 | * @param privateKey the ego's private key | ||
133 | */ | ||
113 | public Ego(String egoName, EcdsaPrivateKey privateKey) { | 134 | public Ego(String egoName, EcdsaPrivateKey privateKey) { |
114 | this.name = egoName; | 135 | this.name = egoName; |
115 | this.privateKey = privateKey; | 136 | this.privateKey = privateKey; |
116 | } | 137 | } |
138 | |||
139 | /** | ||
140 | * Get the ego's private key. | ||
141 | * | ||
142 | * @return the ego's private key | ||
143 | */ | ||
117 | public EcdsaPrivateKey getPrivateKey() { | 144 | public EcdsaPrivateKey getPrivateKey() { |
118 | return privateKey; | 145 | return privateKey; |
119 | } | 146 | } |
147 | |||
148 | /** | ||
149 | * Compute the ego's public key from its private key. | ||
150 | * | ||
151 | * @return the ego's public key | ||
152 | */ | ||
120 | public EcdsaPublicKey getPublicKey() { | 153 | public EcdsaPublicKey getPublicKey() { |
121 | return privateKey.getPublicKey(); | 154 | return privateKey.getPublicKey(); |
122 | } | 155 | } |
156 | |||
157 | /** | ||
158 | * Get the ego's name. | ||
159 | * | ||
160 | * @return the ego's name | ||
161 | */ | ||
123 | public String getName() { | 162 | public String getName() { |
124 | return name; | 163 | return name; |
125 | } | 164 | } |
@@ -261,6 +300,12 @@ public class Identity { | |||
261 | } | 300 | } |
262 | } | 301 | } |
263 | 302 | ||
303 | /** | ||
304 | * Get the anonymous ego. The anonymous ego has a publicly | ||
305 | * known private key. | ||
306 | * | ||
307 | * @return the anonymous ego | ||
308 | */ | ||
264 | public static Ego getAnonymousEgo() { | 309 | public static Ego getAnonymousEgo() { |
265 | if (anonymousEgo == null) { | 310 | if (anonymousEgo == null) { |
266 | anonymousEgo = new Ego(null, EcdsaPrivateKey.getAnonymous()); | 311 | anonymousEgo = new Ego(null, EcdsaPrivateKey.getAnonymous()); |
@@ -269,10 +314,20 @@ public class Identity { | |||
269 | } | 314 | } |
270 | 315 | ||
271 | 316 | ||
317 | /** | ||
318 | * Create a handle that can connect to the identity service. | ||
319 | * Nothing will happen until calling connect. | ||
320 | */ | ||
272 | public Identity() { | 321 | public Identity() { |
273 | // do nothing | 322 | // do nothing |
274 | } | 323 | } |
275 | 324 | ||
325 | /** | ||
326 | * Connect to the identity service. | ||
327 | * | ||
328 | * @param configuration configuration to use | ||
329 | * @param identityListCallback | ||
330 | */ | ||
276 | public void connect(Configuration configuration, IdentityListCallback identityListCallback) { | 331 | public void connect(Configuration configuration, IdentityListCallback identityListCallback) { |
277 | this.configuration = configuration; | 332 | this.configuration = configuration; |
278 | this.client = new Client("identity", configuration); | 333 | this.client = new Client("identity", configuration); |
@@ -283,6 +338,13 @@ public class Identity { | |||
283 | client.send(m); | 338 | client.send(m); |
284 | } | 339 | } |
285 | 340 | ||
341 | /** | ||
342 | * Get the default ego for a service | ||
343 | * | ||
344 | * @param serviceName name of the service | ||
345 | * @param identityCallback callback that receives the default ego | ||
346 | * @return a handle to cancel the operation | ||
347 | */ | ||
286 | public Cancelable get(String serviceName, IdentityCallback identityCallback) { | 348 | public Cancelable get(String serviceName, IdentityCallback identityCallback) { |
287 | return requests.addRequest(new GetDefaultRequest(serviceName, identityCallback)); | 349 | return requests.addRequest(new GetDefaultRequest(serviceName, identityCallback)); |
288 | } | 350 | } |
@@ -298,6 +360,9 @@ public class Identity { | |||
298 | return requests.addRequest(new SetDefaultRequest(serviceName, ego)); | 360 | return requests.addRequest(new SetDefaultRequest(serviceName, ego)); |
299 | } | 361 | } |
300 | 362 | ||
363 | /** | ||
364 | * Disconnect from the identity service. | ||
365 | */ | ||
301 | public void disconnect() { | 366 | public void disconnect() { |
302 | client.disconnect(); | 367 | client.disconnect(); |
303 | client = null; | 368 | client = null; |
diff --git a/src/main/java/org/gnunet/mesh/Mesh.java b/src/main/java/org/gnunet/mesh/Mesh.java index 32f9ba0..ede7761 100644 --- a/src/main/java/org/gnunet/mesh/Mesh.java +++ b/src/main/java/org/gnunet/mesh/Mesh.java | |||
@@ -77,7 +77,7 @@ public class Mesh { | |||
77 | /** | 77 | /** |
78 | * Called whenever a tunnel was destroyed. | 78 | * Called whenever a tunnel was destroyed. |
79 | */ | 79 | */ |
80 | private TunnelEndHandler tunnelEndHandler; | 80 | private ChannelEndHandler channelEndHandler; |
81 | 81 | ||
82 | /** | 82 | /** |
83 | * Message handler for messages received through | 83 | * Message handler for messages received through |
@@ -108,10 +108,8 @@ public class Mesh { | |||
108 | 108 | ||
109 | /** | 109 | /** |
110 | * A tunnel to a remote peer. | 110 | * A tunnel to a remote peer. |
111 | * @param <T> type of context data for the tunnel | ||
112 | */ | 111 | */ |
113 | public class Channel<T> extends MessageQueue { | 112 | public class Channel extends MessageQueue { |
114 | private T context; | ||
115 | private final int opt; | 113 | private final int opt; |
116 | final PeerIdentity peer; | 114 | final PeerIdentity peer; |
117 | final int port; | 115 | final int port; |
@@ -129,13 +127,12 @@ public class Mesh { | |||
129 | * Create a new tunnel (we're initiator and will be allowed to add/remove peers | 127 | * Create a new tunnel (we're initiator and will be allowed to add/remove peers |
130 | * and to broadcast). | 128 | * and to broadcast). |
131 | * | 129 | * |
132 | * @param context tunnel context | ||
133 | * @param peer peer identity the tunnel should go to | 130 | * @param peer peer identity the tunnel should go to |
134 | * @param port Port number. | 131 | * @param port Port number. |
135 | * @param nobuffer Flag for disabling buffering on relay nodes. | 132 | * @param nobuffer Flag for disabling buffering on relay nodes. |
136 | * @param reliable Flag for end-to-end reliability. | 133 | * @param reliable Flag for end-to-end reliability. |
137 | */ | 134 | */ |
138 | public Channel(PeerIdentity peer, int port, boolean nobuffer, boolean reliable, T context) { | 135 | public Channel(PeerIdentity peer, int port, boolean nobuffer, boolean reliable) { |
139 | this(peer, 0, port, nobuffer, reliable); | 136 | this(peer, 0, port, nobuffer, reliable); |
140 | TunnelCreateMessage tcm = new TunnelCreateMessage(); | 137 | TunnelCreateMessage tcm = new TunnelCreateMessage(); |
141 | tcm.otherEnd = peer; | 138 | tcm.otherEnd = peer; |
@@ -225,14 +222,6 @@ public class Mesh { | |||
225 | envelopeCanceler = null; | 222 | envelopeCanceler = null; |
226 | } | 223 | } |
227 | 224 | ||
228 | public T getContext() { | ||
229 | return context; | ||
230 | } | ||
231 | |||
232 | public void setContext(T newContext) { | ||
233 | context = newContext; | ||
234 | } | ||
235 | |||
236 | void handleAck() { | 225 | void handleAck() { |
237 | ackCount++; | 226 | ackCount++; |
238 | logger.debug("got ack for tunnel id " + tunnelId); | 227 | logger.debug("got ack for tunnel id " + tunnelId); |
@@ -287,7 +276,7 @@ public class Mesh { | |||
287 | t.destroyedByService = true; | 276 | t.destroyedByService = true; |
288 | logger.debug("tunnel destroyed by service"); | 277 | logger.debug("tunnel destroyed by service"); |
289 | t.destroy(); | 278 | t.destroy(); |
290 | tunnelEndHandler.onChannelEnd(t); | 279 | channelEndHandler.onChannelEnd(t); |
291 | } | 280 | } |
292 | 281 | ||
293 | public void visit(RejectMessage m) { | 282 | public void visit(RejectMessage m) { |
@@ -300,15 +289,15 @@ public class Mesh { | |||
300 | t.destroyedByService = true; | 289 | t.destroyedByService = true; |
301 | logger.debug("tunnel destroyed by service (nack/reject)"); | 290 | logger.debug("tunnel destroyed by service (nack/reject)"); |
302 | t.destroy(); | 291 | t.destroy(); |
303 | tunnelEndHandler.onChannelEnd(t); | 292 | channelEndHandler.onChannelEnd(t); |
304 | } | 293 | } |
305 | 294 | ||
306 | @Override | 295 | @Override |
307 | public void handleError() { | 296 | public void handleError() { |
308 | logger.warn("lost connection to mesh service, reconnecting"); | 297 | logger.warn("lost connection to mesh service, reconnecting"); |
309 | if (null != tunnelEndHandler) { | 298 | if (null != channelEndHandler) { |
310 | for (Channel t : tunnelMap.values()) { | 299 | for (Channel t : tunnelMap.values()) { |
311 | tunnelEndHandler.onChannelEnd(t); | 300 | channelEndHandler.onChannelEnd(t); |
312 | } | 301 | } |
313 | } | 302 | } |
314 | tunnelMap.clear(); | 303 | tunnelMap.clear(); |
@@ -324,17 +313,17 @@ public class Mesh { | |||
324 | * | 313 | * |
325 | * @param cfg configuration to use | 314 | * @param cfg configuration to use |
326 | * @param inboundChannelHandler called when an inbound channel is established | 315 | * @param inboundChannelHandler called when an inbound channel is established |
327 | * @param tunnelEndHandler called when a tunnel is destroyed (either by the client calling Tunnel.destroy(), | 316 | * @param channelEndHandler called when a tunnel is destroyed (either by the client calling Tunnel.destroy(), |
328 | * or by the service) | 317 | * or by the service) |
329 | * @param messageReceiver runabout for messages we are interested in | 318 | * @param messageReceiver runabout for messages we are interested in |
330 | * @param ports ports to listen on | 319 | * @param ports ports to listen on |
331 | */ | 320 | */ |
332 | public Mesh(Configuration cfg, InboundChannelHandler inboundChannelHandler, | 321 | public Mesh(Configuration cfg, InboundChannelHandler inboundChannelHandler, |
333 | TunnelEndHandler tunnelEndHandler, MeshRunabout messageReceiver, int... ports) { | 322 | ChannelEndHandler channelEndHandler, MeshRunabout messageReceiver, int... ports) { |
334 | if (null == tunnelEndHandler) { | 323 | if (null == channelEndHandler) { |
335 | throw new AssertionError("tunnel end handler may not be null"); | 324 | throw new AssertionError("tunnel end handler may not be null"); |
336 | } | 325 | } |
337 | this.tunnelEndHandler = tunnelEndHandler; | 326 | this.channelEndHandler = channelEndHandler; |
338 | this.messageReceiver = messageReceiver; | 327 | this.messageReceiver = messageReceiver; |
339 | this.ports = ports; | 328 | this.ports = ports; |
340 | this.inboundChannelHandler = inboundChannelHandler; | 329 | this.inboundChannelHandler = inboundChannelHandler; |
@@ -352,14 +341,14 @@ public class Mesh { | |||
352 | } | 341 | } |
353 | 342 | ||
354 | /** | 343 | /** |
355 | * Connect to the mesh service. Use this constructor if you are not interested in inbound tunnels. | 344 | * Connect to the mesh service. Use this constructor if you are not interested in inbound channels. |
356 | * | 345 | * |
357 | * @param cfg configuration to use | 346 | * @param cfg configuration to use |
358 | * @param tunnelEndHandler called when a tunnel is destroyed (either by the client calling Tunnel.destroy(), | 347 | * @param channelEndHandler called when a tunnel is destroyed (either by the client calling Channel.destroy(), |
359 | * or by the service) | 348 | * or by the service) |
360 | */ | 349 | */ |
361 | public Mesh(Configuration cfg, TunnelEndHandler tunnelEndHandler, MeshRunabout messageReceiver) { | 350 | public Mesh(Configuration cfg, ChannelEndHandler channelEndHandler, MeshRunabout messageReceiver) { |
362 | this(cfg, null, tunnelEndHandler, messageReceiver); | 351 | this(cfg, null, channelEndHandler, messageReceiver); |
363 | } | 352 | } |
364 | 353 | ||
365 | /** | 354 | /** |
@@ -367,20 +356,26 @@ public class Mesh { | |||
367 | * and don't want to receive messages. | 356 | * and don't want to receive messages. |
368 | * | 357 | * |
369 | * @param cfg configuration to use | 358 | * @param cfg configuration to use |
370 | * @param tunnelEndHandler called when a tunnel is destroyed (either by the client calling Tunnel.destroy(), | 359 | * @param channelEndHandler called when a tunnel is destroyed (either by the client calling Tunnel.destroy(), |
371 | * or by the service) | 360 | * or by the service) |
372 | */ | 361 | */ |
373 | public Mesh(Configuration cfg, TunnelEndHandler tunnelEndHandler) { | 362 | public Mesh(Configuration cfg, ChannelEndHandler channelEndHandler) { |
374 | this(cfg, null, tunnelEndHandler, null); | 363 | this(cfg, null, channelEndHandler, null); |
375 | } | 364 | } |
376 | 365 | ||
377 | public <T> Channel<T> createTunnel(PeerIdentity peer, int port, boolean nobuffer, boolean reliable, T initialContext) { | ||
378 | return new Channel<T>(peer, port, nobuffer, reliable, initialContext); | ||
379 | } | ||
380 | 366 | ||
381 | public <T> Channel<T> createTunnel(PeerIdentity peer, int port, boolean nobuffer, boolean reliable) { | 367 | /** |
368 | * Create a channel to a peer over the given port, with the given options. | ||
369 | * | ||
370 | * @param peer peer to create a channel to | ||
371 | * @param port port to use | ||
372 | * @param nobuffer true if messages should be buffered | ||
373 | * @param reliable true if transmission should be reliable | ||
374 | * @return a channel | ||
375 | */ | ||
376 | public Channel createChannel(PeerIdentity peer, int port, boolean nobuffer, boolean reliable) { | ||
382 | logger.debug("creating tunnel to peer {} over port {}", peer.toString(), port); | 377 | logger.debug("creating tunnel to peer {} over port {}", peer.toString(), port); |
383 | return new Channel<T>(peer, port, nobuffer, reliable, null); | 378 | return new Channel(peer, port, nobuffer, reliable); |
384 | } | 379 | } |
385 | 380 | ||
386 | /** | 381 | /** |
diff --git a/src/main/java/org/gnunet/nse/package-info.java b/src/main/java/org/gnunet/nse/package-info.java index 3bbc064..45618ba 100644 --- a/src/main/java/org/gnunet/nse/package-info.java +++ b/src/main/java/org/gnunet/nse/package-info.java | |||
@@ -19,6 +19,6 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * API for the gnunet nse service. | 22 | * Retrieve network size estimates. |
23 | */ | 23 | */ |
24 | package org.gnunet.nse; | 24 | package org.gnunet.nse; |
diff --git a/src/main/java/org/gnunet/peerinfo/PeerInfo.java b/src/main/java/org/gnunet/peerinfo/PeerInfo.java index 43c0597..dcd3cc0 100644 --- a/src/main/java/org/gnunet/peerinfo/PeerInfo.java +++ b/src/main/java/org/gnunet/peerinfo/PeerInfo.java | |||
@@ -22,6 +22,10 @@ package org.gnunet.peerinfo; | |||
22 | 22 | ||
23 | import org.gnunet.hello.HelloMessage; | 23 | import org.gnunet.hello.HelloMessage; |
24 | import org.gnunet.mq.Envelope; | 24 | import org.gnunet.mq.Envelope; |
25 | import org.gnunet.peerinfo.messages.InfoEnd; | ||
26 | import org.gnunet.peerinfo.messages.InfoMessage; | ||
27 | import org.gnunet.peerinfo.messages.ListAllPeersMessage; | ||
28 | import org.gnunet.peerinfo.messages.ListPeerMessage; | ||
25 | import org.gnunet.requests.Request; | 29 | import org.gnunet.requests.Request; |
26 | import org.gnunet.requests.SequentialRequestContainer; | 30 | import org.gnunet.requests.SequentialRequestContainer; |
27 | import org.gnunet.util.*; | 31 | import org.gnunet.util.*; |
@@ -97,6 +101,11 @@ public class PeerInfo { | |||
97 | } | 101 | } |
98 | 102 | ||
99 | 103 | ||
104 | /** | ||
105 | * Create a connection to the peerinfo service. | ||
106 | * | ||
107 | * @param cfg configuration to use | ||
108 | */ | ||
100 | public PeerInfo(Configuration cfg) { | 109 | public PeerInfo(Configuration cfg) { |
101 | client = new Client("peerinfo", cfg); | 110 | client = new Client("peerinfo", cfg); |
102 | client.installReceiver(new PeerInfoMessageReceiver()); | 111 | client.installReceiver(new PeerInfoMessageReceiver()); |
@@ -127,6 +136,9 @@ public class PeerInfo { | |||
127 | return iterateRequests.addRequest(r); | 136 | return iterateRequests.addRequest(r); |
128 | } | 137 | } |
129 | 138 | ||
139 | /** | ||
140 | * Disconnect from the peerinfo service. | ||
141 | */ | ||
130 | public void disconnect() { | 142 | public void disconnect() { |
131 | client.disconnect(); | 143 | client.disconnect(); |
132 | } | 144 | } |
diff --git a/src/main/java/org/gnunet/peerinfo/PeerProcessor.java b/src/main/java/org/gnunet/peerinfo/PeerProcessor.java index b096c37..3a76425 100644 --- a/src/main/java/org/gnunet/peerinfo/PeerProcessor.java +++ b/src/main/java/org/gnunet/peerinfo/PeerProcessor.java | |||
@@ -7,6 +7,16 @@ import org.gnunet.util.PeerIdentity; | |||
7 | * Callback class to receive known peers and their HELLOs. | 7 | * Callback class to receive known peers and their HELLOs. |
8 | */ | 8 | */ |
9 | public interface PeerProcessor { | 9 | public interface PeerProcessor { |
10 | /** | ||
11 | * Process a peer and its hello | ||
12 | * | ||
13 | * @param peerIdentity the peer | ||
14 | * @param hello the hello of the peer | ||
15 | */ | ||
10 | public void onPeer(PeerIdentity peerIdentity, HelloMessage hello); | 16 | public void onPeer(PeerIdentity peerIdentity, HelloMessage hello); |
17 | |||
18 | /** | ||
19 | * Called to indicate the end of a peer list. | ||
20 | */ | ||
11 | public void onEnd(); | 21 | public void onEnd(); |
12 | } | 22 | } |
diff --git a/src/main/java/org/gnunet/requests/Request.java b/src/main/java/org/gnunet/requests/Request.java index 53fb3db..80a59ff 100644 --- a/src/main/java/org/gnunet/requests/Request.java +++ b/src/main/java/org/gnunet/requests/Request.java | |||
@@ -84,7 +84,7 @@ import org.gnunet.mq.Envelope; | |||
84 | import org.gnunet.util.Cancelable; | 84 | import org.gnunet.util.Cancelable; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * A getRequestIdentifier that can be put in a getRequestIdentifier container. | 87 | * A request that can be put in a request container. |
88 | */ | 88 | */ |
89 | public abstract class Request implements Cancelable { | 89 | public abstract class Request implements Cancelable { |
90 | /** | 90 | /** |
diff --git a/src/main/java/org/gnunet/requests/SequentialRequestContainer.java b/src/main/java/org/gnunet/requests/SequentialRequestContainer.java index c343812..07a662f 100644 --- a/src/main/java/org/gnunet/requests/SequentialRequestContainer.java +++ b/src/main/java/org/gnunet/requests/SequentialRequestContainer.java | |||
@@ -131,6 +131,12 @@ public class SequentialRequestContainer<T extends Request> extends RequestContai | |||
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | ||
135 | * Add a request to the queue | ||
136 | * | ||
137 | * @param request the request to add | ||
138 | * @return a handle that represents the queued request | ||
139 | */ | ||
134 | public RequestIdentifier<T> addRequest(final T request) { | 140 | public RequestIdentifier<T> addRequest(final T request) { |
135 | final Identifier identifier = new Identifier(request); | 141 | final Identifier identifier = new Identifier(request); |
136 | requests.addLast(identifier); | 142 | requests.addLast(identifier); |
@@ -142,6 +148,9 @@ public class SequentialRequestContainer<T extends Request> extends RequestContai | |||
142 | return identifier; | 148 | return identifier; |
143 | } | 149 | } |
144 | 150 | ||
151 | /** | ||
152 | * Re-send all active requests. | ||
153 | */ | ||
145 | @Override | 154 | @Override |
146 | public void restart() { | 155 | public void restart() { |
147 | LinkedList<Identifier> requestsOld = requests; | 156 | LinkedList<Identifier> requestsOld = requests; |
diff --git a/src/main/java/org/gnunet/requests/SimpleRequestIdentifier.java b/src/main/java/org/gnunet/requests/SimpleRequestIdentifier.java index 5963ce8..7132472 100644 --- a/src/main/java/org/gnunet/requests/SimpleRequestIdentifier.java +++ b/src/main/java/org/gnunet/requests/SimpleRequestIdentifier.java | |||
@@ -18,10 +18,8 @@ | |||
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | |||
22 | package org.gnunet.requests; | 21 | package org.gnunet.requests; |
23 | 22 | ||
24 | |||
25 | import org.gnunet.mq.Envelope; | 23 | import org.gnunet.mq.Envelope; |
26 | import org.gnunet.mq.MessageQueue; | 24 | import org.gnunet.mq.MessageQueue; |
27 | import org.gnunet.mq.NotifySentHandler; | 25 | import org.gnunet.mq.NotifySentHandler; |
@@ -29,7 +27,6 @@ import org.gnunet.util.Cancelable; | |||
29 | import org.gnunet.util.RelativeTime; | 27 | import org.gnunet.util.RelativeTime; |
30 | import org.gnunet.util.Scheduler; | 28 | import org.gnunet.util.Scheduler; |
31 | 29 | ||
32 | |||
33 | abstract class SimpleRequestIdentifier<T extends Request> implements RequestIdentifier<T> { | 30 | abstract class SimpleRequestIdentifier<T extends Request> implements RequestIdentifier<T> { |
34 | private final T request; | 31 | private final T request; |
35 | /** | 32 | /** |
diff --git a/src/main/java/org/gnunet/requests/TimeoutHandler.java b/src/main/java/org/gnunet/requests/TimeoutHandler.java index eca067e..f9715de 100644 --- a/src/main/java/org/gnunet/requests/TimeoutHandler.java +++ b/src/main/java/org/gnunet/requests/TimeoutHandler.java | |||
@@ -21,7 +21,7 @@ | |||
21 | package org.gnunet.requests; | 21 | package org.gnunet.requests; |
22 | 22 | ||
23 | /** | 23 | /** |
24 | * Callback object for handling getRequestIdentifier timeouts. | 24 | * Callback object for handling request timeouts. |
25 | */ | 25 | */ |
26 | public interface TimeoutHandler { | 26 | public interface TimeoutHandler { |
27 | void onTimeout(); | 27 | void onTimeout(); |
diff --git a/src/main/java/org/gnunet/statistics/Statistics.java b/src/main/java/org/gnunet/statistics/Statistics.java index d8b8f3e..d642962 100644 --- a/src/main/java/org/gnunet/statistics/Statistics.java +++ b/src/main/java/org/gnunet/statistics/Statistics.java | |||
@@ -131,6 +131,11 @@ public class Statistics { | |||
131 | } | 131 | } |
132 | } | 132 | } |
133 | 133 | ||
134 | /** | ||
135 | * Create a connection to the statistics service. | ||
136 | * | ||
137 | * @param cfg configuration to use | ||
138 | */ | ||
134 | public Statistics(Configuration cfg) { | 139 | public Statistics(Configuration cfg) { |
135 | client = new Client("statistics", cfg); | 140 | client = new Client("statistics", cfg); |
136 | client.installReceiver(new StatisticsMessageReceiver()); | 141 | client.installReceiver(new StatisticsMessageReceiver()); |
@@ -139,9 +144,7 @@ public class Statistics { | |||
139 | } | 144 | } |
140 | 145 | ||
141 | /** | 146 | /** |
142 | * Retrieve values from statistics. | 147 | * Retrieve a statistics value of a subsystem. |
143 | * Only one instance of this getRequestIdentifier may be active simultaneously. | ||
144 | * Upon cancellation | ||
145 | * | 148 | * |
146 | * @param timeout time after we give up and call receiver.onTimeout | 149 | * @param timeout time after we give up and call receiver.onTimeout |
147 | * @param subsystem the subsystem of interest | 150 | * @param subsystem the subsystem of interest |
@@ -164,6 +167,19 @@ public class Statistics { | |||
164 | } | 167 | } |
165 | 168 | ||
166 | /** | 169 | /** |
170 | * Retrieve all statistics value of a subsystem. | ||
171 | * | ||
172 | * @param timeout time after we give up and call receiver.onTimeout | ||
173 | * @param subsystem the subsystem of interest | ||
174 | * @param receiver callback | ||
175 | * @return handle to onCancel the getRequestIdentifier | ||
176 | */ | ||
177 | public Cancelable get(RelativeTime timeout, final String subsystem, | ||
178 | final StatisticsReceiver receiver) { | ||
179 | return get(timeout, subsystem, "", receiver); | ||
180 | } | ||
181 | |||
182 | /** | ||
167 | * Sets a statistics value asynchronously. | 183 | * Sets a statistics value asynchronously. |
168 | * | 184 | * |
169 | * @param name name of the entry | 185 | * @param name name of the entry |
@@ -226,9 +242,10 @@ public class Statistics { | |||
226 | } | 242 | } |
227 | 243 | ||
228 | /** | 244 | /** |
229 | * Destroy handle to the statistics service. Always finishes writing pending values. | 245 | * Destroy handle to the statistics service. |
230 | * | 246 | * |
231 | * @param syncFirst Wait until the statistics service has received all our updates. | 247 | * @param syncFirst If true, wait until the statistics service has received all our updates. |
248 | * If false, pending updates may be lost. | ||
232 | */ | 249 | */ |
233 | public void destroy(boolean syncFirst) { | 250 | public void destroy(boolean syncFirst) { |
234 | if (destroyRequested) | 251 | if (destroyRequested) |
diff --git a/src/main/java/org/gnunet/statistics/StatisticsReceiver.java b/src/main/java/org/gnunet/statistics/StatisticsReceiver.java index 0c25acc..d30a93e 100644 --- a/src/main/java/org/gnunet/statistics/StatisticsReceiver.java +++ b/src/main/java/org/gnunet/statistics/StatisticsReceiver.java | |||
@@ -21,9 +21,28 @@ | |||
21 | package org.gnunet.statistics; | 21 | package org.gnunet.statistics; |
22 | 22 | ||
23 | 23 | ||
24 | 24 | /** | |
25 | * Handler for statistics results. | ||
26 | */ | ||
25 | public interface StatisticsReceiver { | 27 | public interface StatisticsReceiver { |
28 | /** | ||
29 | * Called when having received a statistics value from the service. | ||
30 | * | ||
31 | * @param subsystem subsystem of the value | ||
32 | * @param name name of the value | ||
33 | * @param value the value | ||
34 | */ | ||
26 | public void onReceive(String subsystem, String name, long value); | 35 | public void onReceive(String subsystem, String name, long value); |
36 | |||
37 | /** | ||
38 | * Called when a statistics request times out. Never called | ||
39 | * for watchers. | ||
40 | */ | ||
27 | public void onTimeout(); | 41 | public void onTimeout(); |
42 | |||
43 | /** | ||
44 | * Called when all values for the request have been received. | ||
45 | * Never called for watchers. | ||
46 | */ | ||
28 | public void onDone(); | 47 | public void onDone(); |
29 | } | 48 | } |
diff --git a/src/main/java/org/gnunet/statistics/StatisticsWatcher.java b/src/main/java/org/gnunet/statistics/StatisticsWatcher.java index 11328b7..5fdd6bc 100644 --- a/src/main/java/org/gnunet/statistics/StatisticsWatcher.java +++ b/src/main/java/org/gnunet/statistics/StatisticsWatcher.java | |||
@@ -1,5 +1,15 @@ | |||
1 | package org.gnunet.statistics; | 1 | package org.gnunet.statistics; |
2 | 2 | ||
3 | /** | ||
4 | * Listener for statistics changes. | ||
5 | */ | ||
3 | public interface StatisticsWatcher { | 6 | public interface StatisticsWatcher { |
7 | /** | ||
8 | * Called when receiving a change notification for a statistics value. | ||
9 | * | ||
10 | * @param subsystem subsystem of the value that changed | ||
11 | * @param name name of the value that changed | ||
12 | * @param value new value | ||
13 | */ | ||
4 | public void onReceive(String subsystem, String name, long value); | 14 | public void onReceive(String subsystem, String name, long value); |
5 | } | 15 | } |
diff --git a/src/main/java/org/gnunet/testbed/ControllerStatusCallback.java b/src/main/java/org/gnunet/testbed/ControllerStatusCallback.java index ba9e56f..2d4930c 100644 --- a/src/main/java/org/gnunet/testbed/ControllerStatusCallback.java +++ b/src/main/java/org/gnunet/testbed/ControllerStatusCallback.java | |||
@@ -3,7 +3,19 @@ package org.gnunet.testbed; | |||
3 | 3 | ||
4 | import org.gnunet.util.Configuration; | 4 | import org.gnunet.util.Configuration; |
5 | 5 | ||
6 | /** | ||
7 | * Listener for controller status changes. | ||
8 | */ | ||
6 | public interface ControllerStatusCallback { | 9 | public interface ControllerStatusCallback { |
10 | /** | ||
11 | * Called on successful startup. | ||
12 | * | ||
13 | * @param cfg configuration | ||
14 | */ | ||
7 | void onStartupSuccess(Configuration cfg); | 15 | void onStartupSuccess(Configuration cfg); |
16 | |||
17 | /** | ||
18 | * Called on failed startup. | ||
19 | */ | ||
8 | void onStartupFailure(); | 20 | void onStartupFailure(); |
9 | } | 21 | } |
diff --git a/src/main/java/org/gnunet/testbed/HostRegistrationCompletion.java b/src/main/java/org/gnunet/testbed/HostRegistrationCompletion.java index 72196ca..e0f46fe 100644 --- a/src/main/java/org/gnunet/testbed/HostRegistrationCompletion.java +++ b/src/main/java/org/gnunet/testbed/HostRegistrationCompletion.java | |||
@@ -1,4 +1,7 @@ | |||
1 | package org.gnunet.testbed; | 1 | package org.gnunet.testbed; |
2 | 2 | ||
3 | public class HostRegistrationCompletion { | 3 | /** |
4 | * (not yet implemented) | ||
5 | */ | ||
6 | public interface HostRegistrationCompletion { | ||
4 | } | 7 | } |
diff --git a/src/main/java/org/gnunet/testbed/OperationCompletionCallback.java b/src/main/java/org/gnunet/testbed/OperationCompletionCallback.java index cc1cfa1..b1e974b 100644 --- a/src/main/java/org/gnunet/testbed/OperationCompletionCallback.java +++ b/src/main/java/org/gnunet/testbed/OperationCompletionCallback.java | |||
@@ -1,7 +1,19 @@ | |||
1 | package org.gnunet.testbed; | 1 | package org.gnunet.testbed; |
2 | 2 | ||
3 | 3 | ||
4 | /** | ||
5 | * Called on completed operation or error. | ||
6 | */ | ||
4 | public interface OperationCompletionCallback { | 7 | public interface OperationCompletionCallback { |
8 | /** | ||
9 | * Called on completed operation. | ||
10 | */ | ||
5 | void onCompletion(); | 11 | void onCompletion(); |
12 | |||
13 | /** | ||
14 | * Called on error. | ||
15 | * | ||
16 | * @param emsg error message | ||
17 | */ | ||
6 | void onError(String emsg); | 18 | void onError(String emsg); |
7 | } | 19 | } |
diff --git a/src/main/java/org/gnunet/util/Connection.java b/src/main/java/org/gnunet/util/Connection.java index d735b27..3f87180 100644 --- a/src/main/java/org/gnunet/util/Connection.java +++ b/src/main/java/org/gnunet/util/Connection.java | |||
@@ -592,7 +592,7 @@ public class Connection { | |||
592 | * | 592 | * |
593 | * @param timeout timeout | 593 | * @param timeout timeout |
594 | * @param cont continuation to call | 594 | * @param cont continuation to call |
595 | * @return | 595 | * @return a handle to cancel the notification |
596 | */ | 596 | */ |
597 | Cancelable notifyConnected(RelativeTime timeout, final Continuation cont) { | 597 | Cancelable notifyConnected(RelativeTime timeout, final Continuation cont) { |
598 | if (notifyConnectedTimeout != null) { | 598 | if (notifyConnectedTimeout != null) { |
diff --git a/src/main/java/org/gnunet/util/crypto/EcdsaSignature.java b/src/main/java/org/gnunet/util/crypto/EcdsaSignature.java index 9e01a6f..28dfb3e 100644 --- a/src/main/java/org/gnunet/util/crypto/EcdsaSignature.java +++ b/src/main/java/org/gnunet/util/crypto/EcdsaSignature.java | |||
@@ -80,9 +80,16 @@ public class EcdsaSignature implements Message { | |||
80 | HashCode h = HashCode.hash(m); | 80 | HashCode h = HashCode.hash(m); |
81 | BigInteger z = new BigInteger(1, h.data); | 81 | BigInteger z = new BigInteger(1, h.data); |
82 | BigInteger sCoeff = Ed25519.decodeScalar(s); | 82 | BigInteger sCoeff = Ed25519.decodeScalar(s); |
83 | |||
84 | if (sCoeff.equals(BigInteger.ZERO) || sCoeff.compareTo(Ed25519.l) >= 0) { | ||
85 | return false; | ||
86 | } | ||
87 | |||
83 | BigInteger rCoeff = Ed25519.decodeScalar(r); | 88 | BigInteger rCoeff = Ed25519.decodeScalar(r); |
89 | if (rCoeff.equals(BigInteger.ZERO) || rCoeff.compareTo(Ed25519.l) >= 0) { | ||
90 | return false; | ||
91 | } | ||
84 | 92 | ||
85 | // FIXME: check range of s and r | ||
86 | BigInteger w = sCoeff.modInverse(Ed25519.l); | 93 | BigInteger w = sCoeff.modInverse(Ed25519.l); |
87 | BigInteger u1 = z.multiply(w).mod(Ed25519.l); | 94 | BigInteger u1 = z.multiply(w).mod(Ed25519.l); |
88 | BigInteger u2 = rCoeff.multiply(w).mod(Ed25519.l); | 95 | BigInteger u2 = rCoeff.multiply(w).mod(Ed25519.l); |
diff --git a/src/main/java/org/gnunet/util/crypto/EddsaSignature.java b/src/main/java/org/gnunet/util/crypto/EddsaSignature.java index ff78908..c9be7e5 100644 --- a/src/main/java/org/gnunet/util/crypto/EddsaSignature.java +++ b/src/main/java/org/gnunet/util/crypto/EddsaSignature.java | |||
@@ -61,9 +61,9 @@ public class EddsaSignature implements Message { | |||
61 | /** | 61 | /** |
62 | * Verify the signature on a message with given purpose. | 62 | * Verify the signature on a message with given purpose. |
63 | * | 63 | * |
64 | * @param m | 64 | * @param m the message signed by this signature |
65 | * @param publicKey | 65 | * @param publicKey public key of the signer |
66 | * @return | 66 | * @return true if the signature is valid, false otherwise |
67 | */ | 67 | */ |
68 | public boolean verifyRaw(byte[] m, EddsaPublicKey publicKey) { | 68 | public boolean verifyRaw(byte[] m, EddsaPublicKey publicKey) { |
69 | Ed25519 R = Ed25519.decode(r); | 69 | Ed25519 R = Ed25519.decode(r); |
diff --git a/src/main/java/org/gnunet/util/crypto/package-info.java b/src/main/java/org/gnunet/util/crypto/package-info.java index 9e79056..8262249 100644 --- a/src/main/java/org/gnunet/util/crypto/package-info.java +++ b/src/main/java/org/gnunet/util/crypto/package-info.java | |||
@@ -20,6 +20,6 @@ | |||
20 | 20 | ||
21 | 21 | ||
22 | /** | 22 | /** |
23 | * Cryptographic primitives for. | 23 | * Cryptographic primitives. |
24 | */ | 24 | */ |
25 | package org.gnunet.util.crypto; | 25 | package org.gnunet.util.crypto; |
diff --git a/src/main/java/org/gnunet/voting/BallotTool.java b/src/main/java/org/gnunet/voting/BallotTool.java index f5b4009..05b8e5a 100644 --- a/src/main/java/org/gnunet/voting/BallotTool.java +++ b/src/main/java/org/gnunet/voting/BallotTool.java | |||
@@ -28,7 +28,7 @@ import org.gnunet.identity.Identity; | |||
28 | import org.gnunet.identity.IdentityCallback; | 28 | import org.gnunet.identity.IdentityCallback; |
29 | import org.gnunet.mesh.Mesh; | 29 | import org.gnunet.mesh.Mesh; |
30 | import org.gnunet.mesh.MeshRunabout; | 30 | import org.gnunet.mesh.MeshRunabout; |
31 | import org.gnunet.mesh.TunnelEndHandler; | 31 | import org.gnunet.mesh.ChannelEndHandler; |
32 | import org.gnunet.secretsharing.ThresholdPublicKey; | 32 | import org.gnunet.secretsharing.ThresholdPublicKey; |
33 | import org.gnunet.testbed.CompressedConfig; | 33 | import org.gnunet.testbed.CompressedConfig; |
34 | import org.gnunet.util.*; | 34 | import org.gnunet.util.*; |
@@ -161,7 +161,7 @@ public class BallotTool extends Program { | |||
161 | 161 | ||
162 | private RelativeTime tunnelReconnectBackoff = RelativeTime.STD_BACKOFF; | 162 | private RelativeTime tunnelReconnectBackoff = RelativeTime.STD_BACKOFF; |
163 | 163 | ||
164 | public class BallotTunnelEndHandler implements TunnelEndHandler { | 164 | public class BallotChannelEndHandler implements ChannelEndHandler { |
165 | @Override | 165 | @Override |
166 | public void onChannelEnd(final Mesh.Channel channel) { | 166 | public void onChannelEnd(final Mesh.Channel channel) { |
167 | // FIXME: just re-running 'doCommands' is a bit of a hack | 167 | // FIXME: just re-running 'doCommands' is a bit of a hack |
@@ -320,8 +320,8 @@ public class BallotTool extends Program { | |||
320 | Random r = new Random(); | 320 | Random r = new Random(); |
321 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); | 321 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); |
322 | System.out.println("registering ballot with authority " + currentAuthority.toString()); | 322 | System.out.println("registering ballot with authority " + currentAuthority.toString()); |
323 | mesh = new Mesh(getConfiguration(), new BallotTunnelEndHandler(), new BallotRegisterReceiver()); | 323 | mesh = new Mesh(getConfiguration(), new BallotChannelEndHandler(), new BallotRegisterReceiver()); |
324 | channel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true); | 324 | channel = mesh.createChannel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true); |
325 | BallotRegisterRequestMessage m = new BallotRegisterRequestMessage(); | 325 | BallotRegisterRequestMessage m = new BallotRegisterRequestMessage(); |
326 | CompressedConfig ccfg = new CompressedConfig(ballot.toConfiguration()); | 326 | CompressedConfig ccfg = new CompressedConfig(ballot.toConfiguration()); |
327 | m.compressedBallotConfig = ccfg.compressedData; | 327 | m.compressedBallotConfig = ccfg.compressedData; |
@@ -365,8 +365,8 @@ public class BallotTool extends Program { | |||
365 | PeerIdentity authority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); | 365 | PeerIdentity authority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); |
366 | System.out.println("submitting to authority " + authority.toString()); | 366 | System.out.println("submitting to authority " + authority.toString()); |
367 | currentAuthority = authority; | 367 | currentAuthority = authority; |
368 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new SubmitReceiver()); | 368 | mesh = new Mesh(cfg, new BallotChannelEndHandler(), new SubmitReceiver()); |
369 | channel = mesh.createTunnel(authority, TallyAuthorityDaemon.MESH_PORT, true, true, null); | 369 | channel = mesh.createChannel(authority, TallyAuthorityDaemon.MESH_PORT, true, true); |
370 | SubmitMessage m = new SubmitMessage(); | 370 | SubmitMessage m = new SubmitMessage(); |
371 | if (ballot.voterPub == null) { | 371 | if (ballot.voterPub == null) { |
372 | throw new InvalidBallotException("no voter in ballot"); | 372 | throw new InvalidBallotException("no voter in ballot"); |
@@ -399,8 +399,8 @@ public class BallotTool extends Program { | |||
399 | Random r = new Random(); | 399 | Random r = new Random(); |
400 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); | 400 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); |
401 | System.out.println("querying authority " + currentAuthority.toString()); | 401 | System.out.println("querying authority " + currentAuthority.toString()); |
402 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new QueryReceiver()); | 402 | mesh = new Mesh(cfg, new BallotChannelEndHandler(), new QueryReceiver()); |
403 | channel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true, null); | 403 | channel = mesh.createChannel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true); |
404 | ResultQueryMessage m = new ResultQueryMessage(); | 404 | ResultQueryMessage m = new ResultQueryMessage(); |
405 | m.ballotGuid = ballot.getBallotGuid(); | 405 | m.ballotGuid = ballot.getBallotGuid(); |
406 | channel.send(m); | 406 | channel.send(m); |
@@ -415,8 +415,8 @@ public class BallotTool extends Program { | |||
415 | Random r = new Random(); | 415 | Random r = new Random(); |
416 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); | 416 | currentAuthority = remainingAuthorities.get(r.nextInt(remainingAuthorities.size())); |
417 | System.out.println("asking authority for key " + currentAuthority.toString()); | 417 | System.out.println("asking authority for key " + currentAuthority.toString()); |
418 | mesh = new Mesh(cfg, new BallotTunnelEndHandler(), new PublicKeyReceiver()); | 418 | mesh = new Mesh(cfg, new BallotChannelEndHandler(), new PublicKeyReceiver()); |
419 | channel = mesh.createTunnel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true, null); | 419 | channel = mesh.createChannel(currentAuthority, TallyAuthorityDaemon.MESH_PORT, true, true); |
420 | KeyQueryMessage m = new KeyQueryMessage(); | 420 | KeyQueryMessage m = new KeyQueryMessage(); |
421 | m.ballotGuid = ballot.getBallotGuid(); | 421 | m.ballotGuid = ballot.getBallotGuid(); |
422 | channel.send(m); | 422 | channel.send(m); |
diff --git a/src/main/java/org/gnunet/voting/TallyAuthorityDaemon.java b/src/main/java/org/gnunet/voting/TallyAuthorityDaemon.java index 1d4a42d..af96871 100644 --- a/src/main/java/org/gnunet/voting/TallyAuthorityDaemon.java +++ b/src/main/java/org/gnunet/voting/TallyAuthorityDaemon.java | |||
@@ -27,7 +27,7 @@ import org.gnunet.consensus.ConsensusElement; | |||
27 | import org.gnunet.construct.Construct; | 27 | import org.gnunet.construct.Construct; |
28 | import org.gnunet.mesh.Mesh; | 28 | import org.gnunet.mesh.Mesh; |
29 | import org.gnunet.mesh.MeshRunabout; | 29 | import org.gnunet.mesh.MeshRunabout; |
30 | import org.gnunet.mesh.TunnelEndHandler; | 30 | import org.gnunet.mesh.ChannelEndHandler; |
31 | import org.gnunet.secretsharing.*; | 31 | import org.gnunet.secretsharing.*; |
32 | import org.gnunet.testbed.CompressedConfig; | 32 | import org.gnunet.testbed.CompressedConfig; |
33 | import org.gnunet.util.*; | 33 | import org.gnunet.util.*; |
@@ -391,7 +391,7 @@ public class TallyAuthorityDaemon extends Program { | |||
391 | @Override | 391 | @Override |
392 | public void run() { | 392 | public void run() { |
393 | logger.info("running tally daemon"); | 393 | logger.info("running tally daemon"); |
394 | mesh = new Mesh(getConfiguration(), null, new TunnelEndHandler() { | 394 | mesh = new Mesh(getConfiguration(), null, new ChannelEndHandler() { |
395 | @Override | 395 | @Override |
396 | public void onChannelEnd(Mesh.Channel channel) { | 396 | public void onChannelEnd(Mesh.Channel channel) { |
397 | logger.warn("on channel end"); | 397 | logger.warn("on channel end"); |