gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21388 - in gnunet-java: . bin src/org/gnunet/core src/org/


From: gnunet
Subject: [GNUnet-SVN] r21388 - in gnunet-java: . bin src/org/gnunet/core src/org/grothoff
Date: Wed, 9 May 2012 17:00:00 +0200

Author: dold
Date: 2012-05-09 17:00:00 +0200 (Wed, 09 May 2012)
New Revision: 21388

Added:
   gnunet-java/bin/gnunet-dht
   gnunet-java/src/org/gnunet/core/ConnectHandler.java
   gnunet-java/src/org/gnunet/core/ConnectNotifyMessage.java
   gnunet-java/src/org/gnunet/core/DisconnectHandler.java
   gnunet-java/src/org/gnunet/core/DisconnectNotifyMessage.java
   gnunet-java/src/org/gnunet/core/HeaderNotify.java
   gnunet-java/src/org/gnunet/core/InitCallback.java
   gnunet-java/src/org/gnunet/core/InitMessage.java
   gnunet-java/src/org/gnunet/core/InitReplyMessage.java
   gnunet-java/src/org/gnunet/core/MessageNotify.java
   gnunet-java/src/org/gnunet/core/NotifyInboundTrafficMessage.java
   gnunet-java/src/org/gnunet/core/NotifyOutboundTrafficMessage.java
   gnunet-java/src/org/gnunet/core/SendMessage.java
   gnunet-java/src/org/gnunet/core/SendMessageReady.java
   gnunet-java/src/org/gnunet/core/SendMessageRequest.java
Removed:
   gnunet-java/bin/gnunet-core
Modified:
   gnunet-java/ISSUES
   gnunet-java/src/org/gnunet/core/Core.java
   gnunet-java/src/org/grothoff/Runabout.java
Log:
fixes/refactoring, started to fix core

Modified: gnunet-java/ISSUES
===================================================================
--- gnunet-java/ISSUES  2012-05-09 14:29:47 UTC (rev 21387)
+++ gnunet-java/ISSUES  2012-05-09 15:00:00 UTC (rev 21388)
@@ -17,9 +17,6 @@
  * only issue left: visit methods have to be public, but this is a non issue.
 
 
-* review the RequestQueue mechanism
-
-
 * Statistics:
  * currently watches can't be canceled on the service level, only on the api 
level, is this intentional?
 
@@ -28,8 +25,15 @@
    but not for retrieval of answers?)
    Is this just a documentation error?
 
+* core:
+ * what happens if during a transmission the service disconnects? should we 
retry?
+
 * with the changes in ARM there is no way to restart gnunet with arm if some 
client is misbehaving
 
 * I'm often getting
   May 09 09:21:49-194786 util-11121 WARNING `socket' failed at 
connection.c:892 with error: Too many open files
 
+
+* review the RequestQueue mechanism
+ * implementing core with the RequestQueue not yet fully possible
+

Deleted: gnunet-java/bin/gnunet-core
===================================================================
--- gnunet-java/bin/gnunet-core 2012-05-09 14:29:47 UTC (rev 21387)
+++ gnunet-java/bin/gnunet-core 2012-05-09 15:00:00 UTC (rev 21388)
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-DIR=`dirname $0`
-
-java -ea -cp "$DIR/../build/:$DIR/../lib/*" org.gnunet.core.Core "$@"

Added: gnunet-java/bin/gnunet-dht
===================================================================
--- gnunet-java/bin/gnunet-dht                          (rev 0)
+++ gnunet-java/bin/gnunet-dht  2012-05-09 15:00:00 UTC (rev 21388)
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+DIR=`dirname $0`
+
+java -ea -cp "$DIR/../build/:$DIR/../lib/*" 
org.gnunet.dht.DistributedHashTable "$@"
+


Property changes on: gnunet-java/bin/gnunet-dht
___________________________________________________________________
Added: svn:executable
   + *

Added: gnunet-java/src/org/gnunet/core/ConnectHandler.java
===================================================================
--- gnunet-java/src/org/gnunet/core/ConnectHandler.java                         
(rev 0)
+++ gnunet-java/src/org/gnunet/core/ConnectHandler.java 2012-05-09 15:00:00 UTC 
(rev 21388)
@@ -0,0 +1,10 @@
+package org.gnunet.core;
+
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * Called when a new peer (with a compatible set of messages) connects to core
+ */
+public interface ConnectHandler {
+    void onConnect(PeerIdentity peerIdentity);
+}

Added: gnunet-java/src/org/gnunet/core/ConnectNotifyMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/core/ConnectNotifyMessage.java                   
        (rev 0)
+++ gnunet-java/src/org/gnunet/core/ConnectNotifyMessage.java   2012-05-09 
15:00:00 UTC (rev 21388)
@@ -0,0 +1,37 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.ByteFill;
+import org.gnunet.construct.NestedMessage;
+import org.gnunet.construct.UInt32;
+import org.gnunet.construct.UnionCase;
+import org.gnunet.util.GnunetMessage;
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * Message sent by the service to clients to notify them
+ * about a peer connecting.
+ */
address@hidden(67)
+public class ConnectNotifyMessage implements GnunetMessage.Body {
+    /**
+     * Number of ATS key-value pairs that follow this struct
+     * (excluding the 0-terminator).
+     */
+    @UInt32
+    public long atsCount;
+
+    /**
+     * Identity of the connecting peer.
+     */
+    @NestedMessage
+    public PeerIdentity peer;
+
+
+    @ByteFill
+    public byte[] atsInfo;
+
+
+    //@FillWith
+    //public ATSInformation[] atsInformation;
+
+}

Modified: gnunet-java/src/org/gnunet/core/Core.java
===================================================================
--- gnunet-java/src/org/gnunet/core/Core.java   2012-05-09 14:29:47 UTC (rev 
21387)
+++ gnunet-java/src/org/gnunet/core/Core.java   2012-05-09 15:00:00 UTC (rev 
21388)
@@ -15,28 +15,31 @@
 
 /**
  * API for the gnunet core service.
- *
+ * <p/>
  * Sends messages to connected peers.
  */
 public class Core {
     private static final Logger logger = LoggerFactory
             .getLogger(Core.class);
 
+
     private final Client client;
+
     /**
      * set to null once connected for the first time
      */
     private InitCallback init;
 
-    private boolean currentlyDown = true;
+    // private final RequestQueue requestQueue;
 
+    /*
+     * Callbacks for traffic notifications. null if not used.
+     */
     private HeaderNotify notifyOutboundHeaders;
     private HeaderNotify notifyInboundHeaders;
-
     private MessageNotify notifyOutboundMessages;
     private MessageNotify notifyInboundMessages;
 
-    private int initOptions;
 
     private ConnectHandler connectHandler;
     private DisconnectHandler disconnectHandler;
@@ -56,288 +59,14 @@
 
     private Cancelable currentClientTransmitHandle;
 
-    enum CoreOption {
-        NOTHING(0),
-        SEND_FULL_INBOUND(8),
-        SEND_HDR_INBOUND(16),
-        SEND_FULL_OUTBOUND(32),
-        SEND_HDR_OUTBOUND(64);
+    private final static int
+            CORE_OPTION_FULL_INBOUND = 8,
+            CORE_OPTION_HDR_INBOUND = 16,
+            CORE_OPTION_FULL_OUTBOUND = 32,
+            CORE_OPTION_HDR_OUTBOUND = 64;
 
-        public final int val;
 
-        CoreOption(int val) {
-            this.val = val;
-        }
-    }
-
-
-    @UnionCase(64)
-    public static class InitMessage implements GnunetMessage.Body {
-        @UInt32
-        public long options;
-
-        @IntegerFill(signed = false, bitSize = 16)
-        public int[] interested;
-    }
-
-    @UnionCase(65)
-    public static class InitReplyMessage implements GnunetMessage.Body {
-        @UInt32
-        public int reserved = 0;
-        /**
-         * pubkey of the local peer
-         */
-        @NestedMessage
-        public PeerIdentity myIdentity;
-    }
-
-    @UnionCase(70)
-    public static class NotifyInboundTrafficMessage implements 
GnunetMessage.Body {
-        /**
-         * Number of ATS key-value pairs that follow this struct
-         * (excluding the 0-terminator).
-         */
-        @UInt32
-        public long ats_count;
-
-        /**
-         * Identity of the receiver or sender.
-         */
-        @NestedMessage
-        public PeerIdentity peer;
-
-        @VariableSizeArray(lengthField = "ats_count")
-        public ATSInformation[] atsRest;
-
-        @NestedMessage(newFrame = true)
-        public GnunetMessage.Header payloadHeader;
-
-        @Union(tag = "payloadHeader.messageType", optional = true)
-        public GnunetMessage.Body payloadBody;
-    }
-
-
-    @UnionCase(71)
-    public static class NotifyOutboundTrafficMessage implements 
GnunetMessage.Body {
-        /**
-         * Number of ATS key-value pairs that follow this struct
-         * (excluding the 0-terminator).
-         */
-        @UInt32
-        public long ats_count;
-
-        /**
-         * Identity of the receiver or sender.
-         */
-        @NestedMessage
-        public PeerIdentity peer;
-
-        @VariableSizeArray(lengthField = "ats_count")
-        public ATSInformation[] atsRest;
-
-        @NestedMessage(newFrame = true)
-        public GnunetMessage.Header payloadHeader;
-
-        @Union(tag = "payloadHeader.messageType", optional = true)
-        public GnunetMessage.Body payloadBody;
-    }
-
-
     /**
-     * Message sent by the service to clients to notify them
-     * about a peer connecting.
-     */
-    @UnionCase(67)
-    public static class ConnectNotifyMessage implements GnunetMessage.Body {
-        /**
-         * Number of ATS key-value pairs that follow this struct
-         * (excluding the 0-terminator).
-         */
-        @UInt32
-        public long atsCount;
-
-        /**
-         * Identity of the connecting peer.
-         */
-        @NestedMessage
-        public PeerIdentity peer;
-
-
-        @ByteFill
-        public byte[] atsInfo;
-
-
-        //@FillWith
-        //public ATSInformation[] atsInformation;
-
-    }
-
-    /**
-     * Message sent by the service to clients to notify them
-     * about a peer disconnecting.
-     */
-    @UnionCase(68)
-    public static class DisconnectNotifyMessage implements GnunetMessage.Body {
-        /**
-         * Always zero.
-         */
-        @UInt32
-        public int reserved;
-
-        /**
-         * Identity of the connecting peer.
-         */
-        @NestedMessage
-        public PeerIdentity peer;
-    }
-
-
-    /**
-     * Client notifying core about the maximum-priority
-     * message it has in the queue for a particular target.
-     */
-    @UnionCase(74)
-    public static class SendMessageRequest implements GnunetMessage.Body {
-        /**
-         * How important is this message?
-         */
-        @UInt32
-        public long priority;
-
-        /**
-         * By what time would the sender really like to see this
-         * message transmitted?
-         */
-        @NestedMessage
-        public AbsoluteTimeMessage deadline;
-
-        /**
-         * Identity of the intended target.
-         */
-        @NestedMessage
-        public PeerIdentity peer;
-
-        /**
-         * How large is the client's message queue for this peer?
-         */
-        @UInt32
-        public long queueSize;
-
-        /**
-         * How large is the message?
-         */
-        @UInt16
-        public int size;
-
-        /**
-         * Counter for this peer to match SMRs to replies.
-         */
-        @UInt16
-        public int smrId;
-    }
-
-    /**
-     * Core notifying client that it is allowed to now
-     * transmit a message to the given target
-     * (response to GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST).
-     */
-    @UnionCase(75)
-    public static class SendMessageReady implements GnunetMessage.Body {
-        /**
-         * How many bytes are allowed for transmission?
-         * Guaranteed to be at least as big as the requested size,
-         * or ZERO if the request is rejected (will timeout,
-         * peer disconnected, queue full, etc.).
-         */
-        @UInt16
-        public int size;
-
-        /**
-         * smrId from the request.
-         */
-        @UInt16
-        public int smrId;
-
-        /**
-         * Identity of the intended target.
-         */
-        @NestedMessage
-        public PeerIdentity peer;
-    }
-
-    /**
-     * Client asking core to transmit a particular message to a particular
-     * target (response to GNUNET_MESSAGE_TYPE_CORE_SEND_READY).
-     */
-    @UnionCase(76)
-    public static class SendMessage implements GnunetMessage.Body {
-        /**
-         * How important is this message?
-         */
-        @UInt32
-        public long priority;
-
-        /**
-         * By what time would the sender really like to see this
-         * message transmitted?
-         */
-        @NestedMessage
-        public AbsoluteTimeMessage deadline;
-
-        /**
-         * Identity of the intended receiver.
-         */
-        @NestedMessage
-        public PeerIdentity peer;
-
-        /**
-         * GNUNET_YES if corking is allowed, GNUNET_NO if not.
-         */
-        @UInt32
-        public int cork;
-
-        /**
-         * Always 0.
-         */
-        @UInt64
-        public int reserved;
-
-        @NestedMessage(newFrame = true)
-        public GnunetMessage payloadMessage;
-
-    }
-
-    /**
-     * Called once the handshake with core was successful.
-     */
-    public interface InitCallback {
-        void onInit(PeerIdentity myIdentity);
-    }
-
-    /**
-     * Called when a new peer (with a compatible set of messages) connects to 
core
-     */
-    public interface ConnectHandler {
-        void onConnect(PeerIdentity peerIdentity);
-    }
-
-    /**
-     * Called when a peer disconnects from the core.
-     */
-    public interface DisconnectHandler {
-        void onDisconnect(PeerIdentity peerIdentity);
-    }
-
-    public interface HeaderNotify {
-        void notify(GnunetMessage.Header header);
-    }
-
-    public interface MessageNotify {
-        void notify(GnunetMessage messageBody);
-    }
-
-
-    /**
      * Represents a request for transmission.
      */
     public class TransmitHandle {
@@ -354,7 +83,7 @@
         public int nextSmrId;
     }
 
-    private Core(Configuration cfg) {
+    public Core(Configuration cfg) {
         client = new Client("core", cfg);
     }
 
@@ -540,35 +269,34 @@
             return;
         }
 
-
         final TransmitHandle transmitHandle = pending.poll();
         if (transmitHandle != null) {
             currentClientTransmitHandle = 
client.notifyTransmitReady(RelativeTime.FOREVER, false,
                     0, new MessageTransmitter() {
-                        @Override
-                        public void transmit(Connection.MessageSink sink) {
-                            currentClientTransmitHandle = null;
+                @Override
+                public void transmit(Connection.MessageSink sink) {
+                    currentClientTransmitHandle = null;
 
-                            SendMessageRequest request = new 
SendMessageRequest();
-                            request.peer = transmitHandle.peerIdentity;
-                            request.priority = 0;
-                            request.queueSize = 5;
-                            request.smrId = transmitHandle.smrId;
-                            request.size = transmitHandle.size;
+                    SendMessageRequest request = new SendMessageRequest();
+                    request.peer = transmitHandle.peerIdentity;
+                    request.priority = 0;
+                    request.queueSize = 5;
+                    request.smrId = transmitHandle.smrId;
+                    request.size = transmitHandle.size;
 
-                            request.deadline = 
transmitHandle.deadline.asMessage();
+                    request.deadline = transmitHandle.deadline.asMessage();
 
-                            sink.send(request);
+                    sink.send(request);
 
-                            transmitPending();
-                        }
+                    transmitPending();
+                }
 
-                        @Override
-                        public void handleError() {
-                            logger.error("error in SendMessageTransmitter");
-                            transmitPending();
-                        }
-                    });
+                @Override
+                public void handleError() {
+                    logger.error("error in SendMessageTransmitter");
+                    transmitPending();
+                }
+            });
 
             return;
         }
@@ -577,19 +305,19 @@
         if (sm != null) {
             currentClientTransmitHandle = 
client.notifyTransmitReady(RelativeTime.FOREVER, false,
                     0, new MessageTransmitter() {
-                        @Override
-                        public void transmit(Connection.MessageSink sink) {
-                            currentClientTransmitHandle = null;
-                            sink.send(sm);
-                            logger.info("transmitted SendMessage!");
-                            transmitPending();
-                        }
+                @Override
+                public void transmit(Connection.MessageSink sink) {
+                    currentClientTransmitHandle = null;
+                    sink.send(sm);
+                    logger.info("transmitted SendMessage!");
+                    transmitPending();
+                }
 
-                        @Override
-                        public void handleError() {
-                            throw new AssertionError("unexpected");
-                        }
-                    });
+                @Override
+                public void handleError() {
+                    throw new AssertionError("unexpected");
+                }
+            });
             return;
         }
         logger.info("transmitPending did nothing");
@@ -621,6 +349,7 @@
 
     }
 
+
     private static ArrayList<Class> getRunaboutVisitees(Runabout r) {
         Class rc = r.getClass();
         ArrayList<Class> ret = new ArrayList<Class>(5);
@@ -633,7 +362,9 @@
         return ret;
     }
 
+
     @SuppressWarnings("unchecked")
+    // todo: where to put this?
     private static int[] getRunaboutMessageTypes(Runabout r) {
         ArrayList<Class> visitees = getRunaboutVisitees(r);
         int[] msgtypes = new int[visitees.size()];
@@ -642,64 +373,4 @@
         }
         return msgtypes;
     }
-
-
-    @UnionCase(42001)
-    public static class MyMessage implements GnunetMessage.Body {
-        @UInt32
-        public int number;
-        @ZeroTerminatedString
-        public String message;
-    }
-
-    public static class MyMessageHandler extends Runabout {
-        public void visit(MyMessage msg) {
-            System.out.println("got my message!!");
-            System.out.println(msg.message);
-            System.out.println(msg.number);
-        }
-    }
-
-    public static void main(String[] args) {
-        new Program(args) {
-            public void run() {
-                final Core core = new Core(this.getConfiguration());
-
-                core.observeConnect(new ConnectHandler() {
-                    @Override
-                    public void onConnect(PeerIdentity peerIdentity) {
-                        
System.out.println(Strings.dataToString(peerIdentity.data));
-                    }
-                });
-
-
-                core.handleMessages(new MyMessageHandler());
-
-
-                final MyMessage myMessage = new MyMessage();
-                myMessage.message = "Hello, gnunet";
-                myMessage.number = 42;
-
-                core.init(new InitCallback() {
-                    @Override
-                    public void onInit(PeerIdentity myIdentity) {
-                        System.out.print("Hello, I'm ");
-                        
System.out.println(Strings.dataToString(myIdentity.data));
-
-                        core.notifyTransmitReady(0, RelativeTime.SECOND, 
myIdentity, Construct.getSize(myMessage),
-                                new MessageTransmitter() {
-                                    @Override
-                                    public void 
transmit(Connection.MessageSink sink) {
-                                        sink.send(myMessage);
-                                    }
-
-                                    @Override
-                                    public void handleError() {
-                                    }
-                                });
-                    }
-                });
-            }
-        }.start();
-    }
 }

Added: gnunet-java/src/org/gnunet/core/DisconnectHandler.java
===================================================================
--- gnunet-java/src/org/gnunet/core/DisconnectHandler.java                      
        (rev 0)
+++ gnunet-java/src/org/gnunet/core/DisconnectHandler.java      2012-05-09 
15:00:00 UTC (rev 21388)
@@ -0,0 +1,10 @@
+package org.gnunet.core;
+
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * Called when a peer disconnects from the core.
+ */
+public interface DisconnectHandler {
+    void onDisconnect(PeerIdentity peerIdentity);
+}

Added: gnunet-java/src/org/gnunet/core/DisconnectNotifyMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/core/DisconnectNotifyMessage.java                
                (rev 0)
+++ gnunet-java/src/org/gnunet/core/DisconnectNotifyMessage.java        
2012-05-09 15:00:00 UTC (rev 21388)
@@ -0,0 +1,26 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.NestedMessage;
+import org.gnunet.construct.UInt32;
+import org.gnunet.construct.UnionCase;
+import org.gnunet.util.GnunetMessage;
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * Message sent by the service to clients to notify them
+ * about a peer disconnecting.
+ */
address@hidden(68)
+public class DisconnectNotifyMessage implements GnunetMessage.Body {
+    /**
+     * Always zero.
+     */
+    @UInt32
+    public int reserved;
+
+    /**
+     * Identity of the connecting peer.
+     */
+    @NestedMessage
+    public PeerIdentity peer;
+}

Added: gnunet-java/src/org/gnunet/core/HeaderNotify.java
===================================================================
--- gnunet-java/src/org/gnunet/core/HeaderNotify.java                           
(rev 0)
+++ gnunet-java/src/org/gnunet/core/HeaderNotify.java   2012-05-09 15:00:00 UTC 
(rev 21388)
@@ -0,0 +1,10 @@
+package org.gnunet.core;
+
+import org.gnunet.util.GnunetMessage;
+
+/**
+ *
+ */
+public interface HeaderNotify {
+    void notify(GnunetMessage.Header header);
+}

Added: gnunet-java/src/org/gnunet/core/InitCallback.java
===================================================================
--- gnunet-java/src/org/gnunet/core/InitCallback.java                           
(rev 0)
+++ gnunet-java/src/org/gnunet/core/InitCallback.java   2012-05-09 15:00:00 UTC 
(rev 21388)
@@ -0,0 +1,10 @@
+package org.gnunet.core;
+
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * Called once the handshake with core was successful.
+ */
+public interface InitCallback {
+    void onInit(PeerIdentity myIdentity);
+}

Added: gnunet-java/src/org/gnunet/core/InitMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/core/InitMessage.java                            
(rev 0)
+++ gnunet-java/src/org/gnunet/core/InitMessage.java    2012-05-09 15:00:00 UTC 
(rev 21388)
@@ -0,0 +1,16 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.IntegerFill;
+import org.gnunet.construct.UInt32;
+import org.gnunet.construct.UnionCase;
+import org.gnunet.util.GnunetMessage;
+
+
address@hidden(64)
+public class InitMessage implements GnunetMessage.Body {
+    @UInt32
+    public long options;
+
+    @IntegerFill(signed = false, bitSize = 16)
+    public int[] interested;
+}

Added: gnunet-java/src/org/gnunet/core/InitReplyMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/core/InitReplyMessage.java                       
        (rev 0)
+++ gnunet-java/src/org/gnunet/core/InitReplyMessage.java       2012-05-09 
15:00:00 UTC (rev 21388)
@@ -0,0 +1,19 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.NestedMessage;
+import org.gnunet.construct.UInt32;
+import org.gnunet.construct.UnionCase;
+import org.gnunet.util.GnunetMessage;
+import org.gnunet.util.PeerIdentity;
+
+
address@hidden(65)
+public class InitReplyMessage implements GnunetMessage.Body {
+    @UInt32
+    public int reserved = 0;
+    /**
+     * pubkey of the local peer
+     */
+    @NestedMessage
+    public PeerIdentity myIdentity;
+}

Added: gnunet-java/src/org/gnunet/core/MessageNotify.java
===================================================================
--- gnunet-java/src/org/gnunet/core/MessageNotify.java                          
(rev 0)
+++ gnunet-java/src/org/gnunet/core/MessageNotify.java  2012-05-09 15:00:00 UTC 
(rev 21388)
@@ -0,0 +1,8 @@
+package org.gnunet.core;
+
+import org.gnunet.util.GnunetMessage;
+
+
+public interface MessageNotify {
+    void notify(GnunetMessage messageBody);
+}

Added: gnunet-java/src/org/gnunet/core/NotifyInboundTrafficMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/core/NotifyInboundTrafficMessage.java            
                (rev 0)
+++ gnunet-java/src/org/gnunet/core/NotifyInboundTrafficMessage.java    
2012-05-09 15:00:00 UTC (rev 21388)
@@ -0,0 +1,32 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.*;
+import org.gnunet.util.ATSInformation;
+import org.gnunet.util.GnunetMessage;
+import org.gnunet.util.PeerIdentity;
+
+
address@hidden(70)
+public class NotifyInboundTrafficMessage implements GnunetMessage.Body {
+    /**
+     * Number of ATS key-value pairs that follow this struct
+     * (excluding the 0-terminator).
+     */
+    @UInt32
+    public long ats_count;
+
+    /**
+     * Identity of the receiver or sender.
+     */
+    @NestedMessage
+    public PeerIdentity peer;
+
+    @VariableSizeArray(lengthField = "ats_count")
+    public ATSInformation[] atsRest;
+
+    @NestedMessage(newFrame = true)
+    public GnunetMessage.Header payloadHeader;
+
+    @Union(tag = "payloadHeader.messageType", optional = true)
+    public GnunetMessage.Body payloadBody;
+}

Added: gnunet-java/src/org/gnunet/core/NotifyOutboundTrafficMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/core/NotifyOutboundTrafficMessage.java           
                (rev 0)
+++ gnunet-java/src/org/gnunet/core/NotifyOutboundTrafficMessage.java   
2012-05-09 15:00:00 UTC (rev 21388)
@@ -0,0 +1,32 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.*;
+import org.gnunet.util.ATSInformation;
+import org.gnunet.util.GnunetMessage;
+import org.gnunet.util.PeerIdentity;
+
+
address@hidden(71)
+public class NotifyOutboundTrafficMessage implements GnunetMessage.Body {
+    /**
+     * Number of ATS key-value pairs that follow this struct
+     * (excluding the 0-terminator).
+     */
+    @UInt32
+    public long ats_count;
+
+    /**
+     * Identity of the receiver or sender.
+     */
+    @NestedMessage
+    public PeerIdentity peer;
+
+    @VariableSizeArray(lengthField = "ats_count")
+    public ATSInformation[] atsRest;
+
+    @NestedMessage(newFrame = true)
+    public GnunetMessage.Header payloadHeader;
+
+    @Union(tag = "payloadHeader.messageType", optional = true)
+    public GnunetMessage.Body payloadBody;
+}

Added: gnunet-java/src/org/gnunet/core/SendMessage.java
===================================================================
--- gnunet-java/src/org/gnunet/core/SendMessage.java                            
(rev 0)
+++ gnunet-java/src/org/gnunet/core/SendMessage.java    2012-05-09 15:00:00 UTC 
(rev 21388)
@@ -0,0 +1,51 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.NestedMessage;
+import org.gnunet.construct.UInt32;
+import org.gnunet.construct.UInt64;
+import org.gnunet.construct.UnionCase;
+import org.gnunet.util.AbsoluteTimeMessage;
+import org.gnunet.util.GnunetMessage;
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * Client asking core to transmit a particular message to a particular
+ * target (response to GNUNET_MESSAGE_TYPE_CORE_SEND_READY).
+ */
address@hidden(76)
+public class SendMessage implements GnunetMessage.Body {
+    /**
+     * How important is this message?
+     */
+    @UInt32
+    public long priority;
+
+    /**
+     * By what time would the sender really like to see this
+     * message transmitted?
+     */
+    @NestedMessage
+    public AbsoluteTimeMessage deadline;
+
+    /**
+     * Identity of the intended receiver.
+     */
+    @NestedMessage
+    public PeerIdentity peer;
+
+    /**
+     * GNUNET_YES if corking is allowed, GNUNET_NO if not.
+     */
+    @UInt32
+    public int cork;
+
+    /**
+     * Always 0.
+     */
+    @UInt64
+    public int reserved;
+
+    @NestedMessage(newFrame = true)
+    public GnunetMessage payloadMessage;
+
+}

Added: gnunet-java/src/org/gnunet/core/SendMessageReady.java
===================================================================
--- gnunet-java/src/org/gnunet/core/SendMessageReady.java                       
        (rev 0)
+++ gnunet-java/src/org/gnunet/core/SendMessageReady.java       2012-05-09 
15:00:00 UTC (rev 21388)
@@ -0,0 +1,36 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.NestedMessage;
+import org.gnunet.construct.UInt16;
+import org.gnunet.construct.UnionCase;
+import org.gnunet.util.GnunetMessage;
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * Core notifying client that it is allowed to now
+ * transmit a message to the given target
+ * (response to GNUNET_MESSAGE_TYPE_CORE_SEND_REQUEST).
+ */
address@hidden(75)
+public class SendMessageReady implements GnunetMessage.Body {
+    /**
+     * How many bytes are allowed for transmission?
+     * Guaranteed to be at least as big as the requested size,
+     * or ZERO if the request is rejected (will timeout,
+     * peer disconnected, queue full, etc.).
+     */
+    @UInt16
+    public int size;
+
+    /**
+     * smrId from the request.
+     */
+    @UInt16
+    public int smrId;
+
+    /**
+     * Identity of the intended target.
+     */
+    @NestedMessage
+    public PeerIdentity peer;
+}

Added: gnunet-java/src/org/gnunet/core/SendMessageRequest.java
===================================================================
--- gnunet-java/src/org/gnunet/core/SendMessageRequest.java                     
        (rev 0)
+++ gnunet-java/src/org/gnunet/core/SendMessageRequest.java     2012-05-09 
15:00:00 UTC (rev 21388)
@@ -0,0 +1,53 @@
+package org.gnunet.core;
+
+import org.gnunet.construct.NestedMessage;
+import org.gnunet.construct.UInt16;
+import org.gnunet.construct.UInt32;
+import org.gnunet.construct.UnionCase;
+import org.gnunet.util.AbsoluteTimeMessage;
+import org.gnunet.util.GnunetMessage;
+import org.gnunet.util.PeerIdentity;
+
+/**
+ * Client notifying core about the maximum-priority
+ * message it has in the queue for a particular target.
+ */
address@hidden(74)
+public class SendMessageRequest implements GnunetMessage.Body {
+    /**
+     * How important is this message?
+     */
+    @UInt32
+    public long priority;
+
+    /**
+     * By what time would the sender really like to see this
+     * message transmitted?
+     */
+    @NestedMessage
+    public AbsoluteTimeMessage deadline;
+
+    /**
+     * Identity of the intended target.
+     */
+    @NestedMessage
+    public PeerIdentity peer;
+
+    /**
+     * How large is the client's message queue for this peer?
+     */
+    @UInt32
+    public long queueSize;
+
+    /**
+     * How large is the message?
+     */
+    @UInt16
+    public int size;
+
+    /**
+     * Counter for this peer to match SMRs to replies.
+     */
+    @UInt16
+    public int smrId;
+}

Modified: gnunet-java/src/org/grothoff/Runabout.java
===================================================================
--- gnunet-java/src/org/grothoff/Runabout.java  2012-05-09 14:29:47 UTC (rev 
21387)
+++ gnunet-java/src/org/grothoff/Runabout.java  2012-05-09 15:00:00 UTC (rev 
21388)
@@ -261,9 +261,9 @@
                                 try {
                                     m.invoke(r, o);
                                 } catch (IllegalAccessException e) {
-                                    e.printStackTrace();
+                                    throw new RunaboutException(e.toString());
                                 } catch (InvocationTargetException e) {
-                                    e.printStackTrace();
+                                    throw new RunaboutException(e.toString());
                                 }
                             }
                         };




reply via email to

[Prev in Thread] Current Thread [Next in Thread]