[Javanetsim-cvs] javaNetSim/guiUI MainScreen.java, 1.87, 1.88 Terminal.java, 1.12, 1.13
Status: Beta
Brought to you by:
darkkey
From: QweR <qw...@us...> - 2008-10-03 22:29:28
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29998/guiUI Modified Files: MainScreen.java Terminal.java Log Message: ICMP unreacheable in ping correct sh run toString for DeviceConfig Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** MainScreen.java 27 Sep 2008 10:16:38 -0000 1.87 --- MainScreen.java 3 Oct 2008 22:29:10 -0000 1.88 *************** *** 2321,2328 **** if(Sim.getNode(key) instanceof core.NetworkLayerDevice){ ! Iterator<String> cnf = ((core.NetworkLayerDevice)Sim.getNode(key)).getConfig().getConfig(core.DeviceConfig.STARTUP_CONFIG).iterator(); ! while(cnf.hasNext()){ ! strSave += cnf.next() + "\n"; ! } } --- 2321,2329 ---- if(Sim.getNode(key) instanceof core.NetworkLayerDevice){ ! // Iterator<String> cnf = ((core.NetworkLayerDevice)Sim.getNode(key)).getConfig().getConfig(core.DeviceConfig.STARTUP_CONFIG).iterator(); ! // while(cnf.hasNext()){ ! // strSave += cnf.next() + "\n"; ! // } ! strSave += ((core.NetworkLayerDevice)Sim.getNode(key)).getConfig().toString(core.DeviceConfig.STARTUP_CONFIG); } Index: Terminal.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/Terminal.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Terminal.java 28 Sep 2008 17:11:47 -0000 1.12 --- Terminal.java 3 Oct 2008 22:29:10 -0000 1.13 *************** *** 34,37 **** --- 34,38 ---- import core.InvalidNetworkInterfaceNameException; import core.CommandInterface.Modes; + import core.protocolsuite.tcp_ip.ICMP_packet; import core.protocolsuite.tcp_ip.IPV4Address; *************** *** 448,471 **** int success = 0; for(int pi=0; pi<count; pi++){ ! int mid = device.sendPing(ip); ! if(device.getTimeICMPPacketReceived(mid)>0){ ! appendToTerminal("!"); ! success++; } else{ appendToTerminal("."); } ! try { ! sleep(delay); ! } catch (InterruptedException e) { } } addToTerminal("\nSuccess rate is " +(int)(success*100/count)+ " percent ("+success+"/"+count+")\n"); } catch (CommunicationException e) { ! addToTerminal("Internal error: ping: CommunicationException\n"); } catch (LowLinkException e) { ! addToTerminal("Internal error: ping: LowLinkException\n"); } catch (Exception e){ ! addToTerminal("Internal error: ping: Exception\n"); } setBlocked(false); --- 449,494 ---- int success = 0; for(int pi=0; pi<count; pi++){ ! ICMP_packet icmpout = device.sendPing(ip); ! ICMP_packet icmpin = device.getReceivedICMPPacket(icmpout.getMessageID()); ! if(icmpin!=null){ ! if(icmpin.getMessageCode()==ICMP_packet.DESTINATION_UNREACHABLE){ ! appendToTerminal("U"); ! } ! else if(icmpin.getMessageCode()==ICMP_packet.TIME_EXCEEDED){ ! appendToTerminal("T"); ! } ! else{ ! appendToTerminal("!"); ! success++; ! } ! } ! else if((icmpin = device.getReceivedICMPPacket(0))!=null){ ! if(icmpin.getMessageCode()==ICMP_packet.DESTINATION_UNREACHABLE){ ! appendToTerminal("U"); ! } ! else if(icmpin.getMessageCode()==ICMP_packet.TIME_EXCEEDED){ ! appendToTerminal("T"); ! } ! device.removeReceivedICMPPacket(0); } else{ appendToTerminal("."); } ! if(pi<count-1){ ! try { ! sleep(delay); ! } catch (InterruptedException e) { ! } } } addToTerminal("\nSuccess rate is " +(int)(success*100/count)+ " percent ("+success+"/"+count+")\n"); } catch (CommunicationException e) { ! //addToTerminal("Internal error: ping: CommunicationException\n"); ! addToTerminal("CommunicationException: "+e.getMessage()); } catch (LowLinkException e) { ! //addToTerminal("Internal error: ping: LowLinkException\n"); ! addToTerminal("LowLinkException: "+e.getMessage()); } catch (Exception e){ ! addToTerminal("Internal error: ping: Exception: "+e.getMessage()+"\n"); } setBlocked(false); *************** *** 483,487 **** if(IPV4Address.validateDecIP(ip)){ out += "Type escape sequence to abort.\n"; ! out += "Sending 5, 4-byte ICMP Echos to "+params.get(0)+", timeout is 2 seconds:\n"; pt = new PingThread(5,1000,ip); pt.start(); --- 506,510 ---- if(IPV4Address.validateDecIP(ip)){ out += "Type escape sequence to abort.\n"; ! out += "Sending 5, 4-byte ICMP Echos to "+params.get(0)+", timeout is 1 second:\n"; pt = new PingThread(5,1000,ip); pt.start(); |