[Javanetsim-cvs] javaNetSim/guiUI MainScreen.java,1.1.1.1,1.2 NetworkLayerDevice.java,1.1.1.1,1.2 RE
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2005-11-08 20:58:24
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29458/javaNetSim/guiUI Modified Files: MainScreen.java NetworkLayerDevice.java README.txt Log Message: Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/NetworkLayerDevice.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** NetworkLayerDevice.java 8 Nov 2005 04:04:22 -0000 1.1.1.1 --- NetworkLayerDevice.java 8 Nov 2005 20:58:14 -0000 1.2 *************** *** 51,54 **** --- 51,55 ---- private JMenuItem mnuArpStaticAdd = new JMenuItem("Add static entry to ARP table..."); private JMenuItem mnuArpRemove = new JMenuItem("Remove entry from ARP table..."); + private JMenuItem mnuRunCmd = new JMenuItem("Run low-level command..."); private JMenuItem mnuArp = new JMenuItem("Print ARP Table"); private JMenuItem mnuBreakLink = new JMenuItem("Break link"); *************** *** 92,95 **** --- 93,101 ---- } }); + mnuRunCmd.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.RunCmd(lblNodeName.getText()); + } + }); mnuProperties.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ *************** *** 109,112 **** --- 115,119 ---- GuiNodePopMenu.add(mnuArpRemove); GuiNodePopMenu.add(mnuArp); + GuiNodePopMenu.add(mnuRunCmd); GuiNodePopMenu.add(mnuBreakLink); GuiNodePopMenu.add(mnuProperties); Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** MainScreen.java 8 Nov 2005 04:04:34 -0000 1.1.1.1 --- MainScreen.java 8 Nov 2005 20:58:14 -0000 1.2 *************** *** 167,171 **** //setup frame this.setSize(800, 600); ! this.setTitle("JFirewallSim"); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); --- 167,171 ---- //setup frame this.setSize(800, 600); ! this.setTitle("javaNetSim"); this.setLocationRelativeTo(null); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); *************** *** 1663,1666 **** --- 1663,1667 ---- /** * Prints the arp table of a selected Node. + * @author Key * @param String inNodeName Name of node to print ARP table for. */ *************** *** 1683,1686 **** --- 1684,1693 ---- } + /** + * Adds static ARP entry to the ARP cache on the target node. + * @author Key + * @param String inNodeName Name of node to add static ARP Entry + */ + public void addStaticARP(String inNodeName){ String MAC = JOptionPane.showInputDialog(this, "MAC address:", "Add static ARP entry", JOptionPane.QUESTION_MESSAGE); *************** *** 1693,1696 **** --- 1700,1709 ---- } } + + /** + * Removes static(or dynamic) ARP entry from the ARP cache on the target node. + * @author Key + * @param String inNodeName Name of node to add static ARP Entry + */ public void removeARP(String inNodeName){ *************** *** 1702,1705 **** --- 1715,1761 ---- } + /** + * Runs network configure command on the target host. (route, et cetera) + * Need for: + * 1. Testing purposes. + * 2. Future realisation of Telnet protocol (QweR?) + * @author Key + * @param String inNodeName Name of node to run command on + */ + + public void RunCmd(String inNodeName){ + String cmd = JOptionPane.showInputDialog(this, "Command (e.g. route print):", "Run network configure command.", JOptionPane.QUESTION_MESSAGE); + if(cmd!=null){ + String tokens[]=cmd.split(" "); + + if(tokens[0].contains("route")){ + //only tests + this.addToConsole("You enter route command.\n"); + + try{ + if(tokens[1].contains("print")){ + + }else if(tokens[1].contains("add")){ + + }else if(tokens[1].contains("del")){ + + }else{ + this.addToConsole("Unknown route command. Usage:\n"); + this.addToConsole("route add (host_ip|network_ip) target_interface [netmask] [gateway] \n"); + this.addToConsole("route del (host_ip|network_ip) \n"); + this.addToConsole("route print \n"); + } + }catch(ArrayIndexOutOfBoundsException e){ + this.addToConsole("Unknown route command. Usage:\n"); + this.addToConsole("route add (host_ip|network_ip) target_interface [netmask] [gateway] \n"); + this.addToConsole("route del (host_ip|network_ip) \n"); + this.addToConsole("route print \n"); + } + + }else{ + this.addToConsole("Unknown command.\n"); + } + } + } /** Index: README.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/README.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** README.txt 8 Nov 2005 04:04:28 -0000 1.1.1.1 --- README.txt 8 Nov 2005 20:58:14 -0000 1.2 *************** *** 1 **** ! This directory is to contain all GUI file for the jfirewallsim project --- 1 ---- ! This directory is to contain all GUI file for the javaNetSim project . |