diff options
-rw-r--r-- | Changelog | 10 | ||||
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | debian/changelog | 8 | ||||
-rw-r--r-- | doc/ivy-java.sgml | 14 | ||||
-rw-r--r-- | doc/jafter.1 | 60 | ||||
-rw-r--r-- | java.mk | 9 | ||||
-rwxr-xr-x | src/Ivy.java | 24 | ||||
-rwxr-xr-x | src/IvyWatcher.java | 10 | ||||
-rw-r--r-- | src/Probe.java | 16 | ||||
-rw-r--r-- | src/ProxyClient.java | 23 | ||||
-rw-r--r-- | src/ProxyMaster.java | 18 | ||||
-rw-r--r-- | src/Puppet.java | 26 |
12 files changed, 193 insertions, 31 deletions
@@ -1,4 +1,14 @@ -------------------------------------------------------------------- +1.2.13 + + mise en place de TCP_NO_DELAY, pour desactiver l'algorithme de Naggle + adds try catch blocks for RE constructors ( new Jakarta Regexp ? ) + updates of documentation ( jafter, sgml file ) + +-------------------------------------------------------------------- +1.2.12 + +-------------------------------------------------------------------- 1.2.10 et 11 documentation updated @@ -1,7 +1,7 @@ include java.mk # Be sure to set this before compiling ... - VERSION = 1.2.12 + VERSION = 1.2.13 DIST = ivy-$(VERSION).jar DOCS = doc/html/api #dist = woody/ @@ -29,8 +29,8 @@ dist: class jar: class ln -sf src/fr . - ln -sf bundle/${dist}gnu . - ln -sf bundle/${dist}org . + ln -sf ${HOME}/dev/bundle/${dist}gnu . + ln -sf ${HOME}/dev/bundle/${dist}org . $(JAR) cfm ivy-java.jar manifest fr/dgac/ivy/*.class fr/dgac/ivy/tools/*.class src/Makefile src/*.java README COPYING.LIB Changelog BUGS gnu org examples/*.java /bin/rm -f gnu org diff --git a/debian/changelog b/debian/changelog index abdbf5c..1c75fe5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +libivy-java (1.2.13) unstable; urgency=low + + * disables the Nagle's socket algorithm ( TCP_NO_DELAY = 1 ) + * adds try catch blocks for RE constructors ( new Jakarta Regexp ? ) + * updates of documentation ( jafter, sgml file ) + + -- Yannick Jestin <yannick.jestin@enac.fr> Wed, 25 Jul 2009 16:51:21 +0100 + libivy-java (1.2.12-2) unstable; urgency=low * etch fixes diff --git a/doc/ivy-java.sgml b/doc/ivy-java.sgml index a7791c5..8d07ce2 100644 --- a/doc/ivy-java.sgml +++ b/doc/ivy-java.sgml @@ -1,18 +1,17 @@ +<?xml version='1.0' encoding="iso-8859-1"?> +<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook V4.5//EN" + "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> <!-- The Ivy Java guide + SGML source file Copyright (c) 1999-2006 DSNA/DTI Centre d'Etudes de la Navigation Aerienne - - SGML source file - + ENAC Ecole Nationale de l'Aviation Civile Author: Yannick Jestin <yannick.jestin@enac.fr> - +<article xmlns="http://docbook.org/ns/docbook"> --> -<?XML VERSION='1.0' ?> -<!DOCTYPE ARTICLE PUBLIC "-//OASIS//DTD DocBook V3.1//EN"> - <article> <artheader> @@ -702,6 +701,7 @@ the numeric id </para></listitem> <listitem><para> .ping CLIENT measures the time it takes to reach a client +</para></listitem> </itemizedlist> </para> </sect2> diff --git a/doc/jafter.1 b/doc/jafter.1 new file mode 100644 index 0000000..806027c --- /dev/null +++ b/doc/jafter.1 @@ -0,0 +1,60 @@ +.\" '\" +.\" '\" Ivy jafter, a small shell script waiting for a message on the Ivy bus +.\" '\" +.\" '\" Copyright (C) 1997-2006 +.\" '\" DSNA/DTI/SDER ( Centre d'Études de la Navigation Aérienne ) +.\" '\" Copyright (C) 2007-2009 +.\" '\" ENAC (Ecole Nationale de l'Aviation Civile) +.\" '\" +.\" '\" See the file "license.terms" for information on usage and redistribution +.\" '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES. +.\" '\" +.\" '\" +.TH "jafter" "" "" "Yannick Jestin <Yannick.Jestin@enac.fr>" "" +.SH "NAME" +jafter \- a Ivy java agent waiting for a message on the bus + +.SH "SYNOPSIS" + + jafter [options] regexp + +.SH OPTIONS + + -b BUS specifies the Ivy bus domain + -t time out in seconds ( defaults to 0, waits forever ) + -h help + + regexp is the regular expression you're waiting for. + +.SH "DESCRIPTION" + + fr.dgac.ivy.tools.After is a small class dedicated to using Ivy within shell + scripts. + + regexp is the regular expression you're waiting for. The program will exit + and return 0 to the parent shell once it has been received on the bus, or + with an error if you set a timeout. + +.SH EXAMPLES +.B jafter -t 5 'hello.*world' + +will hang until it receives a hello world on the default bus, and then exit +silently and return 0. If no message is received within 5 seconds, it will die +and return -1 + +.SH "BUGS" +See the /usr/share/doc/libivy-java/BUGS file for details. + +.SH "AUTHORS" +.nf +Yannick Jestin <yannick.jestin@enac.fr> +.SH "SEE ALSO" +.nf +jprobe (1) +.nf +pcrepattern (3) +.sp +For further details, please refer to the Ivy html page at http://www.tls.cena.fr/products/ivy/ + +.SH "NOTES" +In case of any comment or bug report on this library, please contact yannick.jestin@enac.fr @@ -8,8 +8,9 @@ # 1.2.8 first # - GNUPATH =/usr/share/java/gnu-getopt.jar:/usr/share/java/regexp.jar - #GNUPATH = ../bundle # on my MAC + #GNUPATH =/usr/share/java/gnu-getopt.jar:/usr/share/java/regexp.jar + # on my MAC + GNUPATH =${HOME}/dev/bundle #GNUPATH = /usr/lib/jdk1.1/lib/classes.zip:/usr/share/java/gnu.getopt.jar:/usr/share/java/regexp.jar # debian woody #GNUPATH = ${HOME}/java/Jars/gnu.getopt.jar:${HOME}/java/Jars/regexp.jar # Others #RTPATH = /usr/local/jdk1.5.0/jre/lib/rt.jar # for jikes on my box @@ -20,8 +21,8 @@ CLASSPATH = -classpath $(GNUPATH):. #JAVA = kaffe JAVA = java #JAVA = gij -JAVAC = gcj -C --encoding=8859_1 -Wall -g -#JAVAC = javac +#JAVAC = gcj -C --encoding=8859_1 -Wall -g +JAVAC = javac -target 1.5 #JAVAC = /usr/local/j2sdk1.4.2/bin/javac #JAVACOPTS = #JAVACOPTS = -target 1.2 diff --git a/src/Ivy.java b/src/Ivy.java index 2647434..5e3362f 100755 --- a/src/Ivy.java +++ b/src/Ivy.java @@ -13,6 +13,8 @@ *</pre> * * CHANGELOG: + * 1.2.13: + * - adds support for RESyntaxException * 1.2.12: * - directMessage goes protected * 1.2.9: @@ -114,7 +116,7 @@ public class Ivy implements Runnable { * the library version, useful for development purposes only, when java is * invoked with -DIVY_DEBUG */ - public static final String libVersion ="1.2.12"; + public static final String libVersion ="1.2.13"; private boolean debug; private ServerSocket app; @@ -235,7 +237,12 @@ public class Ivy implements Runnable { Properties sysProp = System.getProperties(); sysProp.put("IVYBUS",domainbus); String range=(String)sysProp.get("IVYRANGE"); - RE rangeRE = new RE("(\\d+)-(\\d+)"); // tcp range min and max + RE rangeRE; // tcp range min and max + try { + rangeRE = new RE("(\\d+)-(\\d+)"); // tcp range min and max + } catch ( RESyntaxException res ) { + throw new IvyException("Regular Expression bug in Ivy source code ... bailing out"); + } if ((range!=null)&&rangeRE.match(range)) { int rangeMin=Integer.parseInt(rangeRE.getParen(1)); int rangeMax=Integer.parseInt(rangeRE.getParen(2)); @@ -575,7 +582,18 @@ public class Ivy implements Runnable { * @param exp a string regular expression * must be synchronized ( RE is not threadsafe ) */ - private static final RE bounded = new RE("^\\^([a-zA-Z0-9_-]+).*"); + private static RE bounded ; + + static { + try { + bounded = new RE("^\\^([a-zA-Z0-9_-]+).*"); + } catch ( RESyntaxException res ) { + res.printStackTrace(); + System.out.println("Regular Expression bug in Ivy source code ... bailing out"); + System.exit(0); + } + } + public synchronized boolean CheckRegexp( String exp ) { if (filter==null) return true; // there's no message filter if (!bounded.match(exp)) return true; // the regexp is not bounded diff --git a/src/IvyWatcher.java b/src/IvyWatcher.java index bf8dc3f..3281079 100755 --- a/src/IvyWatcher.java +++ b/src/IvyWatcher.java @@ -14,6 +14,9 @@ * thing. * * CHANGELOG: + * 1.2.13: + * - TCP_NO_DELAY to disable Nagle's algorithm + * - private static ?! pour already present ... * 1.2.9: * - added an application Id in the UDP broadcast. It seems to be ok with * most implementations ( VERSION PORT APPID APPNAME \n) is compatible with (VERSION @@ -187,7 +190,9 @@ class IvyWatcher implements Runnable { if (!alreadyBroadcasted(remotehost.toString(),remotePort)) { traceDebug("no known agent originating from " + remotehost + ":" + remotePort); try { - bus.createIvyClient(new Socket(remotehost,remotePort),remotePort,false); + Socket s = new Socket(remotehost,remotePort); + s.setTcpNoDelay(true); + bus.createIvyClient(s,remotePort,false); } catch ( java.net.ConnectException jnc ) { traceDebug("cannot connect to "+remotehostname+":"+remotePort+", he probably stopped his bus"); } @@ -278,7 +283,8 @@ class IvyWatcher implements Runnable { * * regoes static ... */ - private static Hashtable alreadySocks=new Hashtable(); + //private static Hashtable alreadySocks=new Hashtable(); + private Hashtable alreadySocks=new Hashtable(); private synchronized boolean alreadyBroadcasted(String s,int port) { // System.out.println("DEBUUUUUUUG " + s+ ":" + port); if (s==null) return false; diff --git a/src/Probe.java b/src/Probe.java index 56085fe..c3f05c2 100644 --- a/src/Probe.java +++ b/src/Probe.java @@ -7,6 +7,8 @@ * (c) CENA * * Changelog: + * 1.2.13 + * - adds support for RESyntaxException * 1.2.12 * - .ping is back * 1.2.9 @@ -145,9 +147,19 @@ public class Probe implements IvyApplicationListener, IvyMessageListener, IvyBin private Ivy bus; private boolean timestamp,quiet,debug,exitOnDie=false; - private static RE directMsgRE = new RE("^\\.direct ([^ ]*) ([0-9]+) (.*)"); - private static RE timeCountRE = new RE("^\\.time (\\d+) (.*)"); + private static RE directMsgRE, timeCountRE; + + static { + try { + directMsgRE = new RE("^\\.direct ([^ ]*) ([0-9]+) (.*)"); + timeCountRE = new RE("^\\.time (\\d+) (.*)"); + } catch ( RESyntaxException res ) { + res.printStackTrace(); + System.out.println("Regular Expression bug in Ivy source code ... bailing out"); + System.exit(0); + } + } public Probe(BufferedReader in, boolean timestamp,boolean quiet,boolean debug) { this.in=in; this.timestamp=timestamp; diff --git a/src/ProxyClient.java b/src/ProxyClient.java index 9eb1e41..91af0ba 100644 --- a/src/ProxyClient.java +++ b/src/ProxyClient.java @@ -7,7 +7,9 @@ * (c) ENAC * * changelog: - * 1.2.12 + * 1.2.13 + * - adds support for RESyntaxException + * */ package fr.dgac.ivy ; import java.io.*; @@ -96,10 +98,21 @@ public class ProxyClient extends Ivy { send("Hello bus="+domain); } - RE getId=new RE("^ID id=(.*) value=(.*)"); - RE fwdGhost=new RE("^ForwardGhost id=(.*) buffer=(.*)"); - RE fwdPuppet=new RE("^ForwardPuppet id=(.*) buffer=(.*)"); - RE puppetRe=new RE("^CreatePuppet id=(.*)"); + static RE getId,fwdGhost,fwdPuppet,puppetRe; + + static { + try { + getId=new RE("^ID id=(.*) value=(.*)"); + fwdGhost=new RE("^ForwardGhost id=(.*) buffer=(.*)"); + fwdPuppet=new RE("^ForwardPuppet id=(.*) buffer=(.*)"); + puppetRe=new RE("^CreatePuppet id=(.*)"); + } catch ( RESyntaxException res ) { + res.printStackTrace(); + System.out.println("Regular Expression bug in Ivy source code ... bailing out"); + System.exit(0); + } + } + void parseMsg(String msg) { // System.out.println("PC parsing "+msg); if (getId.match(msg)) { diff --git a/src/ProxyMaster.java b/src/ProxyMaster.java index f80fa11..f8585fd 100644 --- a/src/ProxyMaster.java +++ b/src/ProxyMaster.java @@ -7,6 +7,8 @@ * (c) ENAC * * changelog: + * 1.2.13 + * - adds support for RESyntaxException * 1.2.12 */ package fr.dgac.ivy.tools ; // TODO go into sub tools, and build a shell/.BAT script @@ -86,8 +88,19 @@ public class ProxyMaster { PrintWriter out; String hostname=null; // I will know from the socket String busDomain=null; // I will know it from the Hello message + RE helloRE, getId,fwdPuppet,fwdGhost; SubReader(Socket socket) throws IOException { + try { + helloRE=new RE("^Hello bus=(.*)"); + getId=new RE("^GetID id=(.*)"); + fwdPuppet=new RE("^ForwardPuppet id=(.*) buffer=(.*)"); + fwdGhost=new RE("^ForwardGhost id=(.*) buffer=(.*)"); + } catch ( RESyntaxException res ) { + res.printStackTrace(); + System.out.println("Regular Expression bug in Ivy source code ... bailing out"); + System.exit(0); + } proxyClients.addElement(this); hostname = socket.getInetAddress().getHostName(); in=new BufferedReader(new InputStreamReader(socket.getInputStream())); @@ -119,10 +132,7 @@ public class ProxyMaster { proxyClients.removeElement(this); } - RE helloRE=new RE("^Hello bus=(.*)"); - RE getId=new RE("^GetID id=(.*)"); - RE fwdPuppet=new RE("^ForwardPuppet id=(.*) buffer=(.*)"); - RE fwdGhost=new RE("^ForwardGhost id=(.*) buffer=(.*)"); + void parseMsg(String msg) { // System.out.println("PM parsing "+msg); diff --git a/src/Puppet.java b/src/Puppet.java index e2a90ee..5398798 100644 --- a/src/Puppet.java +++ b/src/Puppet.java @@ -1,3 +1,16 @@ +/** + * Part of a Ivy-level proxy + * + * @author Yannick Jestin + * @author <a href="http://www.tls.cena.fr/products/ivy/">http://www.tls.cena.fr/products/ivy/</a> + * + * (c) CENA 1998-2004 + * + * CHANGELOG: + * 1.2.13: + * - adds support for RESyntaxException + */ + package fr.dgac.ivy ; import java.lang.Thread; import java.net.*; @@ -57,7 +70,18 @@ class Puppet { } // ivy forwarded protocol message - static final RE ivyProto = new RE("(\\d+) (\\d+)\\02(.*)"); + static RE ivyProto; + + static { + try { + ivyProto = new RE("(\\d+) (\\d+)\\02(.*)"); + } catch ( RESyntaxException res ) { + res.printStackTrace(); + System.out.println("Regular Expression bug in Ivy source code ... bailing out"); + System.exit(0); + } + } + void parse(String s) throws IvyException { if (!ivyProto.match(s)) { System.out.println("Puppet error, can't parse "+s); return; } int pcode=Integer.parseInt(ivyProto.getParen(1)); |