[Javanetsim-cvs] javaNetSim/guiUI EthPortProperties.java, 1.2, 1.3 MainScreen.java, 1.78, 1.79 Term
Status: Beta
Brought to you by:
darkkey
From: QweR <qw...@us...> - 2007-10-20 22:54:48
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv10516/guiUI Modified Files: EthPortProperties.java MainScreen.java Terminal.java Log Message: new mechanism for "no" processing was developed; some console commands was added & fixed Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.78 retrieving revision 1.79 diff -C2 -d -r1.78 -r1.79 *** MainScreen.java 20 Oct 2007 20:19:46 -0000 1.78 --- MainScreen.java 20 Oct 2007 22:54:40 -0000 1.79 *************** *** 4410,4414 **** public void RunCmd(String inNodeName){ try{ ! if(!(Sim.getNode(inNodeName) instanceof core.NetworkLayerDevice) && !(Sim.getNode(inNodeName) instanceof core.Printer)){ Terminal r = new Terminal(this, (core.NetworkLayerDevice)Sim.getNode(inNodeName)); r.pack(); --- 4410,4414 ---- public void RunCmd(String inNodeName){ try{ ! if(/*!(Sim.getNode(inNodeName) instanceof core.NetworkLayerDevice) &&*/ !(Sim.getNode(inNodeName) instanceof core.Printer)){ Terminal r = new Terminal(this, (core.NetworkLayerDevice)Sim.getNode(inNodeName)); r.pack(); Index: EthPortProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/EthPortProperties.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EthPortProperties.java 19 Oct 2007 15:57:01 -0000 1.2 --- EthPortProperties.java 20 Oct 2007 22:54:40 -0000 1.3 *************** *** 302,306 **** private void okButton(){ try { ! String SC = txtMAC.getText(); if(SC.matches("[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]")){ NetworkLayerDevice temp = (NetworkLayerDevice)Sim.getNode(NodeName); --- 302,306 ---- private void okButton(){ try { ! String SC = txtMAC.getText(); if(SC.matches("[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]")){ NetworkLayerDevice temp = (NetworkLayerDevice)Sim.getNode(NodeName); Index: Terminal.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/Terminal.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** Terminal.java 16 Oct 2007 23:02:31 -0000 1.5 --- Terminal.java 20 Oct 2007 22:54:40 -0000 1.6 *************** *** 34,37 **** --- 34,38 ---- import core.CommandProcessor; import core.InvalidNetworkInterfaceNameException; + import core.CommandInterface.Modes; /** *************** *** 52,56 **** private final static int max_history = 128; CmdVerifier cmdverifier = new CmdVerifier(); ! private int current_mode; private int device_type; private CommandProcessor cmdproc; --- 53,57 ---- private final static int max_history = 128; CmdVerifier cmdverifier = new CmdVerifier(); ! private Modes current_mode; private int device_type; private CommandProcessor cmdproc; *************** *** 74,98 **** this.parent = parent; cmdproc = new CommandProcessor(dev); ! ! current_mode = CommandsTree.STD_MODE; if(device instanceof core.ApplicationLayerDevice){ ! device_type = CommandsTree.APPLICATION_LAYER; } else{ ! device_type = CommandsTree.NETWORK_LAYER; } ! cmdproc.add("clear terminal", clear_terminal_Command, cmdproc.STD_CONF_MODE | cmdproc.NETWORK_LAYER, "<cr>", "Clear screen"); cmdproc.addDescription("configure","Enter configuration mode"); ! cmdproc.add("configure replace", configure_replace_Command, cmdproc.STD_MODE | cmdproc.NO_LAYER, "<cr>", "Replace configure from the terminal"); ! cmdproc.add("configure memory", configure_memory_Command, cmdproc.STD_MODE | cmdproc.NO_LAYER, "<cr>", "Configure from memory"); ! cmdproc.add("configure terminal", configure_terminal_Command, cmdproc.STD_MODE | cmdproc.NO_LAYER, "<cr>", "Configure from the terminal"); ! cmdproc.add("exit", exit_Command, cmdproc.STD_CONF_MODE | cmdproc.NO_LAYER, "<cr>", "Exit from current mode"); ! cmdproc.add("interface", interface_Command, cmdproc.CONF_MODE | cmdproc.NETWORK_LAYER, "<interface>", ""); ! cmdproc.add("interface *", interface_Command, cmdproc.CONF_MODE | cmdproc.NETWORK_LAYER, "<cr>", ""); ! cmdproc.add("interface * exit", exit_Command, cmdproc.CONF_MODE | cmdproc.NETWORK_LAYER, "<cr>", ""); ! cmdproc.add("logout", logout_Command, cmdproc.STD_MODE | cmdproc.NO_LAYER, "<cr>", "Exit from the console"); ! cmdproc.add("ping", ping_Command, cmdproc.STD_CONF_MODE | cmdproc.NETWORK_LAYER, "<ip>", "Send echo messages"); ! cmdproc.add("show history", show_history_Command, cmdproc.STD_CONF_MODE | cmdproc.NO_LAYER, "<cr>", "Display the session command history"); panel = new JPanel(); --- 75,98 ---- this.parent = parent; cmdproc = new CommandProcessor(dev); ! if(device instanceof core.ApplicationLayerDevice){ ! current_mode = new Modes(CommandInterface.STD_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.CALLS); } else{ ! current_mode = new Modes(CommandInterface.STD_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALLS); } ! cmdproc.add("clear terminal", clear_terminal_Command, "Clear screen"); cmdproc.addDescription("configure","Enter configuration mode"); ! cmdproc.add("configure replace", configure_replace_Command, "Replace configure from the terminal"); ! cmdproc.add("configure memory", configure_memory_Command, "Configure from memory"); ! cmdproc.add("configure terminal", configure_terminal_Command, "Configure from the terminal"); ! cmdproc.add("exit", exit_Command, "Exit from current mode"); ! cmdproc.add("interface", interface_Command, ""); ! cmdproc.add("interface *", interface_Command, ""); ! cmdproc.add("interface * exit", exit_Command, ""); ! cmdproc.add("logout", logout_Command, "Exit from the console"); ! cmdproc.add("ping", ping_Command, "Send echo messages"); ! cmdproc.add("show history", show_history_Command, "Display the session command history"); panel = new JPanel(); *************** *** 152,156 **** private void addToTerminal(String data){ text += data+"\n"+device.NodeProtocolStack.getParentNodeName(); ! if(current_mode == cmdproc.CONF_MODE){ text += "(config"; if(interface_mode){ --- 152,156 ---- private void addToTerminal(String data){ text += data+"\n"+device.NodeProtocolStack.getParentNodeName(); ! if(current_mode.conf_mode == CommandInterface.CONF_MODE){ text += "(config"; if(interface_mode){ *************** *** 185,189 **** } appendToTerminal(cmdline.getText() + "\n"); ! String tmptext = cmdproc.call(cmdline.getText(), current_mode | device_type, interface_name); if(tmptext==null){ tmptext = "% Incomplete command.\n"; --- 185,189 ---- } appendToTerminal(cmdline.getText() + "\n"); ! String tmptext = cmdproc.call(cmdline.getText(), current_mode, interface_name); if(tmptext==null){ tmptext = "% Incomplete command.\n"; *************** *** 205,209 **** addToTerminal(cmdline.getText()); int caretPos = cmdline.getCaretPosition(); ! String compl_str = cmdproc.complete(cmdline.getText().substring(0,caretPos), current_mode | device_type, interface_name); //String last_str = cmdline.getText().substring(caretPos); if(compl_str!=null && !compl_str.endsWith(" ")){ --- 205,209 ---- addToTerminal(cmdline.getText()); int caretPos = cmdline.getCaretPosition(); ! String compl_str = cmdproc.complete(cmdline.getText().substring(0,caretPos), current_mode, interface_name); //String last_str = cmdline.getText().substring(caretPos); if(compl_str!=null && !compl_str.endsWith(" ")){ *************** *** 215,219 **** case '?': { String tmptext = cmdline.getText() + "?\n"; ! Vector<Pair> tmpv = cmdproc.help(cmdline.getText().substring(0,cmdline.getCaretPosition()), current_mode | device_type, interface_name); if(tmpv!=null){ for(int i=0; i<tmpv.size(); i++){ --- 215,219 ---- case '?': { String tmptext = cmdline.getText() + "?\n"; ! Vector<Pair> tmpv = cmdproc.help(cmdline.getText().substring(0,cmdline.getCaretPosition()), current_mode, interface_name); if(tmpv!=null){ for(int i=0; i<tmpv.size(); i++){ *************** *** 305,309 **** } ! class clear_terminal_CommandClass implements CommandInterface{ public String call(Vector<String> params){ clearTerminal(); --- 305,313 ---- } ! class clear_terminal_CommandClass extends CommandInterface{ ! public clear_terminal_CommandClass (){ ! modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; ! } public String call(Vector<String> params){ clearTerminal(); *************** *** 311,338 **** } }; ! class configure_terminal_CommandClass implements CommandInterface{ public String call(Vector<String> params){ device.getConfig().working_config = DeviceConfig.RUNNING_CONFIG; ! current_mode = cmdproc.CONF_MODE; return "Enter configuration commands, one per line. End with 'exit'"; } }; ! class configure_replace_CommandClass implements CommandInterface{ public String call(Vector<String> params){ device.getConfig().working_config = DeviceConfig.RUNNING_CONFIG; ! current_mode = cmdproc.CONF_MODE; return "Running-config was erased\nEnter configuration commands, one per line. End with 'exit'"; } }; ! class configure_memory_CommandClass implements CommandInterface{ public String call(Vector<String> params){ device.getConfig().working_config = DeviceConfig.STARTUP_CONFIG; ! current_mode = cmdproc.CONF_MODE; return "Starting-config editing\nEnter configuration commands, one per line. End with 'exit'"; } }; ! class exit_CommandClass implements CommandInterface{ public String call(Vector<String> params){ ! if(current_mode == cmdproc.CONF_MODE){ if(interface_mode){ interface_mode = false; --- 315,359 ---- } }; ! class configure_terminal_CommandClass extends CommandInterface{ ! public configure_terminal_CommandClass (){ ! modes = new Modes(CommandInterface.STD_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; ! } public String call(Vector<String> params){ device.getConfig().working_config = DeviceConfig.RUNNING_CONFIG; ! current_mode.conf_mode = CommandInterface.CONF_MODE; return "Enter configuration commands, one per line. End with 'exit'"; } }; ! class configure_replace_CommandClass extends CommandInterface{ ! public configure_replace_CommandClass (){ ! modes = new Modes(CommandInterface.STD_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; ! } public String call(Vector<String> params){ device.getConfig().working_config = DeviceConfig.RUNNING_CONFIG; ! current_mode.conf_mode = CommandInterface.CONF_MODE; ! device.getConfig().clear(DeviceConfig.RUNNING_CONFIG); return "Running-config was erased\nEnter configuration commands, one per line. End with 'exit'"; } }; ! class configure_memory_CommandClass extends CommandInterface{ ! public configure_memory_CommandClass (){ ! modes = new Modes(CommandInterface.STD_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; ! } public String call(Vector<String> params){ device.getConfig().working_config = DeviceConfig.STARTUP_CONFIG; ! current_mode.conf_mode = CommandInterface.CONF_MODE; return "Starting-config editing\nEnter configuration commands, one per line. End with 'exit'"; } }; ! class exit_CommandClass extends CommandInterface{ ! public exit_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){ interface_mode = false; *************** *** 340,348 **** } else{ ! current_mode = cmdproc.STD_MODE; device.getConfig().working_config = DeviceConfig.RUNNING_CONFIG; } } ! else if(current_mode == cmdproc.STD_MODE){ exitWindow(); } --- 361,369 ---- } 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(); } *************** *** 350,354 **** } }; ! class interface_CommandClass implements CommandInterface{ public String call(Vector<String> params){ String out = ""; --- 371,379 ---- } }; ! class interface_CommandClass extends CommandInterface{ ! public interface_CommandClass (){ ! modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; ! } public String call(Vector<String> params){ String out = ""; *************** *** 370,374 **** } }; ! class logout_CommandClass implements CommandInterface{ public String call(Vector<String> params){ exitWindow(); --- 395,403 ---- } }; ! class logout_CommandClass extends CommandInterface{ ! public logout_CommandClass (){ ! modes = new Modes(CommandInterface.STD_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; ! } public String call(Vector<String> params){ exitWindow(); *************** *** 376,380 **** } }; ! class ping_CommandClass implements CommandInterface{ public String call(Vector<String> params){ if(params.size()==1){ --- 405,413 ---- } }; ! class ping_CommandClass extends CommandInterface{ ! public ping_CommandClass (){ ! modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<ip>"; ! } public String call(Vector<String> params){ if(params.size()==1){ *************** *** 405,409 **** } }; ! class show_history_CommandClass implements CommandInterface{ public String call(Vector<String> params){ String out = ""; --- 438,446 ---- } }; ! class show_history_CommandClass extends CommandInterface{ ! public show_history_CommandClass (){ ! modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; ! } public String call(Vector<String> params){ String out = ""; |