[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip Echo.java, 1.28, 1.29 SNMP.java, 1.24, 1.25 T
Status: Beta
Brought to you by:
darkkey
From: QweR <qw...@us...> - 2007-10-15 21:41:49
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv17243/core/protocolsuite/tcp_ip Modified Files: Echo.java SNMP.java Tcp.java Telnet_server.java Udp.java Log Message: add interface commands into console fixed TCP.closePort & UDP.closePort Index: Echo.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Echo.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Echo.java 1 Oct 2007 04:58:12 -0000 1.28 --- Echo.java 15 Oct 2007 21:41:42 -0000 1.29 *************** *** 61,72 **** */ public void Close() throws TransportLayerException ! { ! printLayerInfo("Echo application", "Echo application closed socket."); mParentStack.SL().close(appSock); } public void Free() throws TransportLayerException ! { ! printLayerInfo("Echo application", "Echo application freed socket."); mParentStack.SL().free(appSock); } --- 61,80 ---- */ public void Close() throws TransportLayerException ! { ! if(appType == 0){ ! printLayerInfo("Echo application", "Echo application closed socket."); ! }else{ ! printLayerInfo("Echo application", "Echo server closed socket."); ! } mParentStack.SL().close(appSock); } public void Free() throws TransportLayerException ! { ! if(appType == 0){ ! printLayerInfo("Echo application", "Echo application freed socket."); ! }else{ ! printLayerInfo("Echo application", "Echo server freed socket."); ! } mParentStack.SL().free(appSock); } Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.101 retrieving revision 1.102 diff -C2 -d -r1.101 -r1.102 *** Tcp.java 14 Oct 2007 22:14:52 -0000 1.101 --- Tcp.java 15 Oct 2007 21:41:43 -0000 1.102 *************** *** 521,544 **** { int portToClose=mSL.get_socket(sock).src_port; - TCP_session Elm = getSession(mSL.get_socket(sock).genKey()); ! if(portToClose!=0 && Elm!=null){ TCP_session mainses = getSession(jnSocket.genTCPkey(portToClose,"0.0.0.0",0)); if(mainses != null && mainses.getSocket() == sock){ // remove listening session on client side only removeSession(jnSocket.genTCPkey(portToClose,"0.0.0.0",0)); } ! Enumeration<Integer> segs = Elm.getAllSegmentToResendNumbers(); ! while(segs.hasMoreElements()){ ! int segment = segs.nextElement().intValue(); ! long tid = Elm.removeSegmentToResend(segment); ! removeTimer(tid); } - removeSession(mSL.get_socket(sock).genKey()); - //mSL.close(Elm.sock); - printLayerInfo("Local port " + portToClose + " closed."); } else ! throw new TransportLayerException("TCP Error: port "+ portToClose +" is not being LISTENED to by the application: \"" + mSL.get_socket(sock).app.toString() + "\"."); } --- 521,544 ---- { int portToClose=mSL.get_socket(sock).src_port; ! if(portToClose!=0){ TCP_session mainses = getSession(jnSocket.genTCPkey(portToClose,"0.0.0.0",0)); if(mainses != null && mainses.getSocket() == sock){ // remove listening session on client side only removeSession(jnSocket.genTCPkey(portToClose,"0.0.0.0",0)); } ! TCP_session Elm = getSession(mSL.get_socket(sock).genKey()); ! if(Elm != null){ ! Enumeration<Integer> segs = Elm.getAllSegmentToResendNumbers(); ! while(segs.hasMoreElements()){ ! int segment = segs.nextElement().intValue(); ! long tid = Elm.removeSegmentToResend(segment); ! removeTimer(tid); ! } ! removeSession(mSL.get_socket(sock).genKey()); } printLayerInfo("Local port " + portToClose + " closed."); } else ! throw new TransportLayerException("TCP Error: port "+ portToClose +" is not being LISTENED."); } Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** Udp.java 14 Oct 2007 22:14:52 -0000 1.42 --- Udp.java 15 Oct 2007 21:41:43 -0000 1.43 *************** *** 276,282 **** // bind port to socket public void bindPort(int sock_num, int in_Port) throws TransportLayerException ! { ! int lsPort=PORT_INIT; ! if(!mSL.get_socket(sock_num).open_state){ if (in_Port>=0 && in_Port<=65535) { //create such a record in hashtable --- 276,280 ---- // bind port to socket public void bindPort(int sock_num, int in_Port) throws TransportLayerException ! { if(!mSL.get_socket(sock_num).open_state){ if (in_Port>=0 && in_Port<=65535) { //create such a record in hashtable *************** *** 352,357 **** Simulation.addLayerInfo(UDP_Info); removeSession(jnSocket.genUDPkey(portToClose)); ! mSL.close(Elm.sock); ! } else throw new TransportLayerException("UDP Error: port "+ portToClose +" is not being LISTENED to by the application: \"" + mSL.get_socket(sock).app.toString() + "\"."); } --- 350,354 ---- Simulation.addLayerInfo(UDP_Info); removeSession(jnSocket.genUDPkey(portToClose)); ! } else throw new TransportLayerException("UDP Error: port "+ portToClose +" is not being LISTENED."); } Index: Telnet_server.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Telnet_server.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** Telnet_server.java 14 Oct 2007 22:14:52 -0000 1.18 --- Telnet_server.java 15 Oct 2007 21:41:43 -0000 1.19 *************** *** 325,329 **** try{ snmpa.Close(); ! snmpa.Disconnect(); out+="SNMP agent stoped\r\n"; snmpa.setPassword(l_pass); --- 325,329 ---- try{ snmpa.Close(); ! //snmpa.Disconnect(); out+="SNMP agent stoped\r\n"; snmpa.setPassword(l_pass); Index: SNMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/SNMP.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** SNMP.java 15 Oct 2007 12:04:33 -0000 1.24 --- SNMP.java 15 Oct 2007 21:41:42 -0000 1.25 *************** *** 161,170 **** public void Close() throws TransportLayerException { //mParentStack.CloseUDP(this); ! printInfo("SNMP agent closed socket."); //<--- FIXME!!! mParentStack.SL().close(appSock); } public void Free() throws TransportLayerException{ ! printInfo("SNMP agent freed socket."); //<--- FIXME!!! mParentStack.SL().free(appSock); } --- 161,180 ---- public void Close() throws TransportLayerException { //mParentStack.CloseUDP(this); ! if(appType==0){ ! printInfo("SNMP agent closed socket."); ! } ! else if(appType==1){ ! printInfo("SNMP manager closed socket."); ! } mParentStack.SL().close(appSock); } public void Free() throws TransportLayerException{ ! if(appType==0){ ! printInfo("SNMP agent freed socket."); ! } ! else if(appType==1){ ! printInfo("SNMP manager freed socket."); ! } mParentStack.SL().free(appSock); } *************** *** 203,216 **** } - - /** - * This method disconnects from server. - * @author QweR - * @version v0.01 - */ - public void Disconnect()throws TransportLayerException { - //mParentStack.freeUDPPort(this); - mParentStack.SL().close(appSock); - } /** --- 213,216 ---- *************** *** 399,403 **** } else if(appType==1) { ! Disconnect(); } retIP="unknown"; --- 399,403 ---- } else if(appType==1) { ! Close(); } retIP="unknown"; |