[Javanetsim-cvs] javaNetSim/guiUI Terminal.java,1.13,1.14
Status: Beta
Brought to you by:
darkkey
|
From: QweR <qw...@us...> - 2008-10-05 17:20:56
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21203/guiUI Modified Files: Terminal.java Log Message: no shutdown corrected Index: Terminal.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/Terminal.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** Terminal.java 3 Oct 2008 22:29:10 -0000 1.13 --- Terminal.java 5 Oct 2008 16:53:12 -0000 1.14 *************** *** 70,73 **** --- 70,74 ---- // private configure_memory_CommandClass configure_memory_Command = new configure_memory_CommandClass(); private configure_terminal_CommandClass configure_terminal_Command = new configure_terminal_CommandClass(); + private end_CommandClass end_Command = new end_CommandClass(); private exit_CommandClass exit_Command = new exit_CommandClass(); private interface_CommandClass interface_Command = new interface_CommandClass();private logout_CommandClass logout_Command = new logout_CommandClass(); *************** *** 94,97 **** --- 95,99 ---- // cmdproc.add("configure memory", configure_memory_Command, "Configure from memory"); cmdproc.add("configure terminal", configure_terminal_Command, "Configure from the terminal"); + cmdproc.add("end", end_Command, "Exit from configuration mode"); cmdproc.add("exit", exit_Command, "Exit from current mode"); cmdproc.add("interface", interface_Command, ""); *************** *** 377,380 **** --- 379,404 ---- // } // }; + class end_CommandClass extends CommandInterface{ + public end_CommandClass (){ + modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); + call_params = "<cr>"; + } + public String call(Vector<String> params){ + if(current_mode.conf_mode == CommandInterface.CONF_MODE){ + if(interface_mode!=DEF_MODE){ + interface_mode = DEF_MODE; + command_prefix = ""; + } + else{ + current_mode.conf_mode = CommandInterface.STD_MODE; + device.getConfig().working_config = DeviceConfig.RUNNING_CONFIG; + } + } + else if(current_mode.conf_mode == CommandInterface.STD_MODE){ + exitWindow(); + } + return ""; + } + }; class exit_CommandClass extends CommandInterface{ public exit_CommandClass (){ *************** *** 449,454 **** 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){ --- 473,486 ---- int success = 0; for(int pi=0; pi<count; pi++){ ! ICMP_packet icmpout = null; ! ICMP_packet icmpin = null; ! try{ ! icmpout = device.sendPing(ip); ! icmpin = device.getReceivedICMPPacket(icmpout.getMessageID()); ! } catch (CommunicationException e) { ! // some error - skip :) ! } catch (LowLinkException e) { ! // some error - skip :) ! } if(icmpin!=null){ if(icmpin.getMessageCode()==ICMP_packet.DESTINATION_UNREACHABLE){ *************** *** 483,492 **** } 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"); --- 515,518 ---- |