[Javanetsim-cvs] javaNetSim/core EthernetNetworkInterface.java, 1.17, 1.18 Ethernet_packet.java, 1.
Status: Beta
Brought to you by:
darkkey
From: Alexander B. <da...@us...> - 2008-10-17 10:17:10
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18066/core Modified Files: EthernetNetworkInterface.java Ethernet_packet.java NetworkLayerDevice.java Node.java Log Message: Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkLayerDevice.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** NetworkLayerDevice.java 13 Oct 2008 22:52:07 -0000 1.25 --- NetworkLayerDevice.java 17 Oct 2008 09:10:16 -0000 1.26 *************** *** 51,55 **** public abstract class NetworkLayerDevice extends Node { ! private DeviceConfig config = new DeviceConfig(this); private AccessListEngine acls = new AccessListEngine(this); private NATEngine nat = new NATEngine(this); --- 51,55 ---- public abstract class NetworkLayerDevice extends Node { ! protected DeviceConfig config = new DeviceConfig(this); private AccessListEngine acls = new AccessListEngine(this); private NATEngine nat = new NATEngine(this); Index: EthernetNetworkInterface.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/EthernetNetworkInterface.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** EthernetNetworkInterface.java 5 Oct 2008 19:12:30 -0000 1.17 --- EthernetNetworkInterface.java 17 Oct 2008 09:10:16 -0000 1.18 *************** *** 64,67 **** --- 64,71 ---- protected String MACAddress; public String defaultMACAddress; + public int vlan = 1; + final static int MODE_ACCESS = 0; + final static int MODE_TRUNK = 1; + public int mode = MODE_ACCESS; /** *************** *** 101,110 **** // cast the packet to an EthernetPacket Ethernet_packet tempPacket = (Ethernet_packet)inPacket; if(!parentNode.On || !up) return; //Test if this packet is for this interface or a broadcast ! if(MACAddress.equals(tempPacket.getDestinationMACAddress()) ! || tempPacket.getDestinationMACAddress().equals("FF:FF:FF:FF:FF:FF")){ //Packet is For this Interface or is broadcast so send it to the Parent Node --- 105,123 ---- // cast the packet to an EthernetPacket Ethernet_packet tempPacket = (Ethernet_packet)inPacket; + + boolean drop = false; if(!parentNode.On || !up) return; + + if(!(MACAddress.equals(tempPacket.getDestinationMACAddress()) + || tempPacket.getDestinationMACAddress().equals("FF:FF:FF:FF:FF:FF"))) + drop = true; + + if(mode == MODE_ACCESS && (tempPacket.vlan_id != vlan)) + drop = true; + //Test if this packet is for this interface or a broadcast ! if(!drop){ //Packet is For this Interface or is broadcast so send it to the Parent Node Index: Node.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Node.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Node.java 5 Oct 2008 19:12:31 -0000 1.27 --- Node.java 17 Oct 2008 09:10:16 -0000 1.28 *************** *** 131,135 **** public String location = ""; ! private int ProtocolStackLayers; --- 131,135 ---- public String location = ""; ! protected int ProtocolStackLayers; *************** *** 244,248 **** } ! private void init(int inProtocolStackLayers){ On = true; if(inProtocolStackLayers != 1){ --- 244,248 ---- } ! protected void init(int inProtocolStackLayers){ On = true; if(inProtocolStackLayers != 1){ *************** *** 262,265 **** --- 262,273 ---- } } + + public String getAllData(){ + return ""; + } + + public void loadDataFile(String name, int lines, String Data){ + return; + } /** *************** *** 455,461 **** NetworkInterface temp = (NetworkInterface)NetworkInterfacetable.get(str); ! if(temp.isActive() && temp.isUP() == false){ temp.UP(); ! } } } --- 463,470 ---- NetworkInterface temp = (NetworkInterface)NetworkInterfacetable.get(str); ! if(temp.isActive() && temp.isUP() == false) temp.UP(); ! else ! temp.setUP(); } } Index: Ethernet_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Ethernet_packet.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Ethernet_packet.java 20 Nov 2005 20:30:53 -0000 1.2 --- Ethernet_packet.java 17 Oct 2008 09:10:16 -0000 1.3 *************** *** 36,39 **** --- 36,40 ---- private String sourceMACAddress; private String destMACAddress; + public int vlan_id = 1; /** |