[Javanetsim-cvs] javaNetSim/core Printer.java, NONE, 1.1 Simulation.java, 1.24, 1.25
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2007-10-20 20:19:50
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9138/core Modified Files: Simulation.java Added Files: Printer.java Log Message: Added network printers. Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** Simulation.java 20 Oct 2007 13:27:20 -0000 1.24 --- Simulation.java 20 Oct 2007 20:19:46 -0000 1.25 *************** *** 1032,1035 **** --- 1032,1044 ---- } + public void addPrinter(String inPCName, boolean inOn) throws InvalidNodeNameException { + if (!nodeTable.containsKey(inPCName)) { + nodeTable.put(inPCName, new Printer(inPCName, inOn)); + } else { + throw new InvalidNodeNameException("Node already exists with same name"); + } + return; + } + /** * This method will check to see if the hub name is contained within the --- NEW FILE: Printer.java --- package core; import core.protocolsuite.tcp_ip.DHCPC; import core.protocolsuite.tcp_ip.SNMP; public class Printer extends ApplicationLayerDevice { public final static int SNMP_AGENT_ID = 161; public final static int SNMP_MANAGER_ID = 30161; public final static int DHCP_SERVER_ID = 67; public final static int DHCP_CLIENT_ID = 68; /** * Constructs a PC with the specified name. * @author tristan_veness * @param inName - A name to give the new PC Node. eg: PC1 * @version v0.10 */ protected Printer(String inName, boolean inOn) { super(inName,7, inOn); } public void initApplications(){ super.initApplications(); SNMP snmpAgent = new SNMP((ApplicationLayerDevice)this, NodeProtocolStack, 161, 0, core.ProtocolStack.UIDGen++); DHCPC dhcpc = new DHCPC(NodeProtocolStack, core.ProtocolStack.UIDGen++); addApp(snmpAgent, SNMP_AGENT_ID); addApp(dhcpc, DHCP_CLIENT_ID); } }//EOF |