[Javanetsim-cvs] javaNetSim/guiUI ApplicationLayerDevice.java, 1.9, 1.10 LinkLayerPanel.java, 1.3,
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2007-10-14 17:19:11
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv21615/guiUI Modified Files: ApplicationLayerDevice.java LinkLayerPanel.java MainScreen.java Log Message: Added WAN interfaces class prototypes... Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** MainScreen.java 13 Oct 2007 12:57:00 -0000 1.68 --- MainScreen.java 14 Oct 2007 17:19:07 -0000 1.69 *************** *** 95,98 **** --- 95,100 ---- import core.protocolsuite.tcp_ip.Telnet_server; import core.protocolsuite.tcp_ip.Telnet_client; + import core.protocolsuite.tcp_ip.DHCPD; + import core.protocolsuite.tcp_ip.DHCPC; import guiUI.Terminal; import javax.swing.JViewport; *************** *** 1167,1171 **** Sim.addEthernetLink(strLinkName,inNode1, strFirstNodeInterface, inNode2, strSecondNodeInterface); break; ! case core.NetworkInterface.Serial: Sim.addSerialLink(strLinkName,inNode1, strFirstNodeInterface, inNode2, strSecondNodeInterface); break; --- 1169,1173 ---- Sim.addEthernetLink(strLinkName,inNode1, strFirstNodeInterface, inNode2, strSecondNodeInterface); break; ! case core.NetworkInterface.Console: Sim.addSerialLink(strLinkName,inNode1, strFirstNodeInterface, inNode2, strSecondNodeInterface); break; *************** *** 1427,1431 **** //pnlConsole.append(pad(recording[1],15,' ')+packet+pad(recording[3],10,' ')+layer+recording[5]+ "\n"); ! //System.out.println(pad(recording[1],15,' ')+packet+pad(recording[3],10,' ')+layer+recording[5]+ "\n"); insertInConsole(recording[1], packet, layer, recording[5]); } --- 1429,1433 ---- //pnlConsole.append(pad(recording[1],15,' ')+packet+pad(recording[3],10,' ')+layer+recording[5]+ "\n"); ! System.out.println(pad(recording[1],15,' ')+packet+pad(recording[3],10,' ')+layer+recording[5]+ "\n"); insertInConsole(recording[1], packet, layer, recording[5]); } *************** *** 2842,2846 **** for (i=0; i<mConsole.getColumnCount(); i++) { ! cur += "<TD vAlign=\"top\">" + (String) mConsole.getValueAt(j,i) + "</TD>"; //Select TR bgColor. if (!color_selected) --- 2844,2848 ---- for (i=0; i<mConsole.getColumnCount(); i++) { ! cur += "<TD vAlign=\"top\">" + (String) mConsole.getValueAt(j,i) + " </TD>"; //Select TR bgColor. if (!color_selected) *************** *** 2925,2929 **** for (i=0; i<5; i++) { ! out.append("<TD vAlign=\"top\">" + (String) mConsole.getValueAt(j,i) + "</TD>"); } out.append("\r\n</TR>\r\n"); --- 2927,2931 ---- for (i=0; i<5; i++) { ! out.append("<TD vAlign=\"top\">" + (String) mConsole.getValueAt(j,i) + " </TD>"); } out.append("\r\n</TR>\r\n"); *************** *** 2983,2987 **** + "<TD>Name: " + strNodeName + "</TD>\r\n" + "<TD>Default gateway: " + strDefGate + "</TD>\r\n" ! + "<TD> </TD><TD> </TD><TD> </TD>\r\n</TR>\r\n\t<!-- device interfaces-->\r\n"); } out.append("\t<TR bgColor=#CCCCCC>\r\n"); --- 2985,2989 ---- + "<TD>Name: " + strNodeName + "</TD>\r\n" + "<TD>Default gateway: " + strDefGate + "</TD>\r\n" ! + "<TD> </TD><TD> </TD><TD> </TD><TD> </TD>\r\n</TR>\r\n\t<!-- device interfaces-->\r\n"); } out.append("\t<TR bgColor=#CCCCCC>\r\n"); *************** *** 3652,3655 **** --- 3654,3682 ---- } + + public void DHCPD(String inNodeName){ + try{ + DHCPD dhcpd = ((DHCPD)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(67)); + + DHCPD.pool p = dhcpd.new_pool(); + p.Gateway = "172.168.0.1"; + p.IP = "172.168.0.10"; + p.Genmask = "255.255.255.0"; + p.MAC = ""; + + dhcpd.pools.put(p.IP, p); + + dhcpd.Listen(); + }catch(Exception e){} + } + + public void DHCPC(String inNodeName){ + try{ + ((DHCPC)((core.ApplicationLayerDevice)Sim.getNode(inNodeName)).getApp(68)).StartDHCPC("eth0",""); + }catch(Exception e){ + e.printStackTrace(); + } + } + /** *************** *** 4116,4119 **** --- 4143,4156 ---- new EthPortProperties(this,NodeName, IntName,Sim,Sandbox); break; + case core.NetworkInterface.WAN: + String service = JOptionPane.showInputDialog(this, "Sevice name", "Service name.", JOptionPane.QUESTION_MESSAGE); + if(service == null || service == "" || service.length() < 3){ + ((core.WANNetworkInterface)(temp.getNIC(IntName))).setServer(true); + }else{ + ((core.WANNetworkInterface)(temp.getNIC(IntName))).setServer(false); + } + + ((core.WANNetworkInterface)(temp.getNIC(IntName))).UP(); + break; default: break; Index: LinkLayerPanel.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkLayerPanel.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LinkLayerPanel.java 13 Oct 2007 12:57:00 -0000 1.3 --- LinkLayerPanel.java 14 Oct 2007 17:19:07 -0000 1.4 *************** *** 155,159 **** LineTable.put(inName,new LinkLine(new Line2D.Double(inStart.x,inStart.y,inEnd.x,inEnd.y), new BasicStroke(2.0f), Color.BLACK)); break; ! case core.NetworkInterface.Serial: LineTable.put(inName,new LinkLine(new Line2D.Double(inStart.x,inStart.y,inEnd.x,inEnd.y), new BasicStroke(3.0f), Color.BLUE)); break; --- 155,159 ---- LineTable.put(inName,new LinkLine(new Line2D.Double(inStart.x,inStart.y,inEnd.x,inEnd.y), new BasicStroke(2.0f), Color.BLACK)); break; ! case core.NetworkInterface.Console: LineTable.put(inName,new LinkLine(new Line2D.Double(inStart.x,inStart.y,inEnd.x,inEnd.y), new BasicStroke(3.0f), Color.BLUE)); break; Index: ApplicationLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/ApplicationLayerDevice.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ApplicationLayerDevice.java 8 Nov 2006 14:27:29 -0000 1.9 --- ApplicationLayerDevice.java 14 Oct 2007 17:19:07 -0000 1.10 *************** *** 30,37 **** private JMenuItem mnuTelnetConnect = new JMenuItem("Telnet client."); private JMenuItem mnuPosixTelnet = new JMenuItem("RFC(line) telnet client."); ! private JMenu mnuAppLayer = new JMenu("Applications"); private JMenuItem mnuSNMPStartAgent = new JMenuItem("Start SNMP agent"); private JMenuItem mnuSNMPStopAgent = new JMenuItem("Stop SNMP agent"); private JMenuItem mnuSNMPManager = new JMenuItem("Send SNMP message"); /** Creates a new instance of ApplicationLayerDevice */ --- 30,39 ---- private JMenuItem mnuTelnetConnect = new JMenuItem("Telnet client."); private JMenuItem mnuPosixTelnet = new JMenuItem("RFC(line) telnet client."); ! protected JMenu mnuAppLayer = new JMenu("Applications"); private JMenuItem mnuSNMPStartAgent = new JMenuItem("Start SNMP agent"); private JMenuItem mnuSNMPStopAgent = new JMenuItem("Stop SNMP agent"); private JMenuItem mnuSNMPManager = new JMenuItem("Send SNMP message"); + private JMenuItem mnuDHCPD = new JMenuItem("Start DHCP Server"); + private JMenuItem mnuDHCPC = new JMenuItem("Run DHCP Client"); /** Creates a new instance of ApplicationLayerDevice */ *************** *** 112,115 **** --- 114,129 ---- }); + mnuDHCPD.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.DHCPD(lblNodeName.getText()); + } + }); + + mnuDHCPC.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.DHCPC(lblNodeName.getText()); + } + }); + mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuSNMPStartAgent); *************** *** 122,125 **** --- 136,142 ---- mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuPosixTelnet); + mnuAppLayer.addSeparator(); + mnuAppLayer.add(mnuDHCPC); + mnuAppLayer.add(mnuDHCPD); } } |