[Javanetsim-cvs] javaNetSim/guiUI MainScreen.java,1.16,1.17 NetworkLayerDevice.java,1.4,1.5
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2005-12-03 12:21:04
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28129/guiUI Modified Files: MainScreen.java NetworkLayerDevice.java Log Message: Packet Counts for IP and ARP. Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/NetworkLayerDevice.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NetworkLayerDevice.java 3 Dec 2005 11:28:46 -0000 1.4 --- NetworkLayerDevice.java 3 Dec 2005 12:20:52 -0000 1.5 *************** *** 51,57 **** --- 51,62 ---- private JMenuItem mnuProperties = new JMenuItem("Properties ..."); private JMenu mnuARPMenu = new JMenu("ARP"); + private JMenu mnuCountersMenu = new JMenu("Counters"); + + private JMenuItem mnuShowCounters = new JMenuItem("Show Packet Counters"); + private JMenuItem mnuResetCounters = new JMenuItem("Reset Packet Counters"); 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 mnuPR = new JMenuItem("Print route table"); *************** *** 123,126 **** --- 128,143 ---- } }); + + + mnuShowCounters.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.showCounters(lblNodeName.getText()); + } + }); + mnuResetCounters.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.resetCounters(lblNodeName.getText()); + } + }); *************** *** 131,134 **** --- 148,154 ---- mnuARPMenu.add(mnuArpRemove); mnuARPMenu.add(mnuArp); + GuiNodePopMenu.add(mnuCountersMenu); + mnuCountersMenu.add(mnuShowCounters); + mnuCountersMenu.add(mnuResetCounters); GuiNodePopMenu.add(mnuRunCmd); GuiNodePopMenu.add(mnuPR); Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** MainScreen.java 3 Dec 2005 11:28:46 -0000 1.16 --- MainScreen.java 3 Dec 2005 12:20:52 -0000 1.17 *************** *** 3039,3042 **** --- 3039,3067 ---- /** + * + * @author Key + * @param String inNodeName Name of node + */ + + public void showCounters(String inNodeName){ + core.protocolsuite.tcp_ip.ProtocolStack PS = Sim.getTCPProtocolStack(inNodeName); + int ARPCount = PS.getARPCount(); + int inIPCount = PS.getinputIPCount(); + int outIPCount= PS.getoutputIPCount(); + + String msg = "Counters: \n\n Recieved IP Packets: " + Integer.valueOf(inIPCount).toString() + + "\n Sent IP Packets: " + Integer.valueOf(outIPCount).toString() + + "\n ARP Packets: " + Integer.valueOf(ARPCount).toString(); + + JOptionPane.showMessageDialog(this,msg,inNodeName + ": packet counters.",JOptionPane.INFORMATION_MESSAGE); + } + + public void resetCounters(String inNodeName){ + core.protocolsuite.tcp_ip.ProtocolStack PS = Sim.getTCPProtocolStack(inNodeName); + PS.resetCounters(); + showCounters(inNodeName); + } + + /** * Runs network configure command on the target host. (route, et cetera) |