From aff598c9c6364059fb3e698f955ed524ee4e081d Mon Sep 17 00:00:00 2001 From: jestin Date: Thu, 3 Aug 2006 15:54:54 +0000 Subject: a few changes towards the tunnel manager --- src/Puppet.java | 121 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 105 insertions(+), 16 deletions(-) (limited to 'src/Puppet.java') diff --git a/src/Puppet.java b/src/Puppet.java index d122d52..e2a90ee 100644 --- a/src/Puppet.java +++ b/src/Puppet.java @@ -5,35 +5,124 @@ import java.io.*; import java.util.*; import org.apache.regexp.*; -class Puppet extends Ivy { +class Puppet { - Hashtable bound = new Hashtable(); // clef: l'ID de la regexp choisi par le ghost, valeur: l'Int de l'abonnement local - String myDomain; + // the mapping between Ghost regexp and local bus regexp numbers + Hashtable bound = new Hashtable(); // ghostID localID + Hashtable regexps = new Hashtable(); // ghostID textRegexp + String domain; + String appName; ProxyClient pc; + String id; + boolean started; + PuppetIvy bus; - Puppet(ProxyClient pc,String domain) { - super("noname","noname not ready",null); - myDomain=domain; + Puppet(ProxyClient pc,String id,String domain) { + this.domain=domain; this.pc=pc; + this.id=id; } - void parse(String s){ - System.out.println("the puppet must parse "+s); + void sendGhost(String s) { pc.send("ForwardGhost id="+id+" buffer="+s); } + + class ForwardMessenger implements IvyMessageListener { + String localId,ghostId; + public ForwardMessenger(String ghostId,String re) throws IvyException { + this.ghostId=ghostId; + this.localId = (new Integer(bus.bindMsg(re,ForwardMessenger.this))).toString(); + bound.put(ghostId,localId); + } + public void receive(IvyClient ic,String args[]) { + String tosend = IvyClient.Msg+" "+ghostId+IvyClient.StartArg; + for (int i=0;i