[Javanetsim-cvs] javaNetSim/core NetworkInterfacePort.java, 1.4, 1.5 Node.java, 1.7, 1.8
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2007-09-14 11:14:55
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16192/core Modified Files: NetworkInterfacePort.java Node.java Log Message: Fixed Java 6 related bugs in several Dialogs, introduced new function: Turn On/Off network device... Index: NetworkInterfacePort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkInterfacePort.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** NetworkInterfacePort.java 13 Sep 2007 13:38:52 -0000 1.4 --- NetworkInterfacePort.java 14 Sep 2007 11:14:49 -0000 1.5 *************** *** 1,103 **** /* Java Firewall Simulator (jFirewallSim) Copyright (c) 2004, jFirewallSim development team All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of the Canberra Institute of Technology nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package core; import java.io.Serializable; /** * A NetworkInterfacePort represents the physical interface between * a DataLinkLayerDevice and a physical Link (network cable). Think of it as a port * * <P>Different DataLinkLayerDevices can contain different numbers of NetworkInterfacesPorts. * A Hub often has 4 or 8 and a switch has 8, 16 or 32.</P> * * <P>In order for a DataLinkLayerDevice to be able to send or receive network information (packets), * there must be a Link (network cable) between at least 2 NetworkInterfaces.</P> * * <P>NetworkInterfacePotrs receive and send packets to and from DatalinkProtocols and * the Link object they are connected to.</P> * * @author bevan_valliess * @since 13 Nov 2004 * @version v0.20 */ public class NetworkInterfacePort extends NetworkInterface{ /** * Constructs a NetworkInterfacePort object with the name inName * and a reference to it's parent Node. * @author baven_calliess * @param inName - The name to give the NetworkInterface eg: eth0 * @param inParent - The Node that the NetworkInterface is to be added to, it's parent. * @version v0.20 */ protected NetworkInterfacePort(String inName, Node inParent) { super(inName,inParent); } /** * This method recevie a packet from a connected link and then pass it * to the node's protocolstack. Depending on the network any * testing of the packets headers may need to be inserted here. * @author bevan_calliess * @param inPacket - The packet being recived by this port * @version v0.20 */ protected void receivePacket(Packet inPacket) throws LowLinkException { parentNode.receivePacket(inPacket, name); ! return; } /** * This method sends a packet to a connected link Depending * it is used by the datalinkLayer devices to tansport * packets without any validation or data checking. * @author bevan_calliess * @author angela_brown * @param outPacket - A Packet * @version v0.20 */ protected void sendPacket(Packet outPacket) throws LowLinkException{ Ethernet_packet tempPacket = (Ethernet_packet)outPacket; EthernetLink temp = (EthernetLink)connectedLink; if(temp!=null){ temp.transportPacket(tempPacket,getSourceName()); } } /** * This method returns information about this InterfacePort * @author bevan_calliess * @return String - The details of Interface name Mac and Links * @version v0.20 */ protected String getDetails(){ return "Interface: "+name+"\t\tMAC: Not Applicable \t\t"+ getConnectLinkDetails(); } }//EOF --- 1,209 ---- /* + Java Firewall Simulator (jFirewallSim) + + Copyright (c) 2004, jFirewallSim development team All rights reserved. + + Redistribution and use in source and binary forms, with or without modification, are + permitted provided that the following conditions are met: + + - Redistributions of source code must retain the above copyright notice, this list + of conditions and the following disclaimer. + - Redistributions in binary form must reproduce the above copyright notice, this list + of conditions and the following disclaimer in the documentation and/or other + materials provided with the distribution. + - Neither the name of the Canberra Institute of Technology nor the names of its + contributors may be used to endorse or promote products derived from this software + without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR + TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + package core; + import java.io.Serializable; + /** + * A NetworkInterfacePort represents the physical interface between + * a DataLinkLayerDevice and a physical Link (network cable). Think of it as a port + * + * <P>Different DataLinkLayerDevices can contain different numbers of NetworkInterfacesPorts. + * A Hub often has 4 or 8 and a switch has 8, 16 or 32.</P> + * + * <P>In order for a DataLinkLayerDevice to be able to send or receive network information (packets), + * there must be a Link (network cable) between at least 2 NetworkInterfaces.</P> + * + * <P>NetworkInterfacePotrs receive and send packets to and from DatalinkProtocols and + * the Link object they are connected to.</P> + * + * @author bevan_valliess + * @since 13 Nov 2004 + * @version v0.20 + */ + + public class NetworkInterfacePort extends NetworkInterface{ + + /** + * Constructs a NetworkInterfacePort object with the name inName + * and a reference to it's parent Node. + * @author baven_calliess + * @param inName - The name to give the NetworkInterface eg: eth0 + * @param inParent - The Node that the NetworkInterface is to be added to, it's parent. + * @version v0.20 + */ + protected NetworkInterfacePort(String inName, Node inParent) { + super(inName,inParent); + } + + + /** + * This method recevie a packet from a connected link and then pass it + * to the node's protocolstack. Depending on the network any + * testing of the packets headers may need to be inserted here. + * @author bevan_calliess + * @param inPacket - The packet being recived by this port + * @version v0.20 + */ + protected void receivePacket(Packet inPacket) throws LowLinkException { + if(!parentNode.On) return; + parentNode.receivePacket(inPacket, name); ! ! return; ! } + + /** + * This method sends a packet to a connected link Depending + * it is used by the datalinkLayer devices to tansport + * packets without any validation or data checking. + * @author bevan_calliess + * @author angela_brown + * @param outPacket - A Packet + * @version v0.20 + */ + protected void sendPacket(Packet outPacket) throws LowLinkException{ + + if(!parentNode.On) return; + Ethernet_packet tempPacket = (Ethernet_packet)outPacket; + EthernetLink temp = (EthernetLink)connectedLink; + + if(temp!=null){ + temp.transportPacket(tempPacket,getSourceName()); + } + } + + /** + * This method returns information about this InterfacePort + * @author bevan_calliess + * @return String - The details of Interface name Mac and Links + * @version v0.20 + */ + protected String getDetails(){ + return "Interface: "+name+"\t\tMAC: Not Applicable \t\t"+ getConnectLinkDetails(); + } + }//EOF + Index: Node.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Node.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** Node.java 22 Feb 2006 20:04:27 -0000 1.7 --- Node.java 14 Sep 2007 11:14:49 -0000 1.8 *************** *** 125,129 **** public ProtocolStack NodeProtocolStack; ! protected String name; --- 125,131 ---- public ProtocolStack NodeProtocolStack; ! protected String name; ! ! public boolean On; *************** *** 149,157 **** protected Node(String inName, int inProtocolStackLayers) { ! NetworkInterfacetable = new Hashtable(); name=inName; ! if(inProtocolStackLayers != 1){ --- 151,159 ---- protected Node(String inName, int inProtocolStackLayers) { ! NetworkInterfacetable = new Hashtable(); name=inName; ! On = true; if(inProtocolStackLayers != 1){ |