[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip ARP.java,1.6,1.7 Echo_tcp.java,1.21,1.22 Proto
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2006-02-24 15:41:48
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4814/core/protocolsuite/tcp_ip Modified Files: ARP.java Echo_tcp.java ProtocolStack.java Tcp.java Telnet_client.java Log Message: Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** ProtocolStack.java 24 Feb 2006 10:20:11 -0000 1.42 --- ProtocolStack.java 24 Feb 2006 15:41:44 -0000 1.43 *************** *** 870,874 **** TCP_packet temp = (TCP_packet)inPacket; try{ ! mTCPprotocol.receiveTCPPacket(temp); }catch(TransportLayerException te){} catch(NullPointerException e){ --- 870,874 ---- TCP_packet temp = (TCP_packet)inPacket; try{ ! mTCPprotocol.receiveTCPPacket(temp); }catch(TransportLayerException te){} catch(NullPointerException e){ *************** *** 1888,1893 **** { //let's get first interface IP address ! SourceIPAddress=getIPAddress(FirstInterfaceName); TCP_packet tosend = mTCPprotocol.sendTCPPacket(DestIPAddress,SourceIPAddress,destPort,srcPort,inTCPMessage,flags,acknow_num); //and sending out ;) sendPacket(tosend); --- 1888,1895 ---- { //let's get first interface IP address ! SourceIPAddress=getIPAddress(FirstInterfaceName); ! System.out.println("try to send..."); TCP_packet tosend = mTCPprotocol.sendTCPPacket(DestIPAddress,SourceIPAddress,destPort,srcPort,inTCPMessage,flags,acknow_num); + System.out.println("never be here..."); //and sending out ;) sendPacket(tosend); *************** *** 1897,1903 **** //throw new InvalidNetworkLayerDeviceException("Network interface unavailable on host \"" + temp.getName() +"\"."); }catch(Exception e){ ! //try { ! LayerInfo TCP_Info = new LayerInfo(getClass().getName()); TCP_Info.setObjectName(getParentNodeName()); --- 1899,1905 ---- //throw new InvalidNetworkLayerDeviceException("Network interface unavailable on host \"" + temp.getName() +"\"."); }catch(Exception e){ ! System.out.println("catch..."); //try { ! System.out.println("never be here..."); LayerInfo TCP_Info = new LayerInfo(getClass().getName()); TCP_Info.setObjectName(getParentNodeName()); Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** Tcp.java 24 Feb 2006 12:18:33 -0000 1.40 --- Tcp.java 24 Feb 2006 15:41:44 -0000 1.41 *************** *** 315,320 **** * Used in timer */ ! private static final long TCP_SERVER_TIME = 250; //msec //server closing idle connection time ! private static final long TCP_SENDER_TIME = 1000; //msec time to resend all segments in SegmentsToresend queue /** --- 315,322 ---- * Used in timer */ ! private static final long TCP_SERVER_TIME = 10000; //msec //server closing idle connection time ! private static final long TCP_CONNECT_SERVER_TIME = 250; //msec //server closing idle connection time ! private static final long TCP_SENDER_TIME = 10000; //msec time to resend all segments in SegmentsToresend queue ! private static final long TCP_CONNECT_TIME = 200; //msec time to resend all segments in SegmentsToresend queue whn connecting /** *************** *** 349,353 **** System.out.println("Sender timer init!"); Elm.timer=new Timer(); ! Elm.timer.schedule(new TCPTask(Elm,TCP_SENDER_TIME,this),TCP_SENDER_TIME,TCP_SENDER_TIME); } else { --- 351,355 ---- System.out.println("Sender timer init!"); Elm.timer=new Timer(); ! Elm.timer.schedule(new TCPTask(Elm,TCP_CONNECT_TIME,this),TCP_CONNECT_TIME,TCP_CONNECT_TIME); } else { *************** *** 356,360 **** Elm.timer=null; Elm.timer=new Timer(); ! Elm.timer.schedule(new TCPTask(Elm,TCP_SENDER_TIME,this),TCP_SENDER_TIME,TCP_SENDER_TIME); System.out.println(" Sender Timer REinit DONE!"); } --- 358,362 ---- Elm.timer=null; Elm.timer=new Timer(); ! Elm.timer.schedule(new TCPTask(Elm,TCP_SENDER_TIME,this), TCP_SENDER_TIME, TCP_SENDER_TIME); System.out.println(" Sender Timer REinit DONE!"); } *************** *** 365,369 **** public class TCPTask extends TimerTask { ! private int numRepeat=30; private TCP_HashTableElement Elm; private long repTime; --- 367,371 ---- public class TCPTask extends TimerTask { ! private int numRepeat=5; private TCP_HashTableElement Elm; private long repTime; *************** *** 409,413 **** --- 411,417 ---- Elm.sent_duplicates++; + System.out.println("trying to send in timer"); mParentStack.sendPacket((TCP_packet)Elm.SegmentsToResend.get(curkey)); + System.out.println("never be here II."); } catch (Exception e) {System.out.println("Queue of segments to resend INNER ERROR: " + e.toString());} } *************** *** 443,447 **** } } ! }catch(NullPointerException e){ System.out.println(e.toString()); } } } --- 447,451 ---- } } ! }catch(Exception e){ System.out.println(e.toString()); } } } *************** *** 462,466 **** System.out.println("Server Timer init!"); Elm.Servertimer=new Timer(); ! Elm.Servertimer.schedule(new TCPServerTask(Elm,inlocalPort,TCP_SERVER_TIME,this),TCP_SERVER_TIME,TCP_SERVER_TIME); } else { --- 466,470 ---- System.out.println("Server Timer init!"); Elm.Servertimer=new Timer(); ! Elm.Servertimer.schedule(new TCPServerTask(Elm,inlocalPort,TCP_CONNECT_SERVER_TIME,this),TCP_CONNECT_SERVER_TIME,TCP_CONNECT_SERVER_TIME); } else { *************** *** 478,482 **** public class TCPServerTask extends TimerTask { ! private int numRepeat=34; private int localPort; private TCP_HashTableElement Elm; --- 482,486 ---- public class TCPServerTask extends TimerTask { ! private int numRepeat=6; private int localPort; private TCP_HashTableElement Elm; *************** *** 1056,1069 **** public void receiveTCPPacket(TCP_packet inPacket) throws TransportLayerPortException, TransportLayerException, LowLinkException, CommunicationException { ! System.out.println(mParentStack.getHostName() + ":" + " !!!!!!!!!!! SEQ_numb==" + inPacket.get_sequence_number()); //test: check sum of TCP packet if (inPacket.getCheck_Sum() == 1) { - // test if this packet is for a local Address. if(mParentStack.isInternalIP(inPacket.getDestIPAddress())){ // this.total_received++; //overall stats - // test if destination TCP port exists on this NeworkLayerDevice if (PortTable.get(inPacket.get_destPort()) !=null) --- 1060,1071 ---- public void receiveTCPPacket(TCP_packet inPacket) throws TransportLayerPortException, TransportLayerException, LowLinkException, CommunicationException { ! System.out.println(mParentStack.getHostName() + ":" + " !!!!!!!!!! SEQ_numb==" + inPacket.get_sequence_number()); //test: check sum of TCP packet if (inPacket.getCheck_Sum() == 1) { // test if this packet is for a local Address. if(mParentStack.isInternalIP(inPacket.getDestIPAddress())){ // this.total_received++; //overall stats // test if destination TCP port exists on this NeworkLayerDevice if (PortTable.get(inPacket.get_destPort()) !=null) *************** *** 1071,1088 **** //let's check all the things dealing with destination port number ! TCP_HashTableElement Elm = null; Elm=(TCP_HashTableElement)PortTable.get(inPacket.get_destPort()); ! switch(Elm.PortStatus) { case 0: //port is free => Error: no application to receive TCP ! //have to disconnect listener from port throw new TransportLayerPortException("TCP Error: no application listening to port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"!"); //no break needed ;) case 1: // port is being listened to by a new application. //Check for SYN try{ if (inPacket.get_SYN_flag()) { --- 1073,1093 ---- //let's check all the things dealing with destination port number ! TCP_HashTableElement Elm = null; Elm=(TCP_HashTableElement)PortTable.get(inPacket.get_destPort()); ! System.out.println(Elm.PortStatus); switch(Elm.PortStatus) { case 0: //port is free => Error: no application to receive TCP ! //have to disconnect listener from port ! System.out.println(mParentStack.getHostName() + ":" + " !! 0 SEQ_numb==" + inPacket.get_sequence_number()); throw new TransportLayerPortException("TCP Error: no application listening to port "+inPacket.get_destPort() +" on host \""+ mParentStack.getParentNodeName()+"\"!"); //no break needed ;) case 1: // port is being listened to by a new application. //Check for SYN + System.out.println(mParentStack.getHostName() + ":" + " !! 1 SEQ_numb==" + inPacket.get_sequence_number()); try{ + if (inPacket.get_SYN_flag()) { *************** *** 1146,1156 **** case 2: //busy port, let's check whether it's busy by sender ;) if ((Elm.connectedtoIP.equals(inPacket.getSourceIPAddress())) && (Elm.connectedtoPort==inPacket.get_srcPort())) { //now we decompose TCP segment //everything is OK //Check for SYN if (inPacket.get_SYN_flag()) ! { try{ /* --- 1151,1164 ---- case 2: //busy port, let's check whether it's busy by sender ;) + System.out.println(mParentStack.getHostName() + ":" + " !! 2 SEQ_numb==" + inPacket.get_sequence_number()); if ((Elm.connectedtoIP.equals(inPacket.getSourceIPAddress())) && (Elm.connectedtoPort==inPacket.get_srcPort())) { + System.out.println(mParentStack.getHostName() + ":" + " !! 3 SEQ_numb==" + inPacket.get_sequence_number()); //now we decompose TCP segment //everything is OK //Check for SYN if (inPacket.get_SYN_flag()) ! { ! System.out.println(mParentStack.getHostName() + ":" + " !! 4 SEQ_numb==" + inPacket.get_sequence_number()); try{ /* *************** *** 1170,1173 **** --- 1178,1182 ---- if (!(Elm.ReceivedSegments.contains(chk))) { + System.out.println(mParentStack.getHostName() + ":" + " !! 5 SEQ_numb==" + inPacket.get_sequence_number()); try{ if (Elm.isServer) *************** *** 1270,1273 **** --- 1279,1283 ---- //NOT SYN-segment //check for FIN + System.out.println(mParentStack.getHostName() + ":" + " !! 6 SEQ_numb==" + inPacket.get_sequence_number()); try{ if (inPacket.get_FIN_flag()) Index: Telnet_client.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Telnet_client.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Telnet_client.java 24 Feb 2006 10:20:11 -0000 1.3 --- Telnet_client.java 24 Feb 2006 15:41:44 -0000 1.4 *************** *** 230,233 **** --- 230,234 ---- SendData("\n"); + //SendData("!"); //terminal.recvData("Connected!\n"); //connected.... Index: Echo_tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** Echo_tcp.java 24 Feb 2006 10:20:11 -0000 1.21 --- Echo_tcp.java 24 Feb 2006 15:41:44 -0000 1.22 *************** *** 29,33 **** public class Echo_tcp extends Application{ ! private byte ConnectionAttempts=5; private int counts; --- 29,33 ---- public class Echo_tcp extends Application{ ! private byte ConnectionAttempts=1; private int counts; Index: ARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARP.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ARP.java 3 Dec 2005 19:23:19 -0000 1.6 --- ARP.java 24 Feb 2006 15:41:43 -0000 1.7 *************** *** 308,311 **** --- 308,313 ---- * @author robert_hulford + + * @author key * @param String - The IP address to search for in the ARP table |