gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r3008 - in freeway: . src/org/gnu/freeway/cwrappers/util sr


From: mdonoughe
Subject: [GNUnet-SVN] r3008 - in freeway: . src/org/gnu/freeway/cwrappers/util src/org/gnu/freeway/protocol/afs src/org/gnu/freeway/server src/org/gnu/freeway/transport/tcp src/org/gnu/freeway/transport/udp src/org/gnu/freeway/util src/org/gnu/freeway/util/net
Date: Mon, 12 Jun 2006 21:49:02 -0700 (PDT)

Author: mdonoughe
Date: 2006-06-12 21:48:52 -0700 (Mon, 12 Jun 2006)
New Revision: 3008

Added:
   freeway/protocols.xml
   freeway/transports.xml
Removed:
   freeway/src/org/gnu/freeway/cwrappers/util/MethodLister.java
Modified:
   freeway/build.xml
   freeway/src/org/gnu/freeway/cwrappers/util/SwitchTableGenerator.java
   freeway/src/org/gnu/freeway/protocol/afs/Manager.java
   freeway/src/org/gnu/freeway/server/CoreService.java
   freeway/src/org/gnu/freeway/server/TransportService.java
   freeway/src/org/gnu/freeway/transport/tcp/TCPAddress.java
   freeway/src/org/gnu/freeway/transport/tcp/TCPTransport.java
   freeway/src/org/gnu/freeway/transport/udp/UDPAddress.java
   freeway/src/org/gnu/freeway/transport/udp/UDPTransport.java
   freeway/src/org/gnu/freeway/util/DynamicLibrary.java
   freeway/src/org/gnu/freeway/util/IdentityService.java
   freeway/src/org/gnu/freeway/util/NativeService.java
   freeway/src/org/gnu/freeway/util/net/CSMessage.java
Log:
moved protocols and transports into their own xml files and renamed the 
jar files to indicate whether it is a protocol or a transport.

moved org.gnu.freeway.protocol.* to the main jar file so we don't need 
to include AbstractProtocol for every protocol jar

did the same with org.gnu.freeway.transport.*

moved MethodLister into SwitchTableGenerator and organized the imports

made tcp and udp attempt to use only Inet4Addresses. The actualy source 
of the buffer problems was IdentityService.

DynamicLibrary now longer looks for jar files in /usr/lib and 
/usr/local/lib. Why was it doing this to begin with? There are no jar 
files there and we *already had* the jar file that contains what we 
want to load.

CSMessage matches the C version more closely, but probably breaks a lot 
of stuff because some values are negative and there is more than one 0.


Modified: freeway/build.xml
===================================================================
--- freeway/build.xml   2006-06-12 17:05:02 UTC (rev 3007)
+++ freeway/build.xml   2006-06-13 04:48:52 UTC (rev 3008)
@@ -1,5 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-
+<!DOCTYPE project [
+<!ENTITY protocols SYSTEM "file:protocols.xml">
+<!ENTITY transports SYSTEM "file:transports.xml">
+]>
 <project name="Freeway" default="build" basedir=".">
        <property name="build.compiler" value="jikes" />
        <property name="build.sysclasspath" value="ignore" />
@@ -44,91 +47,17 @@
 
                <jar destfile="${project.build}/freeway.jar">
                        <fileset dir="${project.build}/classes">
-                               <exclude name="org/gnu/freeway/protocol/**" />
-                               <exclude name="org/gnu/freeway/transport/**" />
+                               <exclude name="org/gnu/freeway/protocol/*/*/**" 
/>
+                               <exclude 
name="org/gnu/freeway/transport/*/*/**" />
                        </fileset>
-
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/Protocol.class" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/MessagePack.class" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/Session.class" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/Transport.class" />
                </jar>
 
-               <jar destfile="${project.build}/freeway-afs.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/afs/**" 
excludes="org/gnu/freeway/protocol/afs/MySQLHandle*" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />
-                       <fileset dir="${project.res}/swing" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.afs.AFSProtocol" />
-                       </manifest>
-               </jar>
+               <!--build protocols in protocols.xml-->
+               &protocols;
 
-               <jar destfile="${project.build}/freeway-afs-mysql.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/afs/MySQLHandle*" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.afs.MySQLHandle" />
-                       </manifest>
-               </jar>
+               <!--build transports in transports.xml-->
+               &transports;
 
-               <jar destfile="${project.build}/freeway-chat.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/chat/**" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.chat.ChatProtocol" />
-                       </manifest>
-               </jar>
-
-               <jar destfile="${project.build}/freeway-dht.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/dht/**" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.dht.DHTProtocol" />
-                       </manifest>
-               </jar>
-
-               <jar destfile="${project.build}/freeway-tbench.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/tbench/**" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.tbench.TBenchProtocol" />
-                       </manifest>
-               </jar>
-
-               <jar destfile="${project.build}/freeway-tracekit.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/tracekit/**" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.tracekit.TraceKitProtocol" />
-                       </manifest>
-               </jar>
-
-               <jar destfile="${project.build}/freeway-tcp.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/tcp/**" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/AbstractSession.class" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/AbstractTransport.class" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.transport.tcp.TCPTransport" />
-                       </manifest>
-               </jar>
-
-               <jar destfile="${project.build}/freeway-udp.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/udp/**" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/AbstractSession.class" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/AbstractTransport.class" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.transport.udp.UDPTransport" />
-                       </manifest>
-               </jar>
-
-               <jar destfile="${project.build}/freeway-nat.jar">
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/nat/**" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/AbstractSession.class" />
-                       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/AbstractTransport.class" />
-                       <manifest>
-                               <attribute name="Main-Class" 
value="org.gnu.freeway.transport.nat.NATTransport" />
-                       </manifest>
-               </jar>
-
                <jar destfile="${project.build}/freeway-for-apps.jar">
                        <fileset dir="${project.build}/classes" />
                        <zipfileset dir="${project.res}/tests" prefix="tests" />

Added: freeway/protocols.xml
===================================================================
--- freeway/protocols.xml       2006-06-12 17:05:02 UTC (rev 3007)
+++ freeway/protocols.xml       2006-06-13 04:48:52 UTC (rev 3008)
@@ -0,0 +1,56 @@
+<jar destfile="${project.build}/protocol-afs.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/afs/**" 
excludes="org/gnu/freeway/protocol/afs/MySQLHandle*" />
+<!--   <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />-->
+       <fileset dir="${project.res}/swing" />
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.afs.AFSProtocol" />
+       </manifest>
+</jar>
+
+<jar destfile="${project.build}/protocol-afs-mysql.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/afs/MySQLHandle*" />
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.afs.MySQLHandle" />
+       </manifest>
+</jar>
+
+<jar destfile="${project.build}/protocol-chat.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/chat/**" />
+<!--   <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />-->
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.chat.ChatProtocol" />
+       </manifest>
+</jar>
+
+<jar destfile="${project.build}/protocol-dht.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/dht/**" />
+<!--   <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />-->
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.dht.DHTProtocol" />
+       </manifest>
+</jar>
+
+<jar destfile="${project.build}/protocol-tbench.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/tbench/**" />
+<!--   <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />-->
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.tbench.TBenchProtocol" />
+       </manifest>
+</jar>
+
+<jar destfile="${project.build}/protocol-tracekit.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/tracekit/**" />
+<!--   <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />-->
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.tracekit.TraceKitProtocol" />
+       </manifest>
+</jar>
+
+<jar destfile="${project.build}/protocol-stats.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/stats/**" />
+<!--   <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/AbstractProtocol*" />
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/protocol/NativeProtocol*" />-->
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.protocol.stats.StatsProtocol" />
+       </manifest>
+</jar>

Deleted: freeway/src/org/gnu/freeway/cwrappers/util/MethodLister.java
===================================================================
--- freeway/src/org/gnu/freeway/cwrappers/util/MethodLister.java        
2006-06-12 17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/cwrappers/util/MethodLister.java        
2006-06-13 04:48:52 UTC (rev 3008)
@@ -1,59 +0,0 @@
- /*
-      This file is part of Freeway
-
-      Freeway is free software; you can redistribute it and/or modify
-      it under the terms of the GNU General Public License as published
-      by the Free Software Foundation; either version 2, or (at your
-      option) any later version.
-
-      Freeway is distributed in the hope that it will be useful, but
-      WITHOUT ANY WARRANTY; without even the implied warranty of
-      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-      General Public License for more details.
-
-      You should have received a copy of the GNU General Public License
-      along with Freeway; see the file COPYING.  If not, write to the
-      Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-      Boston, MA 02111-1307, USA.
- */
-
-package org.gnu.freeway.cwrappers.util;
-
-import org.gnu.freeway.support.javaparser.visitors.Visitor;
-import org.gnu.freeway.support.javaparser.visitors.DepthFirstVisitor;
-import java.io.InputStream;
-import org.gnu.freeway.support.javaparser.*;
-import java.util.ArrayList;
-
-/**
- * @file InterfaceImplementor.java
- * @brief 
- * @author mdonoughe
- */
-public class MethodLister extends DepthFirstVisitor implements Visitor {
-       //alias the constructor since an instance of this class is useless to 
others
-       public static ArrayList list(InputStream in) throws ParseException {
-               MethodLister lister = new MethodLister(in);
-               return lister.go();
-       }
-       
-       private InputStream in;
-       private CompilationUnit cu;
-       private ArrayList list;
-
-       private MethodLister(InputStream in) throws ParseException {
-               this.in = in;
-               JavaParser parser = new JavaParser(in);
-               cu = parser.CompilationUnit();
-       }
-       
-       private synchronized ArrayList go() {
-               list = new ArrayList();
-               cu.accept(this);
-               return list;
-       }
-       
-       public void visit(MethodDeclarator n) {
-               list.add(n.f0.tokenImage);
-       }
-}

Modified: freeway/src/org/gnu/freeway/cwrappers/util/SwitchTableGenerator.java
===================================================================
--- freeway/src/org/gnu/freeway/cwrappers/util/SwitchTableGenerator.java        
2006-06-12 17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/cwrappers/util/SwitchTableGenerator.java        
2006-06-13 04:48:52 UTC (rev 3008)
@@ -19,25 +19,29 @@
 
 package org.gnu.freeway.cwrappers.util;
 
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.HashMap;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.ArrayList;
+import java.io.BufferedInputStream;
+import java.io.BufferedWriter;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
 import java.io.FilenameFilter;
 import java.io.IOException;
-import java.io.BufferedWriter;
-import java.io.FileWriter;
+import java.io.InputStream;
 import java.io.Writer;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Iterator;
+
+import org.gnu.freeway.support.javaparser.CompilationUnit;
 import org.gnu.freeway.support.javaparser.JavaParser;
-import java.io.FileInputStream;
-import java.io.BufferedInputStream;
+import org.gnu.freeway.support.javaparser.MethodDeclarator;
 import org.gnu.freeway.support.javaparser.ParseException;
 import org.gnu.freeway.support.javaparser.visitors.DepthFirstVisitor;
-import org.gnu.freeway.server.CPluginLoader;
+import org.gnu.freeway.support.javaparser.visitors.Visitor;
 
 /**
  * @file SwitchTableGenerator.java
@@ -684,4 +688,32 @@
        
                }
        }
+       
+       private static class MethodLister extends DepthFirstVisitor implements 
Visitor {
+               //alias the constructor since an instance of this class is 
useless to others
+               public static ArrayList list(InputStream in) throws 
ParseException {
+                       MethodLister lister = new MethodLister(in);
+                       return lister.go();
+               }
+               
+               private InputStream in;
+               private CompilationUnit cu;
+               private ArrayList list;
+
+               private MethodLister(InputStream in) throws ParseException {
+                       this.in = in;
+                       JavaParser parser = new JavaParser(in);
+                       cu = parser.CompilationUnit();
+               }
+               
+               private synchronized ArrayList go() {
+                       list = new ArrayList();
+                       cu.accept(this);
+                       return list;
+               }
+               
+               public void visit(MethodDeclarator n) {
+                       list.add(n.f0.tokenImage);
+               }
+       }
 }

Modified: freeway/src/org/gnu/freeway/protocol/afs/Manager.java
===================================================================
--- freeway/src/org/gnu/freeway/protocol/afs/Manager.java       2006-06-12 
17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/protocol/afs/Manager.java       2006-06-13 
04:48:52 UTC (rev 3008)
@@ -234,7 +234,7 @@
                dbAvailableBlocks=new int[buckets];
 
                for (i=0;i<buckets;i++) {
-                       dbh=(DBHandle) new 
DynamicLibrary("freeway-afs-"+dtype+".jar").load(DBHandle.class,getClass().getClassLoader());
+                       dbh=(DBHandle) new 
DynamicLibrary("protocol-afs-"+dtype+".jar").load(DBHandle.class,getClass().getClassLoader());
                        if (dbh==null) {
                                log(Level.SEVERE,"Failed to initialize AFS 
database "+i+" !");
                                return;

Modified: freeway/src/org/gnu/freeway/server/CoreService.java
===================================================================
--- freeway/src/org/gnu/freeway/server/CoreService.java 2006-06-12 17:05:02 UTC 
(rev 3007)
+++ freeway/src/org/gnu/freeway/server/CoreService.java 2006-06-13 04:48:52 UTC 
(rev 3008)
@@ -380,7 +380,7 @@
                                return false;
                                }
 
-                       p=(Protocol) new 
DynamicLibrary("freeway-"+str+".jar").load(Protocol.class);
+                       p=(Protocol) new 
DynamicLibrary("protocol-"+str+".jar").load(Protocol.class);
                        if (p==null) {
                                log(Level.WARNING,"Could not load protocol 
'"+str+"' !");
                                return false;

Modified: freeway/src/org/gnu/freeway/server/TransportService.java
===================================================================
--- freeway/src/org/gnu/freeway/server/TransportService.java    2006-06-12 
17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/server/TransportService.java    2006-06-13 
04:48:52 UTC (rev 3008)
@@ -97,7 +97,7 @@
                p=prefs.getArray("GNUNETD","TRANSPORTS");
                if (p.length>0) {
                        for (i=0; i<p.length; i++) {
-                               t=(Transport) new 
DynamicLibrary("freeway-"+p[i]+".jar").load(Transport.class);
+                               t=(Transport) new 
DynamicLibrary("transport-"+p[i]+".jar").load(Transport.class);
                                if (t!=null) {
                                        register(t);
                                        }

Modified: freeway/src/org/gnu/freeway/transport/tcp/TCPAddress.java
===================================================================
--- freeway/src/org/gnu/freeway/transport/tcp/TCPAddress.java   2006-06-12 
17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/transport/tcp/TCPAddress.java   2006-06-13 
04:48:52 UTC (rev 3008)
@@ -18,7 +18,7 @@
        public static final int SIZE    =       8;
 
        /** claimed IP of the sender */
-       private InetAddress     ip;
+       private Inet4Address    ip;
 
        /** claimed port of the sender */
        private int                     port;
@@ -31,7 +31,7 @@
                port=0;
        }
 
-       public TCPAddress( InetAddress addr, int p )
+       public TCPAddress( Inet4Address addr, int p )
        {
                this();
                ip=addr;
@@ -69,7 +69,7 @@
                b=new byte[4];
                buf.get(b);
                try {
-                       ip=InetAddress.getByAddress(b);
+                       ip=(Inet4Address) Inet4Address.getByAddress(b);
                        }
                catch( UnknownHostException x ) {
                        err.reportIf(true,"bad address");

Modified: freeway/src/org/gnu/freeway/transport/tcp/TCPTransport.java
===================================================================
--- freeway/src/org/gnu/freeway/transport/tcp/TCPTransport.java 2006-06-12 
17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/transport/tcp/TCPTransport.java 2006-06-13 
04:48:52 UTC (rev 3008)
@@ -138,7 +138,7 @@
        public P2PHello createHELO()
        {
                P2PHello        helo;
-               InetAddress     ip;
+               Inet4Address    ip;
                int                     port;
 
                port=getTCPPort();

Modified: freeway/src/org/gnu/freeway/transport/udp/UDPAddress.java
===================================================================
--- freeway/src/org/gnu/freeway/transport/udp/UDPAddress.java   2006-06-12 
17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/transport/udp/UDPAddress.java   2006-06-13 
04:48:52 UTC (rev 3008)
@@ -18,7 +18,7 @@
        public static final int SIZE    =       8;
 
        /** claimed IP of the sender */
-       private InetAddress     ip;
+       private Inet4Address    ip;
 
        /** claimed port of the sender */
        private int                     port;
@@ -31,7 +31,7 @@
                port=0;
        }
 
-       public UDPAddress( InetAddress addr, int p )
+       public UDPAddress( Inet4Address addr, int p )
        {
                this();
                ip=addr;
@@ -69,7 +69,7 @@
                b=new byte[4];
                buf.get(b);
                try {
-                       ip=InetAddress.getByAddress(b);
+                       ip=(Inet4Address) Inet4Address.getByAddress(b);
                        }
                catch( UnknownHostException x ) {
                        err.reportIf(true,"bad address");

Modified: freeway/src/org/gnu/freeway/transport/udp/UDPTransport.java
===================================================================
--- freeway/src/org/gnu/freeway/transport/udp/UDPTransport.java 2006-06-12 
17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/transport/udp/UDPTransport.java 2006-06-13 
04:48:52 UTC (rev 3008)
@@ -256,7 +256,7 @@
        public P2PHello createHELO()
        {
                P2PHello        helo;
-               InetAddress     ip;
+               Inet4Address    ip;
                int                     port;
 
                port=getUDPPort();

Modified: freeway/src/org/gnu/freeway/util/DynamicLibrary.java
===================================================================
--- freeway/src/org/gnu/freeway/util/DynamicLibrary.java        2006-06-12 
17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/util/DynamicLibrary.java        2006-06-13 
04:48:52 UTC (rev 3008)
@@ -88,11 +88,7 @@
                        if (mf!=null) {
                                str=(String) 
mf.getMainAttributes().get(Attributes.Name.MAIN_CLASS);
                                if (str!=null) {
-                                       loader=createClassLoader(new String[] { 
//fixme: should use java.library.path and other vars ??
-                                               ".",
-                                               "/usr/lib",
-                                               "/usr/local/lib"
-                                               },loader);
+                                       loader=URLClassLoader.newInstance(new 
URL[] {f.toURL()},loader);
                                        c=loader.loadClass(str);
                                        }
                                }

Modified: freeway/src/org/gnu/freeway/util/IdentityService.java
===================================================================
--- freeway/src/org/gnu/freeway/util/IdentityService.java       2006-06-12 
17:05:02 UTC (rev 3007)
+++ freeway/src/org/gnu/freeway/util/IdentityService.java       2006-06-13 
04:48:52 UTC (rev 3008)
@@ -40,7 +40,7 @@
 {
        private Prefs   prefs;
        /** Our current IP address. */
-       private InetAddress                             myAddress;
+       private Inet4Address                            myAddress;
        private ScheduledTask           refreshTask;
 
 
@@ -104,10 +104,10 @@
         * @return false on failure, true on success
         */
 
-       protected InetAddress getAddressFromHostname()
+       protected Inet4Address getAddressFromHostname()
        {
                try {
-                       return InetAddress.getLocalHost();
+                       return (Inet4Address) Inet4Address.getLocalHost();
                        }
                catch( UnknownHostException x ) {
                        err("Could not obtain IP for localhost !",x);
@@ -115,7 +115,7 @@
                        }
        }
 
-       protected InetAddress getAddressFromIOCTL()
+       protected Inet4Address getAddressFromIOCTL()
        {
                String  interfaces;
                NetworkInterface        ni;
@@ -135,10 +135,12 @@
                                ni=(NetworkInterface) enum1.nextElement();
                                if (ni.getName().equals(interfaces)) {
                                        enum2=ni.getInetAddresses();
-                                       if (enum2.hasMoreElements()) {
+                                       while (enum2.hasMoreElements()) {
                                                //todo: laquelle prendre ???
                                                ip=(InetAddress) 
enum2.nextElement();
-                                               return ip;
+                                               if(ip instanceof Inet4Address) {
+                                                       return (Inet4Address) 
ip;
+                                                       }
                                                }
 
                                        return null;
@@ -156,7 +158,9 @@
                                        if (enum2.hasMoreElements()) {
                                                //todo: laquelle prendre ???
                                                ip=(InetAddress) 
enum2.nextElement();
-                                               return ip;
+                                               if(ip instanceof Inet4Address) {
+                                                       return (Inet4Address) 
ip;
+                                                       }
                                                }
 
                                        return null;
@@ -177,10 +181,10 @@
         * @return false on error, true on success
         */
 
-       protected InetAddress getAddress()
+       protected Inet4Address getAddress()
        {
                String  ipString;
-               InetAddress     ip;
+               Inet4Address    ip;
 
                ipString = prefs.getString("NETWORK","IP",null);//todo: "IP6" 
utilisé ?
                if (ipString == null) {
@@ -191,7 +195,7 @@
                else {
                        log(Level.FINEST,"Obtaining local IP address from 
hostname "+ipString+".");
                        try {
-                               ip = InetAddress.getByName(ipString);
+                               ip = (Inet4Address) 
Inet4Address.getByName(ipString);
                                }
                        catch( UnknownHostException x ) {
                                err("Couldn't resolve '"+ipString+"'",x);
@@ -215,7 +219,7 @@
         * @return false on error, true on success
         */
 
-       public InetAddress getPublicIPAddress()
+       public Inet4Address getPublicIPAddress()
        {
                return (isInitialized() ? myAddress : null);
        }

Modified: freeway/src/org/gnu/freeway/util/NativeService.java
===================================================================
--- freeway/src/org/gnu/freeway/util/NativeService.java 2006-06-12 17:05:02 UTC 
(rev 3007)
+++ freeway/src/org/gnu/freeway/util/NativeService.java 2006-06-13 04:48:52 UTC 
(rev 3008)
@@ -46,7 +46,11 @@
         * @see org.gnu.freeway.util.Service#getName()
         */
        public String getName() {
-               return this.getClass().getSimpleName();
+               String ret = this.getClass().getSimpleName();
+               if(ret.endsWith("Service")) {
+                       ret = ret.substring(0, ret.length() - 7);
+               }
+               return ret;
        }
 
        /* (non-Javadoc)

Modified: freeway/src/org/gnu/freeway/util/net/CSMessage.java
===================================================================
--- freeway/src/org/gnu/freeway/util/net/CSMessage.java 2006-06-12 17:05:02 UTC 
(rev 3007)
+++ freeway/src/org/gnu/freeway/util/net/CSMessage.java 2006-06-13 04:48:52 UTC 
(rev 3008)
@@ -19,25 +19,25 @@
        public static final int IS_RESULT                               =       
0;
 
        /** core: client to gnunetd: to how many nodes are we connected ? */
-       public static final int IS_CLIENT_COUNT                 =       1;
+       public static final int IS_CLIENT_COUNT                 =       32;
 
        /** core: client to gnunetd: how much traffic do we have at the moment? 
*/
-       public static final int IS_TRAFFIC_QUERY                        =       
2;
+       public static final int IS_TRAFFIC_QUERY                        =       
33;
 
        /** core: gnunetd to client: traffic statistics */
-       public static final int IS_TRAFFIC_INFO                 =       3;
+       public static final int IS_TRAFFIC_INFO                 =       34;
 
        /** core: client to gnunetd: request statistics */
-       public static final int IS_GET_STATISTICS               =       4;
+       public static final int IS_GET_STATISTICS               =       36;
 
        /** core: gnunetd to client: statistics */
-       public static final int IS_STATISTICS                   =       5;
+       public static final int IS_STATISTICS                   =       37;
 
        /** core: client to gnunetd: is client server message supported */
-       public static final int IS_CS_MESSAGE_SUPPORTED =       6;
+       public static final int IS_CS_MESSAGE_SUPPORTED =       38;
 
        /** core: client to gnunetd: is p2p message supported */
-       public static final int IS_P2P_MESSAGE_SUPPORTED        =       7;
+       public static final int IS_P2P_MESSAGE_SUPPORTED        =       39;
 
        /** afs : client to gnunetd: send queries */
        public static final int IS_QUERY                                        
=       8;
@@ -46,133 +46,133 @@
        public static final int IS_RESULT_3HASH                 =       9;
 
        /** afs : gnunetd to client: here is your answer (CHK-content) */
-       public static final int IS_RESULT_CHK                   =       10;
+       public static final int IS_RESULT_CHK                   =       -9;
 
        /** afs : client to gnunetd: insert CHK content (no index) */
-       public static final int IS_INSERT_CHK                   =       11;
+       public static final int IS_INSERT_CHK                   =       10;
 
        /** afs : client to gnunetd: insert 3HASH content (no index) */
-       public static final int IS_INSERT_3HASH                 =       12;
+       public static final int IS_INSERT_3HASH                 =       -10;
 
        /** afs : client to gnunetd: index content */
-       public static final int IS_INDEX_BLOCK                  =       13;
+       public static final int IS_INDEX_BLOCK                  =       11;
 
        /** afs : client to gnunetd: get an index for a file */
-       public static final int IS_INDEX_FILE                   =       14;
+       public static final int IS_INDEX_FILE                   =       0;
 
        /** afs : client to gnunetd: index super-block */
-       public static final int IS_INDEX_SUPER                  =       15;
+       public static final int IS_INDEX_SUPER                  =       0;
 
        /** afs : client to gnunetd: delete CHK content (no index) */
-       public static final int IS_DELETE_CHK                   =       16;
+       public static final int IS_DELETE_CHK                   =       12;
 
        /** afs : client to gnunetd: delete 3HASH content (no index) Not used 
so far! */
-       public static final int IS_DELETE_3HASH                 =       17;
+       public static final int IS_DELETE_3HASH                 =       -12;
 
        /** afs : client to gnunetd: unindex content (remove) */
-       public static final int IS_UNINDEX_BLOCK                        =       
18;
+       public static final int IS_UNINDEX_BLOCK                        =       
13;
 
        /** afs : client to gnunetd: remove an file from the indexed list */
-       public static final int IS_UNINDEX_FILE                 =       19;
+       public static final int IS_UNINDEX_FILE                 =       13;
 
        /** afs : client to gnunetd: unindex super-block */
-       public static final int IS_UNINDEX_SUPER                        =       
20;
+       public static final int IS_UNINDEX_SUPER                        =       
13;
 
        /** afs : client to gnunetd: issue namespace query */
-       public static final int IS_NSQUERY                              =       
21;
+       public static final int IS_NSQUERY                              =       
8;
 
        /** afs : client to gnunetd: store SBlock */
-       public static final int IS_INSERT_SBLOCK                        =       
22;
+       public static final int IS_INSERT_SBLOCK                        =       
0;
 
        /** afs : gnunetd to client: SBlock found */
-       public static final int IS_RESULT_SBLOCK                        =       
23;
+       public static final int IS_RESULT_SBLOCK                        =       
0;
 
        /** afs : client to gnunetd: bits of file to upload (indexing) */
-       public static final int IS_UPLOAD_FILE                  =       24;
+       public static final int IS_UPLOAD_FILE                  =       0;
 
        /** afs : client to gnunetd: try using a link for the file */
-       public static final int IS_LINK_FILE                            =       
25;
+       public static final int IS_LINK_FILE                            =       
0;
 
        /** afs : client to gnunetd: what is the average priority of entries in 
the routing table ? */
-       public static final int IS_GET_AVG_PRIORITY             =       26;
+       public static final int IS_GET_AVG_PRIORITY             =       0;
 
        /** chat : */
-       public static final int IS_CHAT_MESSAGE                 =       32;
+       public static final int IS_CHAT_MESSAGE                 =       0;
 
        /** trace : */
-       public static final int IS_TRACE_PROBE                  =       36;
+       public static final int IS_TRACE_PROBE                  =       0;
 
        /** trace : */
-       public static final int IS_TRACE_REPLY                  =       37;
+       public static final int IS_TRACE_REPLY                  =       0;
 
        /** benchmark : */
-       public static final int IS_BENCH_REQUEST                        =       
40;
+       public static final int IS_BENCH_REQUEST                        =       
0;
 
        /** benchmark : */
-       public static final int IS_BENCH_REPLY                  =       41;
+       public static final int IS_BENCH_REPLY                  =       0;
 
        /** testbed : */
-       public static final int IS_TESTBED_REQUEST              =       50;
+       public static final int IS_TESTBED_REQUEST              =       0;
 
        /** testbed : */
-       public static final int IS_TESTBED_REPLY                        =       
51;
+       public static final int IS_TESTBED_REPLY                        =       
0;
 
        /** core: client to gnunetd: shutdown */
-       public static final int IS_SHUTDOWN                             =       
64;
+       public static final int IS_SHUTDOWN                             =       
1;
 
        /** core: client to gnunetd: get configuration option */
-       public static final int IS_GET_OPTION_REQUEST           =       65;
+       public static final int IS_GET_OPTION_REQUEST           =       2;
 
        /** core: gnunetd to client: option value */
-       public static final int IS_GET_OPTION_REPLY             =       66;
+       public static final int IS_GET_OPTION_REPLY             =       3;
 
        /** */
-       public static final int IS_GET_HOST_INFO                        =       
67;
+       public static final int IS_GET_HOST_INFO                        =       
0;
 
        /** */
-       public static final int IS_HOST_INFO                            =       
68;
+       public static final int IS_HOST_INFO                            =       
0;
 
        /** dht: client to CS: ask ID for API     */
-       public static final int IS_DHT_REQUEST_API_ID           =       70;
+       public static final int IS_DHT_REQUEST_API_ID           =       0;
 
        /** dht: client to CS: create new table   */
-       public static final int IS_DHT_REQUEST_CREATE           =       71;
+       public static final int IS_DHT_REQUEST_CREATE           =       0;
 
        /** dht: client to CS: join table         */
-       public static final int IS_DHT_REQUEST_JOIN             =       72;
+       public static final int IS_DHT_REQUEST_JOIN             =       0;
 
        /** dht: client to CS: leave table        */
-       public static final int IS_DHT_REQUEST_LEAVE            =       73;
+       public static final int IS_DHT_REQUEST_LEAVE            =       0;
 
        /** dht: client to CS: insert to table    */
-       public static final int IS_DHT_REQUEST_INSERT           =       74;
+       public static final int IS_DHT_REQUEST_INSERT           =       0;
 
        /** dht: client to CS: fetch from table   */
-       public static final int IS_DHT_REQUEST_FETCH            =       75;
+       public static final int IS_DHT_REQUEST_FETCH            =       0;
 
        /** dht: client to CS: list tables        */
-       public static final int IS_DHT_REQUEST_TABLES           =       76;
+       public static final int IS_DHT_REQUEST_TABLES           =       0;
 
        /** dht: client to CS: list inserted data */
-       public static final int IS_DHT_REQUEST_INSERTED =       77;
+       public static final int IS_DHT_REQUEST_INSERTED =       0;
 
        /** dht: client to CS: drop inserted data */
-       public static final int IS_DHT_REQUEST_DROP             =       78;
+       public static final int IS_DHT_REQUEST_DROP             =       0;
 
        /** dht: client to CS: operation status   */
-       public static final int IS_DHT_REQUEST_STATUS           =       79;
+       public static final int IS_DHT_REQUEST_STATUS           =       0;
 
        /** dht: CS to client: ack or denial      */
-       public static final int IS_DHT_REPLY_STANDARD           =       80;
+       public static final int IS_DHT_REPLY_STANDARD           =       0;
 
        /** dht: CS to client: operation failed   */
-       public static final int IS_DHT_REPLY_FAILURE            =       81;
+       public static final int IS_DHT_REPLY_FAILURE            =       0;
 
        /** dht: CS to client: operation results  */
-       public static final int IS_DHT_REPLY_RESULTS            =       82;
+       public static final int IS_DHT_REPLY_RESULTS            =       0;
 
        /** dht: CS to client: operation status   */
-       public static final int IS_DHT_REPLY_STATUS             =       83;
+       public static final int IS_DHT_REPLY_STATUS             =       0;
 
        /** */
        public static final int IS_MAX                                  =       
100;

Added: freeway/transports.xml
===================================================================
--- freeway/transports.xml      2006-06-12 17:05:02 UTC (rev 3007)
+++ freeway/transports.xml      2006-06-13 04:48:52 UTC (rev 3008)
@@ -0,0 +1,20 @@
+<jar destfile="${project.build}/transport-tcp.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/tcp/**" />
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.transport.tcp.TCPTransport" />
+       </manifest>
+</jar>
+
+<jar destfile="${project.build}/transport-udp.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/udp/**" />
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.transport.udp.UDPTransport" />
+       </manifest>
+</jar>
+
+<jar destfile="${project.build}/transport-nat.jar">
+       <fileset dir="${project.build}/classes" 
includes="org/gnu/freeway/transport/nat/**" />
+       <manifest>
+               <attribute name="Main-Class" 
value="org.gnu.freeway.transport.nat.NATTransport" />
+       </manifest>
+</jar>





reply via email to

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