[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip ARP.java,1.5,1.6 Echo_tcp.java,1.12,1.13 Proto
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2005-12-03 19:23:33
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11291/core/protocolsuite/tcp_ip Modified Files: ARP.java Echo_tcp.java ProtocolStack.java Tcp.java Log Message: ARP on siveving lines works! Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** ProtocolStack.java 3 Dec 2005 12:20:52 -0000 1.29 --- ProtocolStack.java 3 Dec 2005 19:23:19 -0000 1.30 *************** *** 267,270 **** --- 267,272 ---- } + + //Create layer info *************** *** 1670,1675 **** boolean flags[]={false,false,false,false,true,false}; /* URG, ACK, PSH, RST, !SYN!, FIN */ rval=mTCPprotocol.ReservePort(application, inDestIPAddress, indestPort); ! if (sendTCPSegment(application, msg, flags,ack_num)) ! return rval; else return -1; } --- 1672,1681 ---- boolean flags[]={false,false,false,false,true,false}; /* URG, ACK, PSH, RST, !SYN!, FIN */ rval=mTCPprotocol.ReservePort(application, inDestIPAddress, indestPort); ! if (sendTCPSegment(application, msg, flags,ack_num)) { ! return rval; ! }else{ ! mTCPprotocol.FreeApplication(application); ! return -1; ! } } Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Tcp.java 1 Dec 2005 18:37:16 -0000 1.19 --- Tcp.java 3 Dec 2005 19:23:19 -0000 1.20 *************** *** 169,172 **** --- 169,183 ---- public void reset() { + if (timer!=null){ + System.out.println("Timer cancel - part1!"); + try{ + this.timer.cancel(); + }catch(Exception e){ + System.out.println("Timer cancel error."); + } + System.out.println("Timer cancel -part 2!"); + this.timer = null; + } + this.PortStatus=0; this.application=null; *************** *** 234,238 **** this.isFIN_confirmed=false; this.isPassive=false; ! if (timer!=null) this.timer.cancel(); } } --- 245,249 ---- this.isFIN_confirmed=false; this.isPassive=false; ! } } *************** *** 277,282 **** --- 288,299 ---- public void TCPsetTimer(TCP_HashTableElement Elm) { + + + if(Elm.timer==null){ + System.out.println("Timer init!"); Elm.timer=new Timer(); Elm.timer.schedule(new TCPTask(Elm),0,500); + } + } *************** *** 300,306 **** public void run() { ! System.out.println("Timer start!"); if(!Elm.SegmentsToResend.isEmpty()) { Enumeration HTkeys; Integer curkey; --- 317,325 ---- public void run() { ! // System.out.println("Timer start!"); if(!Elm.SegmentsToResend.isEmpty()) { + // this.cancel(); + // Elm.timer.cancel(); Enumeration HTkeys; Integer curkey; *************** *** 314,320 **** } } ! else { ! System.out.println("Timer cancel!"); Elm.timer.cancel(); } } } --- 333,347 ---- } } ! else { ! System.out.println("Timer cancel - part1!"); ! try{ ! Elm.timer.cancel(); ! this.cancel(); ! Elm.timer = null; ! }catch(Exception e){ ! System.out.println("Timer cancel error."); } + System.out.println("Timer cancel - part2!"); + } } } *************** *** 450,455 **** Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToClose); ! if (Elm.PortStatus==1 || (Elm.PortStatus==2 && PortToClose<PORT_START_NUMBER)) { Elm.reset(); } else throw new TransportLayerException("TCP Error: port "+ PortToClose +" is not being LISTENED to by the application: \"" + application.toString() + "\"."); --- 477,483 ---- Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToClose); ! if (Elm.PortStatus==1 || Elm.PortStatus==2) //&& PortToClose<=PORT_START_NUMBER { + System.out.println("!!!"); Elm.reset(); } else throw new TransportLayerException("TCP Error: port "+ PortToClose +" is not being LISTENED to by the application: \"" + application.toString() + "\"."); *************** *** 471,476 **** try{ Integer PortToFree=getApplicationLocalPortNumber(application); ! Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToFree); ! Elm.reset(); }catch(Exception e){} } --- 499,506 ---- try{ Integer PortToFree=getApplicationLocalPortNumber(application); ! Elm=(TCP_HashTableElement) PortTable.get((Integer)PortToFree); ! System.out.println("###"); ! Elm.reset(); ! System.out.println("111"); }catch(Exception e){} } Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Echo_tcp.java 30 Nov 2005 13:02:32 -0000 1.12 --- Echo_tcp.java 3 Dec 2005 19:23:19 -0000 1.13 *************** *** 169,173 **** Simulation.addLayerInfo(protInfo3); - Disconnect(); --- 169,172 ---- Index: ARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARP.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ARP.java 1 Dec 2005 19:51:53 -0000 1.5 --- ARP.java 3 Dec 2005 19:23:19 -0000 1.6 *************** *** 321,325 **** { ! String output= null; //this cleans out any entries older than 2 minutes --- 321,326 ---- { ! String output= null; ! int tryings = 5; //this cleans out any entries older than 2 minutes *************** *** 347,352 **** //then send ARP Packet to try and find out about IP Address mLastIpRequest = IPAddress; ! String srcMAC = mParentStack.getMACAddress(inInterfaceKey); --- 348,355 ---- //then send ARP Packet to try and find out about IP Address + while(output==null && tryings-->0){ + mLastIpRequest = IPAddress; ! String srcMAC = mParentStack.getMACAddress(inInterfaceKey); *************** *** 398,401 **** --- 401,405 ---- } + } } |