[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip Tcp.java, 1.61, 1.62
Status: Beta
Brought to you by:
darkkey
From: gift <gi...@us...> - 2006-09-03 12:31:53
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21387/core/protocolsuite/tcp_ip Modified Files: Tcp.java Log Message: aaaa Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** Tcp.java 3 Sep 2006 10:38:20 -0000 1.61 --- Tcp.java 3 Sep 2006 12:31:48 -0000 1.62 *************** *** 1109,1113 **** Elm.connectedtoPort=inPacket.get_srcPort(); //0 - no status; 1 - is being connected; 2 - is connected; 3 - connection error ! Elm.ApplicationStatus=2; Elm.received_segments++; --- 1109,1113 ---- Elm.connectedtoPort=inPacket.get_srcPort(); //0 - no status; 1 - is being connected; 2 - is connected; 3 - connection error ! Elm.ApplicationStatus=1; Elm.received_segments++; *************** *** 1135,1139 **** listener = (Application)Elm.application; ! AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs --- 1135,1139 ---- listener = (Application)Elm.application; ! //AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs *************** *** 1209,1213 **** TCP_Info.setLayer("Transport"); ! TCP_Info.setDescription("TCP SYN-packet with ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + "." + " TCP Port " + inPacket.get_destPort() + " still has status \"busy\". (SEQ = " + inPacket.get_sequence_number() + ")"); Simulation.addLayerInfo(TCP_Info); --- 1209,1213 ---- TCP_Info.setLayer("Transport"); ! TCP_Info.setDescription("TCP SYN-packet with ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + "." + " TCP Port " + inPacket.get_destPort() + " still has status \"busy\". Connection confirmed! (SEQ = " + inPacket.get_sequence_number() + ")"); Simulation.addLayerInfo(TCP_Info); *************** *** 1228,1232 **** listener = (Application)Elm.application; ! AddOutputBuffer(Elm, inPacket); try{ --- 1228,1232 ---- listener = (Application)Elm.application; ! //AddOutputBuffer(Elm, inPacket); try{ *************** *** 1349,1353 **** listener = (Application)Elm.application; //Elm.isFIN_sent=true; - will be set in "sendTCPSegment" ! AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs System.out.println(mParentStack.getHostName() + ":" + "FIN-packet FIN not sent, BEFORE: I=" + inPacket.get_sequence_number()); --- 1349,1353 ---- listener = (Application)Elm.application; //Elm.isFIN_sent=true; - will be set in "sendTCPSegment" ! //AddOutputBuffer(Elm, inPacket); //we are going to send ACK for received segment => adding it to SentACKs System.out.println(mParentStack.getHostName() + ":" + "FIN-packet FIN not sent, BEFORE: I=" + inPacket.get_sequence_number()); *************** *** 1460,1464 **** String s; ! if (Elm.received_segments>2) s="TCP packet with data ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + "."; else { s="TCP packet with establishing connection ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Connection confirmed!"; --- 1460,1465 ---- String s; ! // if (Elm.received_segments>2) s="TCP packet with data ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + "."; ! if (Elm.ApplicationStatus==2) s="TCP packet with data ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + "."; else { s="TCP packet with establishing connection ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Connection confirmed!"; *************** *** 1486,1489 **** --- 1487,1491 ---- //now we have to send our ACK-segment (with SYN=false, seq_num=XX, ack_num=XX) String msg=""; + String s=""; boolean flags[]={false,true,false,false,false,false}; /* URG, !ACK!, PSH, RST, SYN, FIN */ int ack_num=chk+1; *************** *** 1498,1501 **** --- 1500,1508 ---- System.out.println(mParentStack.getHostName() + ":" + " Data exchange mode, 6-th place DONE I=" + inPacket.get_sequence_number()); + if (Elm.ApplicationStatus!=2) { + s="TCP packet with establishing connection ACK received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Connection confirmed!"; + Elm.ApplicationStatus=2; + } else s = "TCP packet with data received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Passing data to application program. (received SEQ = " + inPacket.get_sequence_number() + " sent ACK = " + ack_num + ")."; + if (!(mParentStack.sendTCPSegment(listener,msg,flags,ack_num))) { Elm.SentACKs.remove(inPacket.get_sequence_number()); *************** *** 1511,1517 **** TCP_Info.setLayer("Transport"); ! TCP_Info.setDescription("TCP packet with data received from "+ inPacket.getSourceIPAddress() + ":" + inPacket.get_srcPort() + ". Passing data to application program. (received SEQ = " + inPacket.get_sequence_number() + " sent ACK = " + ack_num + ")."); ! Simulation.addLayerInfo(TCP_Info); // if (Elm.received_segments>2) --- 1518,1524 ---- TCP_Info.setLayer("Transport"); ! TCP_Info.setDescription(s); ! Simulation.addLayerInfo(TCP_Info); // if (Elm.received_segments>2) *************** *** 1810,1813 **** --- 1817,1821 ---- kkey++; if((!Packet.get_ACK_flag()) && (!Packet.get_SYN_flag())) + //if(!Packet.get_ACK_flag()) listener.RecvData(Packet.getTCP_message()); } |