Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip
In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv6626/core/protocolsuite/tcp_ip
Modified Files:
Echo_tcp.java TCP_session.java Tcp.java socketLayer.java
Log Message:
function 'listen' was added in TCP & socketLayer
removed some useless variables & functions
Index: Tcp.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v
retrieving revision 1.93
retrieving revision 1.94
diff -C2 -d -r1.93 -r1.94
*** Tcp.java 23 Sep 2007 20:24:43 -0000 1.93
--- Tcp.java 23 Sep 2007 22:12:23 -0000 1.94
***************
*** 94,98 ****
private TCP_packet packet;
private int sock;
! private int first_resend;
public long timerID;
--- 94,98 ----
private TCP_packet packet;
private int sock;
! private int nearest_resend;
public long timerID;
[...1186 lines suppressed...]
- // tosend_clone.set_RST_flag(flags[3]);
- // tosend_clone.set_SYN_flag(flags[4]);
- // tosend_clone.set_FIN_flag(flags[5]);
- //
- // //here we push out segment in Hashtable SegmentsToResend and increment counters
- // s_num=Elm.seq_number; //getting sequence number 0-for SYN
- // if (Elm.ReceivedSegments.isEmpty()) a_num=0; else a_num=acknow_num; //(Integer)Elm.ReceivedSegments.lastElement()+1; //getting ACK number 0 - for SYN, 1 - as a reply for SYN ... so on
- //
- // tosend_clone.set_sequence_number(s_num);
- // tosend_clone.set_acknowledgment_number(a_num);
- //
- // Elm=null;
- //
- // return tosend_clone;
- // }
- //
- //
// /**
// * This method sends to application all consequent segments from OutputBuffer
--- 1104,1110 ----
Index: TCP_session.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/TCP_session.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** TCP_session.java 23 Sep 2007 20:24:43 -0000 1.5
--- TCP_session.java 23 Sep 2007 22:12:23 -0000 1.6
***************
*** 30,34 ****
public int seq_number=0;
private int last_ack_number=0; //last sequence number value of the segment that has been passed upstairs
- public static int Element_id = 0;
private int state = CLOSED;
public long last_timer = -1;
--- 30,33 ----
***************
*** 199,209 ****
return sent_duplicates;
}
- public void ResetCounters(){
- received_segments = 0;
- sent_segments = 0;
- sent_ACK = 0;
- received_duplicates = 0;
- sent_duplicates = 0;
- }
}
--- 198,201 ----
Index: socketLayer.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/socketLayer.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** socketLayer.java 23 Sep 2007 20:24:43 -0000 1.5
--- socketLayer.java 23 Sep 2007 22:12:23 -0000 1.6
***************
*** 52,55 ****
--- 52,67 ----
}
+ public void listen(int sock) throws TransportLayerException{
+ jnSocket jnsock = get_socket(sock);
+ //((jnSocket)sockTable.get(sock)).src_port = srcPort; <-- WRONG!
+ jnsock.open_state = true; //bind or connect or listen
+ if(jnsock.type == jnsock.UDP_socket){
+ //mParentStack.UDP().bindPort(sock, srcPort);
+ }
+ else if(jnsock.type == jnsock.TCP_socket){
+ mParentStack.TCP().listen(sock);
+ }
+ }
+
public boolean connect(int sock, String ipaddr, int port) throws LowLinkException, CommunicationException, TransportLayerException{
boolean result = false;
Index: Echo_tcp.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo_tcp.java,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** Echo_tcp.java 23 Sep 2007 20:24:43 -0000 1.34
--- Echo_tcp.java 23 Sep 2007 22:12:23 -0000 1.35
***************
*** 52,56 ****
if(appType == 1){
mParentStack.SL().bind(sock, mParentStack.getSrcIP(), listenPort);
! }
}catch (TransportLayerException e){
System.out.println(e.toString());;
--- 52,57 ----
if(appType == 1){
mParentStack.SL().bind(sock, mParentStack.getSrcIP(), listenPort);
! mParentStack.SL().listen(sock);
! }
}catch (TransportLayerException e){
System.out.println(e.toString());;
|