javanetsim-cvs Mailing List for javaNetSim (Page 6)
Status: Beta
Brought to you by:
darkkey
You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(120) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(1) |
Feb
(69) |
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(76) |
Oct
(28) |
Nov
(77) |
Dec
(186) |
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(36) |
Oct
(61) |
Nov
(23) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(17) |
Oct
(105) |
Nov
(5) |
Dec
(1) |
2009 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(8) |
Oct
(9) |
Nov
|
Dec
|
From: Alexander B. <da...@us...> - 2008-10-05 13:08:16
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10499/core/protocolsuite/tcp_ip Modified Files: ARP.java Log Message: Index: ARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARP.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ARP.java 27 Sep 2008 08:38:23 -0000 1.10 --- ARP.java 5 Oct 2008 13:03:47 -0000 1.11 *************** *** 118,122 **** mParentStack = inParentStack; ! ARP_MAXTRY = 1; } --- 118,122 ---- mParentStack = inParentStack; ! ARP_MAXTRY = 5; } |
From: Alexander B. <da...@us...> - 2008-10-05 13:04:51
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10499/guiUI Modified Files: MainScreen.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** MainScreen.java 3 Oct 2008 22:29:10 -0000 1.88 --- MainScreen.java 5 Oct 2008 13:03:48 -0000 1.89 *************** *** 2214,2218 **** JFileChooser chooser = new JFileChooser(); ! chooser.setDialogTitle("Save As ..."); chooser.setAcceptAllFileFilterUsed(false); chooser.addChoosableFileFilter(new JNSTFilter()); --- 2214,2218 ---- JFileChooser chooser = new JFileChooser(); ! chooser.setDialogTitle("Save As ..."); chooser.setAcceptAllFileFilterUsed(false); chooser.addChoosableFileFilter(new JNSTFilter()); *************** *** 2364,2368 **** System.out.println("Writing Simulation file"); ! System.out.println("Simulation was saved succesfully."); System.out.println("File "+ simSaveFile.getName() + " has been saved to " + simSaveFile.getAbsolutePath()); --- 2364,2368 ---- System.out.println("Writing Simulation file"); ! System.out.println("Simulation was saved succesfully."); System.out.println("File "+ simSaveFile.getName() + " has been saved to " + simSaveFile.getAbsolutePath()); *************** *** 2372,2376 **** isDirty=false; ! setStatus("Simulation was saved succesfully."); }catch(IOException e){ --- 2372,2376 ---- isDirty=false; ! setStatus("Simulation was saved succesfully."); }catch(IOException e){ *************** *** 2529,2533 **** }else if(strClassName.contains("GuiPC")){ deviceType = 2; ! Sim.addPC(strNodeName, false); }else if(strClassName.contains("GuiRouter")){ deviceType = 2; --- 2529,2536 ---- }else if(strClassName.contains("GuiPC")){ deviceType = 2; ! Sim.addPC(strNodeName, false); ! }else if(strClassName.contains("GuiPrinter")){ ! deviceType = 2; ! Sim.addPrinter(strNodeName, false); }else if(strClassName.contains("GuiRouter")){ deviceType = 2; *************** *** 2674,2677 **** --- 2677,2687 ---- Sandbox.setLayer(tempPC,3,0); GUInodeTable.put(strNodeName,tempPC); + }else if(strClassName.contains("GuiPrinter")){ + GuiPrinter tempPC = new GuiPrinter(strNodeName,this); + tempPC.setNodeLocation(pnt); + tempPC.setEnabled(false); + Sandbox.add(tempPC); + Sandbox.setLayer(tempPC,3,0); + GUInodeTable.put(strNodeName,tempPC); }else if(strClassName.contains("GuiRouter")){ GuiRouter tempRouter = new GuiRouter(strNodeName,this); |
From: QweR <qw...@us...> - 2008-10-03 22:29:33
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29998/core Modified Files: CommandProcessor.java DeviceConfig.java NetworkLayerDevice.java Log Message: ICMP unreacheable in ping correct sh run toString for DeviceConfig Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkLayerDevice.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** NetworkLayerDevice.java 26 Sep 2008 17:53:49 -0000 1.18 --- NetworkLayerDevice.java 3 Oct 2008 22:29:10 -0000 1.19 *************** *** 31,34 **** --- 31,35 ---- import core.protocolsuite.tcp_ip.InvalidIPAddressException; import core.InvalidNetworkInterfaceNameException; + import core.protocolsuite.tcp_ip.ICMP_packet; import core.protocolsuite.tcp_ip.InvalidSubnetMaskException; import core.protocolsuite.tcp_ip.Route_entry; *************** *** 134,141 **** * @param inDestIPAddress - The Destination IP Addres eg: 192.168.0.2 * @throws CommunicationException ! * @return ICMP message ID * @version v0.20 */ ! public int sendPing(String inDestIPAddress) throws CommunicationException, LowLinkException{ return NodeProtocolStack.sendPing(inDestIPAddress); --- 135,142 ---- * @param inDestIPAddress - The Destination IP Addres eg: 192.168.0.2 * @throws CommunicationException ! * @return ICMP packet * @version v0.20 */ ! public ICMP_packet sendPing(String inDestIPAddress) throws CommunicationException, LowLinkException{ return NodeProtocolStack.sendPing(inDestIPAddress); *************** *** 143,154 **** /** ! * This method returns receive time of ICMP packet with messageID. * @author QweR * @param messageID - ICMP packet message ID ! * @return receive time of ICMP packet or zero if packet was not received * @version v0.21 */ ! public long getTimeICMPPacketReceived(int messageID){ ! return NodeProtocolStack.getTimeICMPPacketReceived(messageID); } --- 144,166 ---- /** ! * This method returns received ICMP packet with messageID. * @author QweR * @param messageID - ICMP packet message ID ! * @return received ICMP packet or null if packet was not received * @version v0.21 */ ! public ICMP_packet getReceivedICMPPacket(int messageID){ ! return NodeProtocolStack.getReceivedICMPPacket(messageID); ! } ! ! /** ! * This method remove and returns received ICMP packet with messageID. ! * @author QweR ! * @param messageID - ICMP packet message ID ! * @return received ICMP packet or null if packet was not received ! * @version v0.21 ! */ ! public ICMP_packet removeReceivedICMPPacket(int messageID){ ! return NodeProtocolStack.removeReceivedICMPPacket(messageID); } Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** CommandProcessor.java 3 Oct 2008 14:49:54 -0000 1.17 --- CommandProcessor.java 3 Oct 2008 22:29:09 -0000 1.18 *************** *** 2604,2613 **** } public String call(Vector<String> params){ ! String out = ""; ! Iterator<String> cnf = device.getConfig().getConfig(DeviceConfig.RUNNING_CONFIG).iterator(); ! while(cnf.hasNext()){ ! out += cnf.next() + "\n"; ! } ! return out; } }; --- 2604,2608 ---- } public String call(Vector<String> params){ ! return device.getConfig().toString(DeviceConfig.RUNNING_CONFIG); } }; *************** *** 2772,2781 **** } public String call(Vector<String> params){ ! String out = ""; ! Iterator<String> cnf = device.getConfig().getConfig(DeviceConfig.RUNNING_CONFIG).iterator(); ! while(cnf.hasNext()){ ! out += cnf.next() + "\n"; ! } ! return out; } }; --- 2767,2771 ---- } public String call(Vector<String> params){ ! return device.getConfig().toString(DeviceConfig.RUNNING_CONFIG); } }; *************** *** 2899,2908 **** } public String call(Vector<String> params){ ! String out = ""; ! Iterator<String> cnf = device.getConfig().getConfig(DeviceConfig.STARTUP_CONFIG).iterator(); ! while(cnf.hasNext()){ ! out += cnf.next() + "\n"; ! } ! return out; } }; --- 2889,2893 ---- } public String call(Vector<String> params){ ! return device.getConfig().toString(DeviceConfig.STARTUP_CONFIG); } }; *************** *** 3311,3320 **** } public String call(Vector<String> params){ ! String out = ""; ! Iterator<String> cnf = device.getConfig().getConfig(DeviceConfig.RUNNING_CONFIG).iterator(); ! while(cnf.hasNext()){ ! out += cnf.next() + "\n"; ! } ! return out; } }; --- 3296,3300 ---- } public String call(Vector<String> params){ ! return device.getConfig().toString(DeviceConfig.RUNNING_CONFIG); } }; Index: DeviceConfig.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/DeviceConfig.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** DeviceConfig.java 3 Oct 2008 14:49:54 -0000 1.14 --- DeviceConfig.java 3 Oct 2008 22:29:10 -0000 1.15 *************** *** 83,86 **** --- 83,95 ---- return config; } + + public String toString(int config_name){ + String out = ""; + Iterator<String> cnf = device.getConfig().getConfig(config_name).iterator(); + while(cnf.hasNext()){ + out += cnf.next() + "\n"; + } + return out; + } protected LinkedList getRealConfig(int config_name){ *************** *** 419,425 **** if(ni.isUP()) conf.add("no interface "+intName+" shutdown"); if(eni!=null && !eni.getMACAddress().equalsIgnoreCase(eni.defaultMACAddress)) conf.add("interface "+intName+" mac-address "+eni.getMACAddress()); ! if((eni!=null || sni!=null || wfi!=null) && device.getIPAddress((String)ins[i])!=null && !device.getIPAddress((String)ins[i]).equals("")) conf.add("interface "+intName+" ip address "+device.getIPAddress((String)ins[i])+" "+device.getSubnetMask((String)ins[i])); if(sni!=null && sni.getClockRate()!=sni.DEFAULT_CLOCKRATE) --- 428,436 ---- if(ni.isUP()) conf.add("no interface "+intName+" shutdown"); + else + conf.add("interface "+intName+" shutdown"); if(eni!=null && !eni.getMACAddress().equalsIgnoreCase(eni.defaultMACAddress)) conf.add("interface "+intName+" mac-address "+eni.getMACAddress()); ! if((eni!=null || sni!=null || wfi!=null) && device.getIPAddress((String)ins[i])!=null && !device.getIPAddress((String)ins[i]).equals("") && ni.isActive()) conf.add("interface "+intName+" ip address "+device.getIPAddress((String)ins[i])+" "+device.getSubnetMask((String)ins[i])); if(sni!=null && sni.getClockRate()!=sni.DEFAULT_CLOCKRATE) |
From: QweR <qw...@us...> - 2008-10-03 22:29:28
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29998/guiUI Modified Files: MainScreen.java Terminal.java Log Message: ICMP unreacheable in ping correct sh run toString for DeviceConfig Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.87 retrieving revision 1.88 diff -C2 -d -r1.87 -r1.88 *** MainScreen.java 27 Sep 2008 10:16:38 -0000 1.87 --- MainScreen.java 3 Oct 2008 22:29:10 -0000 1.88 *************** *** 2321,2328 **** if(Sim.getNode(key) instanceof core.NetworkLayerDevice){ ! Iterator<String> cnf = ((core.NetworkLayerDevice)Sim.getNode(key)).getConfig().getConfig(core.DeviceConfig.STARTUP_CONFIG).iterator(); ! while(cnf.hasNext()){ ! strSave += cnf.next() + "\n"; ! } } --- 2321,2329 ---- if(Sim.getNode(key) instanceof core.NetworkLayerDevice){ ! // Iterator<String> cnf = ((core.NetworkLayerDevice)Sim.getNode(key)).getConfig().getConfig(core.DeviceConfig.STARTUP_CONFIG).iterator(); ! // while(cnf.hasNext()){ ! // strSave += cnf.next() + "\n"; ! // } ! strSave += ((core.NetworkLayerDevice)Sim.getNode(key)).getConfig().toString(core.DeviceConfig.STARTUP_CONFIG); } Index: Terminal.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/Terminal.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** Terminal.java 28 Sep 2008 17:11:47 -0000 1.12 --- Terminal.java 3 Oct 2008 22:29:10 -0000 1.13 *************** *** 34,37 **** --- 34,38 ---- import core.InvalidNetworkInterfaceNameException; import core.CommandInterface.Modes; + import core.protocolsuite.tcp_ip.ICMP_packet; import core.protocolsuite.tcp_ip.IPV4Address; *************** *** 448,471 **** int success = 0; for(int pi=0; pi<count; pi++){ ! int mid = device.sendPing(ip); ! if(device.getTimeICMPPacketReceived(mid)>0){ ! appendToTerminal("!"); ! success++; } else{ appendToTerminal("."); } ! try { ! sleep(delay); ! } catch (InterruptedException e) { } } addToTerminal("\nSuccess rate is " +(int)(success*100/count)+ " percent ("+success+"/"+count+")\n"); } catch (CommunicationException e) { ! addToTerminal("Internal error: ping: CommunicationException\n"); } catch (LowLinkException e) { ! addToTerminal("Internal error: ping: LowLinkException\n"); } catch (Exception e){ ! addToTerminal("Internal error: ping: Exception\n"); } setBlocked(false); --- 449,494 ---- int success = 0; for(int pi=0; pi<count; pi++){ ! ICMP_packet icmpout = device.sendPing(ip); ! ICMP_packet icmpin = device.getReceivedICMPPacket(icmpout.getMessageID()); ! if(icmpin!=null){ ! if(icmpin.getMessageCode()==ICMP_packet.DESTINATION_UNREACHABLE){ ! appendToTerminal("U"); ! } ! else if(icmpin.getMessageCode()==ICMP_packet.TIME_EXCEEDED){ ! appendToTerminal("T"); ! } ! else{ ! appendToTerminal("!"); ! success++; ! } ! } ! else if((icmpin = device.getReceivedICMPPacket(0))!=null){ ! if(icmpin.getMessageCode()==ICMP_packet.DESTINATION_UNREACHABLE){ ! appendToTerminal("U"); ! } ! else if(icmpin.getMessageCode()==ICMP_packet.TIME_EXCEEDED){ ! appendToTerminal("T"); ! } ! device.removeReceivedICMPPacket(0); } else{ appendToTerminal("."); } ! if(pi<count-1){ ! try { ! sleep(delay); ! } catch (InterruptedException e) { ! } } } addToTerminal("\nSuccess rate is " +(int)(success*100/count)+ " percent ("+success+"/"+count+")\n"); } catch (CommunicationException e) { ! //addToTerminal("Internal error: ping: CommunicationException\n"); ! addToTerminal("CommunicationException: "+e.getMessage()); } catch (LowLinkException e) { ! //addToTerminal("Internal error: ping: LowLinkException\n"); ! addToTerminal("LowLinkException: "+e.getMessage()); } catch (Exception e){ ! addToTerminal("Internal error: ping: Exception: "+e.getMessage()+"\n"); } setBlocked(false); *************** *** 483,487 **** if(IPV4Address.validateDecIP(ip)){ out += "Type escape sequence to abort.\n"; ! out += "Sending 5, 4-byte ICMP Echos to "+params.get(0)+", timeout is 2 seconds:\n"; pt = new PingThread(5,1000,ip); pt.start(); --- 506,510 ---- if(IPV4Address.validateDecIP(ip)){ out += "Type escape sequence to abort.\n"; ! out += "Sending 5, 4-byte ICMP Echos to "+params.get(0)+", timeout is 1 second:\n"; pt = new PingThread(5,1000,ip); pt.start(); |
From: QweR <qw...@us...> - 2008-10-03 22:29:28
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29998/core/protocolsuite/tcp_ip Modified Files: ICMP.java ProtocolStack.java Log Message: ICMP unreacheable in ping correct sh run toString for DeviceConfig Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.68 retrieving revision 1.69 diff -C2 -d -r1.68 -r1.69 *** ProtocolStack.java 28 Sep 2008 17:11:47 -0000 1.68 --- ProtocolStack.java 3 Oct 2008 22:29:10 -0000 1.69 *************** *** 654,658 **** * @throws CommunicationException * ! * @return ICMP message ID * * @version v0.20 --- 654,658 ---- * @throws CommunicationException * ! * @return ICMP packet * * @version v0.20 *************** *** 660,687 **** */ ! public int sendPing(String inDestIPAddress) throws CommunicationException, LowLinkException { ! int result = -1; if (IPV4Address.validateDecIP(inDestIPAddress)) { ! ICMP_packet pingPacket = mICMPprotocol.sendPing(inDestIPAddress); ! result = pingPacket.getMessageID(); sendPacket(pingPacket); } else throw new CommunicationException("Packet dropped host unreachable " + inDestIPAddress); ! return result; } /** ! * This method returns receive time of ICMP packet with messageID. * * @author QweR * @param messageID - * ICMP packet message ID ! * @return receive time of ICMP packet or zero if packet was not received * @version v0.21 */ ! public long getTimeICMPPacketReceived(int messageID) { ! return mICMPprotocol.getTimeICMPPacketReceived(messageID); } --- 660,699 ---- */ ! public ICMP_packet sendPing(String inDestIPAddress) throws CommunicationException, LowLinkException { ! ICMP_packet pingPacket = null; if (IPV4Address.validateDecIP(inDestIPAddress)) { ! pingPacket = mICMPprotocol.sendPing(inDestIPAddress); sendPacket(pingPacket); } else throw new CommunicationException("Packet dropped host unreachable " + inDestIPAddress); ! return pingPacket; } /** ! * This method returns received ICMP packet with messageID. * * @author QweR * @param messageID - * ICMP packet message ID ! * @return received ICMP packet or null if packet was not received * @version v0.21 */ ! public ICMP_packet getReceivedICMPPacket(int messageID) { ! return mICMPprotocol.getReceivedICMPPacket(messageID); ! } ! ! /** ! * This method remove and returns received ICMP packet with messageID. ! * ! * @author QweR ! * @param messageID - ! * ICMP packet message ID ! * @return received ICMP packet or null if packet was not received ! * @version v0.21 ! */ ! public ICMP_packet removeReceivedICMPPacket(int messageID) { ! return mICMPprotocol.removeReceivedICMPPacket(messageID); } *************** *** 896,899 **** --- 908,913 ---- .getSourceIPAddress()); pingPacket.setMessageCode(ICMP_packet.TIME_EXCEEDED); + if(ipPacket instanceof ICMP_packet) + pingPacket.setMessageID(((ICMP_packet)ipPacket).getMessageID()); Simulation.addLayerInfo(getClass().getName(), Index: ICMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ICMP.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ICMP.java 3 Oct 2008 14:49:55 -0000 1.7 --- ICMP.java 3 Oct 2008 22:29:10 -0000 1.8 *************** *** 61,66 **** private ProtocolStack mParentStack; ! private Hashtable<Integer, Long> receivedMessageID; // Message ID and ! // received time of // received packets. --- 61,65 ---- private ProtocolStack mParentStack; ! private Hashtable<Integer, ICMP_packet> receivedPackets; // Message ID and // received packets. *************** *** 86,90 **** mParentStack = inParentStack; ! receivedMessageID = new Hashtable<Integer, Long>(); } --- 85,89 ---- mParentStack = inParentStack; ! receivedPackets = new Hashtable<Integer, ICMP_packet>(); } *************** *** 119,124 **** }else if (inPacket.getMessageCode() == 0) { ! receivedMessageID.put(inPacket.getMessageID(), System ! .currentTimeMillis()); // Create Layer info --- 118,122 ---- }else if (inPacket.getMessageCode() == 0) { ! receivedPackets.put(inPacket.getMessageID(), inPacket); // Create Layer info *************** *** 138,141 **** --- 136,140 ---- }else if (inPacket.getMessageCode() == ICMP_packet.DESTINATION_UNREACHABLE){ + receivedPackets.put(inPacket.getMessageID(), inPacket); Simulation.addLayerInfo(getClass().getName(), mParentStack.getParentNodeName(), "ICMP Dst Unreach", "Network", *************** *** 143,146 **** --- 142,146 ---- + inPacket.getSourceIPAddress()); }else if (inPacket.getMessageCode() == ICMP_packet.TIME_EXCEEDED){ + receivedPackets.put(inPacket.getMessageID(), inPacket); Simulation.addLayerInfo(getClass().getName(), mParentStack.getParentNodeName(), "ICMP Time Exceeded", "Network", *************** *** 164,168 **** * * @param inPacket - ! * The original packet recived by this Node * * @exception CommunicationException --- 164,168 ---- * * @param inPacket - ! * The original packet received by this Node * * @exception CommunicationException *************** *** 269,276 **** } ! public long getTimeICMPPacketReceived(int messageID) { ! if (receivedMessageID.containsKey(messageID)) ! return receivedMessageID.get(messageID); ! return 0; } --- 269,282 ---- } ! public ICMP_packet getReceivedICMPPacket(int messageID) { ! if (receivedPackets.containsKey(messageID)) ! return receivedPackets.get(messageID); ! return null; ! } ! ! public ICMP_packet removeReceivedICMPPacket(int messageID) { ! if (receivedPackets.containsKey(messageID)) ! return receivedPackets.remove(messageID); ! return null; } |
From: Alexander B. <da...@us...> - 2008-10-03 14:50:07
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31069/core/protocolsuite/tcp_ip Modified Files: ICMP.java Log Message: Index: ICMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ICMP.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ICMP.java 28 Sep 2008 17:11:47 -0000 1.6 --- ICMP.java 3 Oct 2008 14:49:55 -0000 1.7 *************** *** 1,54 **** /* ! 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. */ --- 1,29 ---- /* + Java Network Simulator (jNetSim) ! Copyright (c) 2005 - 2008, Alexander K. Bolshev [Key]; All rights reserved. ! 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 Ice Team 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. */ |
From: Alexander B. <da...@us...> - 2008-10-03 14:50:07
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv31069/core Modified Files: CommandProcessor.java DeviceConfig.java W80211_packet.java WiFiPort.java Log Message: Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** CommandProcessor.java 29 Sep 2008 19:14:15 -0000 1.16 --- CommandProcessor.java 3 Oct 2008 14:49:54 -0000 1.17 *************** *** 1371,1375 **** String role = params.get(1); if(role.equalsIgnoreCase("client")){ ! wi.setMode(wi.MODE_STANTION); if(wi.isActive()) wi.DOWN(); wi.UP(); --- 1371,1375 ---- String role = params.get(1); if(role.equalsIgnoreCase("client")){ ! wi.setMode(wi.MODE_STATION); if(wi.isActive()) wi.DOWN(); wi.UP(); Index: DeviceConfig.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/DeviceConfig.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** DeviceConfig.java 29 Sep 2008 19:14:15 -0000 1.13 --- DeviceConfig.java 3 Oct 2008 14:49:54 -0000 1.14 *************** *** 438,442 **** else if(wfi.getMode()==wfi.MODE_REPEATER) conf.add("interface "+intName+" station-role repeater"); ! else if(wfi.getMode()==wfi.MODE_STANTION) conf.add("interface "+intName+" station-role client"); conf.add("interface "+intName+" authentication "+(wfi.isSharedAuth()?"shared":"open")); --- 438,442 ---- else if(wfi.getMode()==wfi.MODE_REPEATER) conf.add("interface "+intName+" station-role repeater"); ! else if(wfi.getMode()==wfi.MODE_STATION) conf.add("interface "+intName+" station-role client"); conf.add("interface "+intName+" authentication "+(wfi.isSharedAuth()?"shared":"open")); Index: W80211_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/W80211_packet.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** W80211_packet.java 28 Sep 2008 14:04:15 -0000 1.1 --- W80211_packet.java 3 Oct 2008 14:49:54 -0000 1.2 *************** *** 3,13 **** public class W80211_packet extends Packet { private String srcBSSID; ! private String dstBSSID; ! ! public W80211_packet(Packet inPacket, String inDst, String inSrc) { dstBSSID = inDst; Data = inPacket; ! srcBSSID = inSrc; } --- 3,42 ---- public class W80211_packet extends Packet { private String srcBSSID; ! private String dstBSSID; ! ! public int Type; ! public int subType; ! public String SSID; ! ! public String WEP; ! public int keyNum; ! ! private static long pCnt = 0; ! ! private long pID; ! ! public Long getID(){ ! return Long.valueOf(pID); ! } ! ! public void Cypher(String inWEP, int inkeyNum){ ! WEP = inWEP; ! keyNum = inkeyNum; ! } ! ! public W80211_packet(Packet inPacket, String inDst, String inSrc, int inType, int inSubType, String inSSID) { dstBSSID = inDst; Data = inPacket; ! srcBSSID = inSrc; ! Type = inType; ! subType = inSubType; ! SSID = inSSID; ! WEP = ""; ! keyNum = 0; ! ! pID = pCnt; ! pCnt++; ! if(pCnt > 6500000) pCnt=0; } Index: WiFiPort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WiFiPort.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WiFiPort.java 29 Sep 2008 19:14:16 -0000 1.5 --- WiFiPort.java 3 Oct 2008 14:49:54 -0000 1.6 *************** *** 3,6 **** --- 3,7 ---- import core.protocolsuite.tcp_ip.ARP_packet; import core.protocolsuite.tcp_ip.IP_packet; + import java.util.Hashtable; public class WiFiPort extends EthernetNetworkInterface { *************** *** 8,12 **** protected int channel = 1; ! protected String BSSID; protected String SSID = "default"; --- 9,13 ---- protected int channel = 1; ! protected String BSSID; protected String SSID = "default"; *************** *** 15,19 **** public static final int MODE_AP = 0; ! public static final int MODE_STANTION = 1; public static final int MODE_REPEATER = 2; --- 16,20 ---- public static final int MODE_AP = 0; ! public static final int MODE_STATION = 1; public static final int MODE_REPEATER = 2; *************** *** 23,27 **** protected String WEP_keys[] = {"", "", "", ""}; ! public WiFiPort(long UID, String inName, Node inParent) { --- 24,76 ---- protected String WEP_keys[] = {"", "", "", ""}; ! ! protected static final int OFFLINE = 0; ! protected static final int PROBE = 1; ! protected static final int AUTH = 2; ! protected static final int ASSOC = 3; ! protected static final int DATA = 4; ! protected static final int DATA_ACK = 5; ! ! // resend block ! ! class ResendPacket{ ! public int cnt; ! public W80211_packet packet; ! public long nextTime; ! public long period; ! ! public ResendPacket(W80211_packet p, long period){ ! cnt = 5; ! this.period = period; ! packet = p; ! nextTime = System.currentTimeMillis() + period; ! } ! } ! ! Hashtable<Long, ResendPacket> ResendPackets = new Hashtable<Long, ResendPacket>(); ! ! // station block ! ! protected boolean associated; ! protected boolean failed; ! protected int state; ! protected String apBSSID; ! ! // AP block ! ! class APClient{ ! public String BSSID; ! public int state; ! ! public APClient(String BSSID){ ! this.BSSID = BSSID; ! state = PROBE; ! } ! } ! ! Hashtable<String, APClient> APClients = new Hashtable<String, APClient>(); ! ! ! // Contructor public WiFiPort(long UID, String inName, Node inParent) { *************** *** 30,37 **** --- 79,148 ---- BSSID = MACAddress; + + associated = false; + + state = OFFLINE; + failed = false; //channel = 0; } + + public void associate() throws LowLinkException{ + failed = false; + associated = false; + + Mode = PROBE; + + sendProbeReq(); + } + + void sendWirelessPacket(W80211_packet inWP, long resendTime) throws LowLinkException{ + ResendPacket p = new ResendPacket(inWP, resendTime); + + ResendPackets.put(p.packet.getID(), p); + + Simulation.Sim.sendWirelessPacket(this, inWP, channel); + } + + void sendWirelessPacket(W80211_packet inWP) throws LowLinkException{ + sendWirelessPacket(inWP, 100); + } + + void sendProbeReq() throws LowLinkException{ + W80211_packet tempWiFi = new W80211_packet(null, BSSID, "FF:FF:FF:FF:FF:FF", 0, 4, SSID); + + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", + "Link", "Sending probe req packet from interface "+ name); + + sendWirelessPacket(tempWiFi, 5000); + } + + void sendProbeReply(String inBSSID) throws LowLinkException{ + W80211_packet tempWiFi = new W80211_packet(null, BSSID, inBSSID, 0, 4, SSID); + + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", + "Link", "Sending probe reply packet from interface "+ name); + + sendWirelessPacket(tempWiFi); + } + + void sendAuthReq(String inBSSID) throws LowLinkException{ + W80211_packet tempWiFi = new W80211_packet(null, BSSID, inBSSID, 0, 4, SSID); + + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", + "Link", "Sending auth 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); + + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", + "Link", "Sending assoc req packet from interface "+ name); + + sendWirelessPacket(tempWiFi); + } public void Timer(int temp){ } *************** *** 114,121 **** super.UP(); ! if(!active) Mode = 0; Simulation.Sim.connectWireless(this); ! parentNode.startTimerTask(this, 500); } --- 225,247 ---- super.UP(); ! if(!active) Mode = MODE_AP; ! ! failed = false; ! apBSSID = ""; ! ! ResendPackets = new Hashtable<Long, ResendPacket>(); ! ! if(Mode != MODE_STATION){ ! APClients = new Hashtable<String, APClient>(); ! } Simulation.Sim.connectWireless(this); ! parentNode.startTimerTask(this, 500); ! ! if(Mode == MODE_STATION){ ! try{ ! associate(); ! }catch(Exception e){} ! } } *************** *** 132,135 **** --- 258,310 ---- } + protected void receiveDataPacket( W80211_packet tempWiFi) throws LowLinkException { + if((tempWiFi.getDstBSSID() != BSSID && tempWiFi.getDstBSSID()!="FF:FF:FF:FF:FF:FF") || tempWiFi.SSID!=SSID || tempWiFi.WEP != WEP_keys[tempWiFi.keyNum] ){ + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Recieved and discarded packet at interface " + name); + + return; + } + + if(tempWiFi.SSID!=SSID || tempWiFi.WEP != WEP_keys[tempWiFi.keyNum] ){ + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Recieved and discarded packet: Wrong 802.11 protocol params."); + + return; + } + + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Recieved and accepted packet at interface " + name); + + Ethernet_packet tempPacket = (Ethernet_packet) tempWiFi.getData(); + + if(MACAddress.equals(tempPacket.getDestinationMACAddress()) + || tempPacket.getDestinationMACAddress().equals("FF:FF:FF:FF:FF:FF") || !active){ + //Packet is For this Interface or is broadcast so send it to the Parent Node + + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", + "Link", "Recieved and accepted packet at interface " + MACAddress); + + boolean allowReceive = true; + + Packet temp = tempPacket; + + if(active){ + + temp = tempPacket.getData(); + + NetworkLayerDevice device = (NetworkLayerDevice) parentNode; + if(device!=null && getACLin()!=0 && temp instanceof IP_packet && !(temp instanceof ARP_packet)){ + allowReceive = device.getACL().passACL(getACLin(), temp); + } + } + + if(allowReceive) + parentNode.receivePacket(temp, name); + + }else{ + //Packet is not for the Interface Drop Packet and record something in + //the Layerinfo object + Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", + "Link", "Recieved and dropped packet at interface " + MACAddress); + } + } + protected void receivePacket(Packet inPacket) throws LowLinkException { if(!parentNode.On) return; *************** *** 138,176 **** W80211_packet tempWiFi = (W80211_packet) inPacket; ! //if() ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Recieved and accepted packet at interface " + name); ! ! Ethernet_packet tempPacket = (Ethernet_packet) tempWiFi.getData(); ! ! if(MACAddress.equals(tempPacket.getDestinationMACAddress()) ! || tempPacket.getDestinationMACAddress().equals("FF:FF:FF:FF:FF:FF") || !active){ ! //Packet is For this Interface or is broadcast so send it to the Parent Node ! ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", ! "Link", "Recieved and accepted packet at interface " + MACAddress); ! ! boolean allowReceive = true; ! ! Packet temp = tempPacket; ! ! if(active){ ! ! temp = tempPacket.getData(); ! ! NetworkLayerDevice device = (NetworkLayerDevice) parentNode; ! if(device!=null && getACLin()!=0 && temp instanceof IP_packet && !(temp instanceof ARP_packet)){ ! allowReceive = device.getACL().passACL(getACLin(), temp); ! } ! } ! ! if(allowReceive) ! parentNode.receivePacket(temp, name); ! ! }else{ ! //Packet is not for the Interface Drop Packet and record something in ! //the Layerinfo object ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", ! "Link", "Recieved and dropped packet at interface " + MACAddress); ! } return; --- 313,371 ---- W80211_packet tempWiFi = (W80211_packet) inPacket; ! if(tempWiFi.Type == 2 && tempWiFi.subType == 0){ ! receiveDataPacket(tempWiFi); ! ! }else{ ! ! if(Mode == MODE_STATION){ ! if(tempWiFi.getDstBSSID() != BSSID || tempWiFi.SSID != SSID){ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Recieved and discarded packet at interface " + name); ! ! return; ! } ! ! if(state == PROBE && tempWiFi.Type == 0 && tempWiFi.Type == 5){ ! ResendPackets.remove(tempWiFi.getID()); ! apBSSID = tempWiFi.getSrcBSSID(); ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", ! "Link", "Recieved probe reply from " + apBSSID + " on interface "+ name); ! state = ASSOC; ! sendAssocReq(apBSSID); ! }else if(state == ASSOC && tempWiFi.Type == 0 && tempWiFi.Type == 1){ ! ResendPackets.remove(tempWiFi.getID()); ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", ! "Link", "Recieved assoc reply from " + apBSSID + " on interface "+ name + ". Association successfull."); ! state = DATA; ! associated = true; ! } ! ! }else if(Mode == MODE_AP){ ! if((tempWiFi.getDstBSSID() != BSSID && tempWiFi.getDstBSSID()!="FF:FF:FF:FF:FF:FF") || tempWiFi.SSID != SSID){ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 packet", "Link", "Recieved and discarded packet at interface " + name); ! ! return; ! } ! ! if(tempWiFi.Type == 0 && tempWiFi.Type == 4){ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", ! "Link", "Recieved probe req from " + tempWiFi.getSrcBSSID() + " on interface "+ name); ! ! if(APClients.get(tempWiFi.getSrcBSSID()) != null){ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", ! "Link", "Connection state with " + tempWiFi.getSrcBSSID() + " cleared."); ! APClients.remove(tempWiFi.getSrcBSSID()); ! } ! ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", ! "Link", "Sending probe reply to " + tempWiFi.getSrcBSSID() + " on interface "+ name); ! ! APClients.put(tempWiFi.getSrcBSSID() , new APClient(tempWiFi.getSrcBSSID())); ! ! sendProbeReply(tempWiFi.getSrcBSSID()); ! } ! ! } ! ! } return; *************** *** 180,195 **** if(!parentNode.On) return; ! ! Ethernet_packet tempPacket = (Ethernet_packet)outPacket; ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", ! "Link", "Sending packet from interface "+ MACAddress); ! W80211_packet tempWiFi = new W80211_packet(tempPacket, BSSID, "FF:FF:FF:FF:FF:FF"); ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", "Link", "Sending packet from interface "+ name); ! Simulation.Sim.sendWirelessPacket(this, tempWiFi, channel); } --- 375,413 ---- if(!parentNode.On) return; ! ! if(Mode == MODE_AP){ ! ! ! }else if(Mode == MODE_STATION){ ! ! if(failed){ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", ! "Link", "Can't send over air: all AP connections failed"); ! return; ! } ! ! if(!associated && state == OFFLINE){ ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", ! "Link", "Can't send over air: no AP; AP searching process will be started immediately"); ! ! associate(); ! ! return; ! } ! ! // else put packet to buffer.... ! ! Ethernet_packet tempPacket = (Ethernet_packet)outPacket; ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", ! "Link", "Sending packet from interface "+ MACAddress); ! //W80211_packet tempWiFi = new W80211_packet(tempPacket, BSSID, "FF:FF:FF:FF:FF:FF"); ! Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Packet", "Link", "Sending packet from interface "+ name); ! //Simulation.Sim.sendWirelessPacket(this, tempWiFi, channel); ! } } |
From: QweR <qw...@us...> - 2008-09-29 19:14:51
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv19016/core Modified Files: CommandProcessor.java DeviceConfig.java EthernetNetworkInterface.java WiFiPort.java Log Message: WiFi's commands was added to console Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** CommandProcessor.java 25 Sep 2008 23:45:32 -0000 1.15 --- CommandProcessor.java 29 Sep 2008 19:14:15 -0000 1.16 *************** *** 28,31 **** --- 28,34 ---- import java.util.Iterator; import java.util.Vector; + import java.util.regex.Matcher; + import java.util.regex.Pattern; + import core.CommandInterface.Modes; import core.AccessListEngine.access_list; *************** *** 36,1831 **** [...6196 lines suppressed...] ! out = "Writing is complete\n"; ! } ! return out; ! } ! }; ! class write_terminal_CommandClass extends CommandInterface{ ! public write_terminal_CommandClass(){ ! modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NO_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; ! } ! public String call(Vector<String> params){ ! String out = ""; ! Iterator<String> cnf = device.getConfig().getConfig(DeviceConfig.RUNNING_CONFIG).iterator(); ! while(cnf.hasNext()){ ! out += cnf.next() + "\n"; ! } ! return out; ! } ! }; } Index: EthernetNetworkInterface.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/EthernetNetworkInterface.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** EthernetNetworkInterface.java 27 Sep 2008 08:38:22 -0000 1.14 --- EthernetNetworkInterface.java 29 Sep 2008 19:14:16 -0000 1.15 *************** *** 25,32 **** 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 core.protocolsuite.tcp_ip.ARP_packet; import core.protocolsuite.tcp_ip.IP_packet; --- 25,35 ---- 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.util.regex.Matcher; + import java.util.regex.Pattern; + import core.protocolsuite.tcp_ip.ARP_packet; import core.protocolsuite.tcp_ip.IP_packet; *************** *** 53,88 **** * @since 19 September 2004 * @version v0.20 ! */ public class EthernetNetworkInterface extends NetworkInterface{ ! /** ! * Stores The MAC address for each instance of this class ! * */ protected String MACAddress; public String defaultMACAddress; - - /** - * Constructs a NetworkInterface object with the name inName and a - * reference to it's parent Node. - * @author bevan_calliess - * @param inName - The name to give the NetworkInterface eg: eth0 - * @param parent - The Node that the NetworkInterface is to be added to, it's parent. - * @version v0.20 - */ - protected EthernetNetworkInterface(long UID, String inName, Node parent) { - super(UID, inName,parent); - if(parentNode instanceof Hub){ - //test for Hub - MACAddress = null; - //set MAC address to null, as hub dont have MAC address. - }else{ - MACAddress = setMacAddress(); - defaultMACAddress = MACAddress; - } - - } ! public void Timer(int temp){ } ! /** * This method receives a packet from a connected link and then pass it --- 56,91 ---- * @since 19 September 2004 * @version v0.20 ! */ public class EthernetNetworkInterface extends NetworkInterface{ ! /** ! * Stores The MAC address for each instance of this class ! * */ protected String MACAddress; public String defaultMACAddress; ! /** ! * Constructs a NetworkInterface object with the name inName and a ! * reference to it's parent Node. ! * @author bevan_calliess ! * @param inName - The name to give the NetworkInterface eg: eth0 ! * @param parent - The Node that the NetworkInterface is to be added to, it's parent. ! * @version v0.20 ! */ ! protected EthernetNetworkInterface(long UID, String inName, Node parent) { ! super(UID, inName,parent); ! if(parentNode instanceof Hub){ ! //test for Hub ! MACAddress = null; ! //set MAC address to null, as hub dont have MAC address. ! }else{ ! MACAddress = setMacAddress(); ! defaultMACAddress = MACAddress; ! } ! ! } ! ! public void Timer(int temp){ } ! /** * This method receives a packet from a connected link and then pass it *************** *** 98,110 **** // cast the packet to an EthernetPacket Ethernet_packet tempPacket = (Ethernet_packet)inPacket; ! if(!parentNode.On) 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 ! ! //Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); pingInfo.setObjectName(parentNode.getName()); --- 101,113 ---- // cast the packet to an EthernetPacket Ethernet_packet tempPacket = (Ethernet_packet)inPacket; ! if(!parentNode.On) 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 ! ! //Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); pingInfo.setObjectName(parentNode.getName()); *************** *** 113,131 **** pingInfo.setDescription("Recieved and accepted packet at interface " + MACAddress); Simulation.addLayerInfo(pingInfo); ! Packet temp = tempPacket.getData(); ! boolean allowReceive = true; ! ! NetworkLayerDevice device = (NetworkLayerDevice) parentNode; ! if(device!=null && getACLin()!=0 && temp instanceof IP_packet && !(temp instanceof ARP_packet)){ ! allowReceive = device.getACL().passACL(getACLin(), temp); ! } ! ! if(allowReceive) ! parentNode.receivePacket(temp, name); ! }else{ ! //Packet is not for the Interface Drop Packet and record something in ! //the Layerinfo object ! LayerInfo pingInfo = new LayerInfo(getClass().getName()); pingInfo.setObjectName(parentNode.getName()); pingInfo.setDataType("Ethernet Packet"); --- 116,134 ---- pingInfo.setDescription("Recieved and accepted packet at interface " + MACAddress); Simulation.addLayerInfo(pingInfo); ! Packet temp = tempPacket.getData(); ! boolean allowReceive = true; ! ! NetworkLayerDevice device = (NetworkLayerDevice) parentNode; ! if(device!=null && getACLin()!=0 && temp instanceof IP_packet && !(temp instanceof ARP_packet)){ ! allowReceive = device.getACL().passACL(getACLin(), temp); ! } ! ! if(allowReceive) ! parentNode.receivePacket(temp, name); ! }else{ ! //Packet is not for the Interface Drop Packet and record something in ! //the Layerinfo object ! LayerInfo pingInfo = new LayerInfo(getClass().getName()); pingInfo.setObjectName(parentNode.getName()); pingInfo.setDataType("Ethernet Packet"); *************** *** 133,143 **** pingInfo.setDescription("Recieved and dropped packet at interface " + MACAddress); Simulation.addLayerInfo(pingInfo); ! } } ! ! public int getType(){ ! return NetworkInterface.Ethernet10T; ! } ! /** * Typecasts the variables being passed in into a EthernetPacket packet and --- 136,146 ---- pingInfo.setDescription("Recieved and dropped packet at interface " + MACAddress); Simulation.addLayerInfo(pingInfo); ! } } ! ! public int getType(){ ! return NetworkInterface.Ethernet10T; ! } ! /** * Typecasts the variables being passed in into a EthernetPacket packet and *************** *** 151,160 **** */ protected void sendPacket(Packet inPacket, String inMacAddress) throws LowLinkException { ! Ethernet_packet Packet = new Ethernet_packet(inPacket,inMacAddress, MACAddress); ! //if(Packet.getHopCount()>255) throw new CommunicationException("Hub buffer overflow (packet loop flood?)."); ! EthernetLink temp = (EthernetLink)connectedLink; ! // Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); --- 154,163 ---- */ protected void sendPacket(Packet inPacket, String inMacAddress) throws LowLinkException { ! Ethernet_packet Packet = new Ethernet_packet(inPacket,inMacAddress, MACAddress); ! //if(Packet.getHopCount()>255) throw new CommunicationException("Hub buffer overflow (packet loop flood?)."); ! EthernetLink temp = (EthernetLink)connectedLink; ! // Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); *************** *** 164,198 **** pingInfo.setDescription("Sending packet from interface "+MACAddress ); Simulation.addLayerInfo(pingInfo); ! if(temp!=null){ ! try{ ! temp.transportPacket(Packet,getSourceName()); ! }catch(LowLinkException ex){ ! LayerInfo frameErrInfo = new LayerInfo(getClass().getName()); ! frameErrInfo.setObjectName(parentNode.getName()); ! frameErrInfo.setDataType("Ethernet Packet"); ! frameErrInfo.setLayer("Link"); ! frameErrInfo.setDescription(ex.toString()); ! Simulation.addLayerInfo(frameErrInfo); ! //throw new LowLinkException(ex.toString()); ! } } } ! /** ! * Returns the NetworkInterface's MAC Address. ! * @author bevan_calliess ! * @return MACAddress ! * @version v0.20 ! */ ! protected String getMACAddress() { ! return MACAddress; ! } ! ! public boolean isActive(){ ! return true; ! } ! ! /** * This method is called when instantiating a NetworkInterface object. * it Generates 6 random numbers and converts them to hexadecimal --- 167,201 ---- pingInfo.setDescription("Sending packet from interface "+MACAddress ); Simulation.addLayerInfo(pingInfo); ! if(temp!=null){ ! try{ ! temp.transportPacket(Packet,getSourceName()); ! }catch(LowLinkException ex){ ! LayerInfo frameErrInfo = new LayerInfo(getClass().getName()); ! frameErrInfo.setObjectName(parentNode.getName()); ! frameErrInfo.setDataType("Ethernet Packet"); ! frameErrInfo.setLayer("Link"); ! frameErrInfo.setDescription(ex.toString()); ! Simulation.addLayerInfo(frameErrInfo); ! //throw new LowLinkException(ex.toString()); ! } } } ! /** ! * Returns the NetworkInterface's MAC Address. ! * @author bevan_calliess ! * @return MACAddress ! * @version v0.20 ! */ ! protected String getMACAddress() { ! return MACAddress; ! } ! ! public boolean isActive(){ ! return true; ! } ! ! /** * This method is called when instantiating a NetworkInterface object. * it Generates 6 random numbers and converts them to hexadecimal *************** *** 204,242 **** * @version v0.20 */ ! protected final String setMacAddress(){ ! ! String macAddress = null; ! ! for(int i=0;i<6;i++){ ! double rndNum = 0; ! ! //This is to ensure a two digit code numbers less than 17 ! //appear as a single digit. ! while(rndNum<17){ ! rndNum = Math.random(); ! rndNum = (rndNum * 100)*2; ! } ! ! // if this is not the first segment add the : divider ! if(macAddress == null){ ! macAddress = Long.toHexString((int)rndNum); ! }else{ ! macAddress = macAddress + ":" + Long.toHexString((int)rndNum); ! } ! } ! return macAddress.toUpperCase(); ! } ! ! protected void setMacAddress(String macAddress){ ! if(macAddress==null){ ! this.MACAddress = defaultMACAddress; ! } ! else{ ! this.MACAddress = macAddress; ! } ! } ! ! ! /** * This method displays details about the current interface card --- 207,251 ---- * @version v0.20 */ ! protected final String setMacAddress(){ ! ! String macAddress = null; ! ! for(int i=0;i<6;i++){ ! double rndNum = 0; ! ! //This is to ensure a two digit code numbers less than 17 ! //appear as a single digit. ! while(rndNum<17){ ! rndNum = Math.random(); ! rndNum = (rndNum * 100)*2; ! } ! ! // if this is not the first segment add the : divider ! if(macAddress == null){ ! macAddress = Long.toHexString((int)rndNum); ! }else{ ! macAddress = macAddress + ":" + Long.toHexString((int)rndNum); ! } ! } ! return macAddress.toUpperCase(); ! } ! ! protected void setMacAddress(String macAddress){ ! if(macAddress==null){ ! this.MACAddress = defaultMACAddress; ! } ! else{ ! this.MACAddress = macAddress; ! } ! } ! ! public static boolean isMacAddress(String macAddress){ ! Pattern p = Pattern.compile("^[0-9A-Fa-f]{2}(:[0-9A-Fa-f]{2}){5}$"); ! Matcher m = p.matcher(macAddress); ! return m.matches(); ! } ! ! ! /** * This method displays details about the current interface card Index: DeviceConfig.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/DeviceConfig.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** DeviceConfig.java 24 Sep 2008 22:17:30 -0000 1.12 --- DeviceConfig.java 29 Sep 2008 19:14:15 -0000 1.13 *************** *** 31,546 **** */ public class DeviceConfig { - - public final static int RUNNING_CONFIG = 1; - public final static int STARTUP_CONFIG = 2; - private final static String EXEC = "#"; - - public int working_config = RUNNING_CONFIG; - - private NetworkLayerDevice device; [...1028 lines suppressed...] ! DHCPD dhcpd = (DHCPD)((ApplicationLayerDevice)device).getApp(PC.DHCP_SERVER_ID); ! if(dhcpd!=null){ ! Enumeration<String> pools = dhcpd.pools.keys(); ! while(pools.hasMoreElements()){ ! String poolname = pools.nextElement(); ! DHCPD.pool pool = (DHCPD.pool) dhcpd.pools.get(poolname); ! conf.add("ip dhcp pool "+poolname+" default-router "+pool.Gateway); ! conf.add("ip dhcp pool "+poolname+" network "+pool.IP+" "+pool.Genmask); ! conf.add("ip dhcp pool "+poolname+" hardware-address "+pool.MAC); ! } ! Vector<Pair> exclude = dhcpd.getExcludeAddresses(); ! for(int i=0; i<exclude.size(); i++){ ! Pair lha = exclude.get(i); ! conf.add("ip dhcp pool excluded-address "+lha.getFirst()+" "+lha.getSecond()); ! } ! } ! conf.add("ip tcp window-size "+device.NodeProtocolStack.TCP().getWindowSize()); ! } ! } } Index: WiFiPort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WiFiPort.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** WiFiPort.java 28 Sep 2008 14:04:15 -0000 1.4 --- WiFiPort.java 29 Sep 2008 19:14:16 -0000 1.5 *************** *** 14,18 **** protected boolean active = false; ! protected int Mode = 0; // 0 - AP, 1 - Station, 2 - Repeater protected boolean shared_auth = false; // true -- shared, false -- open --- 14,22 ---- protected boolean active = false; ! public static final int MODE_AP = 0; ! public static final int MODE_STANTION = 1; ! public static final int MODE_REPEATER = 2; ! ! protected int Mode = MODE_AP; // 0 - AP, 1 - Station, 2 - Repeater protected boolean shared_auth = false; // true -- shared, false -- open *************** *** 38,41 **** --- 42,49 ---- } + public void setChannel(int channel){ + this.channel = channel; + } + public long getID(){ return UID; *************** *** 46,55 **** } ! protected String getBSSID() { return BSSID; ! } ! protected void setMacAddress(String macAddress){ if(macAddress==null){ this.MACAddress = defaultMACAddress; --- 54,101 ---- } ! public String getBSSID() { return BSSID; ! } + public void setBSSID(String bssid) { + BSSID = bssid; + } + + public String getSSID() { + return SSID; + } ! public void setSSID(String ssid) { ! SSID = ssid; ! } ! ! public int getMode() { ! return Mode; ! } ! ! public void setMode(int mode) { ! Mode = mode; ! } ! ! public boolean isSharedAuth() { ! return shared_auth; ! } ! ! public void setSharedAuth(boolean shared_auth) { ! this.shared_auth = shared_auth; ! } ! ! public String getWEPKey(int keynum) { ! if(keynum>=1 && keynum<=4) ! return WEP_keys[keynum-1]; ! return ""; ! } ! ! public void setWEPKeys(int keynum, String wep_key) { ! if(keynum>=1 && keynum<=4) ! WEP_keys[keynum-1] = wep_key; ! } ! ! protected void setMacAddress(String macAddress){ if(macAddress==null){ this.MACAddress = defaultMACAddress; *************** *** 57,61 **** this.MACAddress = macAddress; } ! this.BSSID = this.MACAddress; } --- 103,108 ---- this.MACAddress = macAddress; } ! // if(BSSID==null || BSSID.equals("")) ! // this.BSSID = this.MACAddress; } *************** *** 81,84 **** --- 128,135 ---- } + public void refresh(){ + + } + protected void receivePacket(Packet inPacket) throws LowLinkException { if(!parentNode.On) return; |
From: Alexander B. <da...@us...> - 2008-09-28 17:12:00
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv11437/core Modified Files: Node.java WirelessAP.java Log Message: Index: WirelessAP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WirelessAP.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WirelessAP.java 27 Sep 2008 08:38:22 -0000 1.2 --- WirelessAP.java 28 Sep 2008 17:11:47 -0000 1.3 *************** *** 40,44 **** **/ ! public class WirelessAP extends DataLinkLayerDevice { /** --- 40,44 ---- **/ ! public class WirelessAP extends NetworkLayerDevice{ //DataLinkLayerDevice { /** *************** *** 57,61 **** public WirelessAP(String inName, boolean inOn) { ! super(inName, 1, inOn); //pass name and protocolstack layer IntCaches = new Hashtable(); --- 57,61 ---- public WirelessAP(String inName, boolean inOn) { ! super(inName, 3, inOn); //pass name and protocolstack layer IntCaches = new Hashtable(); *************** *** 138,142 **** */ ! protected void receivePacket(Packet inPacket,String inInterfaceName) throws LowLinkException{ if(sz!=1){ Ethernet_packet tempPacket = (Ethernet_packet)inPacket; --- 138,142 ---- */ ! public void receivePacket(Packet inPacket,String inInterfaceName) throws LowLinkException{ if(sz!=1){ Ethernet_packet tempPacket = (Ethernet_packet)inPacket; Index: Node.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Node.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** Node.java 27 Sep 2008 10:16:37 -0000 1.23 --- Node.java 28 Sep 2008 17:11:47 -0000 1.24 *************** *** 598,606 **** //"Not Applicable" ! if(((NetworkInterface)(NetworkInterfacetable.get(inInterfaceName))).getType() == NetworkInterface.Ethernet10T || ! ((NetworkInterface)(NetworkInterfacetable.get(inInterfaceName))).getType() == NetworkInterface.Wireless || ! ((NetworkInterface)(NetworkInterfacetable.get(inInterfaceName))).getType() == NetworkInterface.Ethernet100FX){ ! EthernetNetworkInterface temp =(EthernetNetworkInterface)NetworkInterfacetable.get(inInterfaceName); ! return temp.getMACAddress(); }else{ return "Not Applicable"; --- 598,604 ---- //"Not Applicable" ! if(NetworkInterfacetable.get(inInterfaceName) instanceof EthernetNetworkInterface){ ! EthernetNetworkInterface temp =(EthernetNetworkInterface)NetworkInterfacetable.get(inInterfaceName); ! return temp.getMACAddress(); }else{ return "Not Applicable"; |
From: Alexander B. <da...@us...> - 2008-09-28 17:11:57
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv11437/core/protocolsuite/tcp_ip Modified Files: ICMP.java ICMP_packet.java ProtocolStack.java Log Message: Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.67 retrieving revision 1.68 diff -C2 -d -r1.67 -r1.68 *** ProtocolStack.java 25 Sep 2008 21:43:46 -0000 1.67 --- ProtocolStack.java 28 Sep 2008 17:11:47 -0000 1.68 *************** *** 1,59 **** /* ! Java Firewall Simulator (jFirewallSim) ! ! ! ! Copyright (c) 2004, jFirewallSim development team All rights reserved. [...2582 lines suppressed...] ! iface = (String) (nics.get(i)); ! if (temp.isActiveInterface(iface)) { ! IP = getIPAddress((String) nics.get(i)); ! if (IP != null) { ! return IP; ! } ! } ! } catch (InvalidNetworkInterfaceNameException e) { ! e.printStackTrace(); ! } ! } ! return ""; ! } ! ! public void intUP(String iface) { ! ! } ! ! }// EOF Index: ICMP_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ICMP_packet.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ICMP_packet.java 25 Sep 2008 21:43:46 -0000 1.5 --- ICMP_packet.java 28 Sep 2008 17:11:47 -0000 1.6 *************** *** 68,72 **** public ICMP_packet(String inDestIPAddress) { ! super (inDestIPAddress); } /** --- 68,72 ---- public ICMP_packet(String inDestIPAddress) { ! super (inDestIPAddress); } /** Index: ICMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ICMP.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ICMP.java 25 Sep 2008 21:43:46 -0000 1.5 --- ICMP.java 28 Sep 2008 17:11:47 -0000 1.6 *************** *** 1,68 **** /* ! 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.protocolsuite.tcp_ip; - - import java.io.Serializable; import java.util.Hashtable; ! //import core.protocolsuite.tcp_ip.ICMP_packet; import core.CommunicationException; --- 1,62 ---- /* ! 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.protocolsuite.tcp_ip; import java.io.Serializable; import java.util.Hashtable; ! // import core.protocolsuite.tcp_ip.ICMP_packet; import core.CommunicationException; *************** *** 74,168 **** import core.Simulation; - - - - /** ! ! * @author angela_brown ! ! * @author bevan_calliess ! * @author luke_hamilton ! * @since Sep 17, 2004 ! * @version v0.00 ! */ ! ! public class ICMP implements Serializable{ ! ! private ProtocolStack mParentStack; ! ! private Hashtable<Integer, Long> receivedMessageID; // Message ID and received time of received packets. ! ! private int lastMessageID = 0; // last packet message id was sent ! ! /** ! * Assigns the ParentStack ! * @author bevan_calliess ! * @author luke_hamilton ! ! * @param inParentStack - Protocol Stack ! * @version v0.20 ! */ ! public ICMP(ProtocolStack inParentStack){ mParentStack = inParentStack; ! receivedMessageID = new Hashtable<Integer, Long>(); } - - /** ! * Receives the ICMP packet and checks the message ! ! * code attached to it. If 8, it is an echo request and ! * pass it of. If 0, print out a message to the layer info. ! * @author bevan_calliess ! * @author angela_brown ! * @author robert_hulford ! ! * @param inPacket - A PAcket ! * @version v0.20 ! */ public void receiveICMPPacket(ICMP_packet inPacket) throws LowLinkException { ! ! ! if(inPacket.getMessageCode() == 8 ){ echoRequest(inPacket); ! } ! if(inPacket.getMessageCode() == 0 ){ ! ! receivedMessageID.put(inPacket.getMessageID(), System.currentTimeMillis()); ! //Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); --- 68,151 ---- import core.Simulation; /** ! * ! * @author angela_brown ! * ! * @author bevan_calliess ! * * @author luke_hamilton ! * * @since Sep 17, 2004 ! * * @version v0.00 ! * */ + public class ICMP implements Serializable { + private ProtocolStack mParentStack; + private Hashtable<Integer, Long> receivedMessageID; // Message ID and + // received time of + // received packets. ! private int lastMessageID = 0; // last packet message id was sent /** ! * * Assigns the ParentStack ! * * @author bevan_calliess ! * * @author luke_hamilton ! * ! * @param inParentStack - ! * Protocol Stack ! * * @version v0.20 ! * */ ! public ICMP(ProtocolStack inParentStack) { mParentStack = inParentStack; ! receivedMessageID = new Hashtable<Integer, Long>(); } /** ! * * Receives the ICMP packet and checks the message ! * ! * code attached to it. If 8, it is an echo request and ! * * pass it of. If 0, print out a message to the layer info. ! * * @author bevan_calliess ! * * @author angela_brown ! * * @author robert_hulford ! * ! * @param inPacket - ! * A PAcket ! * * @version v0.20 ! * */ public void receiveICMPPacket(ICMP_packet inPacket) throws LowLinkException { ! if (inPacket.getMessageCode() == 8) { echoRequest(inPacket); ! }else if (inPacket.getMessageCode() == 0) { ! receivedMessageID.put(inPacket.getMessageID(), System ! .currentTimeMillis()); ! // Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); *************** *** 174,210 **** pingInfo.setLayer("Network"); ! pingInfo.setDescription("Echo reply packet received from "+ inPacket.getSourceIPAddress()); Simulation.addLayerInfo(pingInfo); } } - - /** ! * This method will send a reply to a ping request ! * @author angela_brown ! * @author bevan_calliess ! * @author robert_hulford ! * @author luke_hamilton ! ! * @param inPacket - The original packet recived by this Node ! ! * @exception CommunicationException ! * @version v0.20 ! */ ! ! private void echoRequest(ICMP_packet inPacket) throws LowLinkException{ ! String destIPAddress = inPacket.getSourceIPAddress(); ICMP_packet pingPacket = new ICMP_packet(destIPAddress); --- 157,203 ---- pingInfo.setLayer("Network"); ! pingInfo.setDescription("Echo reply packet received from " ! + inPacket.getSourceIPAddress()); Simulation.addLayerInfo(pingInfo); + }else if (inPacket.getMessageCode() == ICMP_packet.DESTINATION_UNREACHABLE){ + Simulation.addLayerInfo(getClass().getName(), + mParentStack.getParentNodeName(), "ICMP Dst Unreach", "Network", + "Recieved ICMP Destination Unreacheable from " + + inPacket.getSourceIPAddress()); + }else if (inPacket.getMessageCode() == ICMP_packet.TIME_EXCEEDED){ + Simulation.addLayerInfo(getClass().getName(), + mParentStack.getParentNodeName(), "ICMP Time Exceeded", "Network", + "Recieved ICMP Time Exceeded from " + + inPacket.getSourceIPAddress()); } } /** ! * * This method will send a reply to a ping request ! * * @author angela_brown ! * * @author bevan_calliess ! * * @author robert_hulford ! * * @author luke_hamilton ! * ! * @param inPacket - ! * The original packet recived by this Node ! * ! * @exception CommunicationException ! * * @version v0.20 + * + */ ! private void echoRequest(ICMP_packet inPacket) throws LowLinkException { ! String destIPAddress = inPacket.getSourceIPAddress(); ICMP_packet pingPacket = new ICMP_packet(destIPAddress); *************** *** 213,219 **** pingPacket.setMessageID(inPacket.getMessageID()); ! ! ! //Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); --- 206,210 ---- pingPacket.setMessageID(inPacket.getMessageID()); ! // Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); *************** *** 225,278 **** pingInfo.setLayer("Network"); ! pingInfo.setDescription("Created Echo Reply packet to "+destIPAddress); Simulation.addLayerInfo(pingInfo); ! ! ! try{ ! mParentStack.sendPacket(pingPacket); ! }catch(CommunicationException e){ ! //This exception is caught but not acted upon as the ! //Echo request on any PC would not notify the user if it failed ! //TODO Once the recording of a sim process is implemented this should record the error. } ! //catch(LowLinkException e){ ! //This exception is caught but not acted upon as the ! //Echo request on any PC would not notify the user if it failed ! //TODO Once the recording of a sim process is implemented this should record the error. ! //} } - - /** ! * This method will generate an ICMP echo request and send it ! * out via the Protocol stacks send method. ! * @author angela_brown ! * @author bevan_calliess ! * @author robert_hulford ! ! * @param inDestIPAddress - Destination IP Address ! * @return ICMP_packet - Ping Packet ! ! */ public ICMP_packet sendPing(String inDestIPAddress) { --- 216,269 ---- pingInfo.setLayer("Network"); ! pingInfo ! .setDescription("Created Echo Reply packet to " + destIPAddress); Simulation.addLayerInfo(pingInfo); ! try { ! mParentStack.sendPacket(pingPacket); ! } catch (CommunicationException e) { ! // This exception is caught but not acted upon as the ! // Echo request on any PC would not notify the user if it failed ! // TODO Once the recording of a sim process is implemented this ! // should record the error. } ! // catch(LowLinkException e){ ! // This exception is caught but not acted upon as the ! // Echo request on any PC would not notify the user if it failed ! // TODO Once the recording of a sim process is implemented this should ! // record the error. ! // } } /** ! * * This method will generate an ICMP echo request and send it ! * * out via the Protocol stacks send method. ! * * @author angela_brown ! * * @author bevan_calliess ! * * @author robert_hulford ! * ! * @param inDestIPAddress - ! * Destination IP Address ! * * @return ICMP_packet - Ping Packet ! * ! */ public ICMP_packet sendPing(String inDestIPAddress) { *************** *** 281,290 **** pingPacket.setMessageCode(ICMP_packet.ECHO_REQUEST); - - pingPacket.setMessageID(++lastMessageID); ! ! //Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); --- 272,279 ---- pingPacket.setMessageCode(ICMP_packet.ECHO_REQUEST); ! pingPacket.setMessageID(++lastMessageID); ! // Create Layer info LayerInfo pingInfo = new LayerInfo(getClass().getName()); *************** *** 296,316 **** pingInfo.setLayer("Network"); ! pingInfo.setDescription("Created Echo Request packet to " +inDestIPAddress ); ! ! Simulation.addLayerInfo(pingInfo); ! return pingPacket; } ! ! public long getTimeICMPPacketReceived(int messageID){ ! if(receivedMessageID.containsKey(messageID)) return receivedMessageID.get(messageID); return 0; } ! ! ! }//EOF --- 285,303 ---- pingInfo.setLayer("Network"); ! pingInfo.setDescription("Created Echo Request packet to " ! + inDestIPAddress); ! Simulation.addLayerInfo(pingInfo); return pingPacket; } ! ! public long getTimeICMPPacketReceived(int messageID) { ! if (receivedMessageID.containsKey(messageID)) ! return receivedMessageID.get(messageID); return 0; } ! }// EOF |
From: Alexander B. <da...@us...> - 2008-09-28 14:04:29
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv19931 Modified Files: WiFiPort.java Added Files: W80211_packet.java Log Message: --- NEW FILE: W80211_packet.java --- package core; public class W80211_packet extends Packet { private String srcBSSID; private String dstBSSID; public W80211_packet(Packet inPacket, String inDst, String inSrc) { dstBSSID = inDst; Data = inPacket; srcBSSID = inSrc; } public String getSrcBSSID(){ return srcBSSID; } public void setDstBSSID(String inDst){ dstBSSID = inDst; } public String getDstBSSID(){ return dstBSSID; } } Index: WiFiPort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WiFiPort.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WiFiPort.java 27 Sep 2008 10:16:37 -0000 1.3 --- WiFiPort.java 28 Sep 2008 14:04:15 -0000 1.4 *************** *** 18,22 **** protected boolean shared_auth = false; // true -- shared, false -- open ! protected String WEP_keys[] = {"", "", "", ""}; public WiFiPort(long UID, String inName, Node inParent) { --- 18,23 ---- protected boolean shared_auth = false; // true -- shared, false -- open ! protected String WEP_keys[] = {"", "", "", ""}; ! public WiFiPort(long UID, String inName, Node inParent) { |
From: Alexander B. <da...@us...> - 2008-09-27 10:16:44
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv29527/core Modified Files: Node.java WiFiPort.java Log Message: Index: Node.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Node.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** Node.java 27 Sep 2008 08:38:22 -0000 1.22 --- Node.java 27 Sep 2008 10:16:37 -0000 1.23 *************** *** 374,378 **** NetworkInterfacetable.put(interfaceName,new WiFiInterface(core.Simulation.UIDGen++,interfaceName,this)); }else{ ! NetworkInterfacetable.put(interfaceName,new WiFiAPPort(core.Simulation.UIDGen++,interfaceName,this)); } break; --- 374,378 ---- NetworkInterfacetable.put(interfaceName,new WiFiInterface(core.Simulation.UIDGen++,interfaceName,this)); }else{ ! NetworkInterfacetable.put(interfaceName,new WiFiPort(core.Simulation.UIDGen++,interfaceName,this)); } break; Index: WiFiPort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WiFiPort.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WiFiPort.java 27 Sep 2008 08:38:22 -0000 1.2 --- WiFiPort.java 27 Sep 2008 10:16:37 -0000 1.3 *************** *** 4,8 **** import core.protocolsuite.tcp_ip.IP_packet; ! public abstract class WiFiPort extends EthernetNetworkInterface { protected int channel = 1; --- 4,8 ---- import core.protocolsuite.tcp_ip.IP_packet; ! public class WiFiPort extends EthernetNetworkInterface { protected int channel = 1; *************** *** 11,18 **** protected String SSID = "default"; ! boolean active = false; ! protected int Mode = 0; // 0 - AP, 1 - Station public WiFiPort(long UID, String inName, Node inParent) { --- 11,22 ---- protected String SSID = "default"; + + protected boolean active = false; ! protected int Mode = 0; // 0 - AP, 1 - Station, 2 - Repeater ! protected boolean shared_auth = false; // true -- shared, false -- open ! ! protected String WEP_keys[] = {"", "", "", ""}; public WiFiPort(long UID, String inName, Node inParent) { *************** *** 22,26 **** BSSID = MACAddress; ! channel = 0; } --- 26,30 ---- BSSID = MACAddress; ! //channel = 0; } *************** *** 94,102 **** "Link", "Recieved and accepted packet at interface " + MACAddress); ! Packet temp = tempPacket.getData(); ! ! boolean allowReceive = true; ! ! if(active){ NetworkLayerDevice device = (NetworkLayerDevice) parentNode; if(device!=null && getACLin()!=0 && temp instanceof IP_packet && !(temp instanceof ARP_packet)){ --- 98,109 ---- "Link", "Recieved and accepted packet at interface " + MACAddress); ! boolean allowReceive = true; ! ! Packet temp = tempPacket; ! ! if(active){ ! ! temp = tempPacket.getData(); ! NetworkLayerDevice device = (NetworkLayerDevice) parentNode; if(device!=null && getACLin()!=0 && temp instanceof IP_packet && !(temp instanceof ARP_packet)){ *************** *** 140,144 **** Ethernet_packet tempPacket = new Ethernet_packet(inPacket,inMacAddress, MACAddress); ! sendPacket(inPacket); } --- 147,151 ---- Ethernet_packet tempPacket = new Ethernet_packet(inPacket,inMacAddress, MACAddress); ! sendPacket(tempPacket); } |
From: Alexander B. <da...@us...> - 2008-09-27 08:38:36
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv21465/protocolsuite/tcp_ip Modified Files: ARP.java Log Message: Index: ARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARP.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ARP.java 14 Oct 2007 22:14:52 -0000 1.9 --- ARP.java 27 Sep 2008 08:38:23 -0000 1.10 *************** *** 113,121 **** private String mLastIpRequest = "0.0.0.0"; ! public ARP(ProtocolStack inParentStack){ mParentStack = inParentStack; } --- 113,122 ---- private String mLastIpRequest = "0.0.0.0"; ! public int ARP_MAXTRY; public ARP(ProtocolStack inParentStack){ mParentStack = inParentStack; + ARP_MAXTRY = 1; } *************** *** 307,313 **** String output= null; ! int tryings = 5; ! IPV4Address ip; try{ --- 308,314 ---- String output= null; ! int tryings = ARP_MAXTRY; ! IPV4Address ip; try{ *************** *** 340,344 **** //then send ARP Packet to try and find out about IP Address ! while(output==null && tryings-->0){ mLastIpRequest = IPAddress; --- 341,345 ---- //then send ARP Packet to try and find out about IP Address ! while(output==null && tryings-->0){ mLastIpRequest = IPAddress; |
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv21116/core Modified Files: AccessListEngine.java CommandProcessor.java DeviceConfig.java NetworkLayerDevice.java Simulation.java Log Message: commands "write mem", "ip access-list" was corrected turnOff/turnOn function was fixed Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkLayerDevice.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NetworkLayerDevice.java 23 Oct 2007 20:14:48 -0000 1.13 --- NetworkLayerDevice.java 14 Sep 2008 20:51:29 -0000 1.14 *************** *** 75,78 **** --- 75,79 ---- public void turnOff(){ + acls.clear(); super.turnOff(); } Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** CommandProcessor.java 10 Sep 2008 21:35:37 -0000 1.10 --- CommandProcessor.java 14 Sep 2008 20:51:29 -0000 1.11 *************** *** 569,644 **** public String call(Vector<String> params){ String out = ""; ! if(device instanceof ApplicationLayerDevice){ ! if(params.size()==3){ ! try { ! int iacl = Integer.parseInt(params.get(1)); ! if(iacl>=1 && iacl<=2699){ ! if(params.get(2).equalsIgnoreCase("in")){ ! device.getNetworkInterface(params.get(0)).setACLin(iacl); ! // device.getConfig().remove("^interface "+params.get(0)+" ip access-group \\d+ in"); ! // device.getConfig().add("interface "+params.get(0)+" ip access-group "+params.get(1)+" in"); ! } ! else if(params.get(2).equalsIgnoreCase("out")){ ! device.getNetworkInterface(params.get(0)).setACLout(iacl); ! // device.getConfig().remove("^interface "+params.get(0)+" ip access-group \\d+ out"); ! // device.getConfig().add("interface "+params.get(0)+" ip access-group "+params.get(1)+" out"); ! } ! else{ ! out += "error: invalid ACL direction '"+params.get(2)+"'\n"; ! } } else{ ! out += "error: invalid ACL name '"+params.get(1)+"', ACL name must be number from 1 to 2699\n"; } ! } catch (NumberFormatException ex) { out += "error: invalid ACL name '"+params.get(1)+"', ACL name must be number from 1 to 2699\n"; - } catch (InvalidNetworkInterfaceNameException ex) { - out += "error: invalid inferface\n"; } ! } ! else{ ! out += "error: invalid parameters\n"; } } else{ ! out += "This instruction not supported by device\n"; ! } return out; } public String no_call(Vector<String> params){ String out = ""; ! if(device instanceof ApplicationLayerDevice){ ! if(params.size()==3){ ! try { ! int iacl = Integer.parseInt(params.get(1)); ! if(iacl>=1 && iacl<=2699){ ! if(params.get(2).equalsIgnoreCase("in")){ ! device.getNetworkInterface(params.get(0)).setACLin(0); ! // device.getConfig().remove("^interface "+params.get(0)+" ip access-group \\d+ in"); ! } ! else if(params.get(2).equalsIgnoreCase("out")){ ! device.getNetworkInterface(params.get(0)).setACLout(0); ! // device.getConfig().remove("^interface "+params.get(0)+" ip access-group \\d+ out"); ! } ! else{ ! out += "error: invalid ACL direction '"+params.get(2)+"'\n"; ! } } else{ ! out += "error: invalid ACL name '"+params.get(1)+"', ACL name must be number from 1 to 2699\n"; } ! } catch (NumberFormatException ex) { out += "error: invalid ACL name '"+params.get(1)+"', ACL name must be number from 1 to 2699\n"; - } catch (InvalidNetworkInterfaceNameException ex) { - out += "error: invalid inferface\n"; } ! } ! else{ ! out += "error: invalid parameters\n"; } } else{ ! out += "This instruction not supported by device\n"; ! } return out; } --- 569,628 ---- public String call(Vector<String> params){ String out = ""; ! if(params.size()==3){ ! try { ! int iacl = Integer.parseInt(params.get(1)); ! if(iacl>=1 && iacl<=2699){ ! if(params.get(2).equalsIgnoreCase("in")){ ! device.getNetworkInterface(params.get(0)).setACLin(iacl); ! } ! else if(params.get(2).equalsIgnoreCase("out")){ ! device.getNetworkInterface(params.get(0)).setACLout(iacl); } else{ ! out += "error: invalid ACL direction '"+params.get(2)+"'\n"; } ! } ! else{ out += "error: invalid ACL name '"+params.get(1)+"', ACL name must be number from 1 to 2699\n"; } ! } catch (NumberFormatException ex) { ! out += "error: invalid ACL name '"+params.get(1)+"', ACL name must be number from 1 to 2699\n"; ! } catch (InvalidNetworkInterfaceNameException ex) { ! out += "error: invalid inferface\n"; } } else{ ! out += "error: invalid parameters\n"; ! } return out; } public String no_call(Vector<String> params){ String out = ""; ! if(params.size()==3){ ! try { ! int iacl = Integer.parseInt(params.get(1)); ! if(iacl>=1 && iacl<=2699){ ! if(params.get(2).equalsIgnoreCase("in")){ ! device.getNetworkInterface(params.get(0)).setACLin(0); ! } ! else if(params.get(2).equalsIgnoreCase("out")){ ! device.getNetworkInterface(params.get(0)).setACLout(0); } else{ ! out += "error: invalid ACL direction '"+params.get(2)+"'\n"; } ! } ! else{ out += "error: invalid ACL name '"+params.get(1)+"', ACL name must be number from 1 to 2699\n"; } ! } catch (NumberFormatException ex) { ! out += "error: invalid ACL name '"+params.get(1)+"', ACL name must be number from 1 to 2699\n"; ! } catch (InvalidNetworkInterfaceNameException ex) { ! out += "error: invalid inferface\n"; } } else{ ! out += "error: invalid parameters\n"; ! } return out; } *************** *** 1048,1052 **** modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.NO_CALL); call_params = "<1-99> [<line>] (permit|deny) (any|host <ip>|<ip> <mask>) [log]"; ! no_call_params = "<1-99> [<line>] (permit|deny) (any|host <ip>|<ip> <mask>) [log]"; } public String call(Vector<String> params){ --- 1032,1036 ---- modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.NO_CALL); call_params = "<1-99> [<line>] (permit|deny) (any|host <ip>|<ip> <mask>) [log]"; ! no_call_params = "<1-99> (<line>|[<line>] (permit|deny) (any|host <ip>|<ip> <mask>) [log])"; } public String call(Vector<String> params){ *************** *** 1065,1127 **** try{ iline = Integer.parseInt(params.get(index)); ! index = 2; } catch(NumberFormatException e){ } ! String permit_deny = params.get(index); ! short action=-1; ! if(permit_deny.equalsIgnoreCase("permit")){ ! action = AccessListEngine.access_list.PERMIT; ! } ! else if(permit_deny.equalsIgnoreCase("deny")){ ! action = AccessListEngine.access_list.DENY; ! } ! ! if(action>-1){ ! index+=1; ! String ip; ! String mask; ! String hosts = params.get(index); ! if(hosts.equalsIgnoreCase("any")){ ! ip = "0.0.0.0"; ! mask = "0.0.0.0"; ! index+=1; ! } ! else if(hosts.equals("host")){ ! ip = params.get(index+1); ! mask = "255.255.255.255"; ! index+=2; ! } ! else{ ! ip = hosts; ! mask = params.get(index+1); ! index+=2; ! } ! ! boolean log = false; ! if(params.size()>index){ ! if(params.get(index).equalsIgnoreCase("log")) ! log = true; ! } ! //device.getConfig().add("ip access-list "+iacl+" "+permit_deny+" "+hosts); ! if(IPV4Address.validateDecIP(ip) && IPV4Address.validateDecSubnetMask(mask, ip)){ ! if(add){ ! device.getACL().addACL(iacl, iline, action, ip, mask, log); ! } ! else{ ! if(iline==-1){ ! device.getACL().removeACL(iacl, action, ip, mask); ! } ! else{ ! device.getACL().removeACL(iacl, iline); ! } ! } ! } ! else{ ! out += "error: invalid IP address or subnet mask\n"; ! } } else{ ! out += "error: invalid parameter: '"+permit_deny+"'\n"; ! } } else{ --- 1049,1116 ---- try{ iline = Integer.parseInt(params.get(index)); ! index++; } catch(NumberFormatException e){ } ! if(iline>0 && !add){ ! device.getACL().removeACL(iacl, iline); } else{ ! String permit_deny = params.get(index); ! short action=-1; ! if(permit_deny.equalsIgnoreCase("permit")){ ! action = AccessListEngine.access_list.PERMIT; ! } ! else if(permit_deny.equalsIgnoreCase("deny")){ ! action = AccessListEngine.access_list.DENY; ! } ! ! if(action>-1){ ! index+=1; ! String ip; ! String mask; ! String hosts = params.get(index); ! if(hosts.equalsIgnoreCase("any")){ ! ip = "0.0.0.0"; ! mask = "0.0.0.0"; ! index+=1; ! } ! else if(hosts.equals("host")){ ! ip = params.get(index+1); ! mask = "255.255.255.255"; ! index+=2; ! } ! else{ ! ip = hosts; ! mask = params.get(index+1); ! index+=2; ! } ! ! boolean log = false; ! if(params.size()>index){ ! if(params.get(index).equalsIgnoreCase("log")) ! log = true; ! } ! //device.getConfig().add("ip access-list "+iacl+" "+permit_deny+" "+hosts); ! if((IPV4Address.validateDecIP(ip) || ip.compareTo("0.0.0.0")==0) && IPV4Address.validateDecSubnetMask(mask, ip)){ ! if(add){ ! device.getACL().addACL(iacl, iline, action, ip, mask, log); ! } ! else{ ! if(iline==-1){ ! device.getACL().removeACL(iacl, action, ip, mask); ! } ! else{ ! device.getACL().removeACL(iacl, iline); ! } ! } ! } ! else{ ! out += "error: invalid IP address or subnet mask\n"; ! } ! } ! else{ ! out += "error: invalid parameter: '"+permit_deny+"'\n"; ! } ! } } else{ *************** *** 1143,1147 **** //call_params = "<100-2699> [<line>] (permit|deny) (ip|tcp|udp|icmp) (any|host <ip>|<ip> <mask>) (any|host <ip>|<ip> <mask>) [(eq|lt|gt|neq) <port>]"; call_params = "<100-2699> [<line>] (permit|deny) (ip|tcp|udp|icmp) (any|host <ip>|<ip> <mask>) (any|host <ip>|<ip> <mask>) [eq <port>] [log]"; ! no_call_params = "<100-2699> [<line>] (permit|deny) (ip|tcp|udp|icmp) (any|host <ip>|<ip> <mask>) (any|host <ip>|<ip> <mask>) [eq <port>] [log]"; } public String call(Vector<String> params){ --- 1132,1136 ---- //call_params = "<100-2699> [<line>] (permit|deny) (ip|tcp|udp|icmp) (any|host <ip>|<ip> <mask>) (any|host <ip>|<ip> <mask>) [(eq|lt|gt|neq) <port>]"; call_params = "<100-2699> [<line>] (permit|deny) (ip|tcp|udp|icmp) (any|host <ip>|<ip> <mask>) (any|host <ip>|<ip> <mask>) [eq <port>] [log]"; ! no_call_params = "<100-2699> (<line>|[<line>] (permit|deny) (ip|tcp|udp|icmp) (any|host <ip>|<ip> <mask>) (any|host <ip>|<ip> <mask>) [eq <port>] [log])"; } public String call(Vector<String> params){ *************** *** 1160,1294 **** try{ iline = Integer.parseInt(params.get(index)); ! index = 2; } catch(NumberFormatException e){ } ! String permit_deny = params.get(index); ! short action=-1; ! if(permit_deny.equalsIgnoreCase("permit")){ ! action = AccessListEngine.access_list.PERMIT; ! } ! else if(permit_deny.equalsIgnoreCase("deny")){ ! action = AccessListEngine.access_list.DENY; ! } ! ! if(action>-1){ ! int protocol = -1; ! index++; ! String sprotocol = params.get(index); ! if(sprotocol.equalsIgnoreCase("ip")){ ! protocol = AccessListEngine.access_list.IP; ! } ! else if(sprotocol.equalsIgnoreCase("tcp")){ ! protocol = AccessListEngine.access_list.TCP; ! } ! else if(sprotocol.equalsIgnoreCase("udp")){ ! protocol = AccessListEngine.access_list.UDP; ! } ! else if(sprotocol.equalsIgnoreCase("icmp")){ ! protocol = AccessListEngine.access_list.ICMP; ! } ! if(protocol>-1){ ! ! String ip1; ! String mask1; ! String ip2; ! String mask2; ! index++; ! String hosts = params.get(index); ! if(hosts.equalsIgnoreCase("any")){ ! ip1 = "0.0.0.0"; ! mask1 = "0.0.0.0"; ! index++; ! } ! else if(hosts.equals("host")){ ! ip1 = params.get(index+1); ! mask1 = "255.255.255.255"; ! index+=2; ! } ! else{ ! ip1 = hosts; ! mask1 = params.get(index+1); ! index+=2; ! } ! ! hosts = params.get(index); ! if(hosts.equalsIgnoreCase("any")){ ! ip2 = "0.0.0.0"; ! mask2 = "0.0.0.0"; ! index++; ! } ! else if(hosts.equals("host")){ ! ip2 = params.get(index+1); ! mask2 = "255.255.255.255"; ! index+=2; ! } ! else{ ! ip2 = hosts; ! mask2 = params.get(index+1); ! index+=2; ! } ! ! int port = 0; ! boolean log = false; ! if(params.size()>index){ ! if(params.get(index).equalsIgnoreCase("eq")){ ! try{ ! port = Integer.parseInt(params.get(index+1)); ! index += 2; ! } ! catch(NumberFormatException e){ ! out += "error: invalid parameter port = '"+params.get(index+1)+"'\n"; ! port = -1; ! } ! } ! else if(params.get(index).equalsIgnoreCase("log")){ ! log = true; ! index += 1; ! } ! else{ ! out += "error: invalid parameter: '"+params.get(index)+"'\n"; ! port = -1; ! } ! } ! ! if(!log && params.size()>index){ ! if(params.get(index).equalsIgnoreCase("log")) ! log = true; ! } ! ! //device.getConfig().add("ip access-list "+iacl+" "+permit_deny+" "+hosts); ! if(port >= 0){ ! if(IPV4Address.validateDecIP(ip1) && IPV4Address.validateDecSubnetMask(mask1, ip1) && ! IPV4Address.validateDecIP(ip2) && IPV4Address.validateDecSubnetMask(mask2, ip2)){ ! if(port==0 || (protocol == AccessListEngine.access_list.TCP || protocol == AccessListEngine.access_list.UDP)){ ! if(add){ ! device.getACL().addACL(iacl, iline, action, protocol, ip1, mask1, ip2, mask2, port, log); ! } ! else{ ! if(iline==-1){ ! device.getACL().removeACL(iacl, action, protocol, ip1, mask1, ip2, mask2, port); ! } ! else{ ! device.getACL().removeACL(iacl, iline); ! } ! } ! } ! else{ ! out += "error: invalid parameter 'eq "+port+"'\n"; ! port = -1; ! } ! } ! else{ ! out += "error: invalid IP address or subnet mask\n"; ! } ! } ! } ! else{ ! out += "error: invalid protocol: '"+sprotocol+"'\n"; ! } } else{ ! out += "error: invalid action: '"+permit_deny+"'\n"; ! } } else{ --- 1149,1288 ---- try{ iline = Integer.parseInt(params.get(index)); ! index++; } catch(NumberFormatException e){ } ! if(iline>0 && !add){ ! device.getACL().removeACL(iacl, iline); } else{ ! String permit_deny = params.get(index); ! short action=-1; ! if(permit_deny.equalsIgnoreCase("permit")){ ! action = AccessListEngine.access_list.PERMIT; ! } ! else if(permit_deny.equalsIgnoreCase("deny")){ ! action = AccessListEngine.access_list.DENY; ! } ! ! if(action>-1){ ! int protocol = -1; ! index++; ! String sprotocol = params.get(index); ! if(sprotocol.equalsIgnoreCase("ip")){ ! protocol = AccessListEngine.access_list.IP; ! } ! else if(sprotocol.equalsIgnoreCase("tcp")){ ! protocol = AccessListEngine.access_list.TCP; ! } ! else if(sprotocol.equalsIgnoreCase("udp")){ ! protocol = AccessListEngine.access_list.UDP; ! } ! else if(sprotocol.equalsIgnoreCase("icmp")){ ! protocol = AccessListEngine.access_list.ICMP; ! } ! if(protocol>-1){ ! ! String ip1; ! String mask1; ! String ip2; ! String mask2; ! index++; ! String hosts = params.get(index); ! if(hosts.equalsIgnoreCase("any")){ ! ip1 = "0.0.0.0"; ! mask1 = "0.0.0.0"; ! index++; ! } ! else if(hosts.equals("host")){ ! ip1 = params.get(index+1); ! mask1 = "255.255.255.255"; ! index+=2; ! } ! else{ ! ip1 = hosts; ! mask1 = params.get(index+1); ! index+=2; ! } ! ! hosts = params.get(index); ! if(hosts.equalsIgnoreCase("any")){ ! ip2 = "0.0.0.0"; ! mask2 = "0.0.0.0"; ! index++; ! } ! else if(hosts.equals("host")){ ! ip2 = params.get(index+1); ! mask2 = "255.255.255.255"; ! index+=2; ! } ! else{ ! ip2 = hosts; ! mask2 = params.get(index+1); ! index+=2; ! } ! ! int port = 0; ! boolean log = false; ! if(params.size()>index){ ! if(params.get(index).equalsIgnoreCase("eq")){ ! try{ ! port = Integer.parseInt(params.get(index+1)); ! index += 2; ! } ! catch(NumberFormatException e){ ! out += "error: invalid parameter port = '"+params.get(index+1)+"'\n"; ! port = -1; ! } ! } ! else if(params.get(index).equalsIgnoreCase("log")){ ! log = true; ! index += 1; ! } ! else{ ! out += "error: invalid parameter: '"+params.get(index)+"'\n"; ! port = -1; ! } ! } ! ! if(!log && params.size()>index){ ! if(params.get(index).equalsIgnoreCase("log")) ! log = true; ! } ! ! //device.getConfig().add("ip access-list "+iacl+" "+permit_deny+" "+hosts); ! if(port >= 0){ ! if((IPV4Address.validateDecIP(ip1) || ip1.compareTo("0.0.0.0")==0) && IPV4Address.validateDecSubnetMask(mask1, ip1) && ! (IPV4Address.validateDecIP(ip2) || ip2.compareTo("0.0.0.0")==0) && IPV4Address.validateDecSubnetMask(mask2, ip2)){ ! if(port==0 || (protocol == AccessListEngine.access_list.TCP || protocol == AccessListEngine.access_list.UDP)){ ! if(add){ ! device.getACL().addACL(iacl, iline, action, protocol, ip1, mask1, ip2, mask2, port, log); ! } ! else{ ! if(iline==-1){ ! device.getACL().removeACL(iacl, action, protocol, ip1, mask1, ip2, mask2, port); ! } ! else{ ! device.getACL().removeACL(iacl, iline); ! } ! } ! } ! else{ ! out += "error: invalid parameter 'eq "+port+"'\n"; ! port = -1; ! } ! } ! else{ ! out += "error: invalid IP address or subnet mask\n"; ! } ! } ! } ! else{ ! out += "error: invalid protocol: '"+sprotocol+"'\n"; ! } ! } ! else{ ! out += "error: invalid action: '"+permit_deny+"'\n"; ! } ! } } else{ Index: DeviceConfig.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/DeviceConfig.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DeviceConfig.java 20 Nov 2007 19:53:03 -0000 1.10 --- DeviceConfig.java 14 Sep 2008 20:51:29 -0000 1.11 *************** *** 69,74 **** //running_config.add(nextcmd); } ! clearStartupConfig(); ! writeMemory(); } --- 69,74 ---- //running_config.add(nextcmd); } ! // clearStartupConfig(); ! // writeMemory(); } *************** *** 120,124 **** boolean result = false; if(startup_config.isEmpty()){ ! Iterator<String> it = prepareConfig(running_config, false).iterator(); while(it.hasNext()){ startup_config.add(it.next()); --- 120,124 ---- boolean result = false; if(startup_config.isEmpty()){ ! Iterator<String> it = prepareConfig(running_config, true).iterator(); while(it.hasNext()){ startup_config.add(it.next()); *************** *** 451,455 **** for(int i=0;i<ArpTable.size();i++) { ! conf.add("arp "+ArpTable.get(i).get(0)+" "+ArpTable.get(i).get(1)); } } --- 451,456 ---- for(int i=0;i<ArpTable.size();i++) { ! if(ArpTable.get(i).get(2).compareTo("Static")==0) ! conf.add("arp "+ArpTable.get(i).get(0)+" "+ArpTable.get(i).get(1)); } } Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** Simulation.java 9 Sep 2008 09:16:10 -0000 1.27 --- Simulation.java 14 Sep 2008 20:51:29 -0000 1.28 *************** *** 348,354 **** NetworkLayerDevice nld = (NetworkLayerDevice)temp; //nld.setCustomSubnetMask(inInterface, inCustomSubnetMask); ! nld.getConfig().executeCommand("interface "+inInterface+" ip address "+nld.getIPAddress(inInterface)+" "+inCustomSubnetMask); ! // nld.getConfig().remove("interface "+inInterface+" ip address ", DeviceConfig.STARTUP_CONFIG); ! // nld.getConfig().add("interface "+inInterface+" ip address "+nld.getIPAddress(inInterface)+" "+inCustomSubnetMask, DeviceConfig.STARTUP_CONFIG); } else --- 348,353 ---- NetworkLayerDevice nld = (NetworkLayerDevice)temp; //nld.setCustomSubnetMask(inInterface, inCustomSubnetMask); ! nld.getConfig().executeCommand("interface "+inInterface+" ip address "+nld.getIPAddress(inInterface)+" "+inCustomSubnetMask); ! nld.getConfig().executeCommand("write mem"); } else *************** *** 387,394 **** NetworkLayerDevice t = (NetworkLayerDevice)temp; //t.setDefaultGateway(inGatewayIPAddress); ! t.getConfig().executeCommand("ip route 0.0.0.0 0.0.0.0 "+inGatewayIPAddress+" eth0"); ! // t.getConfig().remove("^ip route 0.0.0.0 0.0.0.0 ", DeviceConfig.STARTUP_CONFIG); ! // t.getConfig().add("ip route 0.0.0.0 0.0.0.0 "+inGatewayIPAddress+" eth0", DeviceConfig.STARTUP_CONFIG); ! //t.getConfig().executeCommand("ip route default 0.0.0.0 "+inGatewayIPAddress+" eth0"); } else --- 386,391 ---- NetworkLayerDevice t = (NetworkLayerDevice)temp; //t.setDefaultGateway(inGatewayIPAddress); ! t.getConfig().executeCommand("ip route 0.0.0.0 0.0.0.0 "+inGatewayIPAddress+" eth0"); ! t.getConfig().executeCommand("write mem"); } else *************** *** 469,477 **** if (temp instanceof NetworkLayerDevice){ //test if device is a network layer device NetworkLayerDevice t = (NetworkLayerDevice)temp; ! //t.setIPAddress(inNodeInterface,inIPAddress); ! t.getConfig().executeCommand("interface "+inNodeInterface+" ip address "+inIPAddress+" "+t.getSubnetMask(inNodeInterface)); ! // t.getConfig().remove("^interface "+inNodeInterface+" ip address ", DeviceConfig.STARTUP_CONFIG); ! // t.getConfig().add("interface "+inNodeInterface+" ip address "+inIPAddress+" "+t.getSubnetMask(inNodeInterface), DeviceConfig.STARTUP_CONFIG); ! macAddress = t.getMACAddress(inNodeInterface); updateARP(inIPAddress, macAddress, inNodeName); //t.addToARP(inIPAddress, macAddress); --- 466,473 ---- if (temp instanceof NetworkLayerDevice){ //test if device is a network layer device NetworkLayerDevice t = (NetworkLayerDevice)temp; ! //t.setIPAddress(inNodeInterface,inIPAddress); ! t.getConfig().executeCommand("interface "+inNodeInterface+" ip address "+inIPAddress+" "+t.getSubnetMask(inNodeInterface)); ! t.getConfig().executeCommand("write mem"); ! macAddress = t.getMACAddress(inNodeInterface); updateARP(inIPAddress, macAddress, inNodeName); //t.addToARP(inIPAddress, macAddress); *************** *** 556,562 **** NetworkLayerDevice tempNet = (NetworkLayerDevice)temp; //tempNet.addToARPStatic(inIPAddress, inMACAddress); ! tempNet.getConfig().executeCommand("arp "+inIPAddress+" "+inMACAddress); ! // tempNet.getConfig().remove("^arp "+inIPAddress+" ", DeviceConfig.STARTUP_CONFIG); ! // tempNet.getConfig().add("arp "+inIPAddress+" "+inMACAddress, DeviceConfig.STARTUP_CONFIG); } --- 552,557 ---- NetworkLayerDevice tempNet = (NetworkLayerDevice)temp; //tempNet.addToARPStatic(inIPAddress, inMACAddress); ! tempNet.getConfig().executeCommand("arp "+inIPAddress+" "+inMACAddress); ! tempNet.getConfig().executeCommand("write mem"); } *************** *** 578,583 **** NetworkLayerDevice tempNet = (NetworkLayerDevice)temp; //tempNet.removeARP(inIPAddress); ! tempNet.getConfig().executeCommand("no arp "+inIPAddress); ! // tempNet.getConfig().add("no arp "+inIPAddress, DeviceConfig.STARTUP_CONFIG); } --- 573,578 ---- NetworkLayerDevice tempNet = (NetworkLayerDevice)temp; //tempNet.removeARP(inIPAddress); ! tempNet.getConfig().executeCommand("no arp "+inIPAddress); ! tempNet.getConfig().executeCommand("write mem"); } Index: AccessListEngine.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/AccessListEngine.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AccessListEngine.java 17 Nov 2007 21:38:57 -0000 1.3 --- AccessListEngine.java 14 Sep 2008 20:51:29 -0000 1.4 *************** *** 3,6 **** --- 3,8 ---- import java.util.Enumeration; import java.util.Hashtable; + + import core.protocolsuite.tcp_ip.ICMP_packet; import core.protocolsuite.tcp_ip.IPV4Address; import core.protocolsuite.tcp_ip.IP_packet; *************** *** 194,197 **** --- 196,202 ---- port2 = ((UDP_packet)ippacket).get_destPort(); } + else if(ippacket instanceof ICMP_packet){ + protocol = AccessListEngine.access_list.ICMP; + } String binIP1 = IPV4Address.toBinaryString(IP1); String binNetwork1 = ""; *************** *** 250,253 **** --- 255,263 ---- } + public void clear(){ + ACLs.clear(); + + } + protected void printLayerInfo(String s) { LayerInfo protInfo = new LayerInfo(getClass().getName()); |
From: QweR <qw...@us...> - 2008-09-14 20:51:36
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv21116/guiUI Modified Files: EthPortProperties.java SerPortProperties.java Log Message: commands "write mem", "ip access-list" was corrected turnOff/turnOn function was fixed Index: EthPortProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/EthPortProperties.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EthPortProperties.java 17 Nov 2007 21:38:58 -0000 1.4 --- EthPortProperties.java 14 Sep 2008 20:51:29 -0000 1.5 *************** *** 304,320 **** String SC = txtMAC.getText(); if(SC.matches("[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]")){ ! NetworkLayerDevice temp = (NetworkLayerDevice)Sim.getNode(NodeName); ! temp.getConfig().executeCommand("int " + NodeInt + " mac-address " + SC); if(chkUP.isSelected()){ ! temp.getConfig().executeCommand("int " + NodeInt + " shutdown"); ! temp.getConfig().executeCommand("no int " + NodeInt + " shutdown"); ! // temp.getConfig().remove("int " + NodeInt + " shutdown"); ! // temp.getConfig().add("no int " + NodeInt + " shutdown"); }else{ ! temp.getConfig().executeCommand("int " + NodeInt + " shutdown"); ! // temp.getConfig().remove("int " + NodeInt + " shutdown"); ! // temp.getConfig().add("no int " + NodeInt + " shutdown"); } this.dispose(); --- 304,317 ---- String SC = txtMAC.getText(); if(SC.matches("[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]:[0-9A-F][0-9A-F]")){ ! NetworkLayerDevice tmpNode = (NetworkLayerDevice)Sim.getNode(NodeName); ! tmpNode.getConfig().executeCommand("int " + NodeInt + " mac-address " + SC); if(chkUP.isSelected()){ ! tmpNode.getConfig().executeCommand("int " + NodeInt + " shutdown"); ! tmpNode.getConfig().executeCommand("no int " + NodeInt + " shutdown"); }else{ ! tmpNode.getConfig().executeCommand("int " + NodeInt + " shutdown"); } + tmpNode.getConfig().executeCommand("write mem"); this.dispose(); Index: SerPortProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SerPortProperties.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SerPortProperties.java 17 Nov 2007 21:38:58 -0000 1.3 --- SerPortProperties.java 14 Sep 2008 20:51:29 -0000 1.4 *************** *** 305,321 **** if(CR.matches("[0-9]+")){ if(Sim.getNode(NodeName) instanceof NetworkLayerDevice){ ! NetworkLayerDevice temp = (NetworkLayerDevice)Sim.getNode(NodeName); ! temp.getConfig().executeCommand("int " + NodeInt + " clock-rate " + CR); if(chkUP.isSelected()){ ! temp.getConfig().executeCommand("int " + NodeInt + " shutdown"); ! temp.getConfig().executeCommand("no int " + NodeInt + " shutdown"); ! // temp.getConfig().remove("int " + NodeInt + " shutdown"); ! // temp.getConfig().add("no int " + NodeInt + " shutdown"); }else{ ! temp.getConfig().executeCommand("int " + NodeInt + " shutdown"); ! // temp.getConfig().remove("int " + NodeInt + " shutdown"); ! // temp.getConfig().add("no int " + NodeInt + " shutdown"); } }else{ ((core.SerialNetworkInterface)Sim.getNode(NodeName).getNIC(NodeInt)).setClockRate(Integer.valueOf(CR)); --- 305,318 ---- if(CR.matches("[0-9]+")){ if(Sim.getNode(NodeName) instanceof NetworkLayerDevice){ ! NetworkLayerDevice tmpNode = (NetworkLayerDevice)Sim.getNode(NodeName); ! tmpNode.getConfig().executeCommand("int " + NodeInt + " clock-rate " + CR); if(chkUP.isSelected()){ ! tmpNode.getConfig().executeCommand("int " + NodeInt + " shutdown"); ! tmpNode.getConfig().executeCommand("no int " + NodeInt + " shutdown"); }else{ ! tmpNode.getConfig().executeCommand("int " + NodeInt + " shutdown"); } + tmpNode.getConfig().executeCommand("write mem"); }else{ ((core.SerialNetworkInterface)Sim.getNode(NodeName).getNIC(NodeInt)).setClockRate(Integer.valueOf(CR)); |
From: QweR <qw...@us...> - 2008-09-10 21:35:53
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv24306/core Modified Files: CommandProcessor.java CommandsTree.java Log Message: "ip route " command was fixed Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CommandProcessor.java 17 Nov 2007 21:38:57 -0000 1.9 --- CommandProcessor.java 10 Sep 2008 21:35:37 -0000 1.10 *************** *** 2,6 **** * CommandProcessor.java * ! * Created on 11 Îêòÿáðü 2007 ã., 20:42 * * To change this template, choose Tools | Template Manager --- 2,6 ---- * CommandProcessor.java * ! * Created on 11 ������� 2007 �., 20:42 * * To change this template, choose Tools | Template Manager *************** *** 21,24 **** --- 21,26 ---- import core.protocolsuite.tcp_ip.UDP_session; import core.protocolsuite.tcp_ip.jnSocket; + + import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; *************** *** 1102,1116 **** } //device.getConfig().add("ip access-list "+iacl+" "+permit_deny+" "+hosts); ! if(add){ ! device.getACL().addACL(iacl, iline, action, ip, mask, log); ! } ! else{ ! if(iline==-1){ ! device.getACL().removeACL(iacl, action, ip, mask); } else{ ! device.getACL().removeACL(iacl, iline); } } } else{ --- 1104,1123 ---- } //device.getConfig().add("ip access-list "+iacl+" "+permit_deny+" "+hosts); ! if(IPV4Address.validateDecIP(ip) && IPV4Address.validateDecSubnetMask(mask, ip)){ ! if(add){ ! device.getACL().addACL(iacl, iline, action, ip, mask, log); } else{ ! if(iline==-1){ ! device.getACL().removeACL(iacl, action, ip, mask); ! } ! else{ ! device.getACL().removeACL(iacl, iline); ! } } } + else{ + out += "error: invalid IP address or subnet mask\n"; + } } else{ *************** *** 1251,1271 **** //device.getConfig().add("ip access-list "+iacl+" "+permit_deny+" "+hosts); ! if(port >= 0){ ! if(port==0 || (protocol == AccessListEngine.access_list.TCP || protocol == AccessListEngine.access_list.UDP)){ ! if(add){ ! device.getACL().addACL(iacl, iline, action, protocol, ip1, mask1, ip2, mask2, port, log); ! } ! else{ ! if(iline==-1){ ! device.getACL().removeACL(iacl, action, protocol, ip1, mask1, ip2, mask2, port); } else{ ! device.getACL().removeACL(iacl, iline); } } } else{ ! out += "error: invalid parameter 'eq "+port+"'\n"; ! port = -1; } } --- 1258,1284 ---- //device.getConfig().add("ip access-list "+iacl+" "+permit_deny+" "+hosts); ! if(port >= 0){ ! if(IPV4Address.validateDecIP(ip1) && IPV4Address.validateDecSubnetMask(mask1, ip1) && ! IPV4Address.validateDecIP(ip2) && IPV4Address.validateDecSubnetMask(mask2, ip2)){ ! if(port==0 || (protocol == AccessListEngine.access_list.TCP || protocol == AccessListEngine.access_list.UDP)){ ! if(add){ ! device.getACL().addACL(iacl, iline, action, protocol, ip1, mask1, ip2, mask2, port, log); } else{ ! if(iline==-1){ ! device.getACL().removeACL(iacl, action, protocol, ip1, mask1, ip2, mask2, port); ! } ! else{ ! device.getACL().removeACL(iacl, iline); ! } } } + else{ + out += "error: invalid parameter 'eq "+port+"'\n"; + port = -1; + } } else{ ! out += "error: invalid IP address or subnet mask\n"; } } *************** *** 1585,1606 **** public ip_nat_inside_destination_list_CommandClass(){ modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.NO_CALL); ! call_params = "<1-2699 | WORD> pool <pool> [overload]"; ! no_call_params = "<1-2699 | WORD> pool <pool>"; } public String call(Vector<String> params){ ! String out = ""; ! if(params.size()>=3){ ! device.getConfig().remove("^"); ! device.getConfig().add(""); ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! return out; } public String no_call(Vector<String> params){ String out = ""; ! if(params.size()>=3){ ! device.getConfig().remove("^"); } else{ --- 1598,1640 ---- public ip_nat_inside_destination_list_CommandClass(){ modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.NO_CALL); ! call_params = "<1-2699> pool <pool> [overload]"; ! no_call_params = "<1-2699> pool <pool>"; } public String call(Vector<String> params){ ! return parse(params, true); } public String no_call(Vector<String> params){ + return parse(params, false); + } + private String parse(Vector<String> params, boolean add){ String out = ""; ! if(params.size()==3 || params.size()==4){ ! try{ ! int iacl = Integer.parseInt(params.get(0)); ! if(iacl>=1 && iacl<=2699){ ! if(params.get(1).equalsIgnoreCase("pool")){ ! String poolname = params.get(2); ! boolean overload = false; ! if(params.size()==4){ ! overload = params.get(3).equalsIgnoreCase("overload"); ! } ! if(add){ ! //nat.inside.dest.list.add(iacl,poolname,overload); ! } ! else{ ! //nat.inside.dest.list.remove(iacl,poolname); ! } ! } ! else{ ! out += "error: invalid parameter '"+params.get(1)+"'\n"; ! } ! } ! else{ ! out += "error: invalid ACL name '"+params.get(0)+"', ACL name must be number from 1 to 2699\n"; ! } ! } ! catch(NumberFormatException e){ ! out += "error: invalid ACL name '"+params.get(0)+"', ACL name must be number from 1 to 2699\n"; ! } } else{ *************** *** 1613,1634 **** public ip_nat_inside_source_list_CommandClass(){ modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.NO_CALL); ! call_params = "<1-2699 | WORD> (pool <pool>|interface <interface>) overload"; ! no_call_params = "<1-2699 | WORD> (pool <pool>|interface <interface>)"; } public String call(Vector<String> params){ ! String out = ""; ! if(params.size()>=3){ ! device.getConfig().remove("^"); ! device.getConfig().add(""); ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! return out; } public String no_call(Vector<String> params){ String out = ""; ! if(params.size()>=3){ ! device.getConfig().remove("^"); } else{ --- 1647,1689 ---- public ip_nat_inside_source_list_CommandClass(){ modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.NO_CALL); ! call_params = "<1-2699> (pool <pool>|interface <interface>) overload"; ! no_call_params = "<1-2699> (pool <pool>|interface <interface>)"; } public String call(Vector<String> params){ ! return parse(params, true); } public String no_call(Vector<String> params){ + return parse(params, false); + } + private String parse(Vector<String> params, boolean add){ String out = ""; ! if(params.size()==3 || params.size()==4){ ! try{ ! int iacl = Integer.parseInt(params.get(0)); ! if(iacl>=1 && iacl<=2699){ ! if(params.get(1).equalsIgnoreCase("pool")){ ! String poolname = params.get(2); ! boolean overload = false; ! if(params.size()==4){ ! overload = params.get(3).equalsIgnoreCase("overload"); ! } ! if(add){ ! //nat.inside.src.list.add(iacl,poolname,overload); ! } ! else{ ! //nat.inside.src.list.remove(iacl,poolname); ! } ! } ! else{ ! out += "error: invalid parameter '"+params.get(1)+"'\n"; ! } ! } ! else{ ! out += "error: invalid ACL name '"+params.get(0)+"', ACL name must be number from 1 to 2699\n"; ! } ! } ! catch(NumberFormatException e){ ! out += "error: invalid ACL name '"+params.get(0)+"', ACL name must be number from 1 to 2699\n"; ! } } else{ *************** *** 1645,1662 **** } public String call(Vector<String> params){ ! String out = ""; ! if(params.size()>=3){ ! device.getConfig().remove("^"); ! device.getConfig().add(""); ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! return out; } public String no_call(Vector<String> params){ String out = ""; ! if(params.size()>=3){ ! device.getConfig().remove("^"); } else{ --- 1700,1756 ---- } public String call(Vector<String> params){ ! return parse(params, true); } public String no_call(Vector<String> params){ + return parse(params, false); + } + private String parse(Vector<String> params, boolean add){ + int IP_protocol = 0; + int TCP_protocol = 1; + int UDP_protocol = 2; + String out = ""; ! if(params.size()==3 || params.size()==5){ ! try{ ! String sprotocol = params.get(0); ! int protocol = -1; ! int local_port = 0; ! int global_port = 0; ! String local_ip = ""; ! String global_ip = ""; ! if(sprotocol.equalsIgnoreCase("ip")){ ! protocol = IP_protocol; ! } ! else if(sprotocol.equalsIgnoreCase("tcp")){ ! protocol = TCP_protocol; ! } ! else if(sprotocol.equalsIgnoreCase("udp")){ ! protocol = UDP_protocol; ! } ! if(params.size()==3){ ! local_ip = params.get(1); ! global_ip = params.get(2); ! } ! else if(params.size()==5 && (protocol==TCP_protocol || protocol==UDP_protocol)){ ! local_ip = params.get(1); ! local_port = Integer.parseInt(params.get(2)); ! global_ip = params.get(3); ! global_port = Integer.parseInt(params.get(4)); ! if(local_port<=0 || global_port<=0 || local_port>65535 || global_port>65535){ ! throw new NumberFormatException(); ! } ! } ! if(IPV4Address.validateDecIP(local_ip) && IPV4Address.validateDecIP(global_ip)){ ! if(add){ ! //nat.inside.src.static.add(protocol, local_ip, local_port, global_ip, global_port); ! } ! else{ ! //nat.inside.src.static.remove(protocol, local_ip, local_port, global_ip, global_port); ! } ! } ! } ! catch(NumberFormatException e){ ! out += "error: invalid port number\n"; ! } } else{ *************** *** 1673,1690 **** } public String call(Vector<String> params){ ! String out = ""; ! if(params.size()>=3){ ! device.getConfig().remove("^"); ! device.getConfig().add(""); ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! return out; } public String no_call(Vector<String> params){ String out = ""; ! if(params.size()>=3){ ! device.getConfig().remove("^"); } else{ --- 1767,1789 ---- } public String call(Vector<String> params){ ! return parse(params, true); } public String no_call(Vector<String> params){ + return parse(params, false); + } + private String parse(Vector<String> params, boolean add){ String out = ""; ! if(params.size()==3){ ! String poolname = params.get(0); ! String low_ip = params.get(1); ! String high_ip = params.get(2); ! if(IPV4Address.validateDecIP(low_ip) && IPV4Address.validateDecIP(high_ip)){ ! if(add){ ! //nat.pool.add(poolname, low_ip, high_ip); ! } ! else{ ! //nat.pool.remove(poolname, low_ip, high_ip); ! } ! } } else{ *************** *** 1724,1729 **** } else{ ! device.addRoute(new Route_entry(params.get(0), params.get(2), params.get(1), params.get(3), 0)); ! out+="Route added.\n"; } } --- 1823,1847 ---- } else{ ! try { ! String iface = null; ! if(params.size()==4) iface = params.get(3); ! else{ ! IPV4Address gw = new IPV4Address(params.get(2)); ! ArrayList<?> ifaces = device.getAllInterfacesNames(); ! boolean found = false; ! for(int i=0; i<ifaces.size() && !found; i++){ ! iface = (String) ifaces.get(i); ! gw.setCustomSubnetMask(device.getSubnetMask(iface)); ! found = gw.compareToSubnet(device.getIPAddress(iface)); ! } ! } ! device.addRoute(new Route_entry(params.get(0), params.get(2), params.get(1), iface, 0)); ! out+="Route added.\n"; ! } catch (InvalidIPAddressException e) { ! out+="error: invalid gateway ip address.\n"; ! } catch (InvalidSubnetMaskException e) { ! out+="internal error: invalid subnet mask!\n"; ! e.printStackTrace(); ! } } } Index: CommandsTree.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandsTree.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** CommandsTree.java 17 Nov 2007 21:38:58 -0000 1.6 --- CommandsTree.java 10 Sep 2008 21:35:37 -0000 1.7 *************** *** 2,6 **** * CommandsTree.java * ! * Created on 5 Îêòÿáðü 2007 ã., 19:36 * * To change this template, choose Tools | Template Manager --- 2,6 ---- * CommandsTree.java * ! * Created on 5 ������� 2007 �., 19:36 * * To change this template, choose Tools | Template Manager *************** *** 312,320 **** vprms.add(cmds[i]); } ! if(cmds[0].equalsIgnoreCase("no")){ ! result = func.no_call(vprms); } ! else{ ! result = func.call(vprms); } } --- 312,325 ---- vprms.add(cmds[i]); } ! try{ ! if(cmds[0].equalsIgnoreCase("no")){ ! result = func.no_call(vprms); ! } ! else{ ! result = func.call(vprms); ! } } ! catch(Exception e){ ! result = "Fatal error was occur. Please contact to developer.\nAdditional info: "+e.toString()+"\n"; } } |
From: Alexander B. <da...@us...> - 2008-09-09 09:16:16
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv6886/guiUI Modified Files: GuiNode.java GuiPC.java MainScreen.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.83 retrieving revision 1.84 diff -C2 -d -r1.83 -r1.84 *** MainScreen.java 26 Dec 2007 17:43:15 -0000 1.83 --- MainScreen.java 9 Sep 2008 09:16:10 -0000 1.84 *************** *** 136,141 **** private static final String HTM_PREFIX = "htm"; ! ! //File used to save simulation --- 136,142 ---- private static final String HTM_PREFIX = "htm"; ! ! ! private int Rcnt=0, SWcnt=0, PCcnt=0, PRINTcnt=0, HUBcnt=0; //File used to save simulation *************** *** 684,688 **** public void addPC(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a PC name:","Create New PC", JOptionPane.PLAIN_MESSAGE); if(result != null){ --- 685,689 ---- public void addPC(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a name for a new PC:", "PC" + PCcnt); if(result != null){ *************** *** 695,701 **** Sim.addPC(result, true); ! Sim.getNode(result).addNetworkInterface(core.NetworkInterface.getIntName(core.NetworkInterface.Ethernet10T) + "0", core.NetworkInterface.Ethernet10T, true); ! Sim.getNode(result).addNetworkInterface(core.NetworkInterface.getIntName(core.NetworkInterface.Console) + "0", core.NetworkInterface.Console, false); --- 696,704 ---- Sim.addPC(result, true); + + PCcnt++; ! Sim.getNode(result).addNetworkInterface(core.NetworkInterface.getIntName(core.NetworkInterface.Ethernet10T) + "0", core.NetworkInterface.Ethernet10T, true); ! Sim.getNode(result).addNetworkInterface(core.NetworkInterface.getIntName(core.NetworkInterface.Console) + "0", core.NetworkInterface.Console, false); *************** *** 747,751 **** public void addPrinter(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a Printer name:","Create New Printer", JOptionPane.PLAIN_MESSAGE); if(result != null){ --- 750,754 ---- public void addPrinter(Point inPoint){ ! String result = JOptionPane.showInputDialog(this, "Please enter a name for new Printer:", "Printer" + PRINTcnt); if(result != null){ *************** *** 839,845 **** public void addRouter(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a Router name:","Create New Router", JOptionPane.PLAIN_MESSAGE); ! String[] choices = {"Simple router with 2 Ethernet-TX ports.", "Router with 3 Ethernet-TX ports", "Router with 2 Ethernet-TX ports and 1 Ethernet-FX port.", --- 842,850 ---- public void addRouter(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a name for new Router:", "R" + Rcnt); ! ! if(result != null){ ! String[] choices = {"Simple router with 2 Ethernet-TX ports.", "Router with 3 Ethernet-TX ports", "Router with 2 Ethernet-TX ports and 1 Ethernet-FX port.", *************** *** 848,856 **** }; ! String choice = (String)JOptionPane.showInputDialog(this,"Please choose Switch type", "Create New Switch", JOptionPane.PLAIN_MESSAGE, null, choices,choices[0]); ! if(result != null && choice !=null){ result = result.trim(); --- 853,861 ---- }; ! String choice = (String)JOptionPane.showInputDialog(this,"Please choose router type", "Create New Router", JOptionPane.PLAIN_MESSAGE, null, choices,choices[0]); ! if(choice !=null){ result = result.trim(); *************** *** 861,864 **** --- 866,872 ---- Sim.addRouter(result, true); + + Rcnt++; + Sim.getNode(result).addNetworkInterface(NetworkInterface.getIntName(NetworkInterface.Console) + "0", NetworkInterface.Console, false); *************** *** 920,923 **** --- 928,933 ---- } + + } this.setAllHighlightsOff(); *************** *** 927,931 **** } ! /** --- 937,944 ---- } ! public void showRIPDialog(String inNodeName){ ! new RIPProperties(this,Sim,Sandbox,inNodeName); ! ! } /** *************** *** 941,945 **** public void addHub(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a Hub name:","Create New Hub", JOptionPane.PLAIN_MESSAGE); String[] choises = {"5-ports simple hub.", --- 954,960 ---- public void addHub(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a name for new Hub:","H" + HUBcnt); ! ! if(result != null){ String[] choises = {"5-ports simple hub.", *************** *** 951,955 **** choises,choises[0]); ! if(result != null && choice != null){ result = result.trim(); --- 966,970 ---- choises,choises[0]); ! if(choice != null){ result = result.trim(); *************** *** 960,963 **** --- 975,980 ---- int portCount = 5; + HUBcnt++; + if(choice.contains(choises[1])) portCount = 8; *************** *** 999,1002 **** --- 1016,1021 ---- } + + } this.setAllHighlightsOff(); *************** *** 1134,1140 **** public void addSwitch(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a Switch name:","Create New Switch", JOptionPane.PLAIN_MESSAGE); ! String[] choices = {"5 Ethernet-TX ports simple switch.", "8 Ethernet-TX ports switch.", "12 Ethernet-TX ports switch.", --- 1153,1161 ---- public void addSwitch(Point inPoint){ ! String result = JOptionPane.showInputDialog(this,"Please enter a name for new Switch:", "SW"+SWcnt); ! ! if(result != null){ ! String[] choices = {"5 Ethernet-TX ports simple switch.", "8 Ethernet-TX ports switch.", "12 Ethernet-TX ports switch.", *************** *** 1146,1155 **** }; ! String choice = (String)JOptionPane.showInputDialog(this,"Please choose Switch type", "Create New Switch", JOptionPane.PLAIN_MESSAGE, null, choices,choices[0]); ! if(result != null && choice != null){ result = result.trim(); --- 1167,1176 ---- }; ! String choice = (String)JOptionPane.showInputDialog(this,"Please choose switch type", "Create New Switch", JOptionPane.PLAIN_MESSAGE, null, choices,choices[0]); ! if(choice != null){ result = result.trim(); *************** *** 1160,1163 **** --- 1181,1186 ---- int tx=0, fx=0; + SWcnt++; + if(choice.contains(choices[0])){ tx = 5; fx = 0; *************** *** 1221,1224 **** --- 1244,1249 ---- } + + } this.setAllHighlightsOff(); *************** *** 1357,1361 **** String strSecondNodeInterface = dlgLink.getSecondSelectedInterface(); ! String strLinkName = inNode1 + "-" + Sim.getNode(inNode1).getIntSType(strFirstNodeInterface) + "-" + inNode2; if( Sim.getNode(inNode1).getIntType(strFirstNodeInterface) == Sim.getNode(inNode2).getIntType(strSecondNodeInterface)){ --- 1382,1388 ---- String strSecondNodeInterface = dlgLink.getSecondSelectedInterface(); ! //String strLinkName = inNode1 + "-" + Sim.getNode(inNode1).getIntSType(strFirstNodeInterface) + "-" + inNode2; ! ! String strLinkName = inNode1 + "(" + strFirstNodeInterface + ") - " + inNode2 + "(" + strSecondNodeInterface + ")"; if( Sim.getNode(inNode1).getIntType(strFirstNodeInterface) == Sim.getNode(inNode2).getIntType(strSecondNodeInterface)){ *************** *** 2345,2358 **** printLayerInfo(false); ! JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Open File ..."); ! chooser.setMultiSelectionEnabled(false); ! chooser.setAcceptAllFileFilterUsed(false); ! chooser.addChoosableFileFilter(new JNSTFilter()); int returnVal = chooser.showOpenDialog(this); ! if(returnVal == JFileChooser.APPROVE_OPTION){ try { --- 2372,2385 ---- printLayerInfo(false); ! JFileChooser chooser = new JFileChooser(); chooser.setDialogTitle("Open File ..."); ! chooser.setMultiSelectionEnabled(false); ! chooser.setAcceptAllFileFilterUsed(false); ! chooser.addChoosableFileFilter(new JNSTFilter()); int returnVal = chooser.showOpenDialog(this); ! if(returnVal == JFileChooser.APPROVE_OPTION){ try { *************** *** 2525,2528 **** --- 2552,2556 ---- GuiHub tempHub = new GuiHub(strNodeName,this); tempHub.setNodeLocation(pnt); + tempHub.setEnabled(false); Sandbox.add(tempHub); Sandbox.setLayer((Component) tempHub,3,0); *************** *** 2531,2534 **** --- 2559,2563 ---- GuiSwitch tempSwitch = new GuiSwitch(strNodeName,this); tempSwitch.setNodeLocation(pnt); + tempSwitch.setEnabled(false); Sandbox.add(tempSwitch); Sandbox.setLayer(tempSwitch,3,0); *************** *** 2537,2540 **** --- 2566,2570 ---- GuiCSUDSU tempCSUDSU = new GuiCSUDSU(strNodeName,this); tempCSUDSU.setNodeLocation(pnt); + tempCSUDSU.setEnabled(false); Sandbox.add(tempCSUDSU); Sandbox.setLayer(tempCSUDSU,3,0); *************** *** 2543,2546 **** --- 2573,2577 ---- GuiPC tempPC = new GuiPC(strNodeName,this); tempPC.setNodeLocation(pnt); + tempPC.setEnabled(false); Sandbox.add(tempPC); Sandbox.setLayer(tempPC,3,0); *************** *** 2549,2552 **** --- 2580,2584 ---- GuiRouter tempRouter = new GuiRouter(strNodeName,this); tempRouter.setNodeLocation(pnt); + tempRouter.setEnabled(false); Sandbox.add(tempRouter); Sandbox.setLayer(tempRouter,3,0); *************** *** 2555,2558 **** --- 2587,2591 ---- GuiExternalProxy tempRouter = new GuiExternalProxy(strNodeName,this); tempRouter.setNodeLocation(pnt); + tempRouter.setEnabled(false); Sandbox.add(tempRouter); Sandbox.setLayer(tempRouter,3,0); *************** *** 2594,2597 **** --- 2627,2631 ---- String nodeName = (String) DevicesTurnedOn.get(i); Sim.getNode(nodeName).turnOn(); + ((GuiNode)GUInodeTable.get(nodeName)).setEnabled(true); } *************** *** 2622,2632 **** ! public void Import(){ ! printLayerInfo(false); JFileChooser chooser = new JFileChooser(); ! chooser.setDialogTitle("Import simulation from previous versions ..."); chooser.setMultiSelectionEnabled(false); --- 2656,2666 ---- ! public void Import(){ ! printLayerInfo(false); JFileChooser chooser = new JFileChooser(); ! chooser.setDialogTitle("Import simulation from previous versions ..."); chooser.setMultiSelectionEnabled(false); *************** *** 2645,2648 **** --- 2679,2683 ---- File inFile = chooser.getSelectedFile(); + Vector DevicesTurnedOn = new Vector(); //System.out.println(inFile.getPath()); *************** *** 2740,2743 **** --- 2775,2780 ---- tempHub.setNodeLocation(pnt); + + tempHub.setEnabled(true); Sandbox.add(tempHub); *************** *** 2760,2763 **** --- 2797,2802 ---- tempSwitch.setNodeLocation(pnt); + + tempSwitch.setEnabled(true); Sandbox.add(tempSwitch); *************** *** 2776,2779 **** --- 2815,2820 ---- GuiPC tempPC = new GuiPC(strNodeName,this); + + tempPC.setEnabled(true); tempPC.setNodeLocation(pnt); *************** *** 2799,2802 **** --- 2840,2845 ---- tempRouter.setNodeLocation(pnt); + + tempRouter.setEnabled(true); Sandbox.add(tempRouter); *************** *** 2873,2878 **** } - try{ Route_entry r; --- 2916,2921 ---- } + try{ Route_entry r; *************** *** 2889,2892 **** --- 2932,2938 ---- Sim.addRoute(strNodeName, r); } + + + Sim.execCmd(strNodeName, "write mem"); }catch(Exception e){ *************** *** 4041,4051 **** } ! public void TurnDevice(String inNodeName){ try{ if(Sim.getNode(inNodeName).On == true){ Sim.getNode(inNodeName).turnOff(); }else{ Sim.getNode(inNodeName).turnOn(); ! } }catch(Exception e){ } --- 4087,4098 ---- } ! public void TurnDevice(GuiNode node, String inNodeName){ try{ if(Sim.getNode(inNodeName).On == true){ Sim.getNode(inNodeName).turnOff(); + node.setEnabled(false); }else{ Sim.getNode(inNodeName).turnOn(); ! node.setEnabled(true); } }catch(Exception e){ } *************** *** 4055,4061 **** try{ if(Sim.getNode(inNodeName).On == true){ ! return "Turn On"; }else{ ! return "Turn Off"; } }catch(Exception e){ --- 4102,4108 ---- try{ if(Sim.getNode(inNodeName).On == true){ ! return "Turn Off"; }else{ ! return "Turn On"; } }catch(Exception e){ Index: GuiNode.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiNode.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GuiNode.java 10 Nov 2007 13:25:39 -0000 1.6 --- GuiNode.java 9 Sep 2008 09:16:10 -0000 1.7 *************** *** 109,112 **** --- 109,113 ---- protected JLabel lblNodeName = new JLabel(); + protected GuiNode selfLink = this; *************** *** 248,254 **** lblIcon.setIcon(nodeIcon); ! lblIcon.setHorizontalAlignment((JLabel.CENTER)); ! ! //Set the layout of this jPanel --- 249,253 ---- lblIcon.setIcon(nodeIcon); ! lblIcon.setHorizontalAlignment((JLabel.CENTER)); //Set the layout of this jPanel *************** *** 352,356 **** ! GuiNodePopMenu.add(mnuDelete); GuiNodePopMenu.add(mnuTurn); GuiNodePopMenu.add(mnuBreakLink); --- 351,355 ---- ! GuiNodePopMenu.add(mnuDelete); GuiNodePopMenu.add(mnuTurn); GuiNodePopMenu.add(mnuBreakLink); *************** *** 358,361 **** --- 357,362 ---- GuiNodePopMenu.add(mnuInt); + + mnuTurn.setText(controller.DeviceState(lblNodeName.getText())); mnuTurn.addActionListener(new ActionListener(){ *************** *** 363,373 **** public void actionPerformed(ActionEvent e){ //controller.showLinkDialog(lblNodeName.getText()); ! controller.TurnDevice(lblNodeName.getText()); mnuTurn.setText(controller.DeviceState(lblNodeName.getText())); - } ! }); } /** --- 364,379 ---- public void actionPerformed(ActionEvent e){ //controller.showLinkDialog(lblNodeName.getText()); ! controller.TurnDevice(selfLink, lblNodeName.getText()); mnuTurn.setText(controller.DeviceState(lblNodeName.getText())); } ! }); ! } + public void setEnabled(boolean e){ + lblIcon.setEnabled(e); + mnuTurn.setText(controller.DeviceState(lblNodeName.getText())); + } + /** Index: GuiPC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiPC.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GuiPC.java 26 Dec 2007 17:43:15 -0000 1.6 --- GuiPC.java 9 Sep 2008 09:16:10 -0000 1.7 *************** *** 104,108 **** private JMenuItem mnuDNSListen = new JMenuItem("Start DNS server"); private JMenuItem mnuDNSSend = new JMenuItem("Send request to DNS server"); ! private JMenuItem mnuDNSEdit = new JMenuItem("Edit DNS-table"); --- 104,109 ---- private JMenuItem mnuDNSListen = new JMenuItem("Start DNS server"); private JMenuItem mnuDNSSend = new JMenuItem("Send request to DNS server"); ! private JMenuItem mnuDNSEdit = new JMenuItem("Edit DNS-table"); ! private JMenuItem mnuRIPcfg = new JMenuItem("Configure RIP..."); *************** *** 195,204 **** }); mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuEchoListen); ! mnuAppLayer.add(mnuEchoSend); mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuEchotcpListen); ! mnuAppLayer.add(mnuEchotcpSend); mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuSNMPManager); --- 196,211 ---- }); + mnuRIPcfg.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.showRIPDialog(lblNodeName.getText()); + } + }); + mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuEchoListen); ! mnuAppLayer.add(mnuEchoSend); mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuEchotcpListen); ! mnuAppLayer.add(mnuEchotcpSend); mnuAppLayer.addSeparator(); mnuAppLayer.add(mnuSNMPManager); *************** *** 206,210 **** mnuAppLayer.add(mnuTelnetListen); mnuAppLayer.add(mnuTelnetNoListen); ! mnuAppLayer.add(mnuTelnetConnect); mnuAppLayer.add(mnuPosixTelnet); mnuAppLayer.addSeparator(); --- 213,217 ---- mnuAppLayer.add(mnuTelnetListen); mnuAppLayer.add(mnuTelnetNoListen); ! mnuAppLayer.add(mnuTelnetConnect); mnuAppLayer.add(mnuPosixTelnet); mnuAppLayer.addSeparator(); *************** *** 214,217 **** --- 221,226 ---- mnuAppLayer.add(mnuDNSSend); mnuAppLayer.add(mnuDNSEdit); + mnuAppLayer.addSeparator(); + mnuAppLayer.add(mnuRIPcfg); } |
From: Alexander B. <da...@us...> - 2008-09-09 09:16:15
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv6886/core Modified Files: PC.java Simulation.java Log Message: Index: PC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/PC.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** PC.java 26 Dec 2007 17:43:17 -0000 1.19 --- PC.java 9 Sep 2008 09:16:10 -0000 1.20 *************** *** 58,61 **** --- 58,62 ---- import core.protocolsuite.tcp_ip.Echo; + import core.protocolsuite.tcp_ip.RIP; import core.protocolsuite.tcp_ip.Telnet_server; import core.protocolsuite.tcp_ip.Telnet_client; *************** *** 99,103 **** public final static int DHCP_CLIENT_ID = 68; public final static int DNS_SERVER_ID = 90; ! public final static int DNS_CLIENT_ID = 91; /** --- 100,106 ---- public final static int DHCP_CLIENT_ID = 68; public final static int DNS_SERVER_ID = 90; ! public final static int DNS_CLIENT_ID = 91; ! public final static int RIP_SERVER_ID = 520; ! /** *************** *** 113,116 **** --- 116,121 ---- public void initApplications(){ super.initApplications(); + + RIP ripServer=new RIP(NodeProtocolStack,core.ProtocolStack.UIDGen++); Echo echoServer = new Echo(NodeProtocolStack, 7, 1, core.ProtocolStack.UIDGen++); *************** *** 133,136 **** --- 138,143 ---- DNS dnsClient = new DNS(NodeProtocolStack, 91, 0, core.ProtocolStack.UIDGen++); + addApp(ripServer,RIP_SERVER_ID); + addApp(echoServer, ECHO_SERVER_ID); addApp(echoClient, ECHO_CLIENT_ID); Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** Simulation.java 17 Nov 2007 21:38:58 -0000 1.26 --- Simulation.java 9 Sep 2008 09:16:10 -0000 1.27 *************** *** 403,406 **** --- 403,427 ---- } + public void execCmd(String inNodeName, String cmd) throws InvalidNodeNameException, InvalidNetworkLayerDeviceException{ + if(nodeTable.containsKey(inNodeName)) + { + Node temp = (Node)nodeTable.get(inNodeName); + if (temp instanceof NetworkLayerDevice) + { //test if device is a network layer device + NetworkLayerDevice t = (NetworkLayerDevice)temp; + t.getConfig().executeCommand(cmd); + } + else + { + throw new InvalidNetworkLayerDeviceException("This device is not a network layered device"); + } + } + else + { + throw new InvalidNodeNameException("Node does not exist"); + } + } + + /** * Sets the Protocol Type to a global variable |
From: Alexander B. <da...@us...> - 2008-09-09 09:16:15
|
Update of /cvsroot/javanetsim/javaNetSim In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv6886 Modified Files: README.txt licence.txt Log Message: Index: licence.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/licence.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** licence.txt 7 Sep 2006 14:02:09 -0000 1.2 --- licence.txt 9 Sep 2008 09:16:09 -0000 1.3 *************** *** 1,5 **** Java Network Simulator (javaNetSim) ! Copyright (c) 2006, 2005, Ice Team; All rights reserved. Copyright (c) 2004, jFirewallSim development team; All rights reserved. --- 1,5 ---- Java Network Simulator (javaNetSim) ! Copyright (c) 2008, 2007, 2006, 2005, Alexander Bolshev; All rights reserved. Copyright (c) 2004, jFirewallSim development team; All rights reserved. Index: README.txt =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/README.txt,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** README.txt 20 Nov 2007 19:17:09 -0000 1.15 --- README.txt 9 Sep 2008 09:16:09 -0000 1.16 *************** *** 18,22 **** 1. If you do not have the Java Runtime Environment (JRE) installed on your Operating System, the program will not be ! able to run. You must install the Java Runtime Environment 1.6.0_01 or later. This can be downloaded from www.java.com --- 18,22 ---- 1. If you do not have the Java Runtime Environment (JRE) installed on your Operating System, the program will not be ! able to run. You must install the Java Runtime Environment 1.5.0 or later. This can be downloaded from www.java.com *************** *** 38,42 **** 1. CSU/DSU unit new connection types: RMI, CORBA, UDP. ! 2. Addded printers. 3. Added access-lists. 4. New devices subtypes for Hubs, Switches and Routers. --- 38,42 ---- 1. CSU/DSU unit new connection types: RMI, CORBA, UDP. ! 2. Added printers. 3. Added access-lists. 4. New devices subtypes for Hubs, Switches and Routers. *************** *** 82,86 **** 2. Print ARP Cache/Print Route Table results now shows in a separate window(insted of log console). 3. New Turn On/Off network device function. ! 4. Finally moved to Java 6 (1.6). ***** Release Version 0.32.3 16th November 2006 ***** --- 82,86 ---- 2. Print ARP Cache/Print Route Table results now shows in a separate window(insted of log console). 3. New Turn On/Off network device function. ! 4. Finally moved to Java 6 (1.6). (but still 1.5 compartible) ***** Release Version 0.32.3 16th November 2006 ***** *************** *** 211,225 **** 1. Error in calculating Network by IP and SubNet Mask. - New Features ------------ 1. Breaking links feature in GUI. - 2. Save/Load in GUI (new jfst file format). - 3. Random length subnet masks. - - --- 211,220 ---- |
From: Alexander B. <da...@us...> - 2008-09-06 20:28:08
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv12759/guiUI Modified Files: DNSClient_Dlg.java DNSServ_Dlg.java DNS_Edit.java Log Message: Index: DNSClient_Dlg.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/DNSClient_Dlg.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DNSClient_Dlg.java 26 Dec 2007 17:43:15 -0000 1.1 --- DNSClient_Dlg.java 6 Sep 2008 20:27:27 -0000 1.2 *************** *** 144,175 **** }); ! javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( ! jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() ! .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(jPanel1Layout.createSequentialGroup() ! .addComponent(aRBtn) ! .addGap(18, 18, 18)) ! .addGroup(jPanel1Layout.createSequentialGroup() ! .addComponent(mxRBtn, 0, 0, Short.MAX_VALUE) ! .addGap(54, 54, 54))) ! .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addComponent(ptrRBtn) ! .addComponent(hinfoRBtn)) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( ! jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(jPanel1Layout.createSequentialGroup() ! .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(aRBtn) ! .addComponent(ptrRBtn)) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) ! .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(mxRBtn) ! .addComponent(hinfoRBtn)) .addContainerGap(9, Short.MAX_VALUE)) ); --- 144,175 ---- }); ! org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( ! jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(jPanel1Layout.createSequentialGroup() .addContainerGap() ! .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(jPanel1Layout.createSequentialGroup() ! .add(aRBtn) ! .add(18, 18, 18)) ! .add(jPanel1Layout.createSequentialGroup() ! .add(mxRBtn, 0, 0, Short.MAX_VALUE) ! .add(54, 54, 54))) ! .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(ptrRBtn) ! .add(hinfoRBtn)) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( ! jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(jPanel1Layout.createSequentialGroup() ! .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(aRBtn) ! .add(ptrRBtn)) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) ! .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(mxRBtn) ! .add(hinfoRBtn)) .addContainerGap(9, Short.MAX_VALUE)) ); *************** *** 186,255 **** ipTxt.setEnabled(false); ! javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( ! layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() .addContainerGap() ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addComponent(hostNameLbl) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(hostNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 128, javax.swing.GroupLayout.PREFERRED_SIZE)) ! .addGroup(layout.createSequentialGroup() ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addComponent(jLabel1) ! .addComponent(jLabel2)) ! .addGap(9, 9, 9) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addComponent(servPorttxt, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addComponent(servIPtxt, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(18, Short.MAX_VALUE)) ! .addGroup(layout.createSequentialGroup() .addContainerGap() ! .addComponent(ipLbl) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(ipTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE) ! .addGap(18, 18, 18)) ! .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() ! .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ! .addGroup(layout.createSequentialGroup() ! .addGap(38, 38, 38) ! .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(cancelButton) .addContainerGap(46, Short.MAX_VALUE)) ); ! layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, okButton}); layout.setVerticalGroup( ! layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() .addContainerGap() ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(jLabel1) ! .addComponent(servIPtxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(jLabel2) ! .addComponent(servPorttxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addComponent(hostNameLbl) ! .addComponent(hostNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(ipLbl) ! .addComponent(ipTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ! .addGap(18, 18, 18) ! .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(cancelButton) ! .addComponent(okButton)) ! .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); --- 186,255 ---- ipTxt.setEnabled(false); ! org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( ! layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(layout.createSequentialGroup() .addContainerGap() ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(layout.createSequentialGroup() ! .add(hostNameLbl) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(hostNameTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 128, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ! .add(layout.createSequentialGroup() ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(jLabel1) ! .add(jLabel2)) ! .add(9, 9, 9) ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(servPorttxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 38, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .add(servIPtxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 84, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))) .addContainerGap(18, Short.MAX_VALUE)) ! .add(layout.createSequentialGroup() .addContainerGap() ! .add(ipLbl) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(ipTxt, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 130, Short.MAX_VALUE) ! .add(18, 18, 18)) ! .add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup() ! .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ! .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ! .add(layout.createSequentialGroup() ! .add(38, 38, 38) ! .add(okButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(cancelButton) .addContainerGap(46, Short.MAX_VALUE)) ); ! layout.linkSize(new java.awt.Component[] {cancelButton, okButton}, javax.swing.SwingConstants.HORIZONTAL); layout.setVerticalGroup( ! layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(layout.createSequentialGroup() .addContainerGap() ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(jLabel1) ! .add(servIPtxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(jLabel2) ! .add(servPorttxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(hostNameLbl) ! .add(hostNameTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(ipLbl) ! .add(ipTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ! .add(18, 18, 18) ! .add(jPanel1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(cancelButton) ! .add(okButton)) ! .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); Index: DNSServ_Dlg.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/DNSServ_Dlg.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DNSServ_Dlg.java 26 Dec 2007 17:43:16 -0000 1.1 --- DNSServ_Dlg.java 6 Sep 2008 20:27:27 -0000 1.2 *************** *** 228,272 **** }); ! javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( ! layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() .addContainerGap() ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() ! .addComponent(jLabel1) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(portTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 51, javax.swing.GroupLayout.PREFERRED_SIZE)) ! .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addGroup(layout.createSequentialGroup() ! .addComponent(saveTbl) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(loadTbl) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE) ! .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(cancelButton))) .addContainerGap()) ); ! layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, okButton}); layout.setVerticalGroup( ! layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() .addContainerGap() ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(jLabel1) ! .addComponent(portTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(saveTbl) ! .addComponent(loadTbl) ! .addComponent(cancelButton) ! .addComponent(okButton)) ! .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); --- 228,272 ---- }); ! org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( ! layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(layout.createSequentialGroup() .addContainerGap() ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(layout.createSequentialGroup() ! .add(jLabel1) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(portTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 51, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ! .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .add(layout.createSequentialGroup() ! .add(saveTbl) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(loadTbl) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 140, Short.MAX_VALUE) ! .add(okButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(cancelButton))) .addContainerGap()) ); ! layout.linkSize(new java.awt.Component[] {cancelButton, okButton}, javax.swing.SwingConstants.HORIZONTAL); layout.setVerticalGroup( ! layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(layout.createSequentialGroup() .addContainerGap() ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(jLabel1) ! .add(portTxt, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 113, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(saveTbl) ! .add(loadTbl) ! .add(cancelButton) ! .add(okButton)) ! .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); Index: DNS_Edit.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/DNS_Edit.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DNS_Edit.java 26 Dec 2007 17:43:16 -0000 1.1 --- DNS_Edit.java 6 Sep 2008 20:27:27 -0000 1.2 *************** *** 242,278 **** jScrollPane1.setViewportView(addressTbl); ! javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( ! layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() .addContainerGap() ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addGroup(layout.createSequentialGroup() ! .addComponent(saveTbl) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(loadTbl) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 140, Short.MAX_VALUE) ! .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) ! .addComponent(cancelButton))) .addContainerGap()) ); ! layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, okButton}); layout.setVerticalGroup( ! layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) ! .addGroup(layout.createSequentialGroup() .addContainerGap() ! .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 113, javax.swing.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) ! .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) ! .addComponent(saveTbl) ! .addComponent(loadTbl) ! .addComponent(cancelButton) ! .addComponent(okButton)) ! .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); --- 242,278 ---- jScrollPane1.setViewportView(addressTbl); ! org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( ! layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(layout.createSequentialGroup() .addContainerGap() ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .add(layout.createSequentialGroup() ! .add(saveTbl) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(loadTbl) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 140, Short.MAX_VALUE) ! .add(okButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 67, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED) ! .add(cancelButton))) .addContainerGap()) ); ! layout.linkSize(new java.awt.Component[] {cancelButton, okButton}, javax.swing.SwingConstants.HORIZONTAL); layout.setVerticalGroup( ! layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING) ! .add(layout.createSequentialGroup() .addContainerGap() ! .add(jScrollPane1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 113, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE) ! .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED) ! .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE) ! .add(saveTbl) ! .add(loadTbl) ! .add(cancelButton) ! .add(okButton)) ! .addContainerGap(org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); |
From: Alexander B. <da...@us...> - 2008-09-06 20:28:03
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv12759/core/protocolsuite/tcp_ip Modified Files: DHCPC.java DNS_Message.java Log Message: Index: DHCPC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DHCPC.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DHCPC.java 17 Nov 2007 21:38:58 -0000 1.4 --- DHCPC.java 6 Sep 2008 20:27:27 -0000 1.5 *************** *** 10,14 **** import core.LayerInfo; import core.Simulation; ! import javax.lang.model.util.SimpleAnnotationValueVisitor6; /** --- 10,14 ---- import core.LayerInfo; import core.Simulation; ! //import javax.lang.model.util.SimpleAnnotationValueVisitor6; /** Index: DNS_Message.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DNS_Message.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DNS_Message.java 26 Dec 2007 17:43:17 -0000 1.1 --- DNS_Message.java 6 Sep 2008 20:27:27 -0000 1.2 *************** *** 7,11 **** import java.util.Hashtable; ! import javax.swing.RowSorter.SortKey; import sun.misc.Compare; import sun.misc.Sort; --- 7,11 ---- import java.util.Hashtable; ! //import javax.swing.RowSorter.SortKey; import sun.misc.Compare; import sun.misc.Sort; |
From: Alexander B. <da...@us...> - 2008-09-06 20:28:03
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv12759/core Modified Files: NetworkInterface.java Log Message: Index: NetworkInterface.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkInterface.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** NetworkInterface.java 26 Dec 2007 17:43:17 -0000 1.13 --- NetworkInterface.java 6 Sep 2008 20:27:26 -0000 1.14 *************** *** 129,134 **** } ! public void setDHCP(boolean inDHСP){ ! dhcp = inDHСP; } --- 129,134 ---- } ! public void setDHCP(boolean inDHCP){ ! dhcp = inDHCP; } |
From: Alexander B. <da...@us...> - 2008-09-06 20:27:36
|
Update of /cvsroot/javanetsim/javaNetSim/jars In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv12759/jars Added Files: swing-layout-1.0.jar Log Message: --- NEW FILE: swing-layout-1.0.jar --- (This appears to be a binary file; contents omitted.) |
From: Alexander B. <da...@us...> - 2008-09-06 20:25:36
|
Update of /cvsroot/javanetsim/javaNetSim/jars In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv11969/jars Log Message: Directory /cvsroot/javanetsim/javaNetSim/jars added to the repository |
Update of /cvsroot/javanetsim/javaNetSim/core In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv18458/core Modified Files: WANDatagram.java WANNetworkInterface.java WANRMI.java WANRMIServer.java WANSocket.java Added Files: WANRMICallback.java WANRMIClient.java Log Message: few fixes of WANs Index: WANRMIServer.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WANRMIServer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WANRMIServer.java 10 Nov 2007 13:25:38 -0000 1.2 --- WANRMIServer.java 27 Nov 2007 16:56:27 -0000 1.3 *************** *** 24,29 **** } ! public void setServiceName(String inService) throws RemoteException{ ! parentInterface.setConnService(inService); //parentInterface.connect(); } --- 24,29 ---- } ! public void setServiceName(WANRMICallback callback) throws RemoteException{ ! parentInterface.setRMICallback(callback); //parentInterface.connect(); } --- NEW FILE: WANRMIClient.java --- (This appears to be a binary file; contents omitted.) Index: WANRMI.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WANRMI.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WANRMI.java 10 Nov 2007 13:25:38 -0000 1.2 --- WANRMI.java 27 Nov 2007 16:56:27 -0000 1.3 *************** *** 18,21 **** public void recievePacket(String inPacket) throws RemoteException; ! public void setServiceName(String inService) throws RemoteException; } --- 18,21 ---- public void recievePacket(String inPacket) throws RemoteException; ! public void setServiceName(WANRMICallback callback) throws RemoteException; } --- NEW FILE: WANRMICallback.java --- (This appears to be a binary file; contents omitted.) Index: WANSocket.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WANSocket.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** WANSocket.java 19 Nov 2007 15:10:28 -0000 1.5 --- WANSocket.java 27 Nov 2007 16:56:27 -0000 1.6 *************** *** 124,127 **** --- 124,128 ---- public void run() { try{ + while(s != null){ Socket incoming = s.accept(); parentInterface.addLayerInfo("Wan interface", "Accepted connection from peer."); *************** *** 140,144 **** incoming.close(); incoming = null; ! w.setClientSocket(null, null); }catch(Exception e){ parentInterface.addLayerInfo("Wan interface", "Error during communication: " + e.toString()); --- 141,146 ---- incoming.close(); incoming = null; ! w.setClientSocket(null, null); ! } }catch(Exception e){ parentInterface.addLayerInfo("Wan interface", "Error during communication: " + e.toString()); Index: WANNetworkInterface.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WANNetworkInterface.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** WANNetworkInterface.java 20 Nov 2007 19:17:09 -0000 1.8 --- WANNetworkInterface.java 27 Nov 2007 16:56:27 -0000 1.9 *************** *** 56,59 **** --- 56,61 ---- protected WANRMIServer RMIServer; protected WANRMI RMIClient; + protected WANRMICallback RMICallback; + protected WANRMIClient RMIClientCallback; protected WANCorbaServer CORBAServer; *************** *** 105,108 **** --- 107,114 ---- } + public void setRMICallback(WANRMICallback callback){ + this.RMICallback = callback; + } + /* /Interface properties setup functions */ *************** *** 143,146 **** --- 149,153 ---- Service = ""; Host = ""; + RMICallback = null; if (System.getSecurityManager() == null) System.setSecurityManager ( new RMISecurityManager() ); *************** *** 226,231 **** try{ switch(type){ ! case RMI: ! RMIClient.recievePacket(inPacket.toBytes()); break; case SocketUDP: --- 233,241 ---- try{ switch(type){ ! case RMI: ! if(server) ! RMICallback.recievePacket(inPacket.toBytes()); ! else ! RMIClient.recievePacket(inPacket.toBytes()); break; case SocketUDP: *************** *** 315,319 **** RMIClient = (WANRMI) Naming.lookup ("rmi://" + Host + ":" + port + "/" + Service); ! RMIClient.setServiceName(name); connected = true; --- 325,331 ---- RMIClient = (WANRMI) Naming.lookup ("rmi://" + Host + ":" + port + "/" + Service); ! RMIClientCallback = null; ! RMIClientCallback = new WANRMIClient(this); ! RMIClient.setServiceName( RMIClientCallback ); connected = true; *************** *** 364,370 **** switch(type){ case RMI: RMIClient = null; Naming.unbind(name); ! RMIServer = null; break; case Corba: --- 376,384 ---- switch(type){ case RMI: + RMIClientCallback = null; + RMICallback = null; RMIClient = null; Naming.unbind(name); ! RMIServer = null; break; case Corba: Index: WANDatagram.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WANDatagram.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** WANDatagram.java 20 Nov 2007 19:17:09 -0000 1.2 --- WANDatagram.java 27 Nov 2007 16:56:27 -0000 1.3 *************** *** 49,53 **** }else{ s = new DatagramSocket(); ! sendPacket("P#"); } --- 49,53 ---- }else{ s = new DatagramSocket(); ! sendPacket("P!#"); } *************** *** 114,117 **** --- 114,118 ---- WANDatagram w; WANNetworkInterface parentInterface; + boolean occupied; private InputStream in; *************** *** 124,127 **** --- 125,129 ---- this.w = w; this.parentInterface = parentInterface; + occupied = false; } *************** *** 137,141 **** s.receive(packet); ! setClientAddress(packet.getAddress().getHostAddress(), packet.getPort()); w.recievePacket((new String(packet.getData(),"ascii")).substring(0, packet.getLength())); --- 139,146 ---- s.receive(packet); ! if((new String(packet.getData(),"ascii")).contains("P!#") && !occupied){ ! setClientAddress(packet.getAddress().getHostAddress(), packet.getPort()); ! occupied = true; ! } w.recievePacket((new String(packet.getData(),"ascii")).substring(0, packet.getLength())); |