aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/gnunet/core/Core.java
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2014-04-07 00:26:06 +0000
committerFlorian Dold <florian.dold@gmail.com>2014-04-07 00:26:06 +0000
commitd33161cddda663720ea93c483ed6e3e7511e995b (patch)
tree7413b2aace2d2673e083369b22126d731a8fabaf /src/main/java/org/gnunet/core/Core.java
parenta5a49ee6c7e87b0fb8abae6127713e8ef3c38edb (diff)
downloadgnunet-java-d33161cddda663720ea93c483ed6e3e7511e995b.tar.gz
gnunet-java-d33161cddda663720ea93c483ed6e3e7511e995b.zip
docs / fixed fixme in crypto
Diffstat (limited to 'src/main/java/org/gnunet/core/Core.java')
-rw-r--r--src/main/java/org/gnunet/core/Core.java40
1 files changed, 37 insertions, 3 deletions
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;
23import com.google.common.collect.Maps; 23import com.google.common.collect.Maps;
24import org.gnunet.construct.Construct; 24import org.gnunet.construct.Construct;
25import org.gnunet.construct.MessageLoader; 25import org.gnunet.construct.MessageLoader;
26import org.gnunet.core.messages.*;
26import org.gnunet.mq.Envelope; 27import org.gnunet.mq.Envelope;
27import org.gnunet.requests.MatchingRequestContainer; 28import org.gnunet.requests.MatchingRequestContainer;
28import org.gnunet.requests.Request; 29import 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) {