Thread: [Javanetsim-cvs] javaNetSim/core ExternalProxy.java, 1.4, 1.5 PC.java, 1.23, 1.24 Printer.java, 1.3
Status: Beta
Brought to you by:
darkkey
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18909/core Modified Files: ExternalProxy.java PC.java Printer.java Router.java Simulation.java Version.java W80211_packet.java WiFiPort.java Log Message: Index: PC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/PC.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** PC.java 27 Sep 2008 08:38:22 -0000 1.23 --- PC.java 6 Oct 2008 13:20:39 -0000 1.24 *************** *** 97,101 **** * @version v0.10 */ ! protected PC(String inName, boolean inOn) { super(inName,7, inOn); } --- 97,101 ---- * @version v0.10 */ ! public PC(String inName, boolean inOn) { super(inName,7, inOn); } Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** Simulation.java 27 Sep 2008 08:38:22 -0000 1.31 --- Simulation.java 6 Oct 2008 13:20:39 -0000 1.32 *************** *** 30,33 **** --- 30,34 ---- import java.io.Serializable; import java.util.*; + import java.lang.reflect.*; import core.protocolsuite.tcp_ip.IPV4Address; *************** *** 1071,1074 **** --- 1072,1094 ---- } + public void addNode(String ClassName, String inName, boolean inOn)throws InvalidNodeNameException { + try{ + Class cNode = Class.forName( "core." + ClassName ); + + //Class.forName( ClassName ). + + Constructor con = cNode.getConstructor(String.class, Boolean.TYPE); + + if (!nodeTable.containsKey(inName)) { + nodeTable.put(inName, con.newInstance(new Object[]{inName, inOn})); + } else { + throw new InvalidNodeNameException("Node already exists with same name"); + } + }catch(Exception e){ + e.printStackTrace(); + } + return; + } + /** * This method is for creating a PC within the simulation. Index: Printer.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Printer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Printer.java 26 Sep 2008 17:53:49 -0000 1.3 --- Printer.java 6 Oct 2008 13:20:39 -0000 1.4 *************** *** 20,24 **** * @version v0.10 */ ! protected Printer(String inName, boolean inOn) { super(inName,7, inOn); } --- 20,24 ---- * @version v0.10 */ ! public Printer(String inName, boolean inOn) { super(inName,7, inOn); } Index: W80211_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/W80211_packet.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** W80211_packet.java 5 Oct 2008 13:03:47 -0000 1.3 --- W80211_packet.java 6 Oct 2008 13:20:39 -0000 1.4 *************** *** 9,12 **** --- 9,15 ---- public String SSID; + public boolean shared = false; + public int auth_seq = 0; + public String WEP; public int keyNum; *************** *** 29,32 **** --- 32,40 ---- } + public void setAuth(boolean inShared, int seq){ + shared = inShared; + auth_seq = seq; + } + public W80211_packet(Packet inPacket, String inSrc, String inDst, int inType, int inSubType, String inSSID) { Index: WiFiPort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WiFiPort.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** WiFiPort.java 5 Oct 2008 20:57:00 -0000 1.10 --- WiFiPort.java 6 Oct 2008 13:20:39 -0000 1.11 *************** *** 26,29 **** --- 26,33 ---- protected String WEP_keys[] = {"", "", "", ""}; + protected boolean isSecureEnabled(){ + return ((new String(WEP_keys[0] + WEP_keys[1] + WEP_keys[2] + WEP_keys[3])).length() > 5); + } + protected static final int OFFLINE = 0; protected static final int PROBE = 1; *************** *** 148,160 **** } ! void sendAuthReq(String inBSSID) throws LowLinkException{ W80211_packet tempWiFi = new W80211_packet(null, BSSID, inBSSID, 0, 11, SSID); ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", ! "Link", "Sending auth req packet from interface "+ name); sendWirelessConfirmPacket(tempWiFi); } void sendAssocReq(String inBSSID) throws LowLinkException{ W80211_packet tempWiFi = new W80211_packet(null, BSSID, inBSSID, 0, 0, SSID); --- 152,189 ---- } ! void sendAuthReq(String inBSSID, int seq) throws LowLinkException{ W80211_packet tempWiFi = new W80211_packet(null, BSSID, inBSSID, 0, 11, SSID); ! tempWiFi.setAuth(shared_auth, seq); ! ! tempWiFi.Cypher(WEP_keys[0], 0); ! ! if(seq == 0) ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", ! "Link", "Sending auth req packet from interface "+ name); ! else ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", ! "Link", "Sending auth challenge reply packet from interface "+ name); sendWirelessConfirmPacket(tempWiFi); } + void sendAuthReply(String inBSSID, int seq) throws LowLinkException{ + W80211_packet tempWiFi = new W80211_packet(null, BSSID, inBSSID, 0, 11, SSID); + + tempWiFi.setAuth(shared_auth, seq); + + tempWiFi.Cypher(WEP_keys[0], 0); + + if(seq == 1 || !shared_auth) + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", + "Link", "Sending auth reply packet from interface "+ name); + else + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", + "Link", "Sending auth challenge req packet from interface "+ name); + + sendWirelessPacket(tempWiFi); + } + void sendAssocReq(String inBSSID) throws LowLinkException{ W80211_packet tempWiFi = new W80211_packet(null, BSSID, inBSSID, 0, 0, SSID); *************** *** 413,417 **** //&& ! if(tempWiFi.WEP != WEP_keys[tempWiFi.keyNum] ){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Recieved and discarded packet: Wrong WEP params."); --- 442,446 ---- //&& ! if(isSecureEnabled() && !tempWiFi.WEP.trim().equals(WEP_keys[tempWiFi.keyNum].trim()) ){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Recieved and discarded packet: Wrong WEP params."); *************** *** 496,502 **** Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Recieved probe reply from " + apBSSID + " on interface "+ name); - state = ASSOC; ResendPackets.clear(); ! sendAssocReq(apBSSID); }else if(state == ASSOC && tempWiFi.Type == 0 && tempWiFi.subType == 1){ ResendPackets.remove(tempWiFi.getID()); --- 525,566 ---- Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Recieved probe reply from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! if(!isSecureEnabled()){ ! state = ASSOC; ! sendAssocReq(apBSSID); ! }else{ ! state = AUTH; ! sendAuthReq(apBSSID, 0); ! } ! }else if(state == AUTH && tempWiFi.Type == 0 && tempWiFi.subType == 11){ ! ! if(!shared_auth && !tempWiFi.shared){ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", ! "Link", "Recieved successful auth reply from " + apBSSID + " on interface "+ name); ! ResendPackets.clear(); ! state = ASSOC; ! sendAssocReq(apBSSID); ! }else if(shared_auth && tempWiFi.shared){ ! if(tempWiFi.auth_seq == 1){ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", ! "Link", "Recieved auth challenge from " + apBSSID + " on interface "+ name); ! ResendPackets.clear(); ! state = AUTH; ! sendAuthReq(apBSSID, 2); ! }else{ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", ! "Link", "Recieved successful auth reply from " + apBSSID + " on interface "+ name); ! ResendPackets.clear(); ! state = ASSOC; ! sendAssocReq(apBSSID); ! } ! }else{ ! ResendPackets.clear(); ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Wrong 802.11 protocol action!"); ! failed=true; ! associated=false; ! DOWN(); ! } ! }else if(state == ASSOC && tempWiFi.Type == 0 && tempWiFi.subType == 1){ ResendPackets.remove(tempWiFi.getID()); *************** *** 528,531 **** --- 592,626 ---- sendProbeReply(tempWiFi.getSrcBSSID(), tempWiFi.getID()); + }else if(tempWiFi.Type == 0 && tempWiFi.subType == 11){ + if(APClients.get(tempWiFi.getSrcBSSID()) != null){ + APClients.put(tempWiFi.getSrcBSSID() , new APClient(tempWiFi.getSrcBSSID())); + } + + if(!shared_auth && !tempWiFi.shared){ + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", + "Link", "Recieved auth req from " + apBSSID + " on interface "+ name); + ResendPackets.clear(); + state = AUTH; + sendAuthReply(tempWiFi.getSrcBSSID(), 1); + }else if(shared_auth && tempWiFi.shared){ + if(tempWiFi.auth_seq == 0){ + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", + "Link", "Recieved auth req from " + apBSSID + " on interface "+ name); + ResendPackets.clear(); + state = AUTH; + sendAuthReply(tempWiFi.getSrcBSSID(), 1); + }else{ + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", + "Link", "Recieved auth challenge reply from " + apBSSID + " on interface "+ name); + ResendPackets.clear(); + state = AUTH; + sendAuthReply(tempWiFi.getSrcBSSID(), 3); + } + }else{ + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Wrong 802.11 protocol action!"); + if(APClients.get(tempWiFi.getSrcBSSID()) != null){ + APClients.remove(tempWiFi.getSrcBSSID()); + } + } }else if(tempWiFi.Type == 0 && tempWiFi.subType == 0){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", *************** *** 572,575 **** --- 667,673 ---- W80211_packet tempWiFi = new W80211_packet(tempPacket, BSSID, tempPacket.getDestinationMACAddress(), 2, 0, SSID); + + if(isSecureEnabled()) + tempWiFi.Cypher(WEP_keys[0], 0); Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Data Packet", *************** *** 604,607 **** --- 702,708 ---- W80211_packet tempWiFi = new W80211_packet(tempPacket, BSSID, apBSSID, 2, 0, SSID); + if(isSecureEnabled()) + tempWiFi.Cypher(WEP_keys[0], 0); + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Data Packet", "Link", "Sending packet from interface " + name + " to " + tempWiFi.getDstBSSID()); Index: Router.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Router.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Router.java 26 Sep 2008 17:53:49 -0000 1.10 --- Router.java 6 Oct 2008 13:20:39 -0000 1.11 *************** *** 52,56 **** * @version v0.10 **/ ! protected Router(String inName, boolean inOn) { super(inName,7, inOn); } --- 52,56 ---- * @version v0.10 **/ ! public Router(String inName, boolean inOn) { super(inName,7, inOn); } Index: Version.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Version.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** Version.java 20 Nov 2007 19:17:09 -0000 1.15 --- Version.java 6 Oct 2008 13:20:39 -0000 1.16 *************** *** 40,45 **** */ public class Version { ! public final static String CORE_VERSION = "v0.39"; //version of the simulation core ! public final static String YEARS = "2005 - 2007"; public static final String TEAM_MEMBERS[] = { --- 40,45 ---- */ public class Version { ! public final static String CORE_VERSION = "v0.40"; //version of the simulation core ! public final static String YEARS = "2005 - 2008"; public static final String TEAM_MEMBERS[] = { *************** *** 48,55 **** "from 03 Nov 2005","", "Alexander Bolshev [Key]", "Project Leader / Developer / Maintainer", - "Ilgar Alekperov [Gift]", "Developer / Tester", "Konstantin Karpov [QweR]", "Developer / Tester", ! "", "If you found a bug, please post it to: http://sf.net/tracker/?atid=784685&group_id=152576", ! "", "Get information about latest releases at rss:", "http://sf.net/export/rss2_projfiles.php?group_id=152576", "and about latest news at rss:", "http://sf.net/export/rss2_projnews.php?group_id=152576&rss_fulltext=1" /*, "Semester 2, 2004", "", "Angela Brown " , "Project Manager / Documentation Manager / Developer ", --- 48,58 ---- "from 03 Nov 2005","", "Alexander Bolshev [Key]", "Project Leader / Developer / Maintainer", "Konstantin Karpov [QweR]", "Developer / Tester", ! "","Contributors & Old Developers:", ! "Ilgar Alekperov [Gift]", "\t First version of TCP, Echo TCP, Export to HTML, Testing & Bugfixinig", ! "Igor Goroshkov", "\t RIP protocol core & GUI", ! "", "If you found a bug, please post it to: http://sf.net/tracker/?atid=784685&group_id=152576", ! ! //"", "Get information about latest releases at rss:", "http://sf.net/export/rss2_projfiles.php?group_id=152576", "and about latest news at rss:", "http://sf.net/export/rss2_projnews.php?group_id=152576&rss_fulltext=1" /*, "Semester 2, 2004", "", "Angela Brown " , "Project Manager / Documentation Manager / Developer ", *************** *** 60,64 **** "Semester 1, 2004", "", "Tristan Veness " , "Project Manager / Developer ", ! "James Nikolaidis" , "Developer ", ! */}; }//EOF --- 63,67 ---- "Semester 1, 2004", "", "Tristan Veness " , "Project Manager / Developer ", ! "James Nikolaidis" , "Developer ",*/ ! }; }//EOF Index: ExternalProxy.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/ExternalProxy.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ExternalProxy.java 26 Sep 2008 17:53:48 -0000 1.4 --- ExternalProxy.java 6 Oct 2008 13:20:39 -0000 1.5 *************** *** 66,73 **** * @version v0.10 **/ ! protected ExternalProxy(String inName, boolean inOn) { super(inName,3, inOn); NodeProtocolStack.initNAT(); - addNetworkInterface("eth0", NetworkInterface.Ethernet10T, true, 0 ); externalIP = null; Apps = new Hashtable(); --- 66,72 ---- * @version v0.10 **/ ! public ExternalProxy(String inName, boolean inOn) { super(inName,3, inOn); NodeProtocolStack.initNAT(); externalIP = null; Apps = new Hashtable(); |