javanetsim-cvs Mailing List for javaNetSim (Page 3)
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: QweR <qw...@us...> - 2008-10-24 17:47:03
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10773/core/protocolsuite/tcp_ip Modified Files: DHCPD.java DNS.java DNS_Message.java Telnet_server.java Log Message: Warnings was corrected Index: DNS_Message.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DNS_Message.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DNS_Message.java 24 Oct 2008 16:18:48 -0000 1.4 --- DNS_Message.java 24 Oct 2008 17:46:42 -0000 1.5 *************** *** 35,39 **** public DNS_Message(int new_id, int QR, int opcode, int AA, int TC, int RD, int RA, int rcode, Vector<Query> query, Vector<Answer> answer, Vector<Object> access, Vector<Object> addit) { ! //create DNS-message whith known simple parametres if(new_id==0){ if (DNS_Message.Counter == 16777216) --- 35,39 ---- public DNS_Message(int new_id, int QR, int opcode, int AA, int TC, int RD, int RA, int rcode, Vector<Query> query, Vector<Answer> answer, Vector<Object> access, Vector<Object> addit) { ! //create DNS-message with known simple parameters if(new_id==0){ if (DNS_Message.Counter == 16777216) *************** *** 60,66 **** } //May be parse access and form like answers ! this.accesses = new Vector<Object>(0); //May be parse additional and form like answers ! this.additionals = new Vector<Object>(0); } --- 60,68 ---- } //May be parse access and form like answers ! if(access==null) ! this.accesses = new Vector<Object>(0); //May be parse additional and form like answers ! if(addit==null) ! this.additionals = new Vector<Object>(0); } *************** *** 210,224 **** public DName parseDomainName(String str, int begin){ ! int saveBegin = begin; String qName = new String(); ! int k = str.codePointAt(begin); while(k!=0) { ! int oldBegin = begin+1; ! begin += k+1; ! k = str.codePointAt(begin); ! qName += str.substring(oldBegin, begin) + (k==0?"":"."); } ! return new DName(qName,begin+1-saveBegin); } --- 212,226 ---- public DName parseDomainName(String str, int begin){ ! int cur = begin; String qName = new String(); ! int k = str.codePointAt(cur); while(k!=0) { ! int oldBegin = cur+1; ! cur += k+1; ! k = str.codePointAt(cur); ! qName += str.substring(oldBegin, cur) + (k==0?"":"."); } ! return new DName(qName,cur+1-begin); } *************** *** 228,236 **** private Query parseQuery(String str, int begin) { ! int saveBegin = begin; ! DName dname = parseDomainName(str, begin); ! begin += dname.length; ! Integer qType = new Integer(Str2ToInt(str.substring(begin,begin+2))); ! return new Query(dname.name,qType,begin+4-saveBegin); } --- 230,238 ---- private Query parseQuery(String str, int begin) { ! int cur = begin; ! DName dname = parseDomainName(str, cur); ! cur += dname.length; ! Integer qType = new Integer(Str2ToInt(str.substring(cur,cur+2))); ! return new Query(dname.name,qType,cur+4-begin); } *************** *** 240,250 **** private Answer parseAnswer(String str, int begin) { ! int saveBegin = begin; ! Query qu = parseQuery(str, begin); ! begin += qu.length; ! int ttl = Str4ToInt(str.substring(begin,begin+4)); ! begin += 4; ! int len = Str2ToInt(str.substring(begin,begin+2)); ! begin += 2; String aRes = ""; int priority = 0; --- 242,252 ---- private Answer parseAnswer(String str, int begin) { ! int cur = begin; ! Query qu = parseQuery(str, cur); ! cur += qu.length; ! int ttl = Str4ToInt(str.substring(cur,cur+4)); ! cur += 4; ! int len = Str2ToInt(str.substring(cur,cur+2)); ! cur += 2; String aRes = ""; int priority = 0; *************** *** 252,256 **** case A_QUERY_TYPE:{ if(len==4){ ! aRes = Integer.toString(str.codePointAt(begin))+"."+Integer.toString(str.codePointAt(begin+1))+"."+Integer.toString(str.codePointAt(begin+2))+"."+Integer.toString(str.codePointAt(begin+3)); } break; --- 254,258 ---- case A_QUERY_TYPE:{ if(len==4){ ! aRes = Integer.toString(str.codePointAt(cur))+"."+Integer.toString(str.codePointAt(cur+1))+"."+Integer.toString(str.codePointAt(cur+2))+"."+Integer.toString(str.codePointAt(cur+3)); } break; *************** *** 258,279 **** case PTR_QUERY_TYPE: case CNAME_QUERY_TYPE:{ ! DName dname = parseDomainName(str, begin); aRes = dname.name; break; } case HINFO_QUERY_TYPE:{ ! int hilen = str.codePointAt(begin); ! aRes = str.substring(begin+1,begin+hilen+1); break; } case MX_QUERY_TYPE:{ ! priority = Str2ToInt(str.substring(begin,begin+2)); ! DName dname = parseDomainName(str, begin+2); aRes = dname.name; break; } } ! begin += len; ! return new Answer(qu.name,qu.type,ttl,aRes,priority,begin-saveBegin); } --- 260,281 ---- case PTR_QUERY_TYPE: case CNAME_QUERY_TYPE:{ ! DName dname = parseDomainName(str, cur); aRes = dname.name; break; } case HINFO_QUERY_TYPE:{ ! int hilen = str.codePointAt(cur); ! aRes = str.substring(cur+1,cur+hilen+1); break; } case MX_QUERY_TYPE:{ ! priority = Str2ToInt(str.substring(cur,cur+2)); ! DName dname = parseDomainName(str, cur+2); aRes = dname.name; break; } } ! cur += len; ! return new Answer(qu.name,qu.type,ttl,aRes,priority,cur-begin); } Index: DHCPD.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DHCPD.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** DHCPD.java 24 Oct 2008 16:18:48 -0000 1.11 --- DHCPD.java 24 Oct 2008 17:46:42 -0000 1.12 *************** *** 185,190 **** String IP; ! for(Enumeration e = leases.keys(); e.hasMoreElements();){ ! IP = (String)e.nextElement(); if((leases.get(IP)).MAC.equals(MAC)){ return IP; --- 185,190 ---- String IP; ! for(Enumeration<String> e = leases.keys(); e.hasMoreElements();){ ! IP = e.nextElement(); if((leases.get(IP)).MAC.equals(MAC)){ return IP; *************** *** 204,209 **** String PoolName; ! for(Enumeration e = pools.keys(); e.hasMoreElements();){ ! PoolName = (String)e.nextElement(); pool p = pools.get(PoolName); --- 204,209 ---- String PoolName; ! for(Enumeration<String> e = pools.keys(); e.hasMoreElements();){ ! PoolName = e.nextElement(); pool p = pools.get(PoolName); Index: Telnet_server.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Telnet_server.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** Telnet_server.java 24 Oct 2008 16:18:48 -0000 1.25 --- Telnet_server.java 24 Oct 2008 17:46:42 -0000 1.26 *************** *** 46,50 **** private boolean isnewpass=false; private String temp = ""; ! public Hashtable connections = new Hashtable(); /** Creates a new instance of Telnet Server */ --- 46,50 ---- private boolean isnewpass=false; private String temp = ""; ! public Hashtable<Integer,TSession> connections = new Hashtable<Integer,TSession>(); /** Creates a new instance of Telnet Server */ *************** *** 93,99 **** running = false; mParentStack.SL().close(appSock); ! Enumeration keys = connections.keys(); while(keys.hasMoreElements()){ ! Integer key = (Integer)keys.nextElement(); mParentStack.SL().close(key.intValue()); connections.remove(key); --- 93,99 ---- running = false; mParentStack.SL().close(appSock); ! Enumeration<Integer> keys = connections.keys(); while(keys.hasMoreElements()){ ! Integer key = keys.nextElement(); mParentStack.SL().close(key.intValue()); connections.remove(key); *************** *** 106,112 **** { mParentStack.SL().free(appSock); ! Enumeration keys = connections.keys(); while(keys.hasMoreElements()){ ! Integer key = (Integer)keys.nextElement(); mParentStack.SL().free(key.intValue()); connections.remove(key); --- 106,112 ---- { mParentStack.SL().free(appSock); ! Enumeration<Integer> keys = connections.keys(); while(keys.hasMoreElements()){ ! Integer key = keys.nextElement(); mParentStack.SL().free(key.intValue()); connections.remove(key); *************** *** 191,200 **** */ public void RecvData(int sock, String Data) throws LowLinkException, TransportLayerException { ! ! printLayerInfo("Server: recieving message '" + Data + "' from client."); String outData=""; ! while(Data.length()>0) { ! int ch = (char)Data.charAt(0); switch(ch) { case 0x08: { --- 191,200 ---- */ public void RecvData(int sock, String Data) throws LowLinkException, TransportLayerException { ! String new_data = Data; ! printLayerInfo("Server: recieving message '" + new_data + "' from client."); String outData=""; ! while(new_data.length()>0) { ! int ch = new_data.charAt(0); switch(ch) { case 0x08: { *************** *** 216,220 **** ispass = false; if(isAuth(temp, cmdline)) { ! ((TSession)connections.get(new Integer(sock))).user = temp; outData += "\r\nWelcome to " + mParentStack.getParentNodeName() + "\r\n" + runcmd(""); } --- 216,220 ---- ispass = false; if(isAuth(temp, cmdline)) { ! connections.get(new Integer(sock)).user = temp; outData += "\r\nWelcome to " + mParentStack.getParentNodeName() + "\r\n" + runcmd(""); } *************** *** 250,255 **** } cmdline = ""; ! if(ch==0xD && (char)Data.charAt(1)==0xA) ! Data = Data.substring(1); break; } --- 250,255 ---- } cmdline = ""; ! if(ch==0xD && new_data.charAt(1)==0xA) ! new_data = new_data.substring(1); break; } *************** *** 262,268 **** } else { ! outData += String.valueOf(Data.charAt(0)); } ! cmdline+=String.valueOf(Data.charAt(0)); } else { --- 262,268 ---- } else { ! outData += String.valueOf(new_data.charAt(0)); } ! cmdline+=String.valueOf(new_data.charAt(0)); } else { *************** *** 270,274 **** } } ! Data = Data.substring(1); } try{ --- 270,274 ---- } } ! new_data = new_data.substring(1); } try{ *************** *** 441,447 **** private String removeSpaces(String s) { ! while(s.startsWith(" ")) s = s.substring(1); ! while(s.endsWith(" ")) s = s.substring(0, s.length()-1); ! return s; } --- 441,448 ---- private String removeSpaces(String s) { ! String r = s; ! while(r.startsWith(" ")) r = r.substring(1); ! while(r.endsWith(" ")) r = r.substring(0, r.length()-1); ! return r; } Index: DNS.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DNS.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DNS.java 24 Oct 2008 16:18:48 -0000 1.5 --- DNS.java 24 Oct 2008 17:46:42 -0000 1.6 *************** *** 368,373 **** } ! public void addRecord(String dname, String value, int type){ ! dname = dname.toLowerCase(); switch(type){ case DNS_Message.A_QUERY_TYPE: { --- 368,373 ---- } ! public void addRecord(String name, String value, int type){ ! String dname = name.toLowerCase(); switch(type){ case DNS_Message.A_QUERY_TYPE: { *************** *** 455,460 **** } ! public boolean removeRecord(String dname, String value, int type){ ! dname = dname.toLowerCase(); boolean result = false; switch(type){ --- 455,460 ---- } ! public boolean removeRecord(String name, String value, int type){ ! String dname = name.toLowerCase(); boolean result = false; switch(type){ *************** *** 551,567 **** public static boolean isValidName(String name){ if(name.length()==0) return false; ! name = name.toLowerCase(); ! for(int i=0; i<name.length(); i++){ ! char c = name.charAt(i); if(!((c>='0' && c<='9') || (c>='a' && c<='z') || c=='-' || c=='.')) return false; } ! return (DNS.toInAddrArpa(name)==null); // name is not valid IP-address } public static boolean isValidMail(String name){ if(name.length()==0) return false; ! name = name.toLowerCase(); ! for(int i=0; i<name.length(); i++){ ! char c = name.charAt(i); if(!((c>='0' && c<='9') || (c>='a' && c<='z') || c=='-' || c=='.' || c=='@')) return false; } --- 551,567 ---- public static boolean isValidName(String name){ if(name.length()==0) return false; ! String dname = name.toLowerCase(); ! for(int i=0; i<dname.length(); i++){ ! char c = dname.charAt(i); if(!((c>='0' && c<='9') || (c>='a' && c<='z') || c=='-' || c=='.')) return false; } ! return (DNS.toInAddrArpa(dname)==null); // name is not valid IP-address } public static boolean isValidMail(String name){ if(name.length()==0) return false; ! String dname = name.toLowerCase(); ! for(int i=0; i<dname.length(); i++){ ! char c = dname.charAt(i); if(!((c>='0' && c<='9') || (c>='a' && c<='z') || c=='-' || c=='.' || c=='@')) return false; } |
From: Alexander B. <da...@us...> - 2008-10-24 16:19:04
|
Update of /cvsroot/javanetsim/javaNetSim/textUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4280/textUI Modified Files: TextUI.java Log Message: Refactoring && bugfixing Index: TextUI.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/textUI/TextUI.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TextUI.java 21 Oct 2008 11:50:25 -0000 1.6 --- TextUI.java 24 Oct 2008 16:18:48 -0000 1.7 *************** *** 55,71 **** package textUI; ! import java.io.*; ! ! ! ! //import com.sun.corba.se.internal.iiop.messages.IORAddressingInfo; ! ! ! ! import core.*; ! import core.protocolsuite.tcp_ip.*; ! import java.util.*; --- 55,82 ---- package textUI; ! import java.io.BufferedReader; ! import java.io.File; ! import java.io.FileInputStream; ! import java.io.FileOutputStream; ! import java.io.IOException; ! import java.io.InputStreamReader; ! import java.io.ObjectInputStream; ! import java.io.ObjectOutputStream; ! import java.util.Iterator; ! import java.util.Vector; ! import org.omg.CORBA.DynAnyPackage.Invalid; ! import core.CommunicationException; ! import core.InvalidLinkConnectionException; ! import core.InvalidLinkNameException; ! import core.InvalidNetworkInterfaceNameException; ! import core.InvalidNetworkLayerDeviceException; ! import core.InvalidNodeNameException; ! import core.LowLinkException; ! import core.NetworkLayerDevice; ! import core.Simulation; ! import core.Version; ! import core.protocolsuite.tcp_ip.InvalidIPAddressException; *************** *** 951,955 **** System.out.println("Example:"); ! System.out.println(" load drive:directory/filename."+PREFIX); System.out.println(); --- 962,966 ---- System.out.println("Example:"); ! System.out.println(" load drive:directory/filename."+TextUI.PREFIX); System.out.println(); *************** *** 1021,1025 **** System.out.println("If a file name has not been entered the simulation will saved under the default " + ! "file name Sim."+PREFIX); System.out.println("Example:"); --- 1032,1036 ---- System.out.println("If a file name has not been entered the simulation will saved under the default " + ! "file name Sim."+TextUI.PREFIX); System.out.println("Example:"); *************** *** 1815,1821 **** System.out.println("No file name provided using default"); ! } if(!fileName.endsWith(PREFIX)){ ! fileName = fileName + "."+ PREFIX; } --- 1826,1832 ---- System.out.println("No file name provided using default"); ! } if(!fileName.endsWith(TextUI.PREFIX)){ ! fileName = fileName + "."+ TextUI.PREFIX; } *************** *** 1843,1849 **** else{ //if it does exist check it is not empty ! if(!args[1].endsWith(PREFIX)){ ! fileName = args[1]+"."+PREFIX; }else{ --- 1854,1860 ---- else{ //if it does exist check it is not empty ! if(!args[1].endsWith(TextUI.PREFIX)){ ! fileName = args[1]+"."+TextUI.PREFIX; }else{ *************** *** 1987,1991 **** try { ! if(!args[1].endsWith(PREFIX)){ args[1] = args[1] + "."+PREFIX;} //Add PREFIX if not already added --- 1998,2002 ---- try { ! if(!args[1].endsWith(TextUI.PREFIX)){ args[1] = args[1] + "."+TextUI.PREFIX;} //Add PREFIX if not already added *************** *** 2071,2075 **** System.out.println("Insufficient Parameters."); ! System.out.println("Use: " + args[0]+ " <filename> including path eg c:/savedSimFile."+PREFIX+"\n"); } else { // create a new file object based on the args[1] parameter --- 2082,2086 ---- System.out.println("Insufficient Parameters."); ! System.out.println("Use: " + args[0]+ " <filename> including path eg c:/savedSimFile."+TextUI.PREFIX+"\n"); } else { // create a new file object based on the args[1] parameter |
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4280/core/protocolsuite/tcp_ip Modified Files: ARP.java ARPTableEntry.java Application.java DHCPC.java DHCPD.java DHCPPacket.java DNS.java DNS_Message.java Echo.java Echo_tcp.java ExternalProxyApp.java ICMP.java ICMP_packet.java IGMP.java IPV4Address.java IPV6Address.java IP_packet.java InvalidIPAddressException.java InvalidSubnetMaskException.java IpV4.java IpV6.java PosixTelnetClient.java ProtocolStack.java ProtocolStackException.java RARP.java RIP.java SNMP.java TCP_HashTableElement.java TCP_packet.java TCP_session.java Tcp.java Telnet_client.java Telnet_server.java UDP_packet.java Udp.java jnSocket.java socketLayer.java Log Message: Refactoring && bugfixing Index: DHCPPacket.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DHCPPacket.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** DHCPPacket.java 14 Oct 2007 17:19:07 -0000 1.2 --- DHCPPacket.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 224,229 **** String tmp; int optIdx = 0; - byte[] ip = new byte[4]; - try{ --- 224,227 ---- Index: InvalidIPAddressException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/InvalidIPAddressException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InvalidIPAddressException.java 20 Nov 2005 20:30:53 -0000 1.2 --- InvalidIPAddressException.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 36,39 **** --- 36,44 ---- /** + * + */ + private static final long serialVersionUID = -4316043974958474171L; + + /** * Call the super class and passes the message up * @author luke_hamilton Index: socketLayer.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/socketLayer.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** socketLayer.java 18 Oct 2008 19:55:31 -0000 1.14 --- socketLayer.java 24 Oct 2008 16:18:48 -0000 1.15 *************** *** 1,14 **** package core.protocolsuite.tcp_ip; ! import java.io.Serializable; ! import java.util.*; import core.CommunicationException; import core.LowLinkException; - import core.LayerInfo; - import core.Simulation; import core.TransportLayerException; - import core.TransportLayerPortException; - import core.InvalidNetworkLayerDeviceException; - import core.protocolsuite.tcp_ip.ProtocolStack; /** * --- 1,9 ---- package core.protocolsuite.tcp_ip; ! import java.util.Hashtable; ! import core.CommunicationException; import core.LowLinkException; import core.TransportLayerException; /** * *************** *** 34,38 **** public jnSocket get_socket(int sock){ ! return (jnSocket)sockTable.get(sock); } --- 29,33 ---- public jnSocket get_socket(int sock){ ! return sockTable.get(sock); } *************** *** 42,49 **** //((jnSocket)sockTable.get(sock)).src_port = srcPort; <-- WRONG! //jnsock.open_state = true; //call listen(sock) to open socket ! if(jnsock.type == jnsock.UDP_socket){ mParentStack.UDP().bindPort(sock, srcPort); } ! else if(jnsock.type == jnsock.TCP_socket){ mParentStack.TCP().bindPort(sock, srcPort); } --- 37,44 ---- //((jnSocket)sockTable.get(sock)).src_port = srcPort; <-- WRONG! //jnsock.open_state = true; //call listen(sock) to open socket ! if(jnsock.type == jnSocket.UDP_socket){ mParentStack.UDP().bindPort(sock, srcPort); } ! else if(jnsock.type == jnSocket.TCP_socket){ mParentStack.TCP().bindPort(sock, srcPort); } *************** *** 55,62 **** jnSocket jnsock = get_socket(sock); //((jnSocket)sockTable.get(sock)).src_port = srcPort; <-- WRONG! ! if(jnsock.type == jnsock.UDP_socket){ mParentStack.UDP().listen(sock); } ! else if(jnsock.type == jnsock.TCP_socket){ mParentStack.TCP().listen(sock); } --- 50,57 ---- jnSocket jnsock = get_socket(sock); //((jnSocket)sockTable.get(sock)).src_port = srcPort; <-- WRONG! ! if(jnsock.type == jnSocket.UDP_socket){ mParentStack.UDP().listen(sock); } ! else if(jnsock.type == jnSocket.TCP_socket){ mParentStack.TCP().listen(sock); } *************** *** 67,71 **** boolean result = false; jnSocket jnsock = get_socket(sock); ! if(jnsock.type == jnsock.TCP_socket){ jnsock.open_state = true; jnsock.dst_IP = ipaddr; --- 62,66 ---- boolean result = false; jnSocket jnsock = get_socket(sock); ! if(jnsock.type == jnSocket.TCP_socket){ jnsock.open_state = true; jnsock.dst_IP = ipaddr; *************** *** 73,77 **** result = mParentStack.TCP().connect(sock, ipaddr, port); } ! else if(jnsock.type == jnsock.UDP_socket){ jnsock.dst_IP = ipaddr; jnsock.dst_port = port; --- 68,72 ---- result = mParentStack.TCP().connect(sock, ipaddr, port); } ! else if(jnsock.type == jnSocket.UDP_socket){ jnsock.dst_IP = ipaddr; jnsock.dst_port = port; *************** *** 84,91 **** boolean result = false; jnSocket jnsock = get_socket(sock); ! if(jnsock.type == jnsock.TCP_socket){ result = mParentStack.TCP().disconnect(sock); } ! else if(jnsock.type == jnsock.UDP_socket){ close(sock); result = true; --- 79,86 ---- boolean result = false; jnSocket jnsock = get_socket(sock); ! if(jnsock.type == jnSocket.TCP_socket){ result = mParentStack.TCP().disconnect(sock); } ! else if(jnsock.type == jnSocket.UDP_socket){ close(sock); result = true; *************** *** 115,121 **** //if() // udp only write!!! ! ((jnSocket)sockTable.get(sock)).dst_IP = IP; ! ((jnSocket)sockTable.get(sock)).dst_port = port; ! ((jnSocket)sockTable.get(sock)).open_state = true; mParentStack.UDP().sendUDPPacket(sock, IP, port, data); } --- 110,116 ---- //if() // udp only write!!! ! (sockTable.get(sock)).dst_IP = IP; ! (sockTable.get(sock)).dst_port = port; ! (sockTable.get(sock)).open_state = true; mParentStack.UDP().sendUDPPacket(sock, IP, port, data); } *************** *** 123,128 **** public void recv(int sock, String data) throws LowLinkException, TransportLayerException{ if(sock < lastSock){ ! if(((jnSocket)sockTable.get(sock)).open_state == true){ ! ((jnSocket)sockTable.get(sock)).app.RecvData(sock, data); } } --- 118,123 ---- public void recv(int sock, String data) throws LowLinkException, TransportLayerException{ if(sock < lastSock){ ! if((sockTable.get(sock)).open_state == true){ ! (sockTable.get(sock)).app.RecvData(sock, data); } } *************** *** 131,139 **** public void recvFrom(int sock, String IP, int port, String data) throws LowLinkException, TransportLayerException{ if(sock < lastSock){ ! if(((jnSocket)sockTable.get(sock)).open_state == true){ //DEPRECATED IN SOON ! if(((jnSocket)sockTable.get(sock)).type == jnSocket.UDP_socket){ ! ((jnSocket)sockTable.get(sock)).dst_IP = IP; ! ((jnSocket)sockTable.get(sock)).dst_port = port; } //^^^^^^^^^^^^^^^^ --- 126,134 ---- public void recvFrom(int sock, String IP, int port, String data) throws LowLinkException, TransportLayerException{ if(sock < lastSock){ ! if((sockTable.get(sock)).open_state == true){ //DEPRECATED IN SOON ! if((sockTable.get(sock)).type == jnSocket.UDP_socket){ ! (sockTable.get(sock)).dst_IP = IP; ! (sockTable.get(sock)).dst_port = port; } //^^^^^^^^^^^^^^^^ *************** *** 145,149 **** //((jnSocket)sockTable.get(sock)).app.OnConnect(sock); ! ((jnSocket)sockTable.get(sock)).app.RecvData(sock, data); } } --- 140,144 ---- //((jnSocket)sockTable.get(sock)).app.OnConnect(sock); ! (sockTable.get(sock)).app.RecvData(sock, data); } } *************** *** 151,161 **** public void close(int sock) throws TransportLayerException{ ! jnSocket jnsock = (jnSocket)sockTable.get(sock); //((jnSocket)sockTable.get(sock)).app = null; jnsock.open_state = false; ! if(jnsock.type == jnsock.UDP_socket){ mParentStack.UDP().closePort(sock); } ! else if(jnsock.type == jnsock.TCP_socket){ mParentStack.TCP().closePort(sock); } --- 146,156 ---- public void close(int sock) throws TransportLayerException{ ! jnSocket jnsock = sockTable.get(sock); //((jnSocket)sockTable.get(sock)).app = null; jnsock.open_state = false; ! if(jnsock.type == jnSocket.UDP_socket){ mParentStack.UDP().closePort(sock); } ! else if(jnsock.type == jnSocket.TCP_socket){ mParentStack.TCP().closePort(sock); } *************** *** 164,174 **** } public void free(int sock) throws TransportLayerException{ ! jnSocket jnsock = (jnSocket)sockTable.get(sock); jnsock.app = null; if(jnsock.open_state){ ! if(jnsock.type == jnsock.UDP_socket){ mParentStack.UDP().closePort(sock); } ! else if(jnsock.type == jnsock.TCP_socket){ mParentStack.TCP().closePort(sock); } --- 159,169 ---- } public void free(int sock) throws TransportLayerException{ ! jnSocket jnsock = sockTable.get(sock); jnsock.app = null; if(jnsock.open_state){ ! if(jnsock.type == jnSocket.UDP_socket){ mParentStack.UDP().closePort(sock); } ! else if(jnsock.type == jnSocket.TCP_socket){ mParentStack.TCP().closePort(sock); } Index: RARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/RARP.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RARP.java 20 Nov 2005 20:30:53 -0000 1.2 --- RARP.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 41,43 **** --- 41,48 ---- public class RARP implements Serializable{ + + /** + * + */ + private static final long serialVersionUID = -4161782822013539483L; } Index: IPV6Address.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IPV6Address.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IPV6Address.java 20 Nov 2005 20:30:53 -0000 1.2 --- IPV6Address.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 39,41 **** --- 39,46 ---- public class IPV6Address extends IPAddress { + /** + * + */ + private static final long serialVersionUID = -2061562969365362161L; + } Index: InvalidSubnetMaskException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/InvalidSubnetMaskException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InvalidSubnetMaskException.java 20 Nov 2005 20:30:53 -0000 1.2 --- InvalidSubnetMaskException.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 38,41 **** --- 38,46 ---- /** + * + */ + private static final long serialVersionUID = 1794967722522714133L; + + /** * call the super class and passes the message to it * @author bevan_calliess Index: ARPTableEntry.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARPTableEntry.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ARPTableEntry.java 20 Nov 2005 20:30:53 -0000 1.2 --- ARPTableEntry.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 28,33 **** package core.protocolsuite.tcp_ip; - import java.util.*; import java.io.Serializable; /** --- 28,33 ---- package core.protocolsuite.tcp_ip; import java.io.Serializable; + import java.util.GregorianCalendar; /** *************** *** 40,43 **** --- 40,47 ---- public class ARPTableEntry implements Serializable{ + /** + * + */ + private static final long serialVersionUID = -4410133054157725843L; private String mIPAddress; private String mMACAddress; Index: ARP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ARP.java,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** ARP.java 17 Oct 2008 09:10:16 -0000 1.13 --- ARP.java 24 Oct 2008 16:18:48 -0000 1.14 *************** *** 64,78 **** import java.io.Serializable; ! ! import java.util.*; import core.CommunicationException; ! import core.LowLinkException; - import core.Simulation; - import core.LayerInfo; - --- 64,77 ---- import java.io.Serializable; ! import java.util.Calendar; ! import java.util.GregorianCalendar; ! import java.util.Iterator; ! import java.util.Vector; import core.CommunicationException; ! import core.LayerInfo; import core.LowLinkException; import core.Simulation; *************** *** 107,110 **** --- 106,114 ---- public class ARP implements Serializable{ + /** + * + */ + private static final long serialVersionUID = -2918133325615368085L; + private ProtocolStack mParentStack; Index: DHCPD.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DHCPD.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** DHCPD.java 21 Oct 2008 20:28:19 -0000 1.10 --- DHCPD.java 24 Oct 2008 16:18:48 -0000 1.11 *************** *** 4,17 **** package core.protocolsuite.tcp_ip; ! import core.TransportLayerException; ! import core.InvalidNetworkLayerDeviceException; import core.CommunicationException; ! import core.LowLinkException; import core.LayerInfo; import core.Pair; import core.Simulation; ! import java.util.Hashtable; ! import java.util.Enumeration; ! import java.util.Vector; /** --- 4,18 ---- package core.protocolsuite.tcp_ip; ! import java.util.Enumeration; ! import java.util.Hashtable; ! import java.util.Vector; ! import core.CommunicationException; ! import core.InvalidNetworkLayerDeviceException; import core.LayerInfo; + import core.LowLinkException; import core.Pair; import core.Simulation; ! import core.TransportLayerException; /** *************** *** 21,25 **** public class DHCPD extends Application{ ! public class pool{ public String MAC=""; --- 22,31 ---- public class DHCPD extends Application{ ! /** ! * ! */ ! private static final long serialVersionUID = -3558382935460040966L; ! ! public class pool{ public String MAC=""; *************** *** 68,72 **** } ! public void Timer(int code){ } /** --- 74,79 ---- } ! @Override ! public void Timer(int code){ } /** *************** *** 75,79 **** * @version v0.01 */ ! public void Listen() throws TransportLayerException{ // try{ --- 82,87 ---- * @version v0.01 */ ! @Override ! public void Listen() throws TransportLayerException{ // try{ *************** *** 90,94 **** ! public void Accept(int listenSock, int sessionSock){ } --- 98,103 ---- ! @Override ! public void Accept(int listenSock, int sessionSock){ } *************** *** 100,104 **** * @version v0.01 */ ! public void Close() throws TransportLayerException { printLayerInfo("DHCP server", "DHCPD application closed socket."); --- 109,114 ---- * @version v0.01 */ ! @Override ! public void Close() throws TransportLayerException { printLayerInfo("DHCP server", "DHCPD application closed socket."); *************** *** 107,111 **** } ! public void Free() throws TransportLayerException { printLayerInfo("DHCP server", "DHCPD application freed socket."); --- 117,122 ---- } ! @Override ! public void Free() throws TransportLayerException { printLayerInfo("DHCP server", "DHCPD application freed socket."); *************** *** 123,127 **** */ ! public boolean Connect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException, LowLinkException { return false; } --- 134,139 ---- */ ! @Override ! public boolean Connect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException, LowLinkException { return false; } *************** *** 133,137 **** * @version v0.01 */ ! public void OnConnect(int sock){ } --- 145,150 ---- * @version v0.01 */ ! @Override ! public void OnConnect(int sock){ } *************** *** 142,150 **** */ ! public void OnDisconnect(int sock){ } ! public void OnError(int sock, int error){ } --- 155,165 ---- */ ! @Override ! public void OnDisconnect(int sock){ } ! @Override ! public void OnError(int sock, int error){ } *************** *** 157,165 **** */ ! public void SendData(int sock, String Data) throws LowLinkException, TransportLayerException, CommunicationException { } ! public void SendData(int sock, String host, int port, String Data) throws LowLinkException, TransportLayerException, CommunicationException { mParentStack.SL().writeTo(sock, Data, host, port); } --- 172,182 ---- */ ! @Override ! public void SendData(int sock, String Data) throws LowLinkException, TransportLayerException, CommunicationException { } ! @Override ! public void SendData(int sock, String host, int port, String Data) throws LowLinkException, TransportLayerException, CommunicationException { mParentStack.SL().writeTo(sock, Data, host, port); } *************** *** 170,174 **** for(Enumeration e = leases.keys(); e.hasMoreElements();){ IP = (String)e.nextElement(); ! if(((lease)leases.get(IP)).MAC.equals(MAC)){ return IP; } --- 187,191 ---- for(Enumeration e = leases.keys(); e.hasMoreElements();){ IP = (String)e.nextElement(); ! if((leases.get(IP)).MAC.equals(MAC)){ return IP; } *************** *** 184,188 **** String IP; - String Genmask; String Network, PoolNetwork; String PoolName; --- 201,204 ---- *************** *** 190,194 **** for(Enumeration e = pools.keys(); e.hasMoreElements();){ PoolName = (String)e.nextElement(); ! pool p = (pool)pools.get(PoolName); try{ --- 206,210 ---- for(Enumeration e = pools.keys(); e.hasMoreElements();){ PoolName = (String)e.nextElement(); ! pool p = pools.get(PoolName); try{ *************** *** 239,243 **** * @version v0.01 */ ! public void RecvData(int sock, String Data) throws LowLinkException, TransportLayerException { DHCPPacket p = new DHCPPacket(); String IP; --- 255,260 ---- * @version v0.01 */ ! @Override ! public void RecvData(int sock, String Data) throws LowLinkException, TransportLayerException { DHCPPacket p = new DHCPPacket(); String IP; *************** *** 317,321 **** if(IP!=""){ ! lease l = (lease)leases.get(IP); if(l.xid == p.xid){ --- 334,338 ---- if(IP!=""){ ! lease l = leases.get(IP); if(l.xid == p.xid){ Index: IpV6.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IpV6.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** IpV6.java 20 Nov 2005 20:30:53 -0000 1.2 --- IpV6.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 55,58 **** --- 55,59 ---- * */ + @Override public void setIPAddress(String interfaceKey, String inIPAddress){ *************** *** 61,64 **** --- 62,66 ---- * */ + @Override public String getIPAddress(String inInterfaceKey){ return ""; *************** *** 68,71 **** --- 70,74 ---- * */ + @Override public String getDefaultGateway(){ return ""; *************** *** 74,77 **** --- 77,81 ---- * */ + @Override public void setDefaultGateway(String inGatewayAddress){ *************** *** 80,83 **** --- 84,88 ---- * */ + @Override public boolean isInternalIP(String inIPAddress){ return false; Index: UDP_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/UDP_packet.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** UDP_packet.java 13 Oct 2008 12:36:15 -0000 1.6 --- UDP_packet.java 24 Oct 2008 16:18:48 -0000 1.7 *************** *** 56,60 **** package core.protocolsuite.tcp_ip; - import core.Packet; import core.TransportLayerException; --- 56,59 ---- *************** *** 126,130 **** UDP_destPort = indestPort; UDP_srcPort = insrcPort; ! UDP_MessageLength = HEAD_LENGTH; UDP_message = ""; } --- 125,129 ---- UDP_destPort = indestPort; UDP_srcPort = insrcPort; ! UDP_MessageLength = UDP_packet.HEAD_LENGTH; UDP_message = ""; } *************** *** 144,150 **** int length; ! length = HEAD_LENGTH + UDP_message.length(); ! if (length <= MAX_LENGTH) { UDP_message = inUDP_message; --- 143,149 ---- int length; ! length = UDP_packet.HEAD_LENGTH + UDP_message.length(); ! if (length <= UDP_packet.MAX_LENGTH) { UDP_message = inUDP_message; *************** *** 153,157 **** }else { ! throw new TransportLayerException("UDP Error: UDP message exceeds maximum size of " + MAX_LENGTH + " bytes."); } } --- 152,156 ---- }else { ! throw new TransportLayerException("UDP Error: UDP message exceeds maximum size of " + UDP_packet.MAX_LENGTH + " bytes."); } } *************** *** 206,210 **** public int getCheck_Sum() { ! return CHECK_SUM; } --- 205,209 ---- public int getCheck_Sum() { ! return UDP_packet.CHECK_SUM; } *************** *** 218,222 **** public int getProtocolCode() { ! return PTCL; } --- 217,221 ---- public int getProtocolCode() { ! return UDP_packet.PTCL; } *************** *** 245,252 **** --- 244,253 ---- } + @Override public String toBytes(){ return RawtoBytes() + IPtoBytes() + UDPtoBytes(); } + @Override public void fromBytes(String str){ RawfromBytes(str); Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** ProtocolStack.java 18 Oct 2008 19:55:31 -0000 1.73 --- ProtocolStack.java 24 Oct 2008 16:18:48 -0000 1.74 *************** *** 56,73 **** import java.io.Serializable; import core.CommunicationException; import core.InvalidNetworkInterfaceNameException; - import core.LayerInfo; ! import core.Packet; - import core.Simulation; ! ! import core.*; ! ! import java.util.ArrayList; ! import java.util.Vector; /** --- 56,74 ---- import java.io.Serializable; + import java.util.ArrayList; + import java.util.Vector; import core.CommunicationException; + import core.InvalidDefaultGatewayException; import core.InvalidNetworkInterfaceNameException; import core.LayerInfo; ! import core.LowLinkException; ! import core.NetworkInterface; ! import core.NetworkLayerDevice; ! import core.Node; import core.Packet; import core.Simulation; ! import core.TransportLayerException; ! import core.TransportLayerPortException; /** *************** *** 93,104 **** public class ProtocolStack extends core.ProtocolStack implements Serializable { private RARP mRARPprotocol = null; private ICMP mICMPprotocol = null; - private IGMP mIGMPprotocol = null; - - private SNMP mSNMPprotocol = null; - private ARP mARPprotocol = null; --- 94,106 ---- public class ProtocolStack extends core.ProtocolStack implements Serializable { + /** + * + */ + private static final long serialVersionUID = 5463115741095263969L; + private RARP mRARPprotocol = null; private ICMP mICMPprotocol = null; private ARP mARPprotocol = null; *************** *** 761,764 **** --- 763,767 ---- */ + @Override public void receivePacket(Packet inPacket, String inInterface) throws LowLinkException { *************** *** 969,975 **** if (ip.isBroadcast()) { - // disable broadcasts - NetworkLayerDevice temp = (NetworkLayerDevice) mParentNode; - ArrayList nics = mParentNode.getAllInterfacesNames(); --- 972,975 ---- *************** *** 1354,1358 **** public String getSrcIP() { ! Node temp = (Node) mParentNode; ArrayList nics = temp.getAllInterfacesNames(); String IP = ""; --- 1354,1358 ---- public String getSrcIP() { ! Node temp = mParentNode; ArrayList nics = temp.getAllInterfacesNames(); String IP = ""; *************** *** 1375,1378 **** --- 1375,1379 ---- } + @Override public void intUP(String iface) { Index: RIP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/RIP.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** RIP.java 26 Sep 2008 17:53:49 -0000 1.4 --- RIP.java 24 Oct 2008 16:18:48 -0000 1.5 *************** *** 9,12 **** --- 9,13 ---- import java.util.StringTokenizer; import java.util.Vector; + import core.CommunicationException; import core.InvalidNetworkLayerDeviceException; *************** *** 32,35 **** --- 33,40 ---- public class RIP extends Application{ + /** + * + */ + private static final long serialVersionUID = 4031443419981254419L; private static final int UDP_LISTENING_PORT=520;//ïðîñëóøèâàåìûé ïîðò íà èíòåðôåéñå (ïî ñòàíäàðòó udp 520) private static final String REQUEST_MESSAGE="1|2|0|2|0||||16";//request-ñîîáùåíèå *************** *** 49,53 **** /** Creates a new instance of RIP */ public RIP(ProtocolStack inParentStack, long UID) { ! super(inParentStack, UDP_LISTENING_PORT, 1, UID); clientPort=listenPort;//â ïðèíöèïå îò clientPort íè÷åãî íå çàâèñèò, âñ¸ ðàâíî îí ðàâåí 3000 :) interfaces=new Hashtable<Integer,String>(); --- 54,58 ---- /** Creates a new instance of RIP */ public RIP(ProtocolStack inParentStack, long UID) { ! super(inParentStack, RIP.UDP_LISTENING_PORT, 1, UID); clientPort=listenPort;//â ïðèíöèïå îò clientPort íè÷åãî íå çàâèñèò, âñ¸ ðàâíî îí ðàâåí 3000 :) interfaces=new Hashtable<Integer,String>(); *************** *** 113,117 **** if(!found){ int appSocket=mParentStack.SL().socket(jnSocket.UDP_socket, this); - Integer[] j=new Integer[]{appSocket,0}; appSockets.put(appSocket,false); this.interfaces.put(appSocket, iface); --- 118,121 ---- *************** *** 175,182 **** protInfo.setDataType("RIP Data"); protInfo.setLayer("Application "); ! protInfo.setDescription("Sending RIP broadcast request message '" +REQUEST_MESSAGE); Simulation.addLayerInfo(protInfo); //TODO 255.255.255.255 èñïðàâèòü íà ÎÄÍÓ ïîäñåòü (192.168.0.255) ! mParentStack.SL().writeTo(localSocket,REQUEST_MESSAGE, "255.255.255.255",listenPort); blockSockets=false; }catch(Exception e){ --- 179,186 ---- protInfo.setDataType("RIP Data"); protInfo.setLayer("Application "); ! protInfo.setDescription("Sending RIP broadcast request message '" +RIP.REQUEST_MESSAGE); Simulation.addLayerInfo(protInfo); //TODO 255.255.255.255 èñïðàâèòü íà ÎÄÍÓ ïîäñåòü (192.168.0.255) ! mParentStack.SL().writeTo(localSocket,RIP.REQUEST_MESSAGE, "255.255.255.255",listenPort); blockSockets=false; }catch(Exception e){ *************** *** 280,284 **** String networkAddress=msg[i]; String mask=msg[i+1]; - String nextHop=msg[i+2]; String metric=msg[i+3]; --- 284,287 ---- *************** *** 397,401 **** Simulation.addLayerInfo(protInfo); ! if (Connect(dstIP, UDP_LISTENING_PORT)) mParentStack.SL().writeTo(localSocket,data, dstIP,listenPort); blockSockets=false; --- 400,404 ---- Simulation.addLayerInfo(protInfo); ! if (Connect(dstIP, RIP.UDP_LISTENING_PORT)) mParentStack.SL().writeTo(localSocket,data, dstIP,listenPort); blockSockets=false; *************** *** 437,440 **** --- 440,444 ---- * */ + @Override public void Timer(int code){ //runs++; *************** *** 479,488 **** --- 483,499 ---- * */ + @Override public void Listen() throws TransportLayerException {} + @Override public void Accept(int listenSock, int sessionSock) {} + @Override public void OnConnect(int sock){} + @Override public void OnDisconnect(int sock){} + @Override public void OnError(int sock, int error){} + @Override public void Close() throws TransportLayerException{} + @Override public void Free() throws TransportLayerException{} *************** *** 497,500 **** --- 508,512 ---- * @version v0.01 */ + @Override public boolean Connect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException, LowLinkException { return mParentStack.SL().connect(appSock, Host, port); *************** *** 509,512 **** --- 521,525 ---- */ + @Override public void SendData(int sock, String Data) throws LowLinkException, TransportLayerException, CommunicationException{ blockSockets=true; *************** *** 523,526 **** --- 536,540 ---- * @version v0.01 */ + @Override public void RecvData(int localSocket, String Data) throws LowLinkException, TransportLayerException { Index: TCP_HashTableElement.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/TCP_HashTableElement.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TCP_HashTableElement.java 23 Sep 2008 15:22:15 -0000 1.6 --- TCP_HashTableElement.java 24 Oct 2008 16:18:48 -0000 1.7 *************** *** 3,22 **** //import java.io.Serializable; ! import java.util.*; import core.Error; - /*import core.Simulation; - - import core.TransportLayerException; - - import core.TransportLayerPortException; - - import core.InvalidNetworkLayerDeviceException; - - import core.protocolsuite.tcp_ip.ProtocolStack;*/ - - import java.util.Timer; - //import java.util.TimerTask; --- 3,13 ---- //import java.io.Serializable; ! import java.util.Enumeration; ! import java.util.Hashtable; ! import java.util.Timer; ! import java.util.Vector; import core.Error; //import java.util.TimerTask; *************** *** 110,118 **** public TCP_HashTableElement(){ ! Element_id++; } public int returnID(){ ! return Element_id; } --- 101,109 ---- public TCP_HashTableElement(){ ! TCP_HashTableElement.Element_id++; } public int returnID(){ ! return TCP_HashTableElement.Element_id; } Index: ICMP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ICMP.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ICMP.java 3 Oct 2008 22:29:10 -0000 1.8 --- ICMP.java 24 Oct 2008 16:18:48 -0000 1.9 *************** *** 33,44 **** import java.util.Hashtable; - // import core.protocolsuite.tcp_ip.ICMP_packet; - import core.CommunicationException; - - import core.LowLinkException; - import core.LayerInfo; ! import core.Simulation; --- 33,39 ---- import java.util.Hashtable; import core.CommunicationException; import core.LayerInfo; ! import core.LowLinkException; import core.Simulation; *************** *** 59,62 **** --- 54,62 ---- public class ICMP implements Serializable { + /** + * + */ + private static final long serialVersionUID = 4349938325413984166L; + private ProtocolStack mParentStack; Index: ICMP_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ICMP_packet.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ICMP_packet.java 28 Sep 2008 17:11:47 -0000 1.6 --- ICMP_packet.java 24 Oct 2008 16:18:48 -0000 1.7 *************** *** 117,124 **** --- 117,126 ---- } + @Override public String toBytes(){ return RawtoBytes() + IPtoBytes() + ICMPtoBytes(); } + @Override public void fromBytes(String str){ RawfromBytes(str); Index: DNS.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DNS.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DNS.java 19 Oct 2008 21:40:19 -0000 1.4 --- DNS.java 24 Oct 2008 16:18:48 -0000 1.5 *************** *** 8,23 **** package core.protocolsuite.tcp_ip; - import core.Pair; - import core.TransportLayerException; - import core.InvalidNetworkLayerDeviceException; - import core.CommunicationException; - import core.LowLinkException; - import core.LayerInfo; - import core.Simulation; - //import java.util.Hashtable; import java.util.Hashtable; import java.util.LinkedList; import java.util.Vector; /** * --- 8,23 ---- package core.protocolsuite.tcp_ip; import java.util.Hashtable; import java.util.LinkedList; import java.util.Vector; + import core.CommunicationException; + import core.InvalidNetworkLayerDeviceException; + import core.LayerInfo; + import core.LowLinkException; + import core.Pair; + import core.Simulation; + import core.TransportLayerException; + /** * *************** *** 27,31 **** { ! long utc1; public int received; public Hashtable<String,Vector<String>> records_a = new Hashtable<String,Vector<String>>(); --- 27,35 ---- { ! /** ! * ! */ ! private static final long serialVersionUID = 2930522265631314366L; ! long utc1; public int received; public Hashtable<String,Vector<String>> records_a = new Hashtable<String,Vector<String>>(); *************** *** 49,62 **** { super(inParentStack, listenPort, appType, UID); ! appSock = mParentStack.SL().socket(jnSocket.UDP_socket, this); ! int fake = 0; } ! public void Timer(int code){ } /** * This method start to listen on application port **/ ! public void Listen() throws TransportLayerException{ // try{ --- 53,67 ---- { super(inParentStack, listenPort, appType, UID); ! appSock = mParentStack.SL().socket(jnSocket.UDP_socket, this); } ! @Override ! public void Timer(int code){ } /** * This method start to listen on application port **/ ! @Override ! public void Listen() throws TransportLayerException{ // try{ *************** *** 72,76 **** } ! public void Accept(int listenSock, int sessionSock){ } --- 77,82 ---- } ! @Override ! public void Accept(int listenSock, int sessionSock){ } *************** *** 84,88 **** * @version v0.01 */ ! public void Close() throws TransportLayerException { if(appType == 0){ --- 90,95 ---- * @version v0.01 */ ! @Override ! public void Close() throws TransportLayerException { if(appType == 0){ *************** *** 95,99 **** } ! public void Free() throws TransportLayerException { if(appType == 0){ --- 102,107 ---- } ! @Override ! public void Free() throws TransportLayerException { if(appType == 0){ *************** *** 115,119 **** */ ! public boolean Connect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException, LowLinkException { //clientPort = mParentStack.SL().reserveUDPPort(this, sdHost, sdPort); --- 123,128 ---- */ ! @Override ! public boolean Connect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException, LowLinkException { //clientPort = mParentStack.SL().reserveUDPPort(this, sdHost, sdPort); *************** *** 127,131 **** * @version v0.01 */ ! public void OnConnect(int sock){ } --- 136,141 ---- * @version v0.01 */ ! @Override ! public void OnConnect(int sock){ } *************** *** 136,144 **** */ ! public void OnDisconnect(int sock){ } ! public void OnError(int sock, int error){ } --- 146,156 ---- */ ! @Override ! public void OnDisconnect(int sock){ } ! @Override ! public void OnError(int sock, int error){ } *************** *** 161,165 **** } ! public void SendData(int sock, String mess) throws LowLinkException, TransportLayerException, CommunicationException { //send request A-type and other dafault prametres --- 173,178 ---- } ! @Override ! public void SendData(int sock, String mess) throws LowLinkException, TransportLayerException, CommunicationException { //send request A-type and other dafault prametres *************** *** 190,194 **** * @version v0.01 */ ! public void RecvData(int sock, String Data) throws LowLinkException, TransportLayerException { received++; //processing the protocol doings. --- 203,208 ---- * @version v0.01 */ ! @Override ! public void RecvData(int sock, String Data) throws LowLinkException, TransportLayerException { received++; //processing the protocol doings. *************** *** 542,546 **** if(!((c>='0' && c<='9') || (c>='a' && c<='z') || c=='-' || c=='.')) return false; } ! return (toInAddrArpa(name)==null); // name is not valid IP-address } --- 556,560 ---- if(!((c>='0' && c<='9') || (c>='a' && c<='z') || c=='-' || c=='.')) return false; } ! return (DNS.toInAddrArpa(name)==null); // name is not valid IP-address } Index: TCP_session.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/TCP_session.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** TCP_session.java 11 Nov 2007 19:51:57 -0000 1.11 --- TCP_session.java 24 Oct 2008 16:18:48 -0000 1.12 *************** *** 10,17 **** package core.protocolsuite.tcp_ip; import java.util.Hashtable; - import java.util.PriorityQueue; import java.util.Iterator; ! import java.util.Enumeration; /** --- 10,17 ---- package core.protocolsuite.tcp_ip; + import java.util.Enumeration; import java.util.Hashtable; import java.util.Iterator; ! import java.util.PriorityQueue; /** *************** *** 50,54 **** private int next_pass_seq_num = -1; private int last_ack_number=0; //last sequence number value of the segment that has been passed upstairs ! private int state = CLOSED; public long last_timer = -1; --- 50,54 ---- private int next_pass_seq_num = -1; private int last_ack_number=0; //last sequence number value of the segment that has been passed upstairs ! private int state = TCP_session.CLOSED; public long last_timer = -1; Index: ProtocolStackException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStackException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ProtocolStackException.java 20 Nov 2005 20:30:53 -0000 1.2 --- ProtocolStackException.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 38,41 **** --- 38,46 ---- public class ProtocolStackException extends SimulationException{ /** + * + */ + private static final long serialVersionUID = 346028755139688513L; + + /** * This method is called when there is an error within the * ProtocolStack. The idea is that this error should never occur. Index: DNS_Message.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DNS_Message.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DNS_Message.java 18 Oct 2008 19:55:31 -0000 1.3 --- DNS_Message.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 6,18 **** package core.protocolsuite.tcp_ip; - import java.util.Hashtable; import java.util.Vector; - - //import javax.swing.RowSorter.SortKey; - import sun.misc.Compare; - import sun.misc.Sort; - import sun.reflect.LangReflectAccess; - /** * --- 6,11 ---- *************** *** 44,51 **** //create DNS-message whith known simple parametres if(new_id==0){ ! if (Counter == 16777216) ! Counter = 0; ! Counter++; ! id = Counter; } else{ --- 37,44 ---- //create DNS-message whith known simple parametres if(new_id==0){ ! if (DNS_Message.Counter == 16777216) ! DNS_Message.Counter = 0; ! DNS_Message.Counter++; ! id = DNS_Message.Counter; } else{ *************** *** 112,116 **** ! public String toString() { String resStr = IntToStr2(id) + flags + IntToStr2(queries.size()) + IntToStr2(answers.size()) + IntToStr2(accesses.size()) + IntToStr2(additionals.size()); --- 105,110 ---- ! @Override ! public String toString() { String resStr = IntToStr2(id) + flags + IntToStr2(queries.size()) + IntToStr2(answers.size()) + IntToStr2(accesses.size()) + IntToStr2(additionals.size()); *************** *** 161,165 **** String resQuery = createDomainName(qu.name); resQuery += IntToStr2(qu.type); ! resQuery += IntToStr2(CLASS_IN); return resQuery; } --- 155,159 ---- String resQuery = createDomainName(qu.name); resQuery += IntToStr2(qu.type); ! resQuery += IntToStr2(DNS_Message.CLASS_IN); return resQuery; } *************** *** 168,172 **** { String resAnswer = createQuery(ans); ! resAnswer += IntToStr4(TTL_DEFAULT); switch(ans.type){ case A_QUERY_TYPE: { --- 162,166 ---- { String resAnswer = createQuery(ans); ! resAnswer += IntToStr4(DNS_Message.TTL_DEFAULT); switch(ans.type){ case A_QUERY_TYPE: { *************** *** 320,336 **** static public int getTypeInt(String t){ if(t.equalsIgnoreCase("a")){ ! return A_QUERY_TYPE; } else if(t.equalsIgnoreCase("ptr")){ ! return PTR_QUERY_TYPE; } else if(t.equalsIgnoreCase("cname")){ ! return CNAME_QUERY_TYPE; } else if(t.equalsIgnoreCase("hinfo")){ ! return HINFO_QUERY_TYPE; } else if(t.equalsIgnoreCase("mx")){ ! return MX_QUERY_TYPE; } return 0; --- 314,330 ---- static public int getTypeInt(String t){ if(t.equalsIgnoreCase("a")){ ! return DNS_Message.A_QUERY_TYPE; } else if(t.equalsIgnoreCase("ptr")){ ! return DNS_Message.PTR_QUERY_TYPE; } else if(t.equalsIgnoreCase("cname")){ ! return DNS_Message.CNAME_QUERY_TYPE; } else if(t.equalsIgnoreCase("hinfo")){ ! return DNS_Message.HINFO_QUERY_TYPE; } else if(t.equalsIgnoreCase("mx")){ ! return DNS_Message.MX_QUERY_TYPE; } return 0; *************** *** 338,354 **** static public String getTypeString(int t){ ! if(t == A_QUERY_TYPE){ return "A"; } ! else if(t == PTR_QUERY_TYPE){ return "PTR"; } ! else if(t == CNAME_QUERY_TYPE){ return "CNAME"; } ! else if(t == HINFO_QUERY_TYPE){ return "HINFO"; } ! else if(t == MX_QUERY_TYPE){ return "MX"; } --- 332,348 ---- static public String getTypeString(int t){ ! if(t == DNS_Message.A_QUERY_TYPE){ return "A"; } ! else if(t == DNS_Message.PTR_QUERY_TYPE){ return "PTR"; } ! else if(t == DNS_Message.CNAME_QUERY_TYPE){ return "CNAME"; } ! else if(t == DNS_Message.HINFO_QUERY_TYPE){ return "HINFO"; } ! else if(t == DNS_Message.MX_QUERY_TYPE){ return "MX"; } Index: Telnet_client.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Telnet_client.java,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** Telnet_client.java 26 Sep 2008 17:53:49 -0000 1.17 --- Telnet_client.java 24 Oct 2008 16:18:48 -0000 1.18 *************** *** 7,20 **** package core.protocolsuite.tcp_ip; - import core.TransportLayerException; - import core.InvalidNetworkLayerDeviceException; - import core.CommunicationException; - import core.LowLinkException; - import core.LayerInfo; - import core.Packet; - import core.Simulation; import guiUI.TelnetEmulator; import core.ApplicationLayerDevice; ! import core.Error; /** --- 7,16 ---- package core.protocolsuite.tcp_ip; import guiUI.TelnetEmulator; import core.ApplicationLayerDevice; ! import core.CommunicationException; ! import core.InvalidNetworkLayerDeviceException; ! import core.LowLinkException; ! import core.TransportLayerException; /** *************** *** 25,41 **** public class Telnet_client extends Application{ ! private int ConnectionAttempts=1; ! private ApplicationLayerDevice mDevice; ! private TelnetEmulator terminal; ! private boolean already_closed = false; ! /** Creates a new instance of Telnet Server */ public Telnet_client(ApplicationLayerDevice dev, ProtocolStack inParentStack, int listenPort, int appType, long UID) { super(inParentStack, listenPort, appType, UID); - mDevice = dev; appSock = mParentStack.SL().socket(jnSocket.TCP_socket, this); } ! public void Timer(int code){ } /** --- 21,37 ---- public class Telnet_client extends Application{ ! /** ! * ! */ ! private static final long serialVersionUID = -5670018907094576728L; ! private TelnetEmulator terminal; /** Creates a new instance of Telnet Server */ public Telnet_client(ApplicationLayerDevice dev, ProtocolStack inParentStack, int listenPort, int appType, long UID) { super(inParentStack, listenPort, appType, UID); appSock = mParentStack.SL().socket(jnSocket.TCP_socket, this); } ! @Override ! public void Timer(int code){ } /** *************** *** 44,52 **** * @version v0.01 */ ! public void Listen() throws TransportLayerException{ throw new TransportLayerException("Cannot bind port " + listenPort + "."); } ! public void Accept(int listenSock, int sessionSock){ } --- 40,50 ---- * @version v0.01 */ ! @Override ! public void Listen() throws TransportLayerException{ throw new TransportLayerException("Cannot bind port " + listenPort + "."); } ! @Override ! public void Accept(int listenSock, int sessionSock){ } *************** *** 59,68 **** * @version v0.01 */ ! public void Close() throws TransportLayerException { mParentStack.SL().close(appSock); } ! public void Free() throws TransportLayerException { mParentStack.SL().free(appSock); --- 57,68 ---- * @version v0.01 */ ! @Override ! public void Close() throws TransportLayerException { mParentStack.SL().close(appSock); } ! @Override ! public void Free() throws TransportLayerException { mParentStack.SL().free(appSock); *************** *** 78,82 **** */ ! public boolean Connect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException, LowLinkException { printLayerInfo("Connecting to host " + Host + ":"+ port +". Please wait..."); --- 78,83 ---- */ ! @Override ! public boolean Connect(String Host, int port) throws TransportLayerException, InvalidNetworkLayerDeviceException, CommunicationException, LowLinkException { printLayerInfo("Connecting to host " + Host + ":"+ port +". Please wait..."); *************** *** 98,102 **** * @version v0.01 */ ! public void OnConnect(int sock){ } --- 99,104 ---- * @version v0.01 */ ! @Override ! public void OnConnect(int sock){ } *************** *** 107,111 **** */ ! public void OnDisconnect(int sock){ terminal.recvData("Connection refused"); terminal.close(); --- 109,114 ---- */ ! @Override ! public void OnDisconnect(int sock){ terminal.recvData("Connection refused"); terminal.close(); *************** *** 113,117 **** } ! public void OnError(int sock, int error){ switch(error){ case -1: { --- 116,121 ---- } ! @Override ! public void OnError(int sock, int error){ switch(error){ case -1: { *************** *** 133,137 **** */ ! public void SendData(int sock, String Data) throws LowLinkException, TransportLayerException, CommunicationException { mParentStack.SL().write(sock, Data); --- 137,142 ---- */ ! @Override ! public void SendData(int sock, String Data) throws LowLinkException, TransportLayerException, CommunicationException { mParentStack.SL().write(sock, Data); *************** *** 147,151 **** * @version v0.02 */ ! public void RecvData(int sock, String Data) throws LowLinkException, TransportLayerException { printLayerInfo("Client: Recieving message '" + Data + "' from server."); terminal.recvData(Data); --- 152,157 ---- * @version v0.02 */ ! @Override ! public void RecvData(int sock, String Data) throws LowLinkException, TransportLayerException { printLayerInfo("Client: Recieving message '" + Data + "' from server."); terminal.recvData(Data); Index: Udp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Udp.java,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** Udp.java 23 Sep 2008 15:22:15 -0000 1.44 --- Udp.java 24 Oct 2008 16:18:48 -0000 1.45 *************** *** 30,41 **** import java.io.Serializable; ! import java.util.*; ! import core.LowLinkException; import core.LayerInfo; import core.Simulation; import core.TransportLayerException; import core.TransportLayerPortException; - import core.InvalidNetworkLayerDeviceException; - import core.protocolsuite.tcp_ip.ProtocolStack; /** --- 30,42 ---- import java.io.Serializable; ! import java.util.Enumeration; ! import java.util.Hashtable; ! ! import core.InvalidNetworkLayerDeviceException; import core.LayerInfo; + import core.LowLinkException; import core.Simulation; import core.TransportLayerException; import core.TransportLayerPortException; /** *************** *** 60,64 **** public class Udp implements Serializable { ! private Hashtable sessionTable = new Hashtable(); private Object sessionTable_lock = new Object(); private ProtocolStack mParentStack; --- 61,69 ---- public class Udp implements Serializable { ! /** ! * ! */ ! private static final long serialVersionUID = -3018809624034201712L; ! private Hashtable sessionTable = new Hashtable(); private Object sessionTable_lock = new Object(); private ProtocolStack mParentStack; *************** *** 72,78 **** private static final int PORT_QUANT=100; private static final int PORT_START_NUMBER=3000; - private static final int PORT_INIT = -1; //used in ListenPort && AlreadyListens - - /** * This method assigns the ParentStack --- 77,80 ---- *************** *** 245,251 **** { //lets try to reserve any free port ! int number=PORT_START_NUMBER; boolean Reserved=false; ! while ( (number<PORT_START_NUMBER+PORT_QUANT) && !(Reserved) ) { Elm = getSession(jnSocket.genUDPkey(number)); --- 247,253 ---- { //lets try to reserve any free port ! int number=Udp.PORT_START_NUMBER; boolean Reserved=false; ! while ( (number<Udp.PORT_START_NUMBER+Udp.PORT_QUANT) && !(Reserved) ) { Elm = getSession(jnSocket.genUDPkey(number)); Index: IP_packet.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IP_packet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IP_packet.java 13 Oct 2008 21:20:21 -0000 1.7 --- IP_packet.java 24 Oct 2008 16:18:48 -0000 1.8 *************** *** 244,247 **** --- 244,248 ---- **/ + @Override public Packet getData() *************** *** 252,260 **** } ! public String toBytes(){ return RawtoBytes() + IPtoBytes(); } ! public void fromBytes(String str){ RawfromBytes(str); IPfromBytes(str); --- 253,263 ---- } ! @Override ! public String toBytes(){ return RawtoBytes() + IPtoBytes(); } ! @Override ! public void fromBytes(String str){ RawfromBytes(str); IPfromBytes(str); Index: IPV4Address.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IPV4Address.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** IPV4Address.java 19 Oct 2008 21:40:19 -0000 1.7 --- IPV4Address.java 24 Oct 2008 16:18:48 -0000 1.8 *************** *** 39,42 **** --- 39,46 ---- public class IPV4Address extends IPAddress { + /** + * + */ + private static final long serialVersionUID = -2093944356499761071L; //These an the default binary subnet mask address for class A,B and C network private static final String CLASS_A_BINARY ="11111111000000000000000000000000"; *************** *** 50,56 **** public static final int NO_CLASS = 4; - //This is the saved class type for the IP/subnet mask address's - private int ClassType; - /** * Creates a new IPV4Address object containing the IP address saved in binary --- 54,57 ---- *************** *** 83,87 **** */ public String getSubnetMask() { ! return toDecimalString(binarySubnetMask); } --- 84,88 ---- */ public String getSubnetMask() { ! return IPV4Address.toDecimalString(binarySubnetMask); } *************** *** 204,216 **** if (firstoctet.intValue() >=1 && firstoctet.intValue() <=127){ //test for class A ! return CLASS_A_TYPE; } else if(firstoctet.intValue() >=128 && firstoctet.intValue() <=191){//test for class B ! return CLASS_B_TYPE; } else if (firstoctet.intValue() >=192 && firstoctet.intValue() <=223){//test for class C ! return CLASS_C_TYPE; }else { ! return NO_CLASS; } //return 0; UGLY FIX --- 205,217 ---- if (firstoctet.intValue() >=1 && firstoctet.intValue() <=127){ //test for class A ! return IPV4Address.CLASS_A_TYPE; } else if(firstoctet.intValue() >=128 && firstoctet.intValue() <=191){//test for class B ! return IPV4Address.CLASS_B_TYPE; } else if (firstoctet.intValue() >=192 && firstoctet.intValue() <=223){//test for class C ! return IPV4Address.CLASS_C_TYPE; }else { ! return IPV4Address.NO_CLASS; } //return 0; UGLY FIX *************** *** 227,236 **** public static String getDefaultSubnetMask(String inDecimalIp){ ! if(getDefaultSubnetMaskClassType(inDecimalIp) == CLASS_A_TYPE) ! return toDecimalString(CLASS_A_BINARY); ! else if(getDefaultSubnetMaskClassType(inDecimalIp) == CLASS_B_TYPE) ! return toDecimalString(CLASS_B_BINARY); ! else if(getDefaultSubnetMaskClassType(inDecimalIp) == CLASS_C_TYPE) ! return toDecimalString(CLASS_C_BINARY); return null; //This should never happen } --- 228,237 ---- public static String getDefaultSubnetMask(String inDecimalIp){ ! if(IPV4Address.getDefaultSubnetMaskClassType(inDecimalIp) == IPV4Address.CLASS_A_TYPE) ! return IPV4Address.toDecimalString(IPV4Address.CLASS_A_BINARY); ! else if(IPV4Address.getDefaultSubnetMaskClassType(inDecimalIp) == IPV4Address.CLASS_B_TYPE) ! ... [truncated message content] |
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4280/guiUI Modified Files: ApplicationLayerDevice.java DataLinkLayerDevice.java EthPortProperties.java GuiCSUDSU.java GuiExternalProxy.java GuiHub.java GuiLaptop.java GuiMultilayerSwitch.java GuiNode.java GuiPC.java GuiPrinter.java GuiRouter.java GuiSwitch.java GuiWirelessAP.java HelpWindow.java InfoBox.java LinkDialog.java LinkLayerPanel.java LinkProperties.java MainScreen.java MenuBar.java NetworkLayerDevice.java NodePropertiesDialog.java PingDialog.java PosixTelnetClientGUI.java SNMPSendDataDialog.java SandBox.java SerPortProperties.java SetTCPIPPropertiesDialog.java SimulationToolBar.java SplashWindow.java StandardToolBar.java TelnetEmulator.java Terminal.java ToolBar.java WANPortProperties.java Log Message: Refactoring && bugfixing Index: TelnetEmulator.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/TelnetEmulator.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TelnetEmulator.java 1 Oct 2007 04:58:13 -0000 1.12 --- TelnetEmulator.java 24 Oct 2008 16:18:48 -0000 1.13 *************** *** 11,29 **** package guiUI; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; ! import java.awt.Color; ! import java.awt.event.WindowEvent; ! import java.awt.event.KeyAdapter; ! import java.awt.event.KeyEvent; ! import core.protocolsuite.tcp_ip.Telnet_client; import core.CommunicationException; - import core.LowLinkException; import core.InvalidNetworkLayerDeviceException; import core.TransportLayerException; ! import java.awt.Font; ! import java.awt.event.KeyListener; /** --- 11,31 ---- package guiUI; + import java.awt.Color; + import java.awt.Font; + import java.awt.event.KeyAdapter; + import java.awt.event.KeyEvent; + import java.awt.event.KeyListener; + import java.awt.event.WindowEvent; + import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; ! import core.CommunicationException; import core.InvalidNetworkLayerDeviceException; + import core.LowLinkException; import core.TransportLayerException; ! import core.protocolsuite.tcp_ip.Telnet_client; /** *************** *** 32,36 **** */ public class TelnetEmulator extends JFrame { ! private final Telnet_client telnet; private JPanel panel; private JScrollPane scrollpane; --- 34,42 ---- */ public class TelnetEmulator extends JFrame { ! /** ! * ! */ ! private static final long serialVersionUID = -6645304083337196382L; ! private final Telnet_client telnet; private JPanel panel; private JScrollPane scrollpane; *************** *** 68,74 **** this.addKeyListener( kl = new KeyAdapter(){ // terminal.addKeyListener( kl = new KeyAdapter(){ ! public void keyPressed(KeyEvent e) { char c = e.getKeyChar(); ! if((int)c<65535) { String s; switch(c){ --- 74,81 ---- this.addKeyListener( kl = new KeyAdapter(){ // terminal.addKeyListener( kl = new KeyAdapter(){ ! @Override ! public void keyPressed(KeyEvent e) { char c = e.getKeyChar(); ! if(c<65535) { String s; switch(c){ *************** *** 97,101 **** this.addWindowListener( new java.awt.event.WindowAdapter() { ! public void windowClosing(WindowEvent winEvt) { exitWindow(); } --- 104,109 ---- this.addWindowListener( new java.awt.event.WindowAdapter() { ! @Override ! public void windowClosing(WindowEvent winEvt) { exitWindow(); } Index: Terminal.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/Terminal.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** Terminal.java 22 Oct 2008 16:15:30 -0000 1.20 --- Terminal.java 24 Oct 2008 16:18:48 -0000 1.21 *************** *** 11,40 **** package guiUI; - import core.ApplicationLayerDevice; - import core.CommunicationException; - import core.DeviceConfig; - import core.InvalidNetworkLayerDeviceException; - import core.LowLinkException; - import core.TransportLayerException; - - import javax.swing.JFrame; - import javax.swing.JPanel; - import javax.swing.JTextField; - import javax.swing.JScrollPane; - import javax.swing.JTextArea; - import javax.swing.InputVerifier; import java.awt.BorderLayout; import java.awt.Color; - import java.awt.event.WindowEvent; import java.awt.Font; import java.awt.event.KeyListener; import java.util.Vector; ! import core.CommandInterface; ! import core.Version; ! import java.awt.event.KeyEvent; import javax.swing.JComponent; ! import core.Pair; import core.CommandProcessor; import core.InvalidNetworkInterfaceNameException; import core.CommandInterface.Modes; import core.protocolsuite.tcp_ip.DNS; --- 11,41 ---- package guiUI; import java.awt.BorderLayout; import java.awt.Color; import java.awt.Font; + import java.awt.event.KeyEvent; import java.awt.event.KeyListener; + import java.awt.event.WindowEvent; import java.util.Vector; ! ! import javax.swing.InputVerifier; import javax.swing.JComponent; ! import javax.swing.JFrame; ! import javax.swing.JPanel; ! import javax.swing.JScrollPane; ! import javax.swing.JTextArea; ! import javax.swing.JTextField; ! ! import core.ApplicationLayerDevice; ! import core.CommandInterface; import core.CommandProcessor; + import core.CommunicationException; + import core.DeviceConfig; import core.InvalidNetworkInterfaceNameException; + import core.InvalidNetworkLayerDeviceException; + import core.LowLinkException; + import core.Pair; + import core.TransportLayerException; + import core.Version; import core.CommandInterface.Modes; import core.protocolsuite.tcp_ip.DNS; *************** *** 49,53 **** public class Terminal extends JFrame { ! protected final static int DEF_MODE = 0; protected final static int IF_MODE = 1; protected final static int ACL_MODE = 2; --- 50,58 ---- public class Terminal extends JFrame { ! /** ! * ! */ ! private static final long serialVersionUID = -1484879879775885583L; ! protected final static int DEF_MODE = 0; protected final static int IF_MODE = 1; protected final static int ACL_MODE = 2; *************** *** 65,71 **** CmdVerifier cmdverifier = new CmdVerifier(); private Modes current_mode; - private int device_type; private CommandProcessor cmdproc; ! private int interface_mode = DEF_MODE; private String command_prefix = ""; private boolean blocked = false; --- 70,75 ---- CmdVerifier cmdverifier = new CmdVerifier(); private Modes current_mode; private CommandProcessor cmdproc; ! private int interface_mode = Terminal.DEF_MODE; private String command_prefix = ""; private boolean blocked = false; *************** *** 218,222 **** case 0x0A: { if(cmdline.getText().compareTo("")!=0) { ! if(history.size()>=max_history) history.remove(0); history.add(cmdline.getText()); pos_history = history.size(); --- 222,226 ---- case 0x0A: { if(cmdline.getText().compareTo("")!=0) { ! if(history.size()>=Terminal.max_history) history.remove(0); history.add(cmdline.getText()); pos_history = history.size(); *************** *** 285,289 **** if(history.size()>0) { if(pos_history == history.size() && cmdline.getText().compareTo("")!=0) { ! if(history.size()>=max_history) history.remove(0); history.add(cmdline.getText()); pos_history = history.size()-1; --- 289,293 ---- if(history.size()>0) { if(pos_history == history.size() && cmdline.getText().compareTo("")!=0) { ! if(history.size()>=Terminal.max_history) history.remove(0); history.add(cmdline.getText()); pos_history = history.size()-1; *************** *** 405,409 **** public String call(Vector<String> params){ if(current_mode.conf_mode == CommandInterface.CONF_MODE){ ! interface_mode = DEF_MODE; command_prefix = ""; current_mode.conf_mode = CommandInterface.STD_MODE; --- 409,413 ---- public String call(Vector<String> params){ if(current_mode.conf_mode == CommandInterface.CONF_MODE){ ! interface_mode = Terminal.DEF_MODE; command_prefix = ""; current_mode.conf_mode = CommandInterface.STD_MODE; *************** *** 420,425 **** public String call(Vector<String> params){ if(current_mode.conf_mode == CommandInterface.CONF_MODE){ ! if(interface_mode!=DEF_MODE){ ! interface_mode = DEF_MODE; command_prefix = ""; } --- 424,429 ---- public String call(Vector<String> params){ if(current_mode.conf_mode == CommandInterface.CONF_MODE){ ! if(interface_mode!=Terminal.DEF_MODE){ ! interface_mode = Terminal.DEF_MODE; command_prefix = ""; } *************** *** 441,446 **** } public String call(Vector<String> params){ ! if(interface_mode!=DEF_MODE){ ! interface_mode = DEF_MODE; command_prefix = ""; } --- 445,450 ---- } public String call(Vector<String> params){ ! if(interface_mode!=Terminal.DEF_MODE){ ! interface_mode = Terminal.DEF_MODE; command_prefix = ""; } *************** *** 462,467 **** try { device.getNetworkInterface(params.get(0)); ! if(interface_mode==DEF_MODE){ ! interface_mode = IF_MODE; command_prefix = "interface "+params.get(0); } --- 466,471 ---- try { device.getNetworkInterface(params.get(0)); ! if(interface_mode==Terminal.DEF_MODE){ ! interface_mode = Terminal.IF_MODE; command_prefix = "interface "+params.get(0); } *************** *** 619,623 **** if(pi<count-1){ try { ! sleep(delay); } catch (InterruptedException e) { } --- 623,627 ---- if(pi<count-1){ try { ! Thread.sleep(delay); } catch (InterruptedException e) { } Index: SetTCPIPPropertiesDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SetTCPIPPropertiesDialog.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SetTCPIPPropertiesDialog.java 21 Oct 2008 11:50:25 -0000 1.11 --- SetTCPIPPropertiesDialog.java 24 Oct 2008 16:18:48 -0000 1.12 *************** *** 30,67 **** package guiUI; - import core.InvalidNetworkInterfaceNameException; - import core.InvalidNetworkLayerDeviceException; - import core.InvalidNodeNameException; - import core.NetworkLayerDevice; - import core.Node; - import core.protocolsuite.tcp_ip.IPV4Address; - import core.protocolsuite.tcp_ip.InvalidIPAddressException; - import core.protocolsuite.tcp_ip.InvalidSubnetMaskException; - import javax.swing.JFrame; - import javax.swing.JPanel; - import java.awt.GridBagLayout; - import javax.swing.JDialog; - import javax.swing.JLabel; - import javax.swing.JTextField; - import java.awt.Insets; - import java.awt.GridBagConstraints; import java.awt.BorderLayout; ! import javax.swing.JButton; import java.awt.Dimension; ! import java.awt.event.ActionListener; import java.awt.event.ActionEvent; ! import javax.swing.JComboBox; ! import core.Simulation; ! import java.awt.event.MouseAdapter; ! import java.awt.event.MouseEvent; ! import java.awt.Color; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; ! import java.awt.event.FocusAdapter; ! import java.awt.event.FocusEvent; import java.util.Arrays; ! import java.awt.Component; import javax.swing.SwingConstants; --- 30,65 ---- package guiUI; import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.Component; import java.awt.Dimension; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.Insets; import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.awt.event.FocusAdapter; ! import java.awt.event.FocusEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; ! import java.awt.event.MouseAdapter; ! import java.awt.event.MouseEvent; import java.util.Arrays; ! ! import javax.swing.JButton; ! import javax.swing.JComboBox; ! import javax.swing.JDialog; ! import javax.swing.JFrame; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! import javax.swing.JTextField; import javax.swing.SwingConstants; + import javax.swing.WindowConstants; + + import core.NetworkLayerDevice; + import core.Node; + import core.Simulation; + import core.protocolsuite.tcp_ip.IPV4Address; *************** *** 75,78 **** --- 73,80 ---- */ public class SetTCPIPPropertiesDialog extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = 7663707499126963363L; private JPanel backpanel; private JLabel lblInterface; *************** *** 134,138 **** btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); --- 136,140 ---- btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); *************** *** 245,248 **** --- 247,251 ---- txtIpAddress = new JTextField(); txtIpAddress.addFocusListener(new FocusAdapter() { + @Override public void focusLost(FocusEvent e) { ipAddressEntered(); *************** *** 250,256 **** --- 253,261 ---- }); txtIpAddress.addKeyListener(new KeyAdapter() { + @Override public void keyReleased(KeyEvent e) { // checkForDefaultSubnet(); } + @Override public void keyPressed(KeyEvent e) { // checkForDefaultSubnet(); *************** *** 258,261 **** --- 263,267 ---- }); txtIpAddress.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { txtIpAddress.selectAll(); *************** *** 282,285 **** --- 288,292 ---- txtSubnetMask.addFocusListener(new FocusAdapter() { + @Override public void focusLost(FocusEvent e) { subnetmask(); *************** *** 292,295 **** --- 299,303 ---- }); txtSubnetMask.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { txtSubnetMask.selectAll(); *************** *** 325,328 **** --- 333,337 ---- txtDefaultGW = new JTextField(); txtDefaultGW.addFocusListener(new FocusAdapter() { + @Override public void focusLost(FocusEvent e) { setDefaultGW(); *************** *** 340,343 **** --- 349,353 ---- }); txtDefaultGW.addMouseListener(new MouseAdapter() { + @Override public void mouseClicked(MouseEvent e) { txtDefaultGW.selectAll(); Index: SNMPSendDataDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SNMPSendDataDialog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** SNMPSendDataDialog.java 15 Sep 2007 18:50:49 -0000 1.3 --- SNMPSendDataDialog.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 30,59 **** package guiUI; ! import javax.swing.JFrame; ! import javax.swing.JPanel; import java.awt.GridBagLayout; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JTextField; ! import java.awt.Insets; ! import java.awt.GridBagConstraints; ! import java.awt.BorderLayout; ! import javax.swing.JButton; ! import java.awt.Dimension; ! import java.awt.event.ActionListener; ! import java.awt.event.ActionEvent; ! import javax.swing.JComboBox; import core.Simulation; - import java.awt.event.MouseAdapter; - import java.awt.event.MouseEvent; - import java.awt.Color; - import java.awt.event.KeyAdapter; - import java.awt.event.KeyEvent; - import java.awt.event.FocusAdapter; - import java.awt.event.FocusEvent; - import java.util.Arrays; - import java.awt.Component; - import javax.swing.SwingConstants; - import java.util.Vector; import core.protocolsuite.tcp_ip.SNMP; --- 30,51 ---- package guiUI; ! import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.GridBagConstraints; import java.awt.GridBagLayout; + import java.awt.Insets; + import java.awt.event.ActionEvent; + import java.awt.event.ActionListener; + import java.util.Vector; + + import javax.swing.JButton; import javax.swing.JDialog; + import javax.swing.JFrame; import javax.swing.JLabel; + import javax.swing.JPanel; import javax.swing.JTextField; ! import javax.swing.WindowConstants; ! import core.Simulation; import core.protocolsuite.tcp_ip.SNMP; *************** *** 67,71 **** */ public class SNMPSendDataDialog extends javax.swing.JDialog { ! private JPanel backpanel; private JLabel lblIPAddress; private JLabel lblPort; --- 59,67 ---- */ public class SNMPSendDataDialog extends javax.swing.JDialog { ! /** ! * ! */ ! private static final long serialVersionUID = 2769275985951166051L; ! private JPanel backpanel; private JLabel lblIPAddress; private JLabel lblPort; *************** *** 122,126 **** this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); //this.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); --- 118,122 ---- this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); //this.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE); this.setLocationRelativeTo(null); Index: GuiPC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiPC.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** GuiPC.java 18 Oct 2008 19:55:31 -0000 1.11 --- GuiPC.java 24 Oct 2008 16:18:48 -0000 1.12 *************** *** 55,67 **** package guiUI; - import core.InvalidNodeNameException; - import core.Node; - - import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JMenuItem; ! import javax.swing.JMenu; /** --- 55,64 ---- package guiUI; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JMenuItem; ! ! import core.Node; /** *************** *** 85,88 **** --- 82,90 ---- /** * + */ + private static final long serialVersionUID = 816132267929695723L; + + /** + * * @param inName * The name of the PC *************** *** 198,201 **** --- 200,204 ---- } + @Override public void addInterfaces(MainScreen parent, Node node) { Index: SandBox.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SandBox.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** SandBox.java 6 Oct 2008 13:20:39 -0000 1.11 --- SandBox.java 24 Oct 2008 16:18:48 -0000 1.12 *************** *** 29,37 **** import java.awt.Cursor; import java.awt.Point; ! import java.awt.event.*; ! import java.awt.*; import javax.swing.JLayeredPane; - import javax.swing.JDesktopPane; /** --- 29,44 ---- import java.awt.Cursor; + import java.awt.Dimension; + import java.awt.Image; import java.awt.Point; ! import java.awt.Toolkit; ! import java.awt.event.ComponentEvent; ! import java.awt.event.ComponentListener; ! import java.awt.event.InputEvent; ! import java.awt.event.MouseEvent; ! import java.awt.event.MouseListener; ! import java.awt.event.MouseMotionListener; ! import javax.swing.JLayeredPane; /** *************** *** 49,52 **** --- 56,63 ---- public class SandBox extends JLayeredPane implements MouseListener, MouseMotionListener, ComponentListener{ + /** + * + */ + private static final long serialVersionUID = -7676829472573372306L; public static final int PC_CURSOR = 0; public static final int ROUTER_CURSOR = 1; *************** *** 60,64 **** private Cursor csrDefault = new Cursor(Cursor.DEFAULT_CURSOR); private MainScreen controller; - private GuiNode tempNode; private Point cursorLocation = new Point(0,0); private LinkLayerPanel pnlLinkLayer; --- 71,74 ---- *************** *** 187,196 **** public void mouseClicked(MouseEvent e) { ! if(e.getModifiers() == MouseEvent.BUTTON3_MASK) { controller.setIsLink(false); controller.setAllHighlightsOff(); } ! if(e.getModifiers() == MouseEvent.BUTTON1_MASK) { --- 197,206 ---- public void mouseClicked(MouseEvent e) { ! if(e.getModifiers() == InputEvent.BUTTON3_MASK) { controller.setIsLink(false); controller.setAllHighlightsOff(); } ! if(e.getModifiers() == InputEvent.BUTTON1_MASK) { Index: GuiNode.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiNode.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** GuiNode.java 22 Oct 2008 21:33:00 -0000 1.10 --- GuiNode.java 24 Oct 2008 16:18:48 -0000 1.11 *************** *** 55,83 **** package guiUI; ! import javax.swing.*; ! ! import java.awt.dnd.*; ! ! import java.awt.datatransfer.*; ! ! import java.awt.*; ! import java.awt.event.ActionEvent; - import java.awt.event.ActionListener; ! import java.awt.event.MouseEvent; - import java.awt.event.MouseListener; - import java.awt.event.MouseMotionListener; - import java.io.Serializable; ! import java.net.URL; ! ! import java.util.*; ! import core.*; /** --- 55,100 ---- package guiUI; ! import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.Cursor; ! import java.awt.Dimension; ! import java.awt.Point; ! import java.awt.datatransfer.DataFlavor; ! import java.awt.datatransfer.StringSelection; ! import java.awt.datatransfer.Transferable; ! import java.awt.dnd.DnDConstants; ! import java.awt.dnd.DragGestureEvent; ! import java.awt.dnd.DragGestureListener; ! import java.awt.dnd.DragSource; ! import java.awt.dnd.DragSourceDragEvent; ! import java.awt.dnd.DragSourceDropEvent; ! import java.awt.dnd.DragSourceEvent; ! import java.awt.dnd.DragSourceListener; ! import java.awt.dnd.DropTarget; ! import java.awt.dnd.DropTargetDragEvent; ! import java.awt.dnd.DropTargetDropEvent; ! import java.awt.dnd.DropTargetEvent; ! import java.awt.dnd.DropTargetListener; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ! import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.io.Serializable; + import java.util.Iterator; + import java.util.Vector; ! import javax.swing.BorderFactory; ! import javax.swing.ImageIcon; ! import javax.swing.JLabel; ! import javax.swing.JMenu; ! import javax.swing.JMenuItem; ! import javax.swing.JPanel; ! import javax.swing.JPopupMenu; ! import javax.swing.SwingConstants; ! import core.Node; ! import core.Simulation; /** *************** *** 149,155 **** private int SandBoxHeight; ! private int lastX; ! private int lastY; private int controlX; --- 166,172 ---- private int SandBoxHeight; ! //private int lastX; ! //private int lastY; private int controlX; *************** *** 205,209 **** lblNodeName.setText(inName); ! lblNodeName.setHorizontalAlignment(JLabel.CENTER); SandBoxWidth = (int) controller.getSandboxSize().getWidth(); --- 222,226 ---- lblNodeName.setText(inName); ! lblNodeName.setHorizontalAlignment(SwingConstants.CENTER); SandBoxWidth = (int) controller.getSandboxSize().getWidth(); *************** *** 221,225 **** lblIcon.setIcon(nodeIcon); ! lblIcon.setHorizontalAlignment((JLabel.CENTER)); // Set the layout of this jPanel --- 238,242 ---- lblIcon.setIcon(nodeIcon); ! lblIcon.setHorizontalAlignment((SwingConstants.CENTER)); // Set the layout of this jPanel *************** *** 238,242 **** // this.setBounds(0,0,75,55); ! this.setBounds(0, 0, NodeWidth + 10, NodeHeight + 10); this.addMouseListener(this); --- 255,259 ---- // this.setBounds(0,0,75,55); ! this.setBounds(0, 0, GuiNode.NodeWidth + 10, GuiNode.NodeHeight + 10); this.addMouseListener(this); *************** *** 306,309 **** --- 323,327 ---- } + @Override public void setEnabled(boolean e) { lblIcon.setEnabled(e); *************** *** 684,688 **** // Set popup menu for right click here. ! if (e.getModifiers() == MouseEvent.BUTTON3_MASK) { boolean ena = controller.isOn(lblNodeName.getText()); --- 702,706 ---- // Set popup menu for right click here. ! if (e.getModifiers() == InputEvent.BUTTON3_MASK) { boolean ena = controller.isOn(lblNodeName.getText()); *************** *** 717,721 **** { ! if (e.getModifiers() == MouseEvent.BUTTON1_MASK) { --- 735,739 ---- { ! if (e.getModifiers() == InputEvent.BUTTON1_MASK) { *************** *** 733,739 **** else { ! lastX = this.getX() + e.getX() - this.getWidth(); ! lastY = this.getY() + e.getY() - this.getHeight(); controlX = this.getX() + e.getX() + this.getWidth() / 2; --- 751,757 ---- else { ! //lastX = this.getX() + e.getX() - this.getWidth(); ! //lastY = this.getY() + e.getY() - this.getHeight(); controlX = this.getX() + e.getX() + this.getWidth() / 2; *************** *** 802,805 **** --- 820,824 ---- */ + @Override public String getName() Index: GuiRouter.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiRouter.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** GuiRouter.java 23 Oct 2008 17:08:27 -0000 1.7 --- GuiRouter.java 24 Oct 2008 16:18:48 -0000 1.8 *************** *** 83,86 **** --- 83,91 ---- /** * + */ + private static final long serialVersionUID = -5079851235537869986L; + + /** + * * @param inName * The name of the router *************** *** 117,120 **** --- 122,126 ---- } + @Override public void addInterfaces(MainScreen parent, Node node) { Index: LinkProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkProperties.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** LinkProperties.java 21 Oct 2008 11:50:24 -0000 1.9 --- LinkProperties.java 24 Oct 2008 16:18:48 -0000 1.10 *************** *** 30,61 **** package guiUI; - import core.InvalidLinkNameException; - import core.InvalidNetworkInterfaceNameException; - import core.InvalidNodeNameException; - import javax.swing.JFrame; - import javax.swing.JPanel; - import java.awt.GridBagLayout; - import javax.swing.JDialog; - import javax.swing.JLabel; - import javax.swing.JTextField; - import java.awt.Insets; - import java.awt.GridBagConstraints; import java.awt.BorderLayout; ! import javax.swing.JButton; import java.awt.Dimension; ! import java.awt.event.ActionListener; import java.awt.event.ActionEvent; ! import javax.swing.JComboBox; ! import core.Simulation; ! import java.awt.event.MouseAdapter; ! import java.awt.event.MouseEvent; ! import java.awt.Color; ! import java.awt.event.KeyAdapter; ! import java.awt.event.KeyEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.util.Arrays; ! import java.awt.Component; import javax.swing.SwingConstants; /** --- 30,59 ---- package guiUI; import java.awt.BorderLayout; ! import java.awt.Component; import java.awt.Dimension; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.Insets; import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; import java.util.Arrays; ! ! import javax.swing.JButton; ! import javax.swing.JComboBox; ! import javax.swing.JDialog; ! import javax.swing.JFrame; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! import javax.swing.JTextField; import javax.swing.SwingConstants; + import javax.swing.WindowConstants; + + import core.InvalidLinkNameException; + import core.InvalidNetworkInterfaceNameException; + import core.InvalidNodeNameException; + import core.Simulation; /** *************** *** 68,71 **** --- 66,73 ---- */ public class LinkProperties extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -7313505773384166380L; private JPanel backpanel; private JLabel lblInterface; *************** *** 80,90 **** private MainScreen controller; private Simulation Sim; ! private SandBox SBox; ! ! private String NodeName=""; private String Interface=""; - private boolean ErrorFlag = true; - public LinkProperties(JFrame frame, Object nodeArray[], int selectedIndex, Simulation Sim, SandBox SBox) { super(frame); --- 82,88 ---- private MainScreen controller; private Simulation Sim; ! private String NodeName=""; private String Interface=""; public LinkProperties(JFrame frame, Object nodeArray[], int selectedIndex, Simulation Sim, SandBox SBox) { super(frame); *************** *** 92,97 **** controller = (MainScreen)frame; this.Sim = Sim; ! this.SBox = SBox; ! setTitle("Link Properties"); initGUI(nodeArray,selectedIndex); --- 90,94 ---- controller = (MainScreen)frame; this.Sim = Sim; ! setTitle("Link Properties"); initGUI(nodeArray,selectedIndex); *************** *** 123,127 **** btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); --- 120,124 ---- btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); *************** *** 226,229 **** --- 223,227 ---- txtProp = new JTextField(); txtProp.addFocusListener(new FocusAdapter() { + @Override public void focusLost(FocusEvent e) { //ipAddressEntered(); Index: EthPortProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/EthPortProperties.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** EthPortProperties.java 21 Oct 2008 11:50:24 -0000 1.6 --- EthPortProperties.java 24 Oct 2008 16:18:48 -0000 1.7 *************** *** 31,65 **** package guiUI; - import core.InvalidLinkNameException; - import core.InvalidNetworkInterfaceNameException; - import core.InvalidNodeNameException; - import core.Node; - import core.NetworkLayerDevice; - import javax.swing.JFrame; - import javax.swing.JPanel; - import java.awt.GridBagLayout; - import javax.swing.JDialog; - import javax.swing.JLabel; - import javax.swing.JTextField; - import javax.swing.JCheckBox; - import java.awt.Insets; - import java.awt.GridBagConstraints; import java.awt.BorderLayout; ! import javax.swing.JButton; import java.awt.Dimension; ! import java.awt.event.ActionListener; import java.awt.event.ActionEvent; ! import javax.swing.JComboBox; ! import core.Simulation; ! import java.awt.event.MouseAdapter; ! import java.awt.event.MouseEvent; ! import java.awt.Color; ! import java.awt.event.KeyAdapter; ! import java.awt.event.KeyEvent; import java.awt.event.FocusAdapter; ! import java.awt.event.FocusEvent; ! import java.util.Arrays; ! import java.awt.Component; import javax.swing.SwingConstants; /** --- 31,57 ---- package guiUI; import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.Component; import java.awt.Dimension; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.Insets; import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; ! ! import javax.swing.JButton; ! import javax.swing.JCheckBox; ! import javax.swing.JDialog; ! import javax.swing.JFrame; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! import javax.swing.JTextField; import javax.swing.SwingConstants; + import javax.swing.WindowConstants; + + import core.NetworkLayerDevice; + import core.Simulation; /** *************** *** 72,75 **** --- 64,71 ---- */ public class EthPortProperties extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -8725131940909728794L; private JPanel backpanel; private JLabel lblInterface, cmbInterface; *************** *** 89,99 **** private String NodeInt=""; - private boolean ErrorFlag = true; - public EthPortProperties(JFrame frame, String inNodeName, String inNodeInt, Simulation Sim) { super(frame); ! this.NodeName = inNodeName; ! this.NodeInt = inNodeInt; setResizable(false); --- 85,94 ---- private String NodeInt=""; public EthPortProperties(JFrame frame, String inNodeName, String inNodeInt, Simulation Sim) { super(frame); ! this.NodeName = inNodeName; ! this.NodeInt = inNodeInt; ! this.Sim = Sim; setResizable(false); *************** *** 129,133 **** btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); --- 124,128 ---- btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); *************** *** 241,249 **** txtMAC = new JTextField(); ! txtMAC.addFocusListener(new FocusAdapter() { ! public void actionPerformed(ActionEvent e) { ! lblError.setVisible(false); ! } ! }); txtMAC.setEnabled(true); --- 236,244 ---- txtMAC = new JTextField(); ! txtMAC.addFocusListener(new FocusAdapter() { ! public void actionPerformed(ActionEvent e) { ! lblError.setVisible(false); ! } ! }); txtMAC.setEnabled(true); *************** *** 254,261 **** gridBagConstraints_3.gridx = 1; backpanel.add(txtMAC, gridBagConstraints_3); ! txtMAC.setText(Sim.getNode(NodeName).getMACAddress(NodeInt)); ! chkUP = new JCheckBox(); ! chkUP.setEnabled(true); final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints(); gridBagConstraints_4.fill = GridBagConstraints.HORIZONTAL; --- 249,257 ---- gridBagConstraints_3.gridx = 1; backpanel.add(txtMAC, gridBagConstraints_3); ! ! txtMAC.setText( Sim.getNode(NodeName).getMACAddress(NodeInt)); ! chkUP = new JCheckBox(); ! chkUP.setEnabled(true); final GridBagConstraints gridBagConstraints_4 = new GridBagConstraints(); gridBagConstraints_4.fill = GridBagConstraints.HORIZONTAL; *************** *** 318,322 **** lblError.setVisible(true); controller.shakeDiaLog(this); - ErrorFlag = true; } } catch (Exception e) { --- 314,317 ---- Index: SimulationToolBar.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SimulationToolBar.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SimulationToolBar.java 6 Oct 2008 13:20:39 -0000 1.5 --- SimulationToolBar.java 24 Oct 2008 16:18:48 -0000 1.6 *************** *** 58,72 **** import java.awt.Color; - import java.awt.event.ActionEvent; - import java.awt.event.ActionListener; import javax.swing.ImageIcon; - import javax.swing.JButton; - import javax.swing.JOptionPane; - --- 58,67 ---- *************** *** 89,92 **** --- 84,94 ---- public class SimulationToolBar extends ToolBar{ + /** + * + */ + private static final long serialVersionUID = -4864249995312706530L; + + + private ClassLoader cl = this.getClass().getClassLoader(); Index: LinkDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkDialog.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** LinkDialog.java 13 Oct 2007 12:57:00 -0000 1.4 --- LinkDialog.java 24 Oct 2008 16:18:48 -0000 1.5 *************** *** 33,37 **** import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ! import java.util.*; import javax.swing.BoxLayout; --- 33,37 ---- import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ! import java.util.Arrays; import javax.swing.BoxLayout; *************** *** 44,47 **** --- 44,48 ---- import javax.swing.JPanel; import javax.swing.JTextField; + import javax.swing.SwingConstants; /** *************** *** 54,57 **** --- 55,62 ---- class LinkDialog extends JDialog implements ActionListener { + /** + * + */ + private static final long serialVersionUID = 2863636695410784080L; private JButton btnCancel = new JButton("Cancel"); private JButton btnOK = new JButton("OK"); *************** *** 96,102 **** JLabel lblMessage = new JLabel("Please select the interface card for the specific nodes"); JLabel lblNameLink = new JLabel("Name of Link : "); ! lblFirstNode.setHorizontalAlignment(JLabel.CENTER); ! lblSecondNode.setHorizontalAlignment(JLabel.CENTER); ! lblMessage.setHorizontalAlignment(JLabel.CENTER); txtLinkName.setPreferredSize(new Dimension(80, 25)); --- 101,107 ---- JLabel lblMessage = new JLabel("Please select the interface card for the specific nodes"); JLabel lblNameLink = new JLabel("Name of Link : "); ! lblFirstNode.setHorizontalAlignment(SwingConstants.CENTER); ! lblSecondNode.setHorizontalAlignment(SwingConstants.CENTER); ! lblMessage.setHorizontalAlignment(SwingConstants.CENTER); txtLinkName.setPreferredSize(new Dimension(80, 25)); Index: SerPortProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SerPortProperties.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** SerPortProperties.java 14 Sep 2008 20:51:29 -0000 1.4 --- SerPortProperties.java 24 Oct 2008 16:18:48 -0000 1.5 *************** *** 31,65 **** package guiUI; - import core.InvalidLinkNameException; - import core.InvalidNetworkInterfaceNameException; - import core.InvalidNodeNameException; - import core.Node; - import core.NetworkLayerDevice; - import javax.swing.JFrame; - import javax.swing.JPanel; - import java.awt.GridBagLayout; - import javax.swing.JDialog; - import javax.swing.JLabel; - import javax.swing.JTextField; - import javax.swing.JCheckBox; - import java.awt.Insets; - import java.awt.GridBagConstraints; import java.awt.BorderLayout; ! import javax.swing.JButton; import java.awt.Dimension; ! import java.awt.event.ActionListener; import java.awt.event.ActionEvent; ! import javax.swing.JComboBox; ! import core.Simulation; ! import java.awt.event.MouseAdapter; ! import java.awt.event.MouseEvent; ! import java.awt.Color; ! import java.awt.event.KeyAdapter; ! import java.awt.event.KeyEvent; import java.awt.event.FocusAdapter; ! import java.awt.event.FocusEvent; ! import java.util.Arrays; ! import java.awt.Component; import javax.swing.SwingConstants; /** --- 31,57 ---- package guiUI; import java.awt.BorderLayout; ! import java.awt.Color; ! import java.awt.Component; import java.awt.Dimension; ! import java.awt.GridBagConstraints; ! import java.awt.GridBagLayout; ! import java.awt.Insets; import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; import java.awt.event.FocusAdapter; ! ! import javax.swing.JButton; ! import javax.swing.JCheckBox; ! import javax.swing.JDialog; ! import javax.swing.JFrame; ! import javax.swing.JLabel; ! import javax.swing.JPanel; ! import javax.swing.JTextField; import javax.swing.SwingConstants; + import javax.swing.WindowConstants; + + import core.NetworkLayerDevice; + import core.Simulation; /** *************** *** 72,75 **** --- 64,71 ---- */ public class SerPortProperties extends javax.swing.JDialog { + /** + * + */ + private static final long serialVersionUID = -5208725858132395638L; private JPanel backpanel; private JLabel lblInterface, cmbInterface; *************** *** 85,95 **** private MainScreen controller; private Simulation Sim; ! private SandBox SBox; ! ! private String NodeName=""; private String NodeInt=""; - private boolean ErrorFlag = true; - public SerPortProperties(JFrame frame, String inNodeName, String inNodeInt, Simulation Sim, SandBox SBox) { super(frame); --- 81,87 ---- private MainScreen controller; private Simulation Sim; ! private String NodeName=""; private String NodeInt=""; public SerPortProperties(JFrame frame, String inNodeName, String inNodeInt, Simulation Sim, SandBox SBox) { super(frame); *************** *** 101,106 **** controller = (MainScreen)frame; this.Sim = Sim; ! this.SBox = SBox; ! setTitle("WAN Port Properties"); initGUI(inNodeName, inNodeInt); --- 93,97 ---- controller = (MainScreen)frame; this.Sim = Sim; ! setTitle("WAN Port Properties"); initGUI(inNodeName, inNodeInt); *************** *** 132,136 **** btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); --- 123,127 ---- btnCancel.setText("Cancel"); this.getRootPane().setDefaultButton(btnOk); ! this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); this.setLocationRelativeTo(null); this.setModal(true); *************** *** 246,250 **** txtCR.addFocusListener(new FocusAdapter() { public void actionPerformed(ActionEvent e) { ! lblError.setVisible(false); } }); --- 237,241 ---- txtCR.addFocusListener(new FocusAdapter() { public void actionPerformed(ActionEvent e) { ! lblError.setVisible(false); } }); *************** *** 329,333 **** lblError.setVisible(true); controller.shakeDiaLog(this); - ErrorFlag = true; } } catch (Exception e) { --- 320,323 ---- Index: PingDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/PingDialog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PingDialog.java 15 Sep 2007 11:34:58 -0000 1.3 --- PingDialog.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 31,40 **** import java.awt.FlowLayout; import java.awt.event.ActionEvent; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; ! import javax.swing.*; ! import java.awt.event.*; /** --- 31,44 ---- import java.awt.FlowLayout; import java.awt.event.ActionEvent; + import java.awt.event.ActionListener; + import javax.swing.BoxLayout; import javax.swing.JButton; + import javax.swing.JComboBox; + import javax.swing.JDialog; import javax.swing.JLabel; + import javax.swing.JOptionPane; import javax.swing.JPanel; ! import javax.swing.JTextField; /** *************** *** 45,51 **** public class PingDialog extends JDialog implements ActionListener { private JLabel lblMessage = new JLabel("Send Ping"); private JLabel lblSourceLabel = new JLabel("Source :"); - private JComboBox cboSource; private JLabel lblDestinationLabel = new JLabel("Destination IP :"); private JTextField txtDestinationIP = new JTextField(15); --- 49,58 ---- public class PingDialog extends JDialog implements ActionListener { + /** + * + */ + private static final long serialVersionUID = -1088992961468735310L; private JLabel lblMessage = new JLabel("Send Ping"); private JLabel lblSourceLabel = new JLabel("Source :"); private JLabel lblDestinationLabel = new JLabel("Destination IP :"); private JTextField txtDestinationIP = new JTextField(15); Index: MenuBar.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MenuBar.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** MenuBar.java 6 Oct 2008 13:20:39 -0000 1.20 --- MenuBar.java 24 Oct 2008 16:18:48 -0000 1.21 *************** *** 1,10 **** package guiUI; - import core.Version; - import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ! import javax.swing.*; /** --- 1,15 ---- package guiUI; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; ! import javax.swing.JCheckBoxMenuItem; ! import javax.swing.JMenu; ! import javax.swing.JMenuBar; ! import javax.swing.JMenuItem; ! import javax.swing.JOptionPane; ! import javax.swing.KeyStroke; ! ! import core.Version; /** *************** *** 19,22 **** --- 24,32 ---- public class MenuBar extends JMenuBar { + /** + * + */ + private static final long serialVersionUID = 7498213676250919283L; + private MainScreen controller; Index: LinkLayerPanel.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkLayerPanel.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** LinkLayerPanel.java 19 Oct 2007 15:57:01 -0000 1.6 --- LinkLayerPanel.java 24 Oct 2008 16:18:48 -0000 1.7 *************** *** 58,77 **** import java.awt.BasicStroke; ! import java.awt.Graphics; - import java.awt.Graphics2D; - - import java.awt.geom.*; - - import java.awt.Color; - import java.awt.Point; ! ! import java.util.Hashtable; ! import java.util.Enumeration; ! ! import javax.swing.JPanel; --- 58,69 ---- import java.awt.BasicStroke; ! import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; ! import java.awt.geom.Line2D; ! import java.awt.geom.Point2D; import java.util.Enumeration; ! import java.util.Hashtable; import javax.swing.JPanel; *************** *** 105,108 **** --- 97,105 ---- + /** + * + */ + private static final long serialVersionUID = 6226572644195993822L; + final static String FAKELINE = new String("FakeLine"); *************** *** 216,220 **** if(inWhichEnd == 1){ ! Point2D p1 = (Point2D)inPosition; Point2D p2 = myLine.Line.getP2(); --- 213,217 ---- if(inWhichEnd == 1){ ! Point2D p1 = inPosition; Point2D p2 = myLine.Line.getP2(); *************** *** 226,230 **** Point2D p1 = myLine.Line.getP1(); ! Point2D p2 = (Point2D)inPosition; myLine.Line.setLine(p1,p2); --- 223,227 ---- Point2D p1 = myLine.Line.getP1(); ! Point2D p2 = inPosition; myLine.Line.setLine(p1,p2); *************** *** 250,253 **** --- 247,251 ---- */ + @Override public void paint(Graphics g) Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/NetworkLayerDevice.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NetworkLayerDevice.java 14 Sep 2007 11:14:51 -0000 1.9 --- NetworkLayerDevice.java 24 Oct 2008 16:18:48 -0000 1.10 *************** *** 59,73 **** - import java.awt.Dimension; - import java.awt.event.ActionEvent; - import java.awt.event.ActionListener; - - - import javax.swing.JMenuItem; - import javax.swing.JMenu; --- 59,67 ---- import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JMenu; + import javax.swing.JMenuItem; Index: NodePropertiesDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/NodePropertiesDialog.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** NodePropertiesDialog.java 13 Oct 2007 12:57:00 -0000 1.3 --- NodePropertiesDialog.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 57,75 **** ! import javax.swing.JButton; import javax.swing.JDialog; ! import javax.swing.JPanel; ! ! import javax.swing.*; ! ! import java.awt.event.*; ! ! import java.awt.*; ! ! import java.util.*; ! ! import javax.swing.table.*; --- 57,76 ---- ! import java.awt.Dimension; ! import java.awt.FlowLayout; ! import java.awt.event.ActionEvent; ! import java.awt.event.ActionListener; ! import java.util.ArrayList; ! import java.util.Vector; + import javax.swing.BoxLayout; + import javax.swing.JButton; import javax.swing.JDialog; ! import javax.swing.JFrame; ! import javax.swing.JLabel; import javax.swing.JPanel; ! import javax.swing.JScrollPane; ! import javax.swing.JTable; ! import javax.swing.table.TableModel; *************** *** 95,98 **** --- 96,104 ---- + /** + * + */ + private static final long serialVersionUID = -8899776864912613856L; + private JLabel lblNodeNameLabel = new JLabel("Node Name : "); Index: GuiMultilayerSwitch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiMultilayerSwitch.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GuiMultilayerSwitch.java 22 Oct 2008 21:33:00 -0000 1.2 --- GuiMultilayerSwitch.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 85,88 **** --- 85,92 ---- /** + * + */ + private static final long serialVersionUID = -7713023657795807625L; + /** * @param inName The name of the switch *************** *** 106,109 **** --- 110,114 ---- } + @Override public void addInterfaces(MainScreen parent, Node node){ Index: DataLinkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/DataLinkLayerDevice.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DataLinkLayerDevice.java 21 Oct 2008 11:50:24 -0000 1.5 --- DataLinkLayerDevice.java 24 Oct 2008 16:18:48 -0000 1.6 *************** *** 58,68 **** import java.awt.event.ActionEvent; - - - import java.awt.event.ActionListener; - - import javax.swing.JMenuItem; --- 58,63 ---- Index: StandardToolBar.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/StandardToolBar.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StandardToolBar.java 13 Sep 2007 13:38:53 -0000 1.2 --- StandardToolBar.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 30,36 **** import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.ImageIcon; import javax.swing.JButton; - import javax.swing.JOptionPane; --- 30,36 ---- import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import javax.swing.ImageIcon; import javax.swing.JButton; *************** *** 44,47 **** --- 44,52 ---- public class StandardToolBar extends ToolBar { + /** + * + */ + private static final long serialVersionUID = -4244939315299762795L; + private ClassLoader cl = this.getClass().getClassLoader(); Index: GuiExternalProxy.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiExternalProxy.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GuiExternalProxy.java 6 Oct 2008 13:20:39 -0000 1.2 --- GuiExternalProxy.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 41,44 **** --- 41,49 ---- /** + * + */ + private static final long serialVersionUID = -662756743865057582L; + + /** * @param inName The name of the router * @param inMainscreen The JFrame that the router will be created on *************** *** 49,52 **** --- 54,58 ---- } + @Override public void addInterfaces(MainScreen parent, Node node){ Index: GuiPrinter.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiPrinter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GuiPrinter.java 6 Oct 2008 13:20:39 -0000 1.2 --- GuiPrinter.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 5,8 **** --- 5,13 ---- public class GuiPrinter extends ApplicationLayerDevice { + /** + * + */ + private static final long serialVersionUID = -6715607641533125774L; + public GuiPrinter(String inName, MainScreen inMainScreen) { *************** *** 11,14 **** --- 16,20 ---- } + @Override public void addInterfaces(MainScreen parent, Node node) { Index: GuiCSUDSU.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiCSUDSU.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** GuiCSUDSU.java 6 Oct 2008 13:20:39 -0000 1.2 --- GuiCSUDSU.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 8,11 **** --- 8,16 ---- /** + * + */ + private static final long serialVersionUID = -5724485576670507704L; + + /** * @param inName The name of the switch *************** *** 21,24 **** --- 26,30 ---- } + @Override public void addInterfaces(MainScreen parent, Node node){ ((core.CSUDSU)node).addSerialInterface(); Index: ToolBar.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/ToolBar.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ToolBar.java 13 Sep 2007 13:38:53 -0000 1.2 --- ToolBar.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 29,33 **** ! import javax.swing.*; /** --- 29,34 ---- ! import javax.swing.BorderFactory; ! import javax.swing.JToolBar; /** Index: GuiWirelessAP.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiWirelessAP.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GuiWirelessAP.java 6 Oct 2008 13:20:39 -0000 1.3 --- GuiWirelessAP.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 78,81 **** --- 78,86 ---- /** * + */ + private static final long serialVersionUID = 1997659214891266475L; + + /** + * * @param inName * The name of the switch *************** *** 92,95 **** --- 97,101 ---- } + @Override public void addInterfaces(MainScreen parent, Node node) { Index: InfoBox.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/InfoBox.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InfoBox.java 26 Dec 2007 17:43:16 -0000 1.2 --- InfoBox.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 9,13 **** package guiUI; ! import javax.swing.*; /** --- 9,17 ---- package guiUI; ! import javax.swing.JButton; ! import javax.swing.JDialog; ! import javax.swing.JLabel; ! import javax.swing.JScrollPane; ! import javax.swing.JTextArea; /** *************** *** 19,23 **** //private static final long serialVersionUID = -5836895270535785031L; ! JTextArea message = new JTextArea(); JScrollPane scroll = new JScrollPane(); JLabel w1 = new JLabel(" "); --- 23,31 ---- //private static final long serialVersionUID = -5836895270535785031L; ! /** ! * ! */ ! private static final long serialVersionUID = 8155022723311994317L; ! JTextArea message = new JTextArea(); JScrollPane scroll = new JScrollPane(); JLabel w1 = new JLabel(" "); *************** *** 35,40 **** public InfoBox(java.awt.Frame owner, String title, String mes){ super(owner, title, true); ! setLocation(owner.getLocation().x+(owner.getWidth()-wx)/2,owner.getLocation().y+(owner.getHeight()-hy)/2); ! setData(mes, wx, hy); } --- 43,48 ---- public InfoBox(java.awt.Frame owner, String title, String mes){ super(owner, title, true); ! setLocation(owner.getLocation().x+(owner.getWidth()-InfoBox.wx)/2,owner.getLocation().y+(owner.getHeight()-InfoBox.hy)/2); ! setData(mes, InfoBox.wx, InfoBox.hy); } Index: PosixTelnetClientGUI.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/PosixTelnetClientGUI.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** PosixTelnetClientGUI.java 23 Sep 2008 15:22:17 -0000 1.3 --- PosixTelnetClientGUI.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 11,83 **** package guiUI; - import javax.swing.JFrame; - - import javax.swing.JPanel; - - //import java.awt.GridBagLayout; - - //import javax.swing.JDialog; - - //import javax.swing.JLabel; - - import javax.swing.JTextField; - import javax.swing.JScrollPane; - - import javax.swing.JTextArea; - - //import java.awt.Insets; - - //import java.awt.GridBagConstraints; - import java.awt.BorderLayout; - - /*import javax.swing.JButton; - - import java.awt.Dimension; - - import java.awt.event.ActionListener; - - import java.awt.event.ActionEvent; - - import javax.swing.JComboBox; - - import core.Simulation; - - import java.awt.event.MouseAdapter; - - import java.awt.event.MouseEvent;*/ - import java.awt.Color; ! ! //import java.awt.event.WindowAdapter; ! ! import java.awt.event.... [truncated message content] |
From: Alexander B. <da...@us...> - 2008-10-24 16:19:00
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/ipx_spx In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4280/core/protocolsuite/ipx_spx Modified Files: ProtocolStack.java Log Message: Refactoring && bugfixing Index: ProtocolStack.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/ipx_spx/ProtocolStack.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ProtocolStack.java 19 Oct 2007 08:52:26 -0000 1.4 --- ProtocolStack.java 24 Oct 2008 16:18:48 -0000 1.5 *************** *** 44,50 **** public void sendPacket(String inDestIPAddress, String inPacketType, String inPacketData){ } public void receivePacket(Packet inPacket, String inInterface){ } ! public void intUP(String iface){ } --- 44,52 ---- public void sendPacket(String inDestIPAddress, String inPacketType, String inPacketData){ } + @Override public void receivePacket(Packet inPacket, String inInterface){ } ! @Override ! public void intUP(String iface){ } |
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv4280/core Modified Files: AccessListEngine.java ApplicationLayerDevice.java CSUDSU.java CommandInterface.java CommandProcessor.java CommandsTree.java CommunicationException.java ConsoleLink.java ConsoleNetworkInterface.java DataLinkLayerDevice.java DeviceConfig.java Error.java EthernetLink.java EthernetNetworkInterface.java ExternalProxy.java FalseRandom.java FiberEthernetLink.java FiberEthernetNetworkInterface.java FiberLink.java FiberNetworkInterfacePort.java Hub.java InvalidDataLinkLayerDeviceException.java InvalidDefaultGatewayException.java InvalidLinkConnectionException.java InvalidLinkNameException.java InvalidNetworkInterfaceNameException.java InvalidNetworkLayerDeviceException.java InvalidNodeNameException.java InvalidProtocolStackException.java Laptop.java LayerInfoHandler.java Link.java LowLinkException.java MultilayerSwitch.java NATEngine.java NetworkInterface.java NetworkInterfacePort.java NetworkLayerDevice.java Node.java PC.java Packet.java Printer.java Router.java SerialLink.java SerialNetworkInterface.java Simulation.java SimulationException.java Switch.java TransportLayerException.java TransportLayerPortException.java W80211_packet.java WANCorbaClient.java WANCorbaHelper.java WANCorbaPOA.java WANCorbaServer.java WANDatagram.java WANNetworkInterface.java WANRMI.java WANRMICallback.java WANRMIClient.java WANRMIServer.java WANSocket.java WiFiInterface.java WiFiPort.java WirelessAP.java _WANCorbaStub.java Log Message: Refactoring && bugfixing Index: EthernetLink.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/EthernetLink.java,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** EthernetLink.java 5 Oct 2008 19:12:30 -0000 1.16 --- EthernetLink.java 24 Oct 2008 16:18:48 -0000 1.17 *************** *** 29,34 **** package core; ! import java.util.*; ! import core.FalseRandom; /** * EthernetLink extends Link. It sets two Interface links to a pc. --- 29,33 ---- package core; ! import java.util.Iterator; /** * EthernetLink extends Link. It sets two Interface links to a pc. *************** *** 41,45 **** public class EthernetLink extends Link { ! java.security.SecureRandom rng; /** --- 40,48 ---- public class EthernetLink extends Link { ! /** ! * ! */ ! private static final long serialVersionUID = 5723796766035188219L; ! java.security.SecureRandom rng; /** Index: Hub.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Hub.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** Hub.java 19 Oct 2007 17:40:33 -0000 1.8 --- Hub.java 24 Oct 2008 16:18:48 -0000 1.9 *************** *** 28,32 **** */ package core; ! import java.util.*; /** --- 28,32 ---- */ package core; ! import java.util.Enumeration; /** *************** *** 43,46 **** --- 43,51 ---- /** + * + */ + private static final long serialVersionUID = 5903950146027279730L; + + /** * This creates a layer 1 hub with a default of 4 interface (ports) * @author luke_hamilton *************** *** 60,68 **** ! public void Reset(){ sz = 0; } ! public int getState(){ return sz; } --- 65,75 ---- ! @Override ! public void Reset(){ sz = 0; } ! @Override ! public int getState(){ return sz; } *************** *** 76,79 **** --- 83,87 ---- */ + @Override protected void receivePacket(Packet inPacket,String inInterfaceName) throws LowLinkException{ if(sz!=1){ Index: Error.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Error.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** Error.java 3 Sep 2006 14:32:08 -0000 1.2 --- Error.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 1,4 **** package core; - import java.io.*; --- 1,3 ---- Index: TransportLayerPortException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/TransportLayerPortException.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TransportLayerPortException.java 20 Nov 2005 20:32:52 -0000 1.1 --- TransportLayerPortException.java 24 Oct 2008 16:18:48 -0000 1.2 *************** *** 72,76 **** { ! /** Creates a new instance of TransportLayerException */ public TransportLayerPortException(String inExceptionMsg) { --- 72,81 ---- { ! /** ! * ! */ ! private static final long serialVersionUID = -4761215933031049021L; ! ! /** Creates a new instance of TransportLayerException */ public TransportLayerPortException(String inExceptionMsg) { *************** *** 84,87 **** --- 89,93 ---- */ + @Override public String toString() { Index: InvalidNetworkInterfaceNameException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/InvalidNetworkInterfaceNameException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InvalidNetworkInterfaceNameException.java 20 Nov 2005 20:30:53 -0000 1.2 --- InvalidNetworkInterfaceNameException.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 38,41 **** --- 38,46 ---- /** + * + */ + private static final long serialVersionUID = -809986480259836522L; + + /** * This method throw inExceptionMsg up to the super class Simulation * Excpetion Index: WANRMIServer.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WANRMIServer.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** WANRMIServer.java 27 Nov 2007 16:56:27 -0000 1.3 --- WANRMIServer.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 2,7 **** package core; ! import java.rmi.*; ! import java.rmi.server.*; /** --- 2,7 ---- package core; ! import java.rmi.RemoteException; ! import java.rmi.server.UnicastRemoteObject; /** *************** *** 10,14 **** */ public class WANRMIServer extends UnicastRemoteObject implements WANRMI{ ! WANNetworkInterface parentInterface; /** Creates a new instance of WANRMIServer */ --- 10,18 ---- */ public class WANRMIServer extends UnicastRemoteObject implements WANRMI{ ! /** ! * ! */ ! private static final long serialVersionUID = -1790660178112345871L; ! WANNetworkInterface parentInterface; /** Creates a new instance of WANRMIServer */ Index: Laptop.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Laptop.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** Laptop.java 18 Oct 2008 20:07:24 -0000 1.1 --- Laptop.java 24 Oct 2008 16:18:48 -0000 1.2 *************** *** 57,70 **** - 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; import core.protocolsuite.tcp_ip.DHCPC; - import core.protocolsuite.tcp_ip.DHCPD; import core.protocolsuite.tcp_ip.DNS; import core.protocolsuite.tcp_ip.Echo_tcp; import core.protocolsuite.tcp_ip.PosixTelnetClient; import core.protocolsuite.tcp_ip.SNMP; --- 57,67 ---- import core.protocolsuite.tcp_ip.DHCPC; import core.protocolsuite.tcp_ip.DNS; + import core.protocolsuite.tcp_ip.Echo; import core.protocolsuite.tcp_ip.Echo_tcp; import core.protocolsuite.tcp_ip.PosixTelnetClient; import core.protocolsuite.tcp_ip.SNMP; + import core.protocolsuite.tcp_ip.Telnet_client; *************** *** 89,92 **** --- 86,94 ---- /** + * + */ + private static final long serialVersionUID = -8692117217516199205L; + + /** * Constructs a PC with the specified name. * @author tristan_veness *************** *** 98,102 **** } ! public void initApplications(){ super.initApplications(); --- 100,105 ---- } ! @Override ! public void initApplications(){ super.initApplications(); *************** *** 108,114 **** Echo_tcp echotcpClient = new Echo_tcp(NodeProtocolStack, 0, 0, core.Simulation.UIDGen++); ! SNMP snmpManager = new SNMP((ApplicationLayerDevice)this, NodeProtocolStack, 0, 1, core.Simulation.UIDGen++); ! Telnet_client telnetClient = new Telnet_client((ApplicationLayerDevice)this, NodeProtocolStack, 0, 0, core.Simulation.UIDGen++); PosixTelnetClient ptc = new PosixTelnetClient(NodeProtocolStack, core.Simulation.UIDGen++); --- 111,117 ---- Echo_tcp echotcpClient = new Echo_tcp(NodeProtocolStack, 0, 0, core.Simulation.UIDGen++); ! SNMP snmpManager = new SNMP(this, NodeProtocolStack, 0, 1, core.Simulation.UIDGen++); ! Telnet_client telnetClient = new Telnet_client(this, NodeProtocolStack, 0, 0, core.Simulation.UIDGen++); PosixTelnetClient ptc = new PosixTelnetClient(NodeProtocolStack, core.Simulation.UIDGen++); *************** *** 118,136 **** DNS dnsClient = new DNS(NodeProtocolStack, 91, 0, core.Simulation.UIDGen++); ! addApp(echoServer, ECHO_SERVER_ID); ! addApp(echoClient, ECHO_CLIENT_ID); ! addApp(echotcpServer, ECHO_TCP_SERVER_ID); ! addApp(echotcpClient, ECHO_TCP_CLIENT_ID); ! addApp(telnetClient, TELNET_CLIENT_ID); ! addApp(ptc, POSIX_TELNET_CLIENT_ID); ! addApp(snmpManager, SNMP_MANAGER_ID); ! addApp(dhcpc, DHCP_CLIENT_ID); ! addApp(dnsClient,DNS_CLIENT_ID); } --- 121,139 ---- DNS dnsClient = new DNS(NodeProtocolStack, 91, 0, core.Simulation.UIDGen++); ! addApp(echoServer, ApplicationLayerDevice.ECHO_SERVER_ID); ! addApp(echoClient, ApplicationLayerDevice.ECHO_CLIENT_ID); ! addApp(echotcpServer, ApplicationLayerDevice.ECHO_TCP_SERVER_ID); ! addApp(echotcpClient, ApplicationLayerDevice.ECHO_TCP_CLIENT_ID); ! addApp(telnetClient, ApplicationLayerDevice.TELNET_CLIENT_ID); ! addApp(ptc, ApplicationLayerDevice.POSIX_TELNET_CLIENT_ID); ! addApp(snmpManager, ApplicationLayerDevice.SNMP_MANAGER_ID); ! addApp(dhcpc, ApplicationLayerDevice.DHCP_CLIENT_ID); ! addApp(dnsClient,ApplicationLayerDevice.DNS_CLIENT_ID); } Index: ConsoleLink.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/ConsoleLink.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ConsoleLink.java 14 Oct 2007 17:19:07 -0000 1.1 --- ConsoleLink.java 24 Oct 2008 16:18:48 -0000 1.2 *************** *** 29,34 **** package core; - import java.util.*; - import core.FalseRandom; /** * ConsoleLink extends Link. It sets two Interface links to a pc. --- 29,32 ---- *************** *** 43,46 **** --- 41,49 ---- /** + * + */ + private static final long serialVersionUID = 3739538944636179176L; + + /** * Constructor to be used by the Simulation when connecting 2 PC's * We have made a design decision to restrict a Ethernet link to only has 2 ends. Index: SerialLink.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/SerialLink.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** SerialLink.java 5 Oct 2008 19:12:31 -0000 1.5 --- SerialLink.java 24 Oct 2008 16:18:48 -0000 1.6 *************** *** 29,33 **** package core; ! import java.util.*; /** * SerialLink extends Link. It sets two Interface links to a pc. --- 29,33 ---- package core; ! import java.util.Iterator; /** * SerialLink extends Link. It sets two Interface links to a pc. *************** *** 41,44 **** --- 41,50 ---- public class SerialLink extends Link { + /** + * + */ + private static final long serialVersionUID = -8760714768329454957L; + + public SerialLink(String inName, NetworkInterface inFirstNodeInterface, NetworkInterface inSecondNodeInterface)throws InvalidLinkConnectionException { super(inName); *************** *** 70,74 **** if (!temp.getSourceName().equals(inSourceName)) { ! temp.receivePacket(inPacket); } } --- 76,80 ---- if (!temp.getSourceName().equals(inSourceName)) { ! temp.receivePacket(inPacket); } } Index: SimulationException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/SimulationException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** SimulationException.java 20 Nov 2005 20:30:53 -0000 1.2 --- SimulationException.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 37,40 **** --- 37,44 ---- */ public class SimulationException extends Exception{ + /** + * + */ + private static final long serialVersionUID = -6246457071432271373L; protected String exceptionMsg; /** *************** *** 55,58 **** --- 59,63 ---- * @version v0.20 */ + @Override public String toString(){ return "Exception Details: "+exceptionMsg; Index: WANSocket.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WANSocket.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** WANSocket.java 23 Sep 2008 15:22:13 -0000 1.7 --- WANSocket.java 24 Oct 2008 16:18:48 -0000 1.8 *************** *** 9,14 **** package core; ! import java.io.*; ! import java.net.*; /** --- 9,19 ---- package core; ! import java.io.BufferedReader; ! import java.io.InputStream; ! import java.io.InputStreamReader; ! import java.io.OutputStreamWriter; ! import java.io.PrintWriter; ! import java.net.ServerSocket; ! import java.net.Socket; /** *************** *** 111,118 **** WANNetworkInterface parentInterface; - private InputStream in; - private BufferedReader reader; - - IncomeConnectionHandler(ServerSocket s, WANSocket w, WANNetworkInterface parentInterface) { this.s = s; --- 116,119 ---- *************** *** 122,126 **** } ! public void run() { try{ while(s != null){ --- 123,128 ---- } ! @Override ! public void run() { try{ while(s != null){ *************** *** 155,161 **** WANSocket w; - private InputStream in; - private BufferedReader reader; - WANNetworkInterface parentInterface; --- 157,160 ---- *************** *** 168,172 **** } ! public void run() { try{ parentInterface.addLayerInfo("Wan interface", "Connected to peer."); --- 167,172 ---- } ! @Override ! public void run() { try{ parentInterface.addLayerInfo("Wan interface", "Connected to peer."); Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** CommandProcessor.java 23 Oct 2008 17:08:27 -0000 1.32 --- CommandProcessor.java 24 Oct 2008 16:18:48 -0000 1.33 *************** *** 10,13 **** --- 10,28 ---- package core; + import java.util.ArrayList; + import java.util.Calendar; + import java.util.Enumeration; + import java.util.Hashtable; + import java.util.Iterator; + import java.util.TreeSet; + import java.util.Vector; + import java.util.regex.Matcher; + import java.util.regex.Pattern; + + import core.AccessListEngine.access_list; + import core.CommandInterface.Modes; + import core.NATEngine.NAT_rule; + import core.NATEngine.NAT_session; + import core.WiFiPort.APClient; import core.protocolsuite.tcp_ip.DHCPC; import core.protocolsuite.tcp_ip.DHCPD; *************** *** 26,45 **** import core.protocolsuite.tcp_ip.jnSocket; - import java.util.ArrayList; - import java.util.Calendar; - import java.util.Enumeration; - import java.util.Hashtable; - import java.util.Iterator; - import java.util.TreeSet; - import java.util.Vector; - import java.util.regex.Matcher; - import java.util.regex.Pattern; - - import core.CommandInterface.Modes; - import core.NATEngine.NAT_rule; - import core.NATEngine.NAT_session; - import core.WiFiPort.APClient; - import core.AccessListEngine.access_list; - /** * --- 41,44 ---- *************** *** 445,459 **** public String call(Vector<String> params){ String out = ""; ! if(device instanceof NetworkLayerDevice){ ! NetworkLayerDevice ndev = (NetworkLayerDevice) device; ! if(params.size()==0){ ! ndev.clearVlan(); ! } ! else{ ! out += "error: invalid parameters\n"; ! } } else{ ! out += "This instruction not supported by device\n"; } return out; --- 444,453 ---- public String call(Vector<String> params){ String out = ""; ! NetworkLayerDevice ndev = device; ! if(params.size()==0){ ! ndev.clearVlan(); } else{ ! out += "error: invalid parameters\n"; } return out; Index: NATEngine.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NATEngine.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** NATEngine.java 13 Oct 2008 21:20:21 -0000 1.8 --- NATEngine.java 24 Oct 2008 16:18:48 -0000 1.9 *************** *** 1,9 **** package core; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; ! import java.util.ArrayList; ! import core.protocolsuite.tcp_ip.*; public class NATEngine { --- 1,14 ---- package core; + import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; import java.util.Vector; ! ! import core.protocolsuite.tcp_ip.ICMP_packet; ! import core.protocolsuite.tcp_ip.IPV4Address; ! import core.protocolsuite.tcp_ip.IP_packet; ! import core.protocolsuite.tcp_ip.TCP_packet; ! import core.protocolsuite.tcp_ip.UDP_packet; public class NATEngine { *************** *** 58,62 **** public final static int UDP = 2; public final static int TCP = 3; ! public int protocol = IP; public String in_ip = ""; --- 63,67 ---- public final static int UDP = 2; public final static int TCP = 3; ! public int protocol = NAT_rule.IP; public String in_ip = ""; Index: InvalidProtocolStackException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/InvalidProtocolStackException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InvalidProtocolStackException.java 20 Nov 2005 20:30:53 -0000 1.2 --- InvalidProtocolStackException.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 38,41 **** --- 38,46 ---- public class InvalidProtocolStackException extends SimulationException { /** + * + */ + private static final long serialVersionUID = -4162090886186590648L; + + /** * This method throw inExceptionMsg up to the super class Simulation * Excpetion Index: LayerInfoHandler.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/LayerInfoHandler.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** LayerInfoHandler.java 10 Nov 2007 13:25:38 -0000 1.3 --- LayerInfoHandler.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 29,33 **** ! import java.util.*; /** --- 29,34 ---- ! import java.util.Iterator; ! import java.util.Vector; /** Index: ExternalProxy.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/ExternalProxy.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ExternalProxy.java 13 Oct 2008 12:36:15 -0000 1.6 --- ExternalProxy.java 24 Oct 2008 16:18:48 -0000 1.7 *************** *** 28,35 **** package core; ! import core.protocolsuite.tcp_ip.*; ! import java.util.*; ! import java.io.*; ! import java.net.*; /** --- 28,38 ---- package core; ! import java.io.IOException; ! import java.net.Socket; ! import java.util.Hashtable; ! ! import core.protocolsuite.tcp_ip.ExternalProxyApp; ! import core.protocolsuite.tcp_ip.IP_packet; ! import core.protocolsuite.tcp_ip.TCP_packet; /** *************** *** 43,47 **** public class ExternalProxy extends NetworkLayerDevice { ! int externalPort; String externalIP; ExternalProxyApp NE; --- 46,54 ---- public class ExternalProxy extends NetworkLayerDevice { ! /** ! * ! */ ! private static final long serialVersionUID = -426558271140634982L; ! int externalPort; String externalIP; ExternalProxyApp NE; *************** *** 78,82 **** } ! public void receivePacket(Packet inPacket) throws LowLinkException { if(inPacket instanceof IP_packet){ if(busy) return; --- 85,90 ---- } ! @Override ! public void receivePacket(Packet inPacket) throws LowLinkException { if(inPacket instanceof IP_packet){ if(busy) return; *************** *** 129,133 **** ! public void sendPacket(String inDestMACAddress, Packet inPacket, String inInterfaceKey) throws InvalidNetworkInterfaceNameException, CommunicationException, LowLinkException{ if (NetworkInterfacetable.containsKey(inInterfaceKey)) { --- 137,142 ---- ! @Override ! public void sendPacket(String inDestMACAddress, Packet inPacket, String inInterfaceKey) throws InvalidNetworkInterfaceNameException, CommunicationException, LowLinkException{ if (NetworkInterfacetable.containsKey(inInterfaceKey)) { Index: InvalidNetworkLayerDeviceException.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/InvalidNetworkLayerDeviceException.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** InvalidNetworkLayerDeviceException.java 20 Nov 2005 20:30:53 -0000 1.2 --- InvalidNetworkLayerDeviceException.java 24 Oct 2008 16:18:48 -0000 1.3 *************** *** 35,38 **** --- 35,43 ---- public class InvalidNetworkLayerDeviceException extends SimulationException { /** + * + */ + private static final long serialVersionUID = -281417850697407145L; + + /** * This method throw inExceptionMsg up to the super class Simulation * Excpetion Index: AccessListEngine.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/AccessListEngine.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** AccessListEngine.java 13 Oct 2008 12:36:15 -0000 1.5 --- AccessListEngine.java 24 Oct 2008 16:18:48 -0000 1.6 *************** *** 118,122 **** Enumeration e = ACLl.keys(); while(e.hasMoreElements()){ ! temp_acl = (access_list)ACLl.get((Integer)e.nextElement()); if(temp_acl.action == action && temp_acl.IP1.equals(IP1) && --- 118,122 ---- Enumeration e = ACLl.keys(); while(e.hasMoreElements()){ ! temp_acl = (access_list)ACLl.get(e.nextElement()); if(temp_acl.action == action && temp_acl.IP1.equals(IP1) && *************** *** 143,147 **** Enumeration e = ACLl.keys(); while(e.hasMoreElements()){ ! temp_acl = (access_list)ACLl.get((Integer)e.nextElement()); if(temp_acl.action == action && (protocol==-1 || temp_acl.protocol == protocol) && --- 143,147 ---- Enumeration e = ACLl.keys(); while(e.hasMoreElements()){ ! temp_acl = (access_list)ACLl.get(e.nextElement()); if(temp_acl.action == action && (protocol==-1 || temp_acl.protocol == protocol) && *************** *** 213,217 **** Enumeration e = ACLl.keys(); while(e.hasMoreElements()){ ! temp_acl = (access_list)ACLl.get((Integer)e.nextElement()); if(temp_acl.action>0){ --- 213,217 ---- Enumeration e = ACLl.keys(); while(e.hasMoreElements()){ ! temp_acl = (access_list)ACLl.get(e.nextElement()); if(temp_acl.action>0){ Index: Router.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Router.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Router.java 6 Oct 2008 13:20:39 -0000 1.11 --- Router.java 24 Oct 2008 16:18:48 -0000 1.12 *************** *** 46,49 **** --- 46,54 ---- /** + * + */ + private static final long serialVersionUID = -6546396346550074138L; + + /** * Constructs a new Router with the specified name and is given two * Network Interfaces *************** *** 56,67 **** } ! public void initApplications(){ super.initApplications(); RIP ripServer=new RIP(NodeProtocolStack,core.Simulation.UIDGen++); ! SNMP snmpAgent = new SNMP((ApplicationLayerDevice)this, NodeProtocolStack, SNMP.DEFAULT_PORT, 0, core.Simulation.UIDGen++); ! Telnet_server telnetServer = new Telnet_server((ApplicationLayerDevice)this, NodeProtocolStack, 23, 1, core.Simulation.UIDGen++); DHCPD dhcpd = new DHCPD(NodeProtocolStack, core.Simulation.UIDGen++); --- 61,73 ---- } ! @Override ! public void initApplications(){ super.initApplications(); RIP ripServer=new RIP(NodeProtocolStack,core.Simulation.UIDGen++); ! SNMP snmpAgent = new SNMP(this, NodeProtocolStack, SNMP.DEFAULT_PORT, 0, core.Simulation.UIDGen++); ! Telnet_server telnetServer = new Telnet_server(this, NodeProtocolStack, 23, 1, core.Simulation.UIDGen++); DHCPD dhcpd = new DHCPD(NodeProtocolStack, core.Simulation.UIDGen++); *************** *** 70,83 **** DNS dnsClient = new DNS(NodeProtocolStack, 91, 0, core.Simulation.UIDGen++); ! addApp(ripServer,RIP_SERVER_ID); ! addApp(telnetServer, TELNET_SERVER_ID); ! addApp(snmpAgent, SNMP_AGENT_ID); ! addApp(dhcpd, DHCP_SERVER_ID); ! addApp(dhcpc, DHCP_CLIENT_ID); ! addApp(dnsClient,DNS_CLIENT_ID); } --- 76,89 ---- DNS dnsClient = new DNS(NodeProtocolStack, 91, 0, core.Simulation.UIDGen++); ! addApp(ripServer,ApplicationLayerDevice.RIP_SERVER_ID); ! addApp(telnetServer, ApplicationLayerDevice.TELNET_SERVER_ID); ! addApp(snmpAgent, ApplicationLayerDevice.SNMP_AGENT_ID); ! addApp(dhcpd, ApplicationLayerDevice.DHCP_SERVER_ID); ! addApp(dhcpc, ApplicationLayerDevice.DHCP_CLIENT_ID); ! addApp(dnsClient,ApplicationLayerDevice.DNS_CLIENT_ID); } Index: SerialNetworkInterface.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/SerialNetworkInterface.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** SerialNetworkInterface.java 5 Oct 2008 18:41:06 -0000 1.7 --- SerialNetworkInterface.java 24 Oct 2008 16:18:48 -0000 1.8 *************** *** 30,34 **** public class SerialNetworkInterface extends NetworkInterface{ ! /** * FrameRelay ClockRate * */ --- 30,38 ---- public class SerialNetworkInterface extends NetworkInterface{ ! /** ! * ! */ ! private static final long serialVersionUID = -4159063989094846370L; ! /** * FrameRelay ClockRate * */ *************** *** 40,51 **** protected SerialNetworkInterface(long UID, String inName, Node parent) { super(UID, inName,parent); ! ClockRate = DEFAULT_CLOCKRATE; } ! protected void receivePacket(Packet inPacket) throws LowLinkException { Serial_packet tempPacket = (Serial_packet)inPacket; ! if(tempPacket.getClockRate() == ClockRate ){ LayerInfo pingInfo = new LayerInfo(getClass().getName()); pingInfo.setObjectName(parentNode.getName()); --- 44,56 ---- protected SerialNetworkInterface(long UID, String inName, Node parent) { super(UID, inName,parent); ! ClockRate = SerialNetworkInterface.DEFAULT_CLOCKRATE; } ! @Override ! protected void receivePacket(Packet inPacket) throws LowLinkException { Serial_packet tempPacket = (Serial_packet)inPacket; ! if((tempPacket.getClockRate() == 0 && ClockRate>0) || (tempPacket.getClockRate() > 0 && ClockRate == 0)){ LayerInfo pingInfo = new LayerInfo(getClass().getName()); pingInfo.setObjectName(parentNode.getName()); *************** *** 67,74 **** } ! public int getType(){ return NetworkInterface.Serial; } protected void sendPacket(Packet inPacket) throws LowLinkException { --- 72,81 ---- } ! @Override ! public int getType(){ return NetworkInterface.Serial; } + @Override protected void sendPacket(Packet inPacket) throws LowLinkException { *************** *** 112,116 **** } ! public boolean isActive(){ return true; } --- 119,124 ---- } ! @Override ! public boolean isActive(){ return true; } *************** *** 128,131 **** --- 136,140 ---- * @version v0.20 */ + @Override protected String getDetails(){ *************** *** 133,136 **** --- 142,146 ---- } + @Override public void Timer(int temp){ } } Index: CommandsTree.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandsTree.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** CommandsTree.java 10 Sep 2008 21:35:37 -0000 1.7 --- CommandsTree.java 24 Oct 2008 16:18:48 -0000 1.8 *************** *** 12,15 **** --- 12,16 ---- import java.util.LinkedList; import java.util.Vector; + import core.CommandInterface.Modes; *************** *** 71,75 **** CommandNode node = (CommandNode)tree.get(i); String nodename = node.getName(); ! if(!nodename.equals(ANYWORD)){ if(nodename.length()>cmdsize) nodename = nodename.substring(0,cmdsize); int cmp = command.compareToIgnoreCase(nodename); --- 72,76 ---- CommandNode node = (CommandNode)tree.get(i); String nodename = node.getName(); ! if(!nodename.equals(CommandsTree.ANYWORD)){ if(nodename.length()>cmdsize) nodename = nodename.substring(0,cmdsize); int cmp = command.compareToIgnoreCase(nodename); *************** *** 270,274 **** public String call(String command, Modes mode){ String result = null; ! if(command.startsWith(COMMENT)){ //result = command; //result = command.substring(COMMENT.length()); --- 271,275 ---- public String call(String command, Modes mode){ String result = null; ! if(command.startsWith(CommandsTree.COMMENT)){ //result = command; //result = command.substring(COMMENT.length()); *************** *** 288,292 **** node = node.getNode(cmds[i], mode); if(node != null){ ! if(node.getName().equals(ANYWORD)){ vprms.add(cmds[i]); } --- 289,293 ---- node = node.getNode(cmds[i], mode); if(node != null){ ! if(node.getName().equals(CommandsTree.ANYWORD)){ vprms.add(cmds[i]); } *************** *** 365,370 **** CommandNode node = root; - CommandInterface func = null; - int modes = 0; for(int i=0; i<cmds.length && node!=null && node.modes.isContain(mode); i++){ if(i<cmds.length-1){ --- 366,369 ---- Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.35 retrieving revision 1.36 diff -C2 -d -r1.35 -r1.36 *** Simulation.java 22 Oct 2008 08:54:15 -0000 1.35 --- Simulation.java 24 Oct 2008 16:18:48 -0000 1.36 *************** *** 29,43 **** package core; import java.io.Serializable; ! import java.util.*; ! import java.lang.reflect.*; ! ! import core.protocolsuite.tcp_ip.IPV4Address; ! import core.protocolsuite.tcp_ip.Route_entry; ! import core.protocolsuite.tcp_ip.InvalidIPAddressException; ! import core.protocolsuite.tcp_ip.InvalidSubnetMaskException; public class Simulation implements Serializable { /** * @link aggregation <{core.Link}> * @directed directed --- 29,48 ---- package core; import java.io.Serializable; ! import java.lang.reflect.Constructor; ! import java.util.ArrayList; ! import java.util.Collections; ! import java.util.Enumeration; ! import java.util.Hashtable; ! import java.util.Iterator; ! import java.util.Vector; public class Simulation implements Serializable { /** + * + */ + private static final long serialVersionUID = -3851012405328883446L; + + /** * @link aggregation <{core.Link}> * @directed directed *************** *** 92,97 **** //layerInfoHandler = new LayerInfoHandler(); ! if(Sim!=null){ ! Sim = null; } --- 97,102 ---- //layerInfoHandler = new LayerInfoHandler(); ! if(Simulation.Sim!=null){ ! Simulation.Sim = null; } *************** *** 101,111 **** wifiMedium = new Hashtable<java.lang.Long, WiFiPort>(); ! UIDGen = 0; ! Sim = this; } public void clear(){ ! Sim = null; } --- 106,116 ---- wifiMedium = new Hashtable<java.lang.Long, WiFiPort>(); ! Simulation.UIDGen = 0; ! Simulation.Sim = this; } public void clear(){ ! Simulation.Sim = null; } *************** *** 349,353 **** **/ private void setProtocolType(int inProtocolType) { ! PROTOCOL_TYPE = inProtocolType; } --- 354,358 ---- **/ private void setProtocolType(int inProtocolType) { ! Simulation.PROTOCOL_TYPE = inProtocolType; } *************** *** 360,364 **** **/ public static int getProtocolType() { ! return PROTOCOL_TYPE; } --- 365,369 ---- **/ public static int getProtocolType() { ! return Simulation.PROTOCOL_TYPE; } *************** *** 983,987 **** **/ public static void addLayerInfo(LayerInfo inInfo){ ! Info.receiveInfo(inInfo); } --- 988,992 ---- **/ public static void addLayerInfo(LayerInfo inInfo){ ! Simulation.Info.receiveInfo(inInfo); } *************** *** 992,996 **** inInfo.setLayer(layer); inInfo.setDescription(desc); ! Info.receiveInfo(inInfo); } --- 997,1001 ---- inInfo.setLayer(layer); inInfo.setDescription(desc); ! Simulation.Info.receiveInfo(inInfo); } *************** *** 1002,1006 **** */ public void clearLayerInfo(){ ! Info.clear(); } --- 1007,1011 ---- */ public void clearLayerInfo(){ ! Simulation.Info.clear(); } *************** *** 1014,1018 **** */ public Vector getRecordedInfo(){ ! return Info.getRecordedInfo(); } --- 1019,1023 ---- */ public Vector getRecordedInfo(){ ! return Simulation.Info.getRecordedInfo(); } *************** *** 1119,1136 **** vecInterfaceInfo.add(strInterfaceName); try{ ! vecInterfaceInfo.add((String)tempNetwork.getIntSType(strInterfaceName)); ! vecInterfaceInfo.add((String)tempNetwork.getMACAddress(strInterfaceName)); String tempIP = tempNetwork.getIPAddress(strInterfaceName); if(tempIP != null) { ! vecInterfaceInfo.add((String)tempNetwork.getIPAddress(strInterfaceName)); } else { ! vecInterfaceInfo.add((String)"IP Address not set"); } ! vecInterfaceInfo.add((String)tempNetwork.getSubnetMask(strInterfaceName)); NetworkInterface tempNetworkCard = tempNetwork.getNetworkInterface(strInterfaceName); ! vecInterfaceInfo.add((String)tempNetworkCard.getConnectLinkName()); } --- 1124,1141 ---- vecInterfaceInfo.add(strInterfaceName); try{ ! vecInterfaceInfo.add(tempNetwork.getIntSType(strInterfaceName)); ! vecInterfaceInfo.add(tempNetwork.getMACAddress(strInterfaceName)); String tempIP = tempNetwork.getIPAddress(strInterfaceName); if(tempIP != null) { ! vecInterfaceInfo.add(tempNetwork.getIPAddress(strInterfaceName)); } else { ! vecInterfaceInfo.add("IP Address not set"); } ! vecInterfaceInfo.add(tempNetwork.getSubnetMask(strInterfaceName)); NetworkInterface tempNetworkCard = tempNetwork.getNetworkInterface(strInterfaceName); ! vecInterfaceInfo.add(tempNetworkCard.getConnectLinkName()); } *************** *** 1161,1170 **** vecInterfaceInfo.add("Not Applicable"); vecInterfaceInfo.add(strInterfaceName); ! vecInterfaceInfo.add((String)tempData.getIntSType(strInterfaceName)); vecInterfaceInfo.add("Not Applicable"); vecInterfaceInfo.add("Not Applicable"); vecInterfaceInfo.add("Not Applicable"); NetworkInterface tempNetworkCard = tempData.getNetworkInterface(strInterfaceName); ! vecInterfaceInfo.add((String)tempNetworkCard.getConnectLinkName()); } --- 1166,1175 ---- vecInterfaceInfo.add("Not Applicable"); vecInterfaceInfo.add(strInterfaceName); ! vecInterfaceInfo.add(tempData.getIntSType(strInterfaceName)); vecInterfaceInfo.add("Not Applicable"); vecInterfaceInfo.add("Not Applicable"); vecInterfaceInfo.add("Not Applicable"); NetworkInterface tempNetworkCard = tempData.getNetworkInterface(strInterfaceName); ! vecInterfaceInfo.add(tempNetworkCard.getConnectLinkName()); } Index: Link.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Link.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** Link.java 13 Sep 2007 13:38:52 -0000 1.3 --- Link.java 24 Oct 2008 16:18:48 -0000 1.4 *************** *** 30,34 **** import java.io.Serializable; ! import java.util.*; /** --- 30,34 ---- import java.io.Serializable; ! import java.util.Vector; /** Index: NetworkInterfacePort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkInterfacePort.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** NetworkInterfacePort.java 22 Oct 2008 21:22:55 -0000 1.12 --- NetworkInterfacePort.java 24 Oct 2008 16:18:48 -0000 1.13 *************** *** 55,59 **** package core; - import java.io.Serializable; /** --- 55,58 ---- *************** *** 98,101 **** --- 97,104 ---- /** + * + */ + private static final long serialVersionUID = 2453643722253335811L; + /** * Constructs a NetworkInterfacePort object with the name inName *************** *** 117,121 **** final static int MODE_ACCESS = 0; final static int MODE_TRUNK = 1; ! public int mode = MODE_ACCESS; protected NetworkInterfacePort(long UID, String inName, Node inParent) { --- 120,124 ---- final static int MODE_ACCESS = 0; final static int MODE_TRUNK = 1; ! public int mode = NetworkInterfacePort.MODE_ACCESS; protected NetworkInterfacePort(long UID, String inName, Node inParent) { *************** *** 135,139 **** ! public void Timer(int temp){ } --- 138,143 ---- ! @Override ! public void Timer(int temp){ } *************** *** 154,157 **** --- 158,162 ---- */ + @Override protected void receivePacket(Packet inPacket) throws LowLinkException { if(!parentNode.On) return; *************** *** 161,168 **** boolean drop = false; ! if(mode == MODE_ACCESS && tempPacket.vlan_id == 1 && parentNode instanceof NetworkLayerDevice) tempPacket.vlan_id = vlan; ! if(mode == MODE_ACCESS && tempPacket.vlan_id != vlan && parentNode instanceof NetworkLayerDevice) drop = true; --- 166,173 ---- boolean drop = false; ! if(mode == NetworkInterfacePort.MODE_ACCESS && tempPacket.vlan_id == 1 && parentNode instanceof NetworkLayerDevice) tempPacket.vlan_id = vlan; ! if(mode == NetworkInterfacePort.MODE_ACCESS && tempPacket.vlan_id != vlan && parentNode instanceof NetworkLayerDevice) drop = true; *************** *** 194,197 **** --- 199,203 ---- */ + @Override protected void sendPacket(Packet outPacket) throws LowLinkException{ *************** *** 204,208 **** EthernetLink temp = (EthernetLink)connectedLink; ! if(mode == MODE_ACCESS && (tempPacket.vlan_id != vlan)) drop = true; --- 210,214 ---- EthernetLink temp = (EthernetLink)connectedLink; ! if(mode == NetworkInterfacePort.MODE_ACCESS && (tempPacket.vlan_id != vlan)) drop = true; *************** *** 217,221 **** } ! public int getType(){ return NetworkInterface.Ethernet10T; } --- 223,228 ---- } ! @Override ! public int getType(){ return NetworkInterface.Ethernet10T; } *************** *** 234,238 **** */ ! protected String getDetails(){ return "Interface: "+name+"\t\tMAC: Not Applicable \t\t"+ getConnectLinkDetails(); --- 241,246 ---- */ ! @Override ! protected String getDetails(){ return "Interface: "+name+"\t\tMAC: Not Applicable \t\t"+ getConnectLinkDetails(); Index: WiFiPort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/WiFiPort.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** WiFiPort.java 6 Oct 2008 13:20:39 -0000 1.11 --- WiFiPort.java 24 Oct 2008 16:18:48 -0000 1.12 *************** *** 1,11 **** package core; import core.protocolsuite.tcp_ip.ARP_packet; import core.protocolsuite.tcp_ip.IP_packet; - import java.util.Hashtable; - import java.util.Enumeration; public class WiFiPort extends EthernetNetworkInterface { protected int channel = 1; --- 1,17 ---- package core; + import java.util.Enumeration; + import java.util.Hashtable; + import core.protocolsuite.tcp_ip.ARP_packet; import core.protocolsuite.tcp_ip.IP_packet; public class WiFiPort extends EthernetNetworkInterface { + /** + * + */ + private static final long serialVersionUID = -1737841009400766734L; + protected int channel = 1; *************** *** 20,24 **** 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 --- 26,30 ---- public static final int MODE_REPEATER = 2; ! protected int Mode = WiFiPort.MODE_AP; // 0 - AP, 1 - Station, 2 - Repeater protected boolean shared_auth = false; // true -- shared, false -- open *************** *** 71,75 **** public APClient(String BSSID){ this.BSSID = BSSID; ! state = PROBE; } } --- 77,81 ---- public APClient(String BSSID){ this.BSSID = BSSID; ! state = WiFiPort.PROBE; } } *************** *** 88,92 **** associated = false; ! state = OFFLINE; failed = false; --- 94,98 ---- associated = false; ! state = WiFiPort.OFFLINE; failed = false; *************** *** 101,105 **** associated = false; ! state = PROBE; lineFree=false; --- 107,111 ---- associated = false; ! state = WiFiPort.PROBE; lineFree=false; *************** *** 119,123 **** ResendPackets.put(p.packet.getID(), p); ! if(Mode == MODE_STATION && inWP.Type == 2){ canSend = checkLineFree(); if(!canSend) --- 125,129 ---- ResendPackets.put(p.packet.getID(), p); ! if(Mode == WiFiPort.MODE_STATION && inWP.Type == 2){ canSend = checkLineFree(); if(!canSend) *************** *** 268,272 **** try{ ! if(Mode == MODE_STATION && p.packet.Type == 2){ canSend = checkLineFree(); --- 274,278 ---- try{ ! if(Mode == WiFiPort.MODE_STATION && p.packet.Type == 2){ canSend = checkLineFree(); *************** *** 288,296 **** ResendPackets.remove(pID); ! if(Mode == MODE_STATION){ ! if(state > ASSOC){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Deassociated at AP " + apBSSID + "/" + SSID + " due to network timeout."); ! }else if(state == PROBE){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Probing AP " + SSID + " failed: no such AP found."); --- 294,302 ---- ResendPackets.remove(pID); ! if(Mode == WiFiPort.MODE_STATION){ ! if(state > WiFiPort.ASSOC){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Deassociated at AP " + apBSSID + "/" + SSID + " due to network timeout."); ! }else if(state == WiFiPort.PROBE){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Probing AP " + SSID + " failed: no such AP found."); *************** *** 306,311 **** ! }else if(Mode == MODE_AP){ ! if(state >= ASSOC){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Deassociating client " + p.packet.getDstBSSID() + " due to network timeout."); --- 312,317 ---- ! }else if(Mode == WiFiPort.MODE_AP){ ! if(state >= WiFiPort.ASSOC){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Deassociating client " + p.packet.getDstBSSID() + " due to network timeout."); *************** *** 342,346 **** public void setBSSID(String bssid) { ! if(Mode != MODE_STATION) BSSID = bssid; } --- 348,352 ---- public void setBSSID(String bssid) { ! if(Mode != WiFiPort.MODE_STATION) BSSID = bssid; } *************** *** 395,399 **** this.MACAddress = macAddress; } ! if(Mode == MODE_STATION) this.BSSID = this.MACAddress; } --- 401,405 ---- this.MACAddress = macAddress; } ! if(Mode == WiFiPort.MODE_STATION) this.BSSID = this.MACAddress; } *************** *** 406,410 **** super.UP(); ! if(!active) Mode = MODE_AP; failed = false; --- 412,416 ---- super.UP(); ! if(!active) Mode = WiFiPort.MODE_AP; failed = false; *************** *** 413,417 **** ResendPackets = new Hashtable<Long, ResendPacket>(); ! if(Mode != MODE_STATION){ APClients = new Hashtable<String, APClient>(); } --- 419,423 ---- ResendPackets = new Hashtable<Long, ResendPacket>(); ! if(Mode != WiFiPort.MODE_STATION){ APClients = new Hashtable<String, APClient>(); } *************** *** 420,424 **** parentNode.startTimerTask(this, 500); ! if(Mode == MODE_STATION){ try{ associate(); --- 426,430 ---- parentNode.startTimerTask(this, 500); ! if(Mode == WiFiPort.MODE_STATION){ try{ associate(); *************** *** 512,516 **** }else{ ! if(Mode == MODE_STATION){ if(tempWiFi.getDstBSSID() == "FF:FF:FF:FF:FF:FF"){ --- 518,522 ---- }else{ ! if(Mode == WiFiPort.MODE_STATION){ if(tempWiFi.getDstBSSID() == "FF:FF:FF:FF:FF:FF"){ *************** *** 520,524 **** } ! if(state == PROBE && tempWiFi.Type == 0 && tempWiFi.subType == 5){ ResendPackets.remove(tempWiFi.getID()); apBSSID = tempWiFi.getSrcBSSID(); --- 526,530 ---- } ! if(state == WiFiPort.PROBE && tempWiFi.Type == 0 && tempWiFi.subType == 5){ ResendPackets.remove(tempWiFi.getID()); apBSSID = tempWiFi.getSrcBSSID(); *************** *** 527,537 **** ResendPackets.clear(); if(!isSecureEnabled()){ ! state = ASSOC; sendAssocReq(apBSSID); }else{ ! state = AUTH; sendAuthReq(apBSSID, 0); } ! }else if(state == AUTH && tempWiFi.Type == 0 && tempWiFi.subType == 11){ if(!shared_auth && !tempWiFi.shared){ --- 533,543 ---- ResendPackets.clear(); if(!isSecureEnabled()){ ! state = WiFiPort.ASSOC; sendAssocReq(apBSSID); }else{ ! state = WiFiPort.AUTH; sendAuthReq(apBSSID, 0); } ! }else if(state == WiFiPort.AUTH && tempWiFi.Type == 0 && tempWiFi.subType == 11){ if(!shared_auth && !tempWiFi.shared){ *************** *** 539,543 **** "Link", "Recieved successful auth reply from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = ASSOC; sendAssocReq(apBSSID); }else if(shared_auth && tempWiFi.shared){ --- 545,549 ---- "Link", "Recieved successful auth reply from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = WiFiPort.ASSOC; sendAssocReq(apBSSID); }else if(shared_auth && tempWiFi.shared){ *************** *** 546,550 **** "Link", "Recieved auth challenge from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = AUTH; sendAuthReq(apBSSID, 2); }else{ --- 552,556 ---- "Link", "Recieved auth challenge from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = WiFiPort.AUTH; sendAuthReq(apBSSID, 2); }else{ *************** *** 552,556 **** "Link", "Recieved successful auth reply from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = ASSOC; sendAssocReq(apBSSID); } --- 558,562 ---- "Link", "Recieved successful auth reply from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = WiFiPort.ASSOC; sendAssocReq(apBSSID); } *************** *** 563,581 **** } ! }else if(state == ASSOC && tempWiFi.Type == 0 && tempWiFi.subType == 1){ ResendPackets.remove(tempWiFi.getID()); Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Recieved assoc reply from " + apBSSID + " on interface "+ name + ". Association successfull."); ! state = DATA; ResendPackets.clear(); Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Associated at AP " + apBSSID + "/" + SSID + "."); associated = true; ! }else if(state == DATA && tempWiFi.Type == 1 && tempWiFi.subType == 12){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Control Packet", "Link", "Recieved CTS packet from " + tempWiFi.getSrcBSSID() + " on interface "+ name + "."); lineFree=true; } ! }else if(Mode == MODE_AP){ if(tempWiFi.Type == 0 && tempWiFi.subType == 4){ --- 569,587 ---- } ! }else if(state == WiFiPort.ASSOC && tempWiFi.Type == 0 && tempWiFi.subType == 1){ ResendPackets.remove(tempWiFi.getID()); Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Recieved assoc reply from " + apBSSID + " on interface "+ name + ". Association successfull."); ! state = WiFiPort.DATA; ResendPackets.clear(); Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Management Packet", "Link", "Associated at AP " + apBSSID + "/" + SSID + "."); associated = true; ! }else if(state == WiFiPort.DATA && tempWiFi.Type == 1 && tempWiFi.subType == 12){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "802.11 Control Packet", "Link", "Recieved CTS packet from " + tempWiFi.getSrcBSSID() + " on interface "+ name + "."); lineFree=true; } ! }else if(Mode == WiFiPort.MODE_AP){ if(tempWiFi.Type == 0 && tempWiFi.subType == 4){ *************** *** 601,605 **** "Link", "Recieved auth req from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = AUTH; sendAuthReply(tempWiFi.getSrcBSSID(), 1); }else if(shared_auth && tempWiFi.shared){ --- 607,611 ---- "Link", "Recieved auth req from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = WiFiPort.AUTH; sendAuthReply(tempWiFi.getSrcBSSID(), 1); }else if(shared_auth && tempWiFi.shared){ *************** *** 608,612 **** "Link", "Recieved auth req from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = AUTH; sendAuthReply(tempWiFi.getSrcBSSID(), 1); }else{ --- 614,618 ---- "Link", "Recieved auth req from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = WiFiPort.AUTH; sendAuthReply(tempWiFi.getSrcBSSID(), 1); }else{ *************** *** 614,618 **** "Link", "Recieved auth challenge reply from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = AUTH; sendAuthReply(tempWiFi.getSrcBSSID(), 3); } --- 620,624 ---- "Link", "Recieved auth challenge reply from " + apBSSID + " on interface "+ name); ResendPackets.clear(); ! state = WiFiPort.AUTH; sendAuthReply(tempWiFi.getSrcBSSID(), 3); } *************** *** 631,635 **** "Link", "Station " + tempWiFi.getSrcBSSID() + " associated."); ! APClients.get(tempWiFi.getSrcBSSID()).state = DATA; sendAssocReply(tempWiFi.getSrcBSSID(), tempWiFi.getID()); }else{ --- 637,641 ---- "Link", "Station " + tempWiFi.getSrcBSSID() + " associated."); ! APClients.get(tempWiFi.getSrcBSSID()).state = WiFiPort.DATA; sendAssocReply(tempWiFi.getSrcBSSID(), tempWiFi.getID()); }else{ *************** *** 659,663 **** if(!parentNode.On) return; ! if(Mode == MODE_AP){ Ethernet_packet tempPacket = (Ethernet_packet)outPacket; --- 665,669 ---- if(!parentNode.On) return; ! if(Mode == WiFiPort.MODE_AP){ Ethernet_packet tempPacket = (Ethernet_packet)outPacket; *************** *** 676,680 **** sendWirelessConfirmPacket(tempWiFi, 200); ! }else if(Mode == MODE_STATION){ if(failed){ --- 682,686 ---- sendWirelessConfirmPacket(tempWiFi, 200); ! }else if(Mode == WiFiPort.MODE_STATION){ if(failed){ *************** *** 684,688 **** } ! 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"); --- 690,694 ---- } ! if(!associated && state == WiFiPort.OFFLINE){ Simulation.addLayerInfo(getClass().getName(), parentNode.getName(), "Ethernet Packet", "Link", "Can't send over air: no AP; AP searching process will be started immediately"); Index: NetworkInterface.java =================================================================== RCS file:... [truncated message content] |
From: QweR <qw...@us...> - 2008-10-23 17:09:12
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29132/core Modified Files: CommandProcessor.java Log Message: RIP gui was deleted Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** CommandProcessor.java 22 Oct 2008 21:32:59 -0000 1.31 --- CommandProcessor.java 23 Oct 2008 17:08:27 -0000 1.32 *************** *** 224,228 **** commands.addDescription("router","Enable a routing process"); commands.add("router rip", router_rip_Command, "Routing Information Protocol (RIP)"); ! commands.add("router rip network", router_rip_network_Command, "Routing Information Protocol (RIP)"); commands.addDescription("show","Show running system information"); --- 224,228 ---- commands.addDescription("router","Enable a routing process"); commands.add("router rip", router_rip_Command, "Routing Information Protocol (RIP)"); ! commands.add("router rip network", router_rip_network_Command, "Add network/interface for RIP"); commands.addDescription("show","Show running system information"); |
From: QweR <qw...@us...> - 2008-10-23 17:09:00
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29132/guiUI Modified Files: GuiRouter.java MainScreen.java Removed Files: RIPProperties.java Log Message: RIP gui was deleted Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.98 retrieving revision 1.99 diff -C2 -d -r1.98 -r1.99 *** MainScreen.java 22 Oct 2008 08:54:15 -0000 1.98 --- MainScreen.java 23 Oct 2008 17:08:27 -0000 1.99 *************** *** 718,726 **** } - public void showRIPDialog(String inNodeName) { - new RIPProperties(this, Sim, Sandbox, inNodeName); - - } - public String getDeviceTypeDialog(String title, String msg, String[] choices) { String optbtn = (String) UIManager.get("OptionPane.cancelButtonText"); --- 718,721 ---- --- RIPProperties.java DELETED --- Index: GuiRouter.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiRouter.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** GuiRouter.java 6 Oct 2008 13:20:39 -0000 1.6 --- GuiRouter.java 23 Oct 2008 17:08:27 -0000 1.7 *************** *** 96,111 **** private JMenuItem mnuTelnetNoListen = new JMenuItem("Stop telnet server."); - private JMenuItem mnuRIPcfg = new JMenuItem("Configure RIP..."); - public GuiRouter(String inName, MainScreen inMainScreen) { super(inName, inMainScreen, "images/simulation/router.png"); // router_large.gif - mnuRIPcfg.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - controller.showRIPDialog(lblNodeName.getText()); - } - }); - mnuTelnetListen.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { --- 96,103 ---- *************** *** 122,127 **** mnuAppLayer.add(mnuTelnetListen); mnuAppLayer.add(mnuTelnetNoListen); - mnuAppLayer.addSeparator(); - mnuAppLayer.add(mnuRIPcfg); } --- 114,117 ---- |
From: QweR <qw...@us...> - 2008-10-22 22:17:07
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10964/guiUI Modified Files: GuiMultilayerSwitch.java GuiNode.java Log Message: cosmetic changes Index: GuiNode.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiNode.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** GuiNode.java 13 Oct 2008 19:49:15 -0000 1.9 --- GuiNode.java 22 Oct 2008 21:33:00 -0000 1.10 *************** *** 129,133 **** private JMenuItem mnuTurn = new JMenuItem("Turn Off"); ! private JMenu mnuBreakLink = new JMenu("Disconnect link:"); private JMenuItem mnuLink = new JMenuItem("Links properties"); --- 129,133 ---- private JMenuItem mnuTurn = new JMenuItem("Turn Off"); ! private JMenu mnuBreakLink = new JMenu("Disconnect link"); private JMenuItem mnuLink = new JMenuItem("Links properties"); *************** *** 298,301 **** --- 298,306 ---- } }); + mnuBreakLink.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + updateConnectedLinkMenu(); + } + }); } *************** *** 312,316 **** for (int i = 0; i < ints.length; i++) { int int_type = Simulation.Sim.getNode(this.strNodeName).getIntType((String)ints[i]); ! if(int_type != core.NetworkInterface.Console && int_type != core.NetworkInterface.Wireless){ JMenuItem mnuI = new JMenuItem((String) ints[i]); --- 317,321 ---- for (int i = 0; i < ints.length; i++) { int int_type = Simulation.Sim.getNode(this.strNodeName).getIntType((String)ints[i]); ! if(int_type != core.NetworkInterface.Console && int_type != core.NetworkInterface.Wireless){ JMenuItem mnuI = new JMenuItem((String) ints[i]); *************** *** 350,353 **** --- 355,388 ---- } + public void updateConnectedLinkMenu(){ + try { + mnuBreakLink.removeAll(); + Object ints[] = controller.getInterfaces(lblNodeName.getText()); + for (int i = 0; i < ints.length; i++) { + int int_type = Simulation.Sim.getNode(this.strNodeName).getIntType((String)ints[i]); + boolean lineIsConnected = (Simulation.Sim.getNode(this.strNodeName).getNetworkInterface((String)ints[i]).getConnectedLink()!=null); + + if(int_type != core.NetworkInterface.Wireless && lineIsConnected){ + + JMenuItem mnuDI = new JMenuItem((String) ints[i]); + mnuDI.addActionListener(new ActionListener() { + + public void actionPerformed(ActionEvent e) { + + controller.breakLink(lblNodeName.getText(), + ((JMenuItem) e.getSource()).getText()); + + } + + }); + mnuBreakLink.add(mnuDI); + } + } + + } catch (Exception e) { + e.printStackTrace(); + } + } + public abstract void addInterfaces(MainScreen parent, Node node); *************** *** 656,659 **** --- 691,695 ---- .setEnabled(ena); } + updateConnectedLinkMenu(); GuiNodePopMenu.show(e.getComponent(), e.getX(), e.getY()); } Index: GuiMultilayerSwitch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/GuiMultilayerSwitch.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GuiMultilayerSwitch.java 17 Oct 2008 18:59:14 -0000 1.1 --- GuiMultilayerSwitch.java 22 Oct 2008 21:33:00 -0000 1.2 *************** *** 55,58 **** --- 55,63 ---- package guiUI; + import java.awt.event.ActionEvent; + import java.awt.event.ActionListener; + + import javax.swing.JMenuItem; + import core.Node; *************** *** 87,93 **** --- 92,106 ---- */ + private JMenuItem mnuReset = new JMenuItem("Reset"); + public GuiMultilayerSwitch(String inName, MainScreen inMainScreen) { super(inName, inMainScreen,"images/simulation/mlswitch.png"); + mnuReset.addActionListener(new ActionListener(){ + public void actionPerformed(ActionEvent e){ + controller.Reset(lblNodeName.getText()); + } + }); + GuiNodePopMenu.add(mnuReset); } |
From: QweR <qw...@us...> - 2008-10-22 22:16:38
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10964/core Modified Files: CommandProcessor.java MultilayerSwitch.java NetworkInterface.java NetworkLayerDevice.java Log Message: cosmetic changes Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkLayerDevice.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** NetworkLayerDevice.java 22 Oct 2008 20:26:03 -0000 1.28 --- NetworkLayerDevice.java 22 Oct 2008 21:33:00 -0000 1.29 *************** *** 54,57 **** --- 54,58 ---- private AccessListEngine acls = new AccessListEngine(this); private NATEngine nat = new NATEngine(this); + Hashtable<Integer, String> Vlans; *************** *** 66,75 **** public NetworkLayerDevice(String inName, int inProtocolStackLayers, boolean inOn) { super(inName, inProtocolStackLayers, inOn); ! //set default startup-config ! config.working_config = DeviceConfig.STARTUP_CONFIG; ! //config.add("ip telnet 21"); ! //end set default startup-config ! config.working_config = DeviceConfig.RUNNING_CONFIG; ! config.load(); } --- 67,78 ---- public NetworkLayerDevice(String inName, int inProtocolStackLayers, boolean inOn) { super(inName, inProtocolStackLayers, inOn); ! //set default startup-config ! config.working_config = DeviceConfig.STARTUP_CONFIG; ! //config.add("ip telnet 21"); ! //end set default startup-config ! config.working_config = DeviceConfig.RUNNING_CONFIG; ! config.load(); ! ! Vlans = new Hashtable<Integer, String>(); } *************** *** 521,523 **** --- 524,599 ---- } + + public Enumeration<Integer> getVlans(){ + return Vlans.keys(); + } + + public void addVlan(int v, String name){ + Vlans.put(v, name); + } + + public void removeVlan(int v){ + Vlans.remove(v); + } + + public void clearVlan(){ + Vlans.clear(); + } + + public String getVlanName(int v){ + if(Vlans.containsKey(v)){ + return Vlans.get(v); + } + else if(v == 1){ + return "default"; + } + return null; + } + + public void setVlanName(int v, String name){ + Vlans.remove(v); + Vlans.put(v, name); + } + + public String getAllData(){ + String file = ""; + file += "vlan.dat\n"; + file += "1\n"; + + Enumeration<Integer> it; + Integer v; + + it = Vlans.keys(); + + while (it.hasMoreElements()) { + v = it.nextElement(); + + file = file + v + "," + Vlans.get(v) + "|"; + } + + file += "\n"; + + return file; + } + + public void loadDataFile(String name, int lines, String Data){ + + if(name.equals("vlan.dat")){ + Vlans.clear(); + + String[] vlans = Data.split("\\|"); + + for(int i = 0; i<vlans.length; i++){ + if(vlans[i].length() > 1){ + String[] vlan = vlans[i].split(","); + if(vlan.length>1) + Vlans.put(Integer.valueOf(vlan[0]), vlan[1]); + else + Vlans.put(Integer.valueOf(vlan[0]), ""); + } + } + } + + return; + } }//EOF Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** CommandProcessor.java 22 Oct 2008 16:15:30 -0000 1.30 --- CommandProcessor.java 22 Oct 2008 21:32:59 -0000 1.31 *************** *** 173,177 **** commands.add("interface * description", interface__description_Command, "Interface specific description"); commands.addDescription("interface * encryption","Configure encryption"); ! commands.add("interface * encryption key", interface__encryption_key_Command, "Specify clock-rate"); commands.addDescription("interface * ip","Configure Internet Protocol"); commands.add("interface * ip address", interface__ip_address_Command, "Set the IP address of an interface"); --- 173,177 ---- commands.add("interface * description", interface__description_Command, "Interface specific description"); commands.addDescription("interface * encryption","Configure encryption"); ! commands.add("interface * encryption key", interface__encryption_key_Command, "Configure encryption key"); commands.addDescription("interface * ip","Configure Internet Protocol"); commands.add("interface * ip address", interface__ip_address_Command, "Set the IP address of an interface"); *************** *** 445,452 **** public String call(Vector<String> params){ String out = ""; ! if(device instanceof MultilayerSwitch){ ! MultilayerSwitch msdev = (MultilayerSwitch) device; if(params.size()==0){ ! msdev.clearVlan(); } else{ --- 445,452 ---- public String call(Vector<String> params){ String out = ""; ! if(device instanceof NetworkLayerDevice){ ! NetworkLayerDevice ndev = (NetworkLayerDevice) device; if(params.size()==0){ ! ndev.clearVlan(); } else{ *************** *** 1539,1544 **** private String parse(Vector<String> params, boolean add){ String out = ""; ! if(device instanceof MultilayerSwitch){ ! MultilayerSwitch msdev = (MultilayerSwitch) device; if((params.size()==2 && add) || (params.size()==1 && !add)){ try{ --- 1539,1543 ---- private String parse(Vector<String> params, boolean add){ String out = ""; ! if(device instanceof NetworkLayerDevice){ if((params.size()==2 && add) || (params.size()==1 && !add)){ try{ *************** *** 1584,1589 **** public String call(Vector<String> params){ String out = ""; ! if(device instanceof MultilayerSwitch){ ! MultilayerSwitch msdev = (MultilayerSwitch) device; if(params.size()==1){ try{ --- 1583,1587 ---- public String call(Vector<String> params){ String out = ""; ! if(device instanceof NetworkLayerDevice){ if(params.size()==1){ try{ *************** *** 1617,1622 **** public String call(Vector<String> params){ String out = ""; ! if(device instanceof MultilayerSwitch){ ! MultilayerSwitch msdev = (MultilayerSwitch) device; if(params.size()==1){ try{ --- 1615,1619 ---- public String call(Vector<String> params){ String out = ""; ! if(device instanceof NetworkLayerDevice){ if(params.size()==1){ try{ *************** *** 2211,2215 **** public ip_dns_primary_CommandClass(){ modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.NO_CALL); ! call_params = "<DNS domain name> soa <DNS primary name server> <DNS mailbox of responsible person> <Refresh time> <Refresh retry time> <Authority expire time> <Minimum TTL for zone info>"; no_call_params = "<cr>"; } --- 2208,2214 ---- public ip_dns_primary_CommandClass(){ modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.NO_CALL); ! call_params = "<DNS domain name> soa <DNS primary name server>\n"+ ! " <DNS mailbox of responsible person> <Refresh time>\n"+ ! " <Refresh retry time> <Authority expire time> <Minimum TTL for zone info>"; no_call_params = "<cr>"; } *************** *** 3873,3883 **** public String call(Vector<String> params){ String out = ""; ! if(device instanceof MultilayerSwitch){ ! MultilayerSwitch msdev = (MultilayerSwitch) device; if(params.size()==0){ Hashtable<Integer, Vector<String>> vlanport = new Hashtable<Integer, Vector<String>>(); TreeSet<Integer> vlans = new TreeSet<Integer>(); vlans.add(1); ! Enumeration<Integer> keys = msdev.getVlans(); while(keys.hasMoreElements()){ vlans.add(keys.nextElement()); --- 3872,3882 ---- public String call(Vector<String> params){ String out = ""; ! if(device instanceof NetworkLayerDevice){ ! NetworkLayerDevice ndev = (NetworkLayerDevice) device; if(params.size()==0){ Hashtable<Integer, Vector<String>> vlanport = new Hashtable<Integer, Vector<String>>(); TreeSet<Integer> vlans = new TreeSet<Integer>(); vlans.add(1); ! Enumeration<Integer> keys = ndev.getVlans(); while(keys.hasMoreElements()){ vlans.add(keys.nextElement()); *************** *** 3907,3911 **** while(vlansi.hasNext()){ int vlanid = vlansi.next(); ! String vlanname = msdev.getVlanName(vlanid); if(vlanname==null) vlanname = "(vlan not exists)"; String ports = ""; --- 3906,3910 ---- while(vlansi.hasNext()){ int vlanid = vlansi.next(); ! String vlanname = ndev.getVlanName(vlanid); if(vlanname==null) vlanname = "(vlan not exists)"; String ports = ""; *************** *** 3913,3917 **** Vector<String> ps = vlanport.get(vlanid); for(int i=0; i<ps.size(); i++){ ! ports += (i==0?"":",")+ps.get(i); } } --- 3912,3916 ---- Vector<String> ps = vlanport.get(vlanid); for(int i=0; i<ps.size(); i++){ ! ports += (i==0?"":",")+(i!=0 && i%5==0?"\n ":"")+ps.get(i); } } *************** *** 3919,3923 **** ports = "no ports found"; } ! out += vlanid+" "+String.format("%20s", vlanname)+" "+ports+"\n"; } } --- 3918,3922 ---- ports = "no ports found"; } ! out += String.format("%5d %20s", vlanid, vlanname)+" "+ports+"\n"; } } *************** *** 4195,4199 **** class vlan_CommandClass extends CommandInterface{ public vlan_CommandClass(){ ! modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.NO_CALL); call_params = "<vlanid> [<name>]"; no_call_params = "<vlanid> [<name>]"; --- 4194,4198 ---- class vlan_CommandClass extends CommandInterface{ public vlan_CommandClass(){ ! modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.NO_CALL); call_params = "<vlanid> [<name>]"; no_call_params = "<vlanid> [<name>]"; *************** *** 4207,4212 **** private String parse(Vector<String> params, boolean add){ String out = ""; ! if(device instanceof MultilayerSwitch){ ! MultilayerSwitch msdev = (MultilayerSwitch) device; if(params.size()==1 || params.size()==2){ try{ --- 4206,4211 ---- private String parse(Vector<String> params, boolean add){ String out = ""; ! if(device instanceof NetworkLayerDevice){ ! NetworkLayerDevice ndev = (NetworkLayerDevice) device; if(params.size()==1 || params.size()==2){ try{ *************** *** 4220,4231 **** if(params.size()==2) name = params.get(1); if(add){ ! msdev.addVlan(vlanid, name); } else{ if(name.equals("")){ ! msdev.removeVlan(vlanid); } ! else if(msdev.getVlanName(vlanid).equals(name)){ ! msdev.removeVlan(vlanid); } } --- 4219,4230 ---- if(params.size()==2) name = params.get(1); if(add){ ! ndev.addVlan(vlanid, name); } else{ if(name.equals("")){ ! ndev.removeVlan(vlanid); } ! else if(ndev.getVlanName(vlanid).equals(name)){ ! ndev.removeVlan(vlanid); } } Index: MultilayerSwitch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/MultilayerSwitch.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MultilayerSwitch.java 22 Oct 2008 21:22:55 -0000 1.7 --- MultilayerSwitch.java 22 Oct 2008 21:32:59 -0000 1.8 *************** *** 12,16 **** Hashtable<String, Hashtable<String, Long>> IntCaches; - Hashtable<Integer, String> Vlans; public MultilayerSwitch(String inName, boolean inOn) { --- 12,15 ---- *************** *** 19,97 **** IntCaches = new Hashtable<String, Hashtable<String, Long>>(); - Vlans = new Hashtable<Integer, String>(); - } - - public Enumeration<Integer> getVlans(){ - return Vlans.keys(); - } - - public void addVlan(int v, String name){ - Vlans.put(v, name); - } - - public void removeVlan(int v){ - Vlans.remove(v); - } - - public void clearVlan(){ - Vlans.clear(); - } - - public String getVlanName(int v){ - if(Vlans.containsKey(v)){ - return Vlans.get(v); - } - else if(v == 1){ - return "default"; - } - return null; } - - public void setVlanName(int v, String name){ - Vlans.remove(v); - Vlans.put(v, name); - } - - public String getAllData(){ - String file = ""; - file += "vlan.dat\n"; - file += "1\n"; - - Enumeration<Integer> it; - Integer v; - - it = Vlans.keys(); - - while (it.hasMoreElements()) { - v = it.nextElement(); - - file = file + v + "," + Vlans.get(v) + "|"; - } - - file += "\n"; - - return file; - } - - public void loadDataFile(String name, int lines, String Data){ - - if(name.equals("vlan.dat")){ - Vlans.clear(); - - String[] vlans = Data.split("\\|"); - - for(int i = 0; i<vlans.length; i++){ - if(vlans[i].length() > 1){ - String[] vlan = vlans[i].split(","); - if(vlan.length>1) - Vlans.put(Integer.valueOf(vlan[0]), vlan[1]); - else - Vlans.put(Integer.valueOf(vlan[0]), ""); - } - } - } - - return; - } --- 18,22 ---- Index: NetworkInterface.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkInterface.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** NetworkInterface.java 10 Oct 2008 22:18:05 -0000 1.19 --- NetworkInterface.java 22 Oct 2008 21:33:00 -0000 1.20 *************** *** 421,425 **** */ ! protected Link getConnectedLink() { return connectedLink; --- 421,425 ---- */ ! public Link getConnectedLink() { return connectedLink; |
From: Alexander B. <da...@us...> - 2008-10-22 21:23:00
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv10174/core Modified Files: MultilayerSwitch.java NetworkInterfacePort.java Log Message: Fixed multilayer swtches bug. Index: NetworkInterfacePort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkInterfacePort.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** NetworkInterfacePort.java 22 Oct 2008 08:54:15 -0000 1.11 --- NetworkInterfacePort.java 22 Oct 2008 21:22:55 -0000 1.12 *************** *** 161,168 **** boolean drop = false; ! if(mode == MODE_ACCESS && tempPacket.vlan_id == 1) tempPacket.vlan_id = vlan; ! if(mode == MODE_ACCESS && tempPacket.vlan_id != vlan) drop = true; --- 161,168 ---- boolean drop = false; ! if(mode == MODE_ACCESS && tempPacket.vlan_id == 1 && parentNode instanceof NetworkLayerDevice) tempPacket.vlan_id = vlan; ! if(mode == MODE_ACCESS && tempPacket.vlan_id != vlan && parentNode instanceof NetworkLayerDevice) drop = true; *************** *** 208,211 **** --- 208,213 ---- if(temp!=null && !drop){ + + tempPacket.vlan_id = 1; temp.transportPacket(tempPacket,getSourceName()); Index: MultilayerSwitch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/MultilayerSwitch.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MultilayerSwitch.java 22 Oct 2008 20:26:03 -0000 1.6 --- MultilayerSwitch.java 22 Oct 2008 21:22:55 -0000 1.7 *************** *** 175,183 **** Hashtable<String, Long> inInt = IntCaches.get(inInterfaceName); inInt.put(tempPacket.getSourceMACAddress(), Long.valueOf(System.currentTimeMillis())); ! Ethernet_packet copyPacket = new Ethernet_packet(tempPacket ! .getData(), tempPacket.getDestinationMACAddress(), ! tempPacket.getSourceMACAddress()); ! // tag it ! copyPacket.vlan_id = tempPacket.vlan_id; it = NetworkInterfacetable.elements(); --- 175,179 ---- Hashtable<String, Long> inInt = IntCaches.get(inInterfaceName); inInt.put(tempPacket.getSourceMACAddress(), Long.valueOf(System.currentTimeMillis())); ! it = NetworkInterfacetable.elements(); *************** *** 190,196 **** intFound = true; try { ! if(tempInterface.mode == NetworkInterfacePort.MODE_TRUNK ! || tempInterface.vlan == copyPacket.vlan_id) tempInterface.sendPacket(copyPacket); } catch (NullPointerException e) { System.out.println("MultilayerSwitch.java: " + e.toString()); --- 186,199 ---- intFound = true; try { ! if((tempInterface.mode == NetworkInterfacePort.MODE_TRUNK ! || tempInterface.vlan == tempPacket.vlan_id) && tempInterface.getConnectedLink()!=null){ ! Ethernet_packet copyPacket = new Ethernet_packet(tempPacket ! .getData(), tempPacket.getDestinationMACAddress(), ! tempPacket.getSourceMACAddress()); ! // tag it ! copyPacket.vlan_id = tempPacket.vlan_id; ! tempInterface.sendPacket(copyPacket); + } } catch (NullPointerException e) { System.out.println("MultilayerSwitch.java: " + e.toString()); *************** *** 210,216 **** try { ! if(tempInterface.mode == NetworkInterfacePort.MODE_TRUNK ! || tempInterface.vlan == copyPacket.vlan_id) tempInterface.sendPacket(copyPacket); } catch (NullPointerException e) { System.out.println("Switch.java: " + e.toString()); --- 213,226 ---- try { ! if((tempInterface.mode == NetworkInterfacePort.MODE_TRUNK ! || tempInterface.vlan == tempPacket.vlan_id) && tempInterface.getConnectedLink()!=null){ ! Ethernet_packet copyPacket = new Ethernet_packet(tempPacket ! .getData(), tempPacket.getDestinationMACAddress(), ! tempPacket.getSourceMACAddress()); ! // tag it ! copyPacket.vlan_id = tempPacket.vlan_id; ! tempInterface.sendPacket(copyPacket); + } } catch (NullPointerException e) { System.out.println("Switch.java: " + e.toString()); |
From: Alexander B. <da...@us...> - 2008-10-22 20:26:08
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv6034/core Modified Files: MultilayerSwitch.java NetworkLayerDevice.java Log Message: Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkLayerDevice.java,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** NetworkLayerDevice.java 21 Oct 2008 11:50:24 -0000 1.27 --- NetworkLayerDevice.java 22 Oct 2008 20:26:03 -0000 1.28 *************** *** 77,80 **** --- 77,81 ---- super.turnOn(); initApplications(); + ifacesLinkUP(); // up all before loading config config.load(); } Index: MultilayerSwitch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/MultilayerSwitch.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** MultilayerSwitch.java 22 Oct 2008 08:54:15 -0000 1.5 --- MultilayerSwitch.java 22 Oct 2008 20:26:03 -0000 1.6 *************** *** 234,242 **** } - public void turnOn(){ - init(ProtocolStackLayers); - initApplications(); - ifacesLinkUP(); // up all before loading config - config.load(); - } } --- 234,236 ---- |
From: QweR <qw...@us...> - 2008-10-22 16:16:07
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21408/core Modified Files: CommandProcessor.java DeviceConfig.java Printer.java Log Message: some little bugs was trapped Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** CommandProcessor.java 20 Oct 2008 23:46:56 -0000 1.29 --- CommandProcessor.java 22 Oct 2008 16:15:30 -0000 1.30 *************** *** 21,24 **** --- 21,25 ---- import core.protocolsuite.tcp_ip.SNMP; import core.protocolsuite.tcp_ip.TCP_session; + import core.protocolsuite.tcp_ip.Tcp; import core.protocolsuite.tcp_ip.Telnet_server; import core.protocolsuite.tcp_ip.UDP_session; *************** *** 1264,1270 **** if(params.size()==1){ try { ! if(device.getNetworkInterface(params.get(0))!=null){ ! dhcpc.StartDHCPC(params.get(0), "169.254.0.1"); ! } } catch (InvalidNetworkInterfaceNameException ex) { out += "Invalid interface name\n"; --- 1265,1270 ---- if(params.size()==1){ try { ! device.getNetworkInterface(params.get(0)); ! dhcpc.StartDHCPC(params.get(0), "169.254.0.1"); } catch (InvalidNetworkInterfaceNameException ex) { out += "Invalid interface name\n"; *************** *** 1527,1531 **** class interface__switchport_access_vlan_CommandClass extends CommandInterface{ public interface__switchport_access_vlan_CommandClass(){ ! modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.NO_CALL); call_params = "<vlanid>"; no_call_params = "<cr>"; --- 1527,1531 ---- class interface__switchport_access_vlan_CommandClass extends CommandInterface{ public interface__switchport_access_vlan_CommandClass(){ ! modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.NO_CALL); call_params = "<vlanid>"; no_call_params = "<cr>"; *************** *** 1579,1583 **** class interface__switchport_mode_access_CommandClass extends CommandInterface{ public interface__switchport_mode_access_CommandClass(){ ! modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); call_params = "<cr>"; } --- 1579,1583 ---- class interface__switchport_mode_access_CommandClass extends CommandInterface{ public interface__switchport_mode_access_CommandClass(){ ! modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); call_params = "<cr>"; } *************** *** 1612,1616 **** class interface__switchport_mode_trunk_CommandClass extends CommandInterface{ public interface__switchport_mode_trunk_CommandClass(){ ! modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); call_params = "<cr>"; } --- 1612,1616 ---- class interface__switchport_mode_trunk_CommandClass extends CommandInterface{ public interface__switchport_mode_trunk_CommandClass(){ ! modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); call_params = "<cr>"; } *************** *** 2941,2945 **** if(params.size()==0){ try{ ! device.NodeProtocolStack.TCP().setWindowSize(10); out += "TCP window size is " + device.NodeProtocolStack.TCP().getWindowSize() + " segments"; } --- 2941,2945 ---- if(params.size()==0){ try{ ! device.NodeProtocolStack.TCP().setWindowSize(Tcp.DEFAULT_WINDOW_SIZE); out += "TCP window size is " + device.NodeProtocolStack.TCP().getWindowSize() + " segments"; } Index: DeviceConfig.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/DeviceConfig.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** DeviceConfig.java 20 Oct 2008 23:46:56 -0000 1.23 --- DeviceConfig.java 22 Oct 2008 16:15:30 -0000 1.24 *************** *** 27,30 **** --- 27,31 ---- import core.protocolsuite.tcp_ip.Route_entry; import core.protocolsuite.tcp_ip.SNMP; + import core.protocolsuite.tcp_ip.Tcp; import core.protocolsuite.tcp_ip.Telnet_server; *************** *** 43,48 **** private NetworkLayerDevice device; private CommandProcessor cmdproc; ! private LinkedList running_config = new LinkedList(); ! private LinkedList startup_config = new LinkedList(); Modes mode; --- 44,49 ---- private NetworkLayerDevice device; private CommandProcessor cmdproc; ! private LinkedList<String> running_config = new LinkedList<String>(); ! private LinkedList<String> startup_config = new LinkedList<String>(); Modes mode; *************** *** 77,82 **** } ! public LinkedList getConfig(int config_name){ ! LinkedList config = null; switch(config_name){ case RUNNING_CONFIG: config = prepareConfig(running_config, true); break; --- 78,83 ---- } ! public LinkedList<String> getConfig(int config_name){ ! LinkedList<String> config = null; switch(config_name){ case RUNNING_CONFIG: config = prepareConfig(running_config, true); break; *************** *** 96,101 **** } ! protected LinkedList getRealConfig(int config_name){ ! LinkedList config = null; switch(config_name){ case RUNNING_CONFIG: config = running_config; break; --- 97,102 ---- } ! protected LinkedList<String> getRealConfig(int config_name){ ! LinkedList<String> config = null; switch(config_name){ case RUNNING_CONFIG: config = running_config; break; *************** *** 155,159 **** public boolean addBefore(String command, int config_name, String beforeCommand){ boolean result = false; ! LinkedList config = getRealConfig(config_name); boolean found = false; int index = -1; --- 156,160 ---- public boolean addBefore(String command, int config_name, String beforeCommand){ boolean result = false; ! LinkedList<String> config = getRealConfig(config_name); boolean found = false; int index = -1; *************** *** 199,203 **** try{ Pattern p = Pattern.compile(command); ! LinkedList config = getRealConfig(config_name); Iterator<String> it = config.iterator(); while(it.hasNext()){ --- 200,204 ---- try{ Pattern p = Pattern.compile(command); ! LinkedList<String> config = getRealConfig(config_name); Iterator<String> it = config.iterator(); while(it.hasNext()){ *************** *** 226,230 **** try{ Pattern p = Pattern.compile(command); ! LinkedList config = getRealConfig(config_name); Iterator<String> it = config.iterator(); while(it.hasNext() && !result){ --- 227,231 ---- try{ Pattern p = Pattern.compile(command); ! LinkedList<String> config = getRealConfig(config_name); Iterator<String> it = config.iterator(); while(it.hasNext() && !result){ *************** *** 263,269 **** } ! private LinkedList prepareConfig(LinkedList in, boolean fullConfig){ ! LinkedList out = new LinkedList(); ! Iterator it = in.iterator(); while(it.hasNext()){ String nc = (String)it.next(); --- 264,270 ---- } ! private LinkedList<String> prepareConfig(LinkedList<String> in, boolean fullConfig){ ! LinkedList<String> out = new LinkedList<String>(); ! Iterator<String> it = in.iterator(); while(it.hasNext()){ String nc = (String)it.next(); *************** *** 311,315 **** } ! protected void fillConfigACLS(LinkedList conf){ final int ERROR = 0; final int STANDART = 1; --- 312,316 ---- } ! protected void fillConfigACLS(LinkedList<String> conf){ final int ERROR = 0; final int STANDART = 1; *************** *** 322,326 **** Hashtable acl = (Hashtable)acls.get((Integer)aclkeys.nextElement()); ! Enumeration rulekeys = acl.keys(); while(rulekeys.hasMoreElements()){ access_list rule = (access_list)acl.get((Integer)rulekeys.nextElement()); --- 323,327 ---- Hashtable acl = (Hashtable)acls.get((Integer)aclkeys.nextElement()); ! Enumeration<Integer> rulekeys = acl.keys(); while(rulekeys.hasMoreElements()){ access_list rule = (access_list)acl.get((Integer)rulekeys.nextElement()); *************** *** 338,345 **** String permit_deny = "unsupported_action"; ! if(rule.action==rule.DENY){ permit_deny = "deny "; } ! else if(rule.action==rule.PERMIT){ permit_deny = "permit"; } --- 339,346 ---- String permit_deny = "unsupported_action"; ! if(rule.action==access_list.DENY){ permit_deny = "deny "; } ! else if(rule.action==access_list.PERMIT){ permit_deny = "permit"; } *************** *** 370,383 **** String protocol = "unsupported_protocol"; ! if(rule.protocol==rule.IP){ protocol = "ip "; } ! else if(rule.protocol==rule.TCP){ protocol = "tcp "; } ! else if(rule.protocol==rule.UDP){ protocol = "udp "; } ! else if(rule.protocol==rule.ICMP){ protocol = "icmp"; } --- 371,384 ---- String protocol = "unsupported_protocol"; ! if(rule.protocol==access_list.IP){ protocol = "ip "; } ! else if(rule.protocol==access_list.TCP){ protocol = "tcp "; } ! else if(rule.protocol==access_list.UDP){ protocol = "udp "; } ! else if(rule.protocol==access_list.ICMP){ protocol = "icmp"; } *************** *** 406,410 **** } ! protected void fillInterfaces(LinkedList conf){ if(device instanceof NetworkLayerDevice){ Object[] ins = device.getAllInterfaces(); --- 407,411 ---- } ! protected void fillInterfaces(LinkedList<String> conf){ if(device instanceof NetworkLayerDevice){ Object[] ins = device.getAllInterfaces(); *************** *** 437,441 **** 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) conf.add("interface "+intName+" clock-rate "+sni.getClockRate()); if(wfi!=null){ --- 438,442 ---- 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()!=SerialNetworkInterface.DEFAULT_CLOCKRATE) conf.add("interface "+intName+" clock-rate "+sni.getClockRate()); if(wfi!=null){ *************** *** 500,504 **** if(device instanceof ApplicationLayerDevice){ DHCPC dhcpc = (DHCPC)((ApplicationLayerDevice)device).getApp(PC.DHCP_CLIENT_ID); ! if(dhcpc!=null && dhcpc.running){ conf.add("interface "+intName+" ip dhcp client"); } --- 501,505 ---- if(device instanceof ApplicationLayerDevice){ DHCPC dhcpc = (DHCPC)((ApplicationLayerDevice)device).getApp(PC.DHCP_CLIENT_ID); ! if(dhcpc!=null && dhcpc.running && dhcpc.getInterface().equalsIgnoreCase(intName)){ conf.add("interface "+intName+" ip dhcp client"); } *************** *** 512,516 **** } ! protected void fillARP(LinkedList conf){ if(device instanceof NetworkLayerDevice){ Vector<Vector<String>> ArpTable = device.getARPTable(); --- 513,517 ---- } ! protected void fillARP(LinkedList<String> conf){ if(device instanceof NetworkLayerDevice){ Vector<Vector<String>> ArpTable = device.getARPTable(); *************** *** 525,529 **** } ! protected void fillCommon(LinkedList conf){ conf.add("hostname "+device.getName()); if(device.location!=null && !device.location.equals("")) --- 526,530 ---- } ! protected void fillCommon(LinkedList<String> conf){ conf.add("hostname "+device.getName()); if(device.location!=null && !device.location.equals("")) *************** *** 531,538 **** } ! ! ! ! protected void fillIP(LinkedList conf){ if(device instanceof NetworkLayerDevice){ NetworkLayerDevice ndev = (NetworkLayerDevice)device; --- 532,536 ---- } ! protected void fillIP(LinkedList<String> conf){ if(device instanceof NetworkLayerDevice){ NetworkLayerDevice ndev = (NetworkLayerDevice)device; *************** *** 576,582 **** 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(); --- 574,583 ---- String poolname = pools.nextElement(); DHCPD.pool pool = (DHCPD.pool) dhcpd.pools.get(poolname); ! if(pool.Gateway!="") ! conf.add("ip dhcp pool "+poolname+" default-router "+pool.Gateway); ! if(pool.Genmask!="") ! conf.add("ip dhcp pool "+poolname+" network "+pool.IP+" "+pool.Genmask); ! if(pool.MAC!="") ! conf.add("ip dhcp pool "+poolname+" hardware-address "+pool.MAC); } Vector<Pair> exclude = dhcpd.getExcludeAddresses(); *************** *** 586,594 **** } } ! conf.add("ip tcp window-size "+device.NodeProtocolStack.TCP().getWindowSize()); } } ! protected void fillExtended(LinkedList conf){ conf.add("clock set "+device.getClock()); --- 587,596 ---- } } ! if(device.NodeProtocolStack.TCP().getWindowSize() != Tcp.DEFAULT_WINDOW_SIZE) ! conf.add("ip tcp window-size "+device.NodeProtocolStack.TCP().getWindowSize()); } } ! protected void fillExtended(LinkedList<String> conf){ conf.add("clock set "+device.getClock()); *************** *** 598,602 **** SNMP snmpa = (SNMP) appdevice.getApp(core.ApplicationLayerDevice.SNMP_AGENT_ID); if(snmpa != null && snmpa.running){ ! if(snmpa.getPort()!=snmpa.DEFAULT_PORT){ conf.add("snmp-server port "+snmpa.getPort()); } --- 600,604 ---- SNMP snmpa = (SNMP) appdevice.getApp(core.ApplicationLayerDevice.SNMP_AGENT_ID); if(snmpa != null && snmpa.running){ ! if(snmpa.getPort()!=SNMP.DEFAULT_PORT){ conf.add("snmp-server port "+snmpa.getPort()); } *************** *** 689,693 **** } ! protected void fillRoute(LinkedList conf){ if(device instanceof NetworkLayerDevice){ String routes[] = device.getRouteTableEntries(); --- 691,695 ---- } ! protected void fillRoute(LinkedList<String> conf){ if(device instanceof NetworkLayerDevice){ String routes[] = device.getRouteTableEntries(); Index: Printer.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Printer.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Printer.java 6 Oct 2008 13:20:39 -0000 1.4 --- Printer.java 22 Oct 2008 16:15:30 -0000 1.5 *************** *** 31,37 **** DHCPC dhcpc = new DHCPC(NodeProtocolStack, core.Simulation.UIDGen++); - addApp(snmpAgent, SNMP_AGENT_ID); addApp(dhcpc, DHCP_CLIENT_ID); } --- 31,40 ---- DHCPC dhcpc = new DHCPC(NodeProtocolStack, core.Simulation.UIDGen++); addApp(snmpAgent, SNMP_AGENT_ID); addApp(dhcpc, DHCP_CLIENT_ID); + + getConfig().executeCommand("no interface eth0 shutdown"); + getConfig().executeCommand("interface eth0 ip dhcp client"); + getConfig().executeCommand("write memory"); } |
From: QweR <qw...@us...> - 2008-10-22 16:16:07
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21408/guiUI Modified Files: Terminal.java Log Message: some little bugs was trapped Index: Terminal.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/Terminal.java,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** Terminal.java 19 Oct 2008 21:40:19 -0000 1.19 --- Terminal.java 22 Oct 2008 16:15:30 -0000 1.20 *************** *** 239,242 **** --- 239,248 ---- break; } + case 0x11: { + interface__exit_Command.call(new Vector<String>(0)); + addText(""); + cmdline.setText(""); + break; + } case 0x1B: { cmdline.setText(""); *************** *** 271,274 **** --- 277,281 ---- default: { pos_history = history.size(); + //terminal.setText(text+"\n"+Integer.toHexString(symbol.charAt(0))); } } *************** *** 301,305 **** default: { pos_history = history.size(); ! //terminal.setText(text+"\n"+Integer.toHexString(i)); } } --- 308,312 ---- default: { pos_history = history.size(); ! //terminal.setText(text+"\n"+Integer.toHexString(symbol.charAt(2))); } } |
From: QweR <qw...@us...> - 2008-10-22 16:15:59
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv21408/core/protocolsuite/tcp_ip Modified Files: DHCPC.java Tcp.java Log Message: some little bugs was trapped Index: DHCPC.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DHCPC.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** DHCPC.java 26 Sep 2008 17:53:49 -0000 1.6 --- DHCPC.java 22 Oct 2008 16:15:30 -0000 1.7 *************** *** 22,27 **** String iface; ! ! String DHCPServer; int xid; int leaseTime; --- 22,27 ---- String iface; ! ! String DHCPServer; int xid; int leaseTime; *************** *** 315,317 **** --- 315,321 ---- SendData(appSock, "255.255.255.255", 67, Data); } + + public String getInterface() { + return iface; + } } Index: Tcp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/Tcp.java,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** Tcp.java 19 Nov 2007 15:10:28 -0000 1.105 --- Tcp.java 22 Oct 2008 16:15:30 -0000 1.106 *************** *** 248,252 **** private Timer timer; private PriorityQueue tcp_timers = new PriorityQueue(); ! private int window_size = 10; //tcp window-size for new sessions private Object tcp_timers_lock = new Object(); //for locking queue tcp_timers private int current_time = 0; --- 248,253 ---- private Timer timer; private PriorityQueue tcp_timers = new PriorityQueue(); ! private int window_size = DEFAULT_WINDOW_SIZE; //tcp window-size for new sessions ! public final static int DEFAULT_WINDOW_SIZE = 10; private Object tcp_timers_lock = new Object(); //for locking queue tcp_timers private int current_time = 0; |
From: Alexander B. <da...@us...> - 2008-10-22 09:49:24
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17503/core Modified Files: MultilayerSwitch.java NetworkInterfacePort.java Simulation.java Switch.java Log Message: Fixed bugs with ClassCasting, naming, dhcp re-leasing and VLANs. Index: Switch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Switch.java,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Switch.java 21 Oct 2008 11:50:24 -0000 1.11 --- Switch.java 22 Oct 2008 08:54:15 -0000 1.12 *************** *** 136,139 **** --- 136,141 ---- inInt.put(tempPacket.getSourceMACAddress(), "1"); Ethernet_packet copyPacket = new Ethernet_packet(tempPacket.getData(), tempPacket.getDestinationMACAddress(),tempPacket.getSourceMACAddress()); + // tag it + copyPacket.vlan_id = tempPacket.vlan_id; it = NetworkInterfacetable.elements(); Index: MultilayerSwitch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/MultilayerSwitch.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** MultilayerSwitch.java 21 Oct 2008 11:50:24 -0000 1.4 --- MultilayerSwitch.java 22 Oct 2008 08:54:15 -0000 1.5 *************** *** 84,88 **** if(vlans[i].length() > 1){ String[] vlan = vlans[i].split(","); ! Vlans.put(Integer.valueOf(vlan[0]), vlan[1]); } } --- 84,91 ---- if(vlans[i].length() > 1){ String[] vlan = vlans[i].split(","); ! if(vlan.length>1) ! Vlans.put(Integer.valueOf(vlan[0]), vlan[1]); ! else ! Vlans.put(Integer.valueOf(vlan[0]), ""); } } *************** *** 175,178 **** --- 178,183 ---- .getData(), tempPacket.getDestinationMACAddress(), tempPacket.getSourceMACAddress()); + // tag it + copyPacket.vlan_id = tempPacket.vlan_id; it = NetworkInterfacetable.elements(); Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** Simulation.java 21 Oct 2008 11:50:24 -0000 1.34 --- Simulation.java 22 Oct 2008 08:54:15 -0000 1.35 *************** *** 906,909 **** --- 906,911 ---- throw new InvalidNodeNameException("Node already exists with same name"); } + }catch(InvalidNodeNameException ie){ + throw ie; }catch(Exception e){ e.printStackTrace(); Index: NetworkInterfacePort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkInterfacePort.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** NetworkInterfacePort.java 20 Oct 2008 23:46:56 -0000 1.10 --- NetworkInterfacePort.java 22 Oct 2008 08:54:15 -0000 1.11 *************** *** 156,165 **** protected void receivePacket(Packet inPacket) throws LowLinkException { if(!parentNode.On) return; boolean drop = false; ! if(mode == MODE_ACCESS && (((Ethernet_packet)inPacket).vlan_id != vlan)) drop = true; ! ! if(!drop) parentNode.receivePacket(inPacket, name); return; --- 156,172 ---- protected void receivePacket(Packet inPacket) throws LowLinkException { if(!parentNode.On) return; + + Ethernet_packet tempPacket = (Ethernet_packet)inPacket; boolean drop = false; ! ! if(mode == MODE_ACCESS && tempPacket.vlan_id == 1) ! tempPacket.vlan_id = vlan; ! ! if(mode == MODE_ACCESS && tempPacket.vlan_id != vlan) drop = true; ! ! if(!drop) ! parentNode.receivePacket(tempPacket, name); return; *************** *** 190,201 **** if(!parentNode.On) return; ! Ethernet_packet tempPacket = (Ethernet_packet)outPacket; EthernetLink temp = (EthernetLink)connectedLink; ! ! ! if(temp!=null){ temp.transportPacket(tempPacket,getSourceName()); --- 197,211 ---- if(!parentNode.On) return; ! ! boolean drop = false; ! Ethernet_packet tempPacket = (Ethernet_packet)outPacket; EthernetLink temp = (EthernetLink)connectedLink; ! if(mode == MODE_ACCESS && (tempPacket.vlan_id != vlan)) ! drop = true; ! ! if(temp!=null && !drop){ temp.transportPacket(tempPacket,getSourceName()); |
From: Alexander B. <da...@us...> - 2008-10-22 08:56:59
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv17503/guiUI Modified Files: MainScreen.java Log Message: Fixed bugs with ClassCasting, naming, dhcp re-leasing and VLANs. Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.97 retrieving revision 1.98 diff -C2 -d -r1.97 -r1.98 *** MainScreen.java 21 Oct 2008 20:28:19 -0000 1.97 --- MainScreen.java 22 Oct 2008 08:54:15 -0000 1.98 *************** *** 802,805 **** --- 802,812 ---- + "' all ready exist within Simulation", "Invalid Switch name", JOptionPane.ERROR_MESSAGE); + + + this.setAllHighlightsOff(); + + this.refreshNodeInformationTab(); + + return; } catch (Exception e) { *************** *** 1805,1813 **** 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( --- 1812,1815 ---- *************** *** 1819,1824 **** strSave += "#data\n"; ! strSave += ((core.NetworkLayerDevice) Sim .getNode(key)).getAllData(); strSave += "#enddata\n"; --- 1821,1828 ---- strSave += "#data\n"; ! if (Sim.getNode(key) instanceof core.NetworkLayerDevice) { ! strSave += ((core.NetworkLayerDevice) Sim .getNode(key)).getAllData(); + } strSave += "#enddata\n"; |
From: Alexander B. <da...@us...> - 2008-10-21 20:28:29
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26077/core/protocolsuite/tcp_ip Modified Files: DHCPD.java Log Message: Index: DHCPD.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DHCPD.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** DHCPD.java 20 Oct 2008 23:46:56 -0000 1.9 --- DHCPD.java 21 Oct 2008 20:28:19 -0000 1.10 *************** *** 258,263 **** IP = findLease(p.chaddr); ! if(IP==""){ ! lease l = advertLease(p.chaddr); if(l.IP!=""){ --- 258,266 ---- IP = findLease(p.chaddr); ! if(IP!=""){ ! leases.remove(p.chaddr); ! } ! ! lease l = advertLease(p.chaddr); if(l.IP!=""){ *************** *** 293,297 **** } } ! } /*else if(check if leased yet ){ --- 296,301 ---- } } ! ! /*else if(check if leased yet ){ |
From: Alexander B. <da...@us...> - 2008-10-21 20:28:27
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv26077/guiUI Modified Files: MainScreen.java Log Message: Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.96 retrieving revision 1.97 diff -C2 -d -r1.96 -r1.97 *** MainScreen.java 21 Oct 2008 11:50:24 -0000 1.96 --- MainScreen.java 21 Oct 2008 20:28:19 -0000 1.97 *************** *** 897,901 **** strFirstNodeInter = Sim.getNode(inNode1).getAvailableInterfaces(); ! strSecondNodeInter = Sim.getNode(inNode1).getAvailableInterfaces(); if (strFirstNodeInter.length == 0 || strSecondNodeInter.length == 0) { --- 897,901 ---- strFirstNodeInter = Sim.getNode(inNode1).getAvailableInterfaces(); ! strSecondNodeInter = Sim.getNode(inNode2).getAvailableInterfaces(); if (strFirstNodeInter.length == 0 || strSecondNodeInter.length == 0) { |
From: Alexander B. <da...@us...> - 2008-10-21 11:50:39
|
Update of /cvsroot/javanetsim/javaNetSim/textUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14781/textUI Modified Files: TextUI.java Log Message: Refactoring of Simulation. Index: TextUI.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/textUI/TextUI.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TextUI.java 19 Oct 2007 17:40:33 -0000 1.5 --- TextUI.java 21 Oct 2008 11:50:25 -0000 1.6 *************** *** 2155,2159 **** }else{ ! try { sim.setIPAddress(args[1],args[2],args[3]); --- 2155,2159 ---- }else{ ! /*try { sim.setIPAddress(args[1],args[2],args[3]); *************** *** 2185,2189 **** System.out.println("IP Address's cant be set on '"+args[1]+"'. This isn't a network layer device.\n"); ! } } --- 2185,2189 ---- System.out.println("IP Address's cant be set on '"+args[1]+"'. This isn't a network layer device.\n"); ! } */ } *************** *** 2273,2277 **** }else{ ! try{ sim.setDefaultGateway(args[1],args[2]); --- 2273,2277 ---- }else{ ! /*try{ sim.setDefaultGateway(args[1],args[2]); *************** *** 2293,2297 **** System.out.println("Invalid Default Gateway"); ! } } --- 2293,2297 ---- System.out.println("Invalid Default Gateway"); ! }*/ } *************** *** 2425,2445 **** try { ! String[] arpTableEntries = sim.getARPTable(args[1]); ! ! for(int i = 0;i<arpTableEntries.length;i++){ System.out.println(arpTableEntries[i]); ! ! } ! ! }catch(InvalidNodeNameException e) ! ! { ! ! System.out.println("'"+args[1]+"' does not exist within Simulation.\n"); ! ! }catch(InvalidNetworkLayerDeviceException e) ! ! { System.out.println("'"+args[1]+"' is not a network device.\n"); --- 2425,2434 ---- try { ! String[] arpTableEntries = ((core.NetworkLayerDevice)sim.getNode(args[1])).getFormattedARPTable(); + for(int i = 0;i<arpTableEntries.length;i++) System.out.println(arpTableEntries[i]); ! ! }catch(ClassCastException e){ System.out.println("'"+args[1]+"' is not a network device.\n"); *************** *** 2485,2495 **** try { ! System.out.println("GW: "+ sim.getDefaultGateway(args[1])); ! ! }catch (InvalidNodeNameException e){ ! ! System.out.println("Node with the name: '" + args[1] + "' does not exsist."); ! }catch (InvalidNetworkLayerDeviceException e){ System.out.println("Default Gateway cannot be set on '"+ args[1]+ "'. This isn't a network layer device.\n"); --- 2474,2480 ---- try { ! System.out.println("GW: "+ ((core.NetworkLayerDevice)sim.getNode(args[1])).getDefaultGateway()); ! }catch (ClassCastException e){ System.out.println("Default Gateway cannot be set on '"+ args[1]+ "'. This isn't a network layer device.\n"); *************** *** 2533,2539 **** }else{ ! try { ! sim.setCustomSubnetMask(args[1],args[2],args[3]); System.out.println("Node '" + args[1] + "' has been set with a subnet mask.\n"); --- 2518,2524 ---- }else{ ! /*try { ! //sim.setCustomSubnetMask(args[1],args[2],args[3]); System.out.println("Node '" + args[1] + "' has been set with a subnet mask.\n"); *************** *** 2556,2561 **** System.out.println("SubnetMask '" + args[3] + "' is not a valid subnet mask for this node"); ! ! } } --- 2541,2546 ---- System.out.println("SubnetMask '" + args[3] + "' is not a valid subnet mask for this node"); ! ! }*/ } *************** *** 2593,2603 **** try { ! System.out.println("SubnetMask: "+ sim.getSubnetMask(args[1],args[2])); ! ! }catch (InvalidNodeNameException e){ ! ! System.out.println("Node with the name: '" + args[1] + "' does not exsist."); ! }catch (InvalidNetworkLayerDeviceException e){ System.out.println("Node '"+ args[1]+ "'. is not a network layer device.\n"); --- 2578,2584 ---- try { ! System.out.println("SubnetMask: "+ ((NetworkLayerDevice)sim.getNode(args[1])).getSubnetMask(args[2])); ! }catch (ClassCastException e){ System.out.println("Node '"+ args[1]+ "'. is not a network layer device.\n"); *************** *** 2687,2693 **** sim.addEthernetLink("link1", "pc1", "eth0", "pc2", "eth0"); ! sim.setIPAddress("pc1","eth0","192.168.0.1"); ! sim.setIPAddress("pc2","eth0","192.168.0.2"); //as a temp fix for the bug in ARP if you reset the --- 2668,2674 ---- sim.addEthernetLink("link1", "pc1", "eth0", "pc2", "eth0"); ! //sim.setIPAddress("pc1","eth0","192.168.0.1"); ! //sim.setIPAddress("pc2","eth0","192.168.0.2"); //as a temp fix for the bug in ARP if you reset the *************** *** 2697,2703 **** // is local and set the ARP entry ! sim.setIPAddress("pc1","eth0","192.168.0.1"); ! sim.setIPAddress("pc2","eth0","192.168.0.2"); --- 2678,2684 ---- // is local and set the ARP entry ! //sim.setIPAddress("pc1","eth0","192.168.0.1"); ! //sim.setIPAddress("pc2","eth0","192.168.0.2"); *************** *** 2741,2745 **** try { ! sim.addPC("pc1", true); sim.addRouter("router1", true); --- 2722,2726 ---- try { ! /*sim.addPC("pc1", true); sim.addRouter("router1", true); *************** *** 2769,2773 **** sim.addEthernetLink("link2", "pc2" , "eth0", "router1", "eth1"); ! isDirty = true; --- 2750,2754 ---- sim.addEthernetLink("link2", "pc2" , "eth0", "router1", "eth1"); ! */ isDirty = true; *************** *** 2809,2813 **** try { ! sim.addPC("pc1", true); sim.addRouter("router1", true); --- 2790,2794 ---- try { ! /*sim.addPC("pc1", true); sim.addRouter("router1", true); *************** *** 2847,2851 **** sim.addEthernetLink("link3", "router1" , "eth1", "router2", "eth1"); ! isDirty = true; --- 2828,2832 ---- sim.addEthernetLink("link3", "router1" , "eth1", "router2", "eth1"); ! */ isDirty = true; *************** *** 2901,2905 **** ! sim.setIPAddress("pc1","eth0","192.168.0.1"); sim.setIPAddress("pc2","eth0","192.168.0.2"); --- 2882,2886 ---- ! /*sim.setIPAddress("pc1","eth0","192.168.0.1"); sim.setIPAddress("pc2","eth0","192.168.0.2"); *************** *** 2908,2912 **** sim.setIPAddress("pc4","eth0","192.168.0.4"); ! --- 2889,2893 ---- sim.setIPAddress("pc4","eth0","192.168.0.4"); ! */ *************** *** 2967,2971 **** try { ! sim.addPC("pc1", true); sim.addPC("pc2", true); --- 2948,2952 ---- try { ! /*sim.addPC("pc1", true); sim.addPC("pc2", true); *************** *** 3035,3039 **** sim.addEthernetLink("link8", "hub2", "eth3", "pc6", "eth0"); ! isDirty = true; --- 3016,3020 ---- sim.addEthernetLink("link8", "hub2", "eth3", "pc6", "eth0"); ! */ isDirty = true; |
From: Alexander B. <da...@us...> - 2008-10-21 11:50:37
|
Update of /cvsroot/javanetsim/javaNetSim/guiUI In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14781/guiUI Modified Files: DataLinkLayerDevice.java EthPortProperties.java LinkProperties.java MainScreen.java RIPProperties.java SetTCPIPPropertiesDialog.java Removed Files: EditRoutesDialog.java Log Message: Refactoring of Simulation. Index: LinkProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/LinkProperties.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** LinkProperties.java 13 Oct 2007 12:57:00 -0000 1.8 --- LinkProperties.java 21 Oct 2008 11:50:24 -0000 1.9 *************** *** 331,335 **** try { ! Object nics[] = Sim.getAllInterfaces(NodeName); //Get object array of interface names //Sort the array --- 331,335 ---- try { ! Object nics[] = Sim.getNode(NodeName).getAllInterfaces(); //Get object array of interface names //Sort the array Index: RIPProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/RIPProperties.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RIPProperties.java 23 Sep 2008 15:22:18 -0000 1.2 --- RIPProperties.java 21 Oct 2008 11:50:25 -0000 1.3 *************** *** 142,146 **** private void fillInterfaceCmb(String nodeName){ try { ! Object nics[] = Sim.getAllInterfaces(nodeName); //Get object array of interface names //Sort the array --- 142,146 ---- private void fillInterfaceCmb(String nodeName){ try { ! Object nics[] = Sim.getNode(nodeName).getAllInterfaces(); //Get object array of interface names //Sort the array --- EditRoutesDialog.java DELETED --- Index: SetTCPIPPropertiesDialog.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/SetTCPIPPropertiesDialog.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** SetTCPIPPropertiesDialog.java 19 Oct 2007 15:57:01 -0000 1.10 --- SetTCPIPPropertiesDialog.java 21 Oct 2008 11:50:25 -0000 1.11 *************** *** 33,36 **** --- 33,39 ---- import core.InvalidNetworkLayerDeviceException; import core.InvalidNodeNameException; + import core.NetworkLayerDevice; + import core.Node; + import core.protocolsuite.tcp_ip.IPV4Address; import core.protocolsuite.tcp_ip.InvalidIPAddressException; import core.protocolsuite.tcp_ip.InvalidSubnetMaskException; *************** *** 381,399 **** if(NodeName != null && Interface != null && IPAddress != null && !ErrorFlag){ ! Sim.setIPAddress(NodeName,Interface,IPAddress); controller.addToConsole(NodeName +"'s IP Address has been set to " + IPAddress + " on interface "+Interface+"\n"); - //if(SubnetMask != null ){ - Sim.setCustomSubnetMask(NodeName,Interface,SubnetMask); controller.addToConsole(NodeName +"'s Subnet Address has been set to " + SubnetMask + " on interface "+Interface+"\n"); ! ! if(NodeName != null && DefaultGWAddress!=null){ ! Sim.setDefaultGateway(NodeName,DefaultGWAddress); ! controller.addToConsole(NodeName +"'s Default Gateway Address has been set to " + DefaultGWAddress +"\n"); ! } ! ! this.dispose(); ! } } catch (Exception e) { e.printStackTrace(); --- 384,400 ---- if(NodeName != null && Interface != null && IPAddress != null && !ErrorFlag){ ! Node temp = Sim.getNode(NodeName); ! NetworkLayerDevice nld = (NetworkLayerDevice)temp; ! ! nld.setTCPIPSettings(Interface, IPAddress, SubnetMask, DefaultGWAddress); ! controller.addToConsole(NodeName +"'s IP Address has been set to " + IPAddress + " on interface "+Interface+"\n"); controller.addToConsole(NodeName +"'s Subnet Address has been set to " + SubnetMask + " on interface "+Interface+"\n"); ! controller.addToConsole(NodeName +"'s Default Gateway Address has been set to " + DefaultGWAddress +"\n"); ! ! this.dispose(); ! } } catch (Exception e) { e.printStackTrace(); *************** *** 428,432 **** try { ! Object nics[] = Sim.getAllInterfaces(NodeName); //Get object array of interface names //Sort the array --- 429,433 ---- try { ! Object nics[] = Sim.getNode(NodeName).getAllInterfaces(); //Get object array of interface names //Sort the array *************** *** 439,443 **** cmbInterface.setEnabled(true); ! DefaultGWAddress = Sim.getDefaultGateway(NodeName); if(DefaultGWAddress != null){ txtDefaultGW.setText(DefaultGWAddress); --- 440,444 ---- cmbInterface.setEnabled(true); ! DefaultGWAddress = ((core.NetworkLayerDevice)Sim.getNode(NodeName)).getDefaultGateway(); if(DefaultGWAddress != null){ txtDefaultGW.setText(DefaultGWAddress); *************** *** 458,486 **** */ private void selectInterface(){ ! //save IP and mask current interface ! if(!Interface.equals("")){ ! try { ! if(IPAddress!=null) Sim.setIPAddress(NodeName, Interface, IPAddress); ! } catch (InvalidIPAddressException ex) { ! // ex.printStackTrace(); ! } catch (InvalidNodeNameException ex) { ! ex.printStackTrace(); ! } catch (InvalidNetworkInterfaceNameException ex) { ! // ex.printStackTrace(); ! } catch (InvalidNetworkLayerDeviceException ex) { ! // ex.printStackTrace(); ! } ! try { ! if(SubnetMask!=null) Sim.setCustomSubnetMask(NodeName, Interface, SubnetMask); ! } catch (InvalidSubnetMaskException ex) { ! // ex.printStackTrace(); ! } catch (InvalidNodeNameException ex) { ! ex.printStackTrace(); ! } catch (InvalidNetworkLayerDeviceException ex) { ! ex.printStackTrace(); ! } catch (InvalidNetworkInterfaceNameException ex) { ! // ex.printStackTrace(); ! } ! } //read IP and mask for selected interface --- 459,468 ---- */ private void selectInterface(){ ! //save IP and mask current interface ! if(!Interface.equals("")){ ! if(IPAddress!=null && SubnetMask!=null) ! ((NetworkLayerDevice)Sim.getNode(NodeName)).setTCPIPSettings(Interface, IPAddress, SubnetMask); ! ! } //read IP and mask for selected interface *************** *** 490,498 **** if(Interface != null){ try { ! IPAddress = Sim.getIpAddressForInterface(NodeName,Interface); if(IPAddress != null){ txtIpAddress.setText(IPAddress); ! SubnetMask =Sim.getSubnetMask(NodeName,Interface); txtSubnetMask.setText(SubnetMask); txtSubnetMask.setEnabled(true); --- 472,480 ---- if(Interface != null){ try { ! IPAddress = ((NetworkLayerDevice)Sim.getNode(NodeName)).getIPAddress(Interface); if(IPAddress != null){ txtIpAddress.setText(IPAddress); ! SubnetMask =((core.NetworkLayerDevice)Sim.getNode(NodeName)).getSubnetMask(Interface); txtSubnetMask.setText(SubnetMask); txtSubnetMask.setEnabled(true); *************** *** 523,527 **** if(!ip.equalsIgnoreCase("Enter IP Address")){ ! if(!Simulation.validateDecIP(ip)){ lblError.setText("Invalid IP Address"); lblError.setForeground(Color.RED); --- 505,509 ---- if(!ip.equalsIgnoreCase("Enter IP Address")){ ! if(!IPV4Address.validateDecIP(ip)){ lblError.setText("Invalid IP Address"); lblError.setForeground(Color.RED); *************** *** 533,537 **** IPAddress = ip; if(txtSubnetMask.getText().equals("Enter Subnet Mask") || txtSubnetMask.getText() == null || txtSubnetMask.getText().equals("0.0.0.0")){ ! SubnetMask = Simulation.getDefaultSubnetMask(IPAddress); txtSubnetMask.setText(SubnetMask); txtSubnetMask.setEnabled(true); --- 515,519 ---- IPAddress = ip; if(txtSubnetMask.getText().equals("Enter Subnet Mask") || txtSubnetMask.getText() == null || txtSubnetMask.getText().equals("0.0.0.0")){ ! SubnetMask = IPV4Address.getDefaultSubnetMask(IPAddress); txtSubnetMask.setText(SubnetMask); txtSubnetMask.setEnabled(true); *************** *** 551,567 **** String subMask = txtSubnetMask.getText(); ! /* ! if(!Simulation.validateDecSubnetMask(IPAddress,subMask)){ ! lblError.setText("Invalid SubnetMask Address"); ! lblError.setForeground(Color.RED); ! lblError.setVisible(true); ! controller.shakeDiaLog(this); ! ErrorFlag = true; ! }else{*/ ! lblError.setVisible(false); ! txtSubnetMask.setEnabled(true); ! SubnetMask = subMask; ! ErrorFlag = false; ! //} } --- 533,541 ---- String subMask = txtSubnetMask.getText(); ! ! lblError.setVisible(false); ! txtSubnetMask.setEnabled(true); ! SubnetMask = subMask; ! ErrorFlag = false; } *************** *** 576,580 **** String GW = txtDefaultGW.getText(); if(!GW.equalsIgnoreCase("Enter Default Gateway")){ ! if(!Simulation.validateDecIP(GW) && !GW.equals("")){ lblError.setText("Invalid Default Gateway Address"); lblError.setForeground(Color.RED); --- 550,554 ---- String GW = txtDefaultGW.getText(); if(!GW.equalsIgnoreCase("Enter Default Gateway")){ ! if(!IPV4Address.validateDecIP(GW) && !GW.equals("")){ lblError.setText("Invalid Default Gateway Address"); lblError.setForeground(Color.RED); *************** *** 603,619 **** String tempip = txtIpAddress.getText(); ! //if(Simulation.validateDecIP(tempip)){ ! if(txtSubnetMask.getText().equals("Enter Subnet Mask") || txtSubnetMask.getText() == null || txtSubnetMask.getText().equals("0.0.0.0")){ ! String tempSubnet = Simulation.getDefaultSubnetMask(tempip); txtSubnetMask.setText(tempSubnet); txtSubnetMask.setEnabled(true); ! } ! btnOk.setEnabled(true); ! ! /*}else{ ! txtSubnetMask.setText("Enter Subnet Mask"); ! txtSubnetMask.setEnabled(false); ! }*/ } --- 577,589 ---- String tempip = txtIpAddress.getText(); ! if(txtSubnetMask.getText().equals("Enter Subnet Mask") || txtSubnetMask.getText() == null || txtSubnetMask.getText().equals("0.0.0.0")){ ! String tempSubnet = IPV4Address.getDefaultSubnetMask(tempip); txtSubnetMask.setText(tempSubnet); txtSubnetMask.setEnabled(true); ! } ! ! btnOk.setEnabled(true); ! } Index: DataLinkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/DataLinkLayerDevice.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** DataLinkLayerDevice.java 14 Sep 2007 11:14:50 -0000 1.4 --- DataLinkLayerDevice.java 21 Oct 2008 11:50:24 -0000 1.5 *************** *** 130,134 **** public void actionPerformed(ActionEvent e){ ! controller.ResetHub(lblNodeName.getText()); } --- 130,134 ---- public void actionPerformed(ActionEvent e){ ! controller.Reset(lblNodeName.getText()); } Index: EthPortProperties.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/EthPortProperties.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** EthPortProperties.java 14 Sep 2008 20:51:29 -0000 1.5 --- EthPortProperties.java 21 Oct 2008 11:50:24 -0000 1.6 *************** *** 85,89 **** private MainScreen controller; private Simulation Sim; - private SandBox SBox; private String NodeName=""; --- 85,88 ---- *************** *** 92,96 **** private boolean ErrorFlag = true; ! public EthPortProperties(JFrame frame, String inNodeName, String inNodeInt, Simulation Sim, SandBox SBox) { super(frame); --- 91,95 ---- private boolean ErrorFlag = true; ! public EthPortProperties(JFrame frame, String inNodeName, String inNodeInt, Simulation Sim) { super(frame); *************** *** 100,105 **** setResizable(false); controller = (MainScreen)frame; - this.Sim = Sim; - this.SBox = SBox; setTitle("Ethernet Port Properties"); initGUI(inNodeName, inNodeInt); --- 99,102 ---- Index: MainScreen.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/guiUI/MainScreen.java,v retrieving revision 1.95 retrieving revision 1.96 diff -C2 -d -r1.95 -r1.96 *** MainScreen.java 18 Oct 2008 19:55:31 -0000 1.95 --- MainScreen.java 21 Oct 2008 11:50:24 -0000 1.96 *************** *** 644,647 **** --- 644,648 ---- public static void main(String args[]) { + // Set Default look and feel (For setExtendedState bug) *************** *** 894,900 **** { ! strFirstNodeInter = Sim.getAvailableInterfaces(inNode1); ! strSecondNodeInter = Sim.getAvailableInterfaces(inNode2); if (strFirstNodeInter.length == 0 || strSecondNodeInter.length == 0) { --- 895,901 ---- { ! strFirstNodeInter = Sim.getNode(inNode1).getAvailableInterfaces(); ! strSecondNodeInter = Sim.getNode(inNode1).getAvailableInterfaces(); if (strFirstNodeInter.length == 0 || strSecondNodeInter.length == 0) { *************** *** 1445,1449 **** try { ! strFirstNodeInter = Sim.getAvailableInterfaces(inFirstNodeName); if (strFirstNodeInter.length == 0) --- 1446,1450 ---- try { ! strFirstNodeInter = Sim.getNode(inFirstNodeName).getAvailableInterfaces(); if (strFirstNodeInter.length == 0) *************** *** 1704,1708 **** try { ! Object nics[] = Sim.getAllInterfaces(key); Arrays.sort(nics); --- 1705,1709 ---- try { ! Object nics[] = Sim.getNode(key).getAllInterfaces(); Arrays.sort(nics); *************** *** 2621,2630 **** if (!iface[2].contains("null")) { ! Sim.setIPAddress(strNodeName, iface[0], ! iface[2]); ! ! Sim.setCustomSubnetMask(strNodeName, ! iface[0], iface[3]); ! } --- 2622,2629 ---- if (!iface[2].contains("null")) { ! ! ((core.NetworkLayerDevice)Sim.getNode(strNodeName)) ! .setTCPIPSettings(iface[0], iface[2], iface[3]); ! } *************** *** 2642,2648 **** if (!iface[4].contains("null")) ! Sim ! .setDefaultGateway(strNodeName, ! iface[4]); } else if (deviceType == 1) { --- 2641,2646 ---- if (!iface[4].contains("null")) ! ((core.NetworkLayerDevice)Sim.getNode(strNodeName)) ! .setTCPIPSettings(iface[4]); } else if (deviceType == 1) { *************** *** 2707,2718 **** String rts[] = rs.split("\\|"); ! r = new Route_entry(rts[0], rts[1], rts[2], rts[4], Integer.valueOf(rts[3]) ! .intValue()); ! // System.out.println(rts[4]); ! Sim.addRoute(strNodeName, r); } ! Sim.execCmd(strNodeName, "write mem"); } catch (Exception e) { --- 2705,2717 ---- String rts[] = rs.split("\\|"); ! /*r = new Route_entry(rts[0], rts[1], rts[2], rts[4], Integer.valueOf(rts[3]) ! .intValue());*/ ! //((core.NetworkLayerDevice)Sim.getNode(strNodeName)).addRoute(r); ! ((core.NetworkLayerDevice)Sim.getNode(strNodeName)).getConfig() ! .executeCommand("ip route " + rts[0] + " " + rts[2] + " " + rts[1] + " " + rts[4]); } ! Sim.getNode(strNodeName).execCmd("write mem"); } catch (Exception e) { *************** *** 2868,2877 **** public void ShowHubState(String InNodeName) { ! int state = Sim.getState(InNodeName); try { if (Sim.getNode(InNodeName) instanceof core.Switch) { ! String cache = Sim.getCache(InNodeName); if (state == -1) { --- 2867,2876 ---- public void ShowHubState(String InNodeName) { ! int state = Sim.getNode(InNodeName).getState(); try { if (Sim.getNode(InNodeName) instanceof core.Switch) { ! String cache = ((core.Switch)Sim.getNode(InNodeName)).getCache(); if (state == -1) { *************** *** 2932,2940 **** } ! public void ResetHub(String InNodeName) { ! ! Sim.Reset(InNodeName); insertInConsole(InNodeName, "(none)", "Hardware", "Device reseted."); } --- 2931,2940 ---- } ! public void Reset(String InNodeName) { insertInConsole(InNodeName, "(none)", "Hardware", "Device reseted."); + + Sim.getNode(InNodeName).Reset(); + } *************** *** 3667,3671 **** String s = ""; s += "ARP entries for :" + inNodeName + "\n"; ! String ArpTable[] = Sim.getARPTable(inNodeName); for (int i = 0; i < ArpTable.length; i++) { s += ArpTable[i] + "\n"; --- 3667,3671 ---- String s = ""; s += "ARP entries for :" + inNodeName + "\n"; ! String ArpTable[] = ((core.NetworkLayerDevice)Sim.getNode(inNodeName)).getFormattedARPTable(); for (int i = 0; i < ArpTable.length; i++) { s += ArpTable[i] + "\n"; *************** *** 3700,3704 **** if (IP != null) { ! Sim.addStaticARP(IP, MAC, inNodeName); this.addToConsole("Created new static ARP entry: " + inNodeName --- 3700,3704 ---- if (IP != null) { ! ((core.NetworkLayerDevice)Sim.getNode(inNodeName)).addStaticARP(IP, MAC); this.addToConsole("Created new static ARP entry: " + inNodeName *************** *** 3730,3734 **** if (IP != null) { ! Sim.deleteARP(IP, inNodeName); this.addToConsole("Removed ARP entry: on " + inNodeName --- 3730,3734 ---- if (IP != null) { ! ((core.NetworkLayerDevice)Sim.getNode(inNodeName)).deleteARPRecord(IP); this.addToConsole("Removed ARP entry: on " + inNodeName *************** *** 4141,4151 **** public void PrintRouteTable(String inNodeName) { ! try { ! new InfoBox(this, "Route table", ((core.NetworkLayerDevice) Sim ! .getNode(inNodeName)).getFormattedRouteTable()); ! } catch (InvalidNodeNameException e) { ! e.printStackTrace(); ! } ! } --- 4141,4146 ---- public void PrintRouteTable(String inNodeName) { ! new InfoBox(this, "Route table", ((core.NetworkLayerDevice) Sim ! .getNode(inNodeName)).getFormattedRouteTable()); } *************** *** 4158,4163 **** public void showCounters(String inNodeName) { ! core.protocolsuite.tcp_ip.ProtocolStack PS = Sim ! .getTCPProtocolStack(inNodeName); int ARPCount = PS.getARPCount(); int inIPCount = PS.getinputIPCount(); --- 4153,4157 ---- public void showCounters(String inNodeName) { ! core.protocolsuite.tcp_ip.ProtocolStack PS = Sim.getNode(inNodeName).getProtocolStack(); int ARPCount = PS.getARPCount(); int inIPCount = PS.getinputIPCount(); *************** *** 4203,4208 **** public void resetCounters(String inNodeName) { ! core.protocolsuite.tcp_ip.ProtocolStack PS = Sim ! .getTCPProtocolStack(inNodeName); PS.resetCounters(); showCounters(inNodeName); --- 4197,4202 ---- public void resetCounters(String inNodeName) { ! core.protocolsuite.tcp_ip.ProtocolStack PS = Sim.getNode(inNodeName) ! .getProtocolStack(); PS.resetCounters(); showCounters(inNodeName); *************** *** 4286,4348 **** public void RunCmd(String inNodeName) { ! try { ! if (!(Sim.getNode(inNodeName) instanceof core.Printer)) { ! Terminal r = new Terminal(this, (core.NetworkLayerDevice) Sim ! .getNode(inNodeName)); ! r.pack(); ! r.setVisible(true); ! } else { ! JOptionPane.showMessageDialog(this, ! "Feature isn't supported by this device type!", ! "Error", JOptionPane.ERROR_MESSAGE); ! } ! } catch (InvalidNodeNameException e) { ! System.out ! .print(e.toString() + ": You change non-existent device!"); ! } ! // String cmd = JOptionPane.showInputDialog(this, "Command (e.g. route ! // print):", "Run network configure command.", ! // JOptionPane.QUESTION_MESSAGE); ! // if(cmd!=null){ ! // String tokens[]=cmd.split(" "); ! // if(tokens[0].contains("route")){ ! // try{ ! // if(tokens[1].contains("print")){ ! // String routes[] = Sim.getRouteTableEntries(inNodeName); ! // this.addToConsole("IP routing table:\n" + "Destination" + "\t" + ! // "Gateway" + "\t" + "Genmask" + "\t" + "Type" + "\t" + "Iface\n"); ! // for(int i=0; i<routes.length - 1; i++){ ! // Route_entry r = Sim.getRouteEntry(inNodeName, routes[i]); ! // this.addToConsole(routes[i] + "\t" + r.gateway + "\t" + r.genMask + ! // "\t" + r.Type + "\t" + r.iFace + "\n"); ! // } ! // }else if(tokens[1].contains("add")){ ! // String gw = ""; ! // if(tokens.length > 5) gw = tokens[5]; ! // Route_entry r = new Route_entry(tokens[2], gw, tokens[4], tokens[3], ! // 0); ! // Sim.addRoute(inNodeName, r); ! // this.addToConsole("Route added.\n"); ! // }else if(tokens[1].contains("del")){ ! // Sim.removeRoute(inNodeName, tokens[2]); ! // this.addToConsole("Route to " + tokens[2] + "removed.\n"); ! // }else{ ! // this.addToConsole("Unknown route command. Usage:\n"); ! // this.addToConsole("route add (host_ip|network_ip) target_interface ! // netmask (gateway|*) \n"); ! // this.addToConsole("route del (host_ip|network_ip) \n"); ! // this.addToConsole("route print \n"); ! // } ! // }catch(ArrayIndexOutOfBoundsException e){ ! // this.addToConsole("Unknown route command. Usage:\n"); ! // this.addToConsole("route add (host_ip|network_ip) target_interface ! // netmask (gateway|*) \n"); ! // this.addToConsole("route del (host_ip|network_ip) \n"); ! // this.addToConsole("route print \n"); ! // } ! // }else{ ! // this.addToConsole("Unknown or invalid command.\n"); ! // } ! // } } --- 4280,4293 ---- public void RunCmd(String inNodeName) { ! if (!(Sim.getNode(inNodeName) instanceof core.Printer)) { ! Terminal r = new Terminal(this, (core.NetworkLayerDevice) Sim ! .getNode(inNodeName)); ! r.pack(); ! r.setVisible(true); ! } else { ! JOptionPane.showMessageDialog(this, ! "Feature isn't supported by this device type!", ! "Error", JOptionPane.ERROR_MESSAGE); ! } } *************** *** 4405,4409 **** public Object[] getInterfaces(String NodeName) throws InvalidNodeNameException { ! Object nics[] = Sim.getAllInterfaces(NodeName); // Get object array of // interface names Arrays.sort(nics); --- 4350,4354 ---- public Object[] getInterfaces(String NodeName) throws InvalidNodeNameException { ! Object nics[] = Sim.getNode(NodeName).getAllInterfaces(); // Get object array of // interface names Arrays.sort(nics); *************** *** 4420,4424 **** case core.NetworkInterface.Ethernet100FX: if (temp.getNIC(IntName).isActive()) { ! new EthPortProperties(this, NodeName, IntName, Sim, Sandbox); } break; --- 4365,4369 ---- case core.NetworkInterface.Ethernet100FX: if (temp.getNIC(IntName).isActive()) { ! new EthPortProperties(this, NodeName, IntName, Sim); } break; |
From: Alexander B. <da...@us...> - 2008-10-21 11:50:36
|
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14781/core Modified Files: DataLinkLayerDevice.java MultilayerSwitch.java NetworkLayerDevice.java Node.java Simulation.java Switch.java Log Message: Refactoring of Simulation. Index: Node.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Node.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** Node.java 17 Oct 2008 09:10:16 -0000 1.28 --- Node.java 21 Oct 2008 11:50:24 -0000 1.29 *************** *** 120,127 **** */ ! ! protected java.util.Hashtable NetworkInterfacetable = null; //Hashtable of network interfaces public ProtocolStack NodeProtocolStack; protected String name; --- 120,131 ---- */ ! ! protected java.util.Hashtable NetworkInterfacetable = null; //Hashtable of network interfaces public ProtocolStack NodeProtocolStack; + + public ProtocolStack getProtocolStack(){ + return NodeProtocolStack; + } protected String name; *************** *** 557,560 **** --- 561,581 ---- } + + public Object[] getAllInterfaces(){ + + ArrayList<String> interfaceArray = new ArrayList<String>(); + Enumeration keys = NetworkInterfacetable.keys(); + while(keys.hasMoreElements()){ + String str = (String) keys.nextElement(); + NetworkInterface x = (NetworkInterface)NetworkInterfacetable.get(str); + interfaceArray.add(x.getName()); + } + + return interfaceArray.toArray(); + } + + public void execCmd(String cmd){ + System.out.println("WRANING: Cannot execute " + cmd + " for " + getName() + "."); + } Index: MultilayerSwitch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/MultilayerSwitch.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** MultilayerSwitch.java 20 Oct 2008 23:46:56 -0000 1.3 --- MultilayerSwitch.java 21 Oct 2008 11:50:24 -0000 1.4 *************** *** 114,117 **** --- 114,118 ---- outInt.clear(); } + super.Reset(); } Index: Simulation.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Simulation.java,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** Simulation.java 19 Oct 2008 21:40:19 -0000 1.33 --- Simulation.java 21 Oct 2008 11:50:24 -0000 1.34 *************** *** 37,100 **** import core.protocolsuite.tcp_ip.InvalidSubnetMaskException; - /** - * <P>The Simulation is the main class in the Network Simulator system.</P> - * - * <P>It is a container class for Nodes, Links, a script and a LayerInfoHandler. The - * Simulation manages and controls all of these objects and provides public methods - * that a GUI or CLI can use to manipulate those objects and the objects contained within - * those objects (the Nodes and Links)</P> - * - * <P>Any public method in this class is to be used by a GUI or CLI. New methods - * will need to be added when a GUI or CLI requires them.</P> - * - * <P>Many of the methods in this class return an object type. When designing a GUI don't get confused by - * the fact you can simply use that object reference to directly talk with the object. - * The object references being returned were originally meant for the GUI to use to - * pass back the reference to the Simulation which can then directly (and more efficiently) - * talk with that object. For example when calling the Simulation method:</P> - * - * <BLOCKQUOTE><BLOCKQUOTE><P><I>PC addPC(String inNodeName)</I></P></BLOCKQUOTE></BLOCKQUOTE> - * - * The PC reference returned by the method can be stored by the GUI, but the GUI should - * never call methods on that PC object itself. Rather, it should pass that PC reference back - * to the Simulation when wanting to call a PC or Node method such as: - * - * <BLOCKQUOTE><BLOCKQUOTE><P><I>NetworkInterface addInterface(String inNetworkInterfaceName)</I></P></BLOCKQUOTE></BLOCKQUOTE> - * - * The GUI should instead call the Simulation method: - * - * <BLOCKQUOTE><BLOCKQUOTE><P><I>NetworkInterface addInterface(String interfaceName, String nodeName)</I></P></BLOCKQUOTE></BLOCKQUOTE> - * - * We have an overloaded method of the above in the Simulation: - * - * <BLOCKQUOTE><BLOCKQUOTE><P><I>NetworkInterface addInterface(String interfaceName, Node node)</I></P></BLOCKQUOTE></BLOCKQUOTE> - * - * <P>Note that you pass a Node object reference as opposed to a String. The latter method - * will process faster because it has a direct reference and does not need to loop through - * the Simulation's list of Nodes.</P> - * - * <P>To reiterate, the GUI should NEVER call any method on any class contained in the Network - * Simulator package except for the Simulation class. The only other classes exempt from this rule - * are the LayerInfo and IPV4Address classes. See the {@link LayerInfo LayerInfo} - * and {@link IPV4Address IPV4Address} classes for more information.</P> - * - * - * @author tristan_veness (Original Author) - * @author luke_hamilton - * @author angela_brown - * @author michael_reith - * @author robert_hulford - * @author bevan_calliess - * @since 13 June 2004 - * @version v0.20 - */ - - /* Note: Future groups might like to change the return types of some of the methods in the Simulation - * so that they do not return an object to the GUI and simply return an error code or throw - * an exception instead. You could create a more efficient method for retrieving Objects - * by replacing the Vectors with more efficient storage classes like binary trees or hash tables. - * See the java class named TreeMap. - */ - public class Simulation implements Serializable { --- 37,40 ---- *************** *** 203,207 **** **/ //TODO I think this should also throw an invalidNetInterfaceNameException. -Luke hamilton ! public String getSubnetMask(String inNodeName, String inInterface)throws InvalidNetworkLayerDeviceException, InvalidNodeNameException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); --- 143,147 ---- **/ //TODO I think this should also throw an invalidNetInterfaceNameException. -Luke hamilton ! /*public String getSubnetMask(String inNodeName, String inInterface)throws InvalidNetworkLayerDeviceException, InvalidNodeNameException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); *************** *** 213,223 **** } throw new InvalidNodeNameException("Node does not exist."); ! } ! public core.protocolsuite.tcp_ip.ProtocolStack getTCPProtocolStack(String inNodeName) { Node temp = (Node)nodeTable.get(inNodeName); return (core.protocolsuite.tcp_ip.ProtocolStack)temp.NodeProtocolStack; ! } /** * This method is called from the GUI. Checks to see if inNodeName is an instance of networkLayerDevice, --- 153,163 ---- } throw new InvalidNodeNameException("Node does not exist."); ! }*/ ! /* public core.protocolsuite.tcp_ip.ProtocolStack getTCPProtocolStack(String inNodeName) { Node temp = (Node)nodeTable.get(inNodeName); return (core.protocolsuite.tcp_ip.ProtocolStack)temp.NodeProtocolStack; ! }*/ /** * This method is called from the GUI. Checks to see if inNodeName is an instance of networkLayerDevice, *************** *** 231,235 **** * @version v0.20 **/ ! public String getIpAddressForInterface(String inNodeName, String inInterface) throws InvalidNetworkInterfaceNameException, InvalidNodeNameException, InvalidNetworkLayerDeviceException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); --- 171,175 ---- * @version v0.20 **/ ! /*public String getIpAddressForInterface(String inNodeName, String inInterface) throws InvalidNetworkInterfaceNameException, InvalidNodeNameException, InvalidNetworkLayerDeviceException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); *************** *** 241,245 **** } throw new InvalidNodeNameException("Node does not exist."); ! } /** --- 181,185 ---- } throw new InvalidNodeNameException("Node does not exist."); ! }*/ /** *************** *** 254,258 **** * @version v0.20 **/ ! public String getMacAddressForInterface(String inNodeName, String inInterface) throws InvalidNetworkInterfaceNameException, InvalidNodeNameException, InvalidNetworkLayerDeviceException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); --- 194,198 ---- * @version v0.20 **/ ! /*public String getMacAddressForInterface(String inNodeName, String inInterface) throws InvalidNetworkInterfaceNameException, InvalidNodeNameException, InvalidNetworkLayerDeviceException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); *************** *** 264,268 **** } throw new InvalidNodeNameException("Node does not exist."); ! } /** --- 204,208 ---- } throw new InvalidNodeNameException("Node does not exist."); ! }*/ /** *************** *** 296,300 **** //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! comment && doc this ! public Node getNode(String inNodeName) throws InvalidNodeNameException{ return (Node)nodeTable.get(inNodeName); } --- 236,240 ---- //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! comment && doc this ! public Node getNode(String inNodeName){ return (Node)nodeTable.get(inNodeName); } *************** *** 312,316 **** **/ ! public String getDefaultGateway(String inNodeName)throws InvalidNodeNameException, InvalidNetworkLayerDeviceException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); --- 252,256 ---- **/ ! /*public String getDefaultGateway(String inNodeName)throws InvalidNodeNameException, InvalidNetworkLayerDeviceException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); *************** *** 322,370 **** } throw new InvalidNodeNameException("Node does not exist."); ! } ! /** ! * This method is called from the TEXTUI or GUI. If inNodeName is contained within the hash ! * table (nodeTable) typecast it to a Node and check if it is an instance of the NetworkLayerDevice. ! * If so, type cast node to a NetworkLayerDevice and get it details from the arp table in the ! * NetworkLayerDevice level. ! * @author bevan_calliess ! * @author robert_hulford ! * @param inNodeName - The Name of the Node eg: pc1 ! * @return arpEntries ! * @throws InvalidNetworkLayerDeviceException ! * @throws InvalidNodeNameException ! * @version v0.20 ! **/ ! public String[] getARPTable(String inNodeName) throws InvalidNetworkLayerDeviceException, InvalidNodeNameException ! { ! String[] arpEntries; ! if(nodeTable.containsKey(inNodeName)){ ! Node tempNode = (Node)nodeTable.get(inNodeName); ! if (tempNode instanceof NetworkLayerDevice)//test if device is a network layer device ! { ! NetworkLayerDevice t = (NetworkLayerDevice)tempNode; ! Vector<Vector<String>> ArpTable = t.getARPTable(); ! arpEntries = new String[ArpTable.size()+1]; ! if(ArpTable.size()>0){ ! arpEntries[0] = "Internet Address\tPhysical Address\t\tType\n"; ! for(int i=0;i<ArpTable.size();i++) ! { ! arpEntries[i+1] = ArpTable.get(i).get(0) + "\t\t" + ArpTable.get(i).get(1) + "\t\t" + ArpTable.get(i).get(2) + "\n"; ! } ! } ! else{ ! arpEntries[0] = "No ARP Entries Found\n"; ! } ! }else ! { ! throw new InvalidNetworkLayerDeviceException("This device is not a network layered device"); ! } ! }else{ ! throw new InvalidNodeNameException("Node does not exist"); ! } ! ! return arpEntries; ! } /** * This method is called from the TEXTUI or GUI. if inNodeName is contained within the hash table (nodeTable) --- 262,268 ---- } throw new InvalidNodeNameException("Node does not exist."); ! }*/ ! /** * This method is called from the TEXTUI or GUI. if inNodeName is contained within the hash table (nodeTable) *************** *** 381,385 **** * @version v0.20 **/ ! public void setCustomSubnetMask(String inNodeName,String inInterface,String inCustomSubnetMask)throws InvalidNetworkLayerDeviceException, InvalidNodeNameException, InvalidNetworkInterfaceNameException,InvalidSubnetMaskException { if (nodeTable.containsKey(inNodeName)){ // try{ --- 279,283 ---- * @version v0.20 **/ ! /*public void setCustomSubnetMask(String inNodeName,String inInterface,String inCustomSubnetMask)throws InvalidNetworkLayerDeviceException, InvalidNodeNameException, InvalidNetworkInterfaceNameException,InvalidSubnetMaskException { if (nodeTable.containsKey(inNodeName)){ // try{ *************** *** 389,394 **** 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 --- 287,291 ---- NetworkLayerDevice nld = (NetworkLayerDevice)temp; //nld.setCustomSubnetMask(inInterface, inCustomSubnetMask); ! } else *************** *** 402,406 **** throw new InvalidNodeNameException("Node does not exist"); } ! } /** --- 299,303 ---- throw new InvalidNodeNameException("Node does not exist"); } ! }*/ /** *************** *** 418,422 **** * @version v0.20 **/ ! public void setDefaultGateway(String inNodeName, String inGatewayIPAddress) throws InvalidNodeNameException, InvalidDefaultGatewayException,InvalidNetworkLayerDeviceException{ if(nodeTable.containsKey(inNodeName)) --- 315,319 ---- * @version v0.20 **/ ! /*public void setDefaultGateway(String inNodeName, String inGatewayIPAddress) throws InvalidNodeNameException, InvalidDefaultGatewayException,InvalidNetworkLayerDeviceException{ if(nodeTable.containsKey(inNodeName)) *************** *** 427,431 **** 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"); } --- 324,328 ---- NetworkLayerDevice t = (NetworkLayerDevice)temp; //t.setDefaultGateway(inGatewayIPAddress); ! t. t.getConfig().executeCommand("write mem"); } *************** *** 439,463 **** throw new InvalidNodeNameException("Node does not exist"); } ! } - 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"); - } - } --- 336,342 ---- throw new InvalidNodeNameException("Node does not exist"); } ! }*/ ! *************** *** 500,504 **** * @version v0.20 **/ ! public void setIPAddress(String inNodeName, String inNodeInterface, String inIPAddress) throws InvalidNodeNameException, InvalidNetworkInterfaceNameException, InvalidIPAddressException,InvalidNetworkLayerDeviceException{ String macAddress; --- 379,383 ---- * @version v0.20 **/ ! /*public void setIPAddress(String inNodeName, String inNodeInterface, String inIPAddress) throws InvalidNodeNameException, InvalidNetworkInterfaceNameException, InvalidIPAddressException,InvalidNetworkLayerDeviceException{ String macAddress; *************** *** 519,523 **** throw new InvalidNodeNameException("Node does not exist"); } ! } /** --- 398,402 ---- throw new InvalidNodeNameException("Node does not exist"); } ! }*/ /** *************** *** 535,539 **** * @version v0.20 **/ ! public void setMACAddress(String inNodeName, String inNodeInterface, String inMACAddress) throws InvalidNodeNameException, InvalidNetworkInterfaceNameException, InvalidNetworkLayerDeviceException{ if(nodeTable.containsKey(inNodeName)){ --- 414,418 ---- * @version v0.20 **/ ! /*public void setMACAddress(String inNodeName, String inNodeInterface, String inMACAddress) throws InvalidNodeNameException, InvalidNetworkInterfaceNameException, InvalidNetworkLayerDeviceException{ if(nodeTable.containsKey(inNodeName)){ *************** *** 550,554 **** throw new InvalidNodeNameException("Node does not exist"); } ! } /** --- 429,433 ---- throw new InvalidNodeNameException("Node does not exist"); } ! }*/ /** *************** *** 562,566 **** * @version v0.20 **/ ! public void updateARP(String inIPAddress, String inMACAddress, String inSkipName) { Enumeration e = nodeTable.elements(); --- 441,445 ---- * @version v0.20 **/ ! /*public void updateARP(String inIPAddress, String inMACAddress, String inSkipName) { Enumeration e = nodeTable.elements(); *************** *** 578,625 **** } ! } ! } ! public void addStaticARP(String inIPAddress, String inMACAddress, String inSkipName) ! { ! Enumeration e = nodeTable.elements(); ! while(e.hasMoreElements()) ! { ! Node temp = (Node)e.nextElement(); ! if (temp instanceof NetworkLayerDevice) ! { ! if(temp.getName().equals(inSkipName)) ! { ! NetworkLayerDevice tempNet = (NetworkLayerDevice)temp; ! //tempNet.addToARPStatic(inIPAddress, inMACAddress); ! tempNet.getConfig().executeCommand("arp "+inIPAddress+" "+inMACAddress); ! tempNet.getConfig().executeCommand("write mem"); ! } ! ! } ! ! } ! } ! public void deleteARP(String inIPAddress, String inSkipName) ! { ! Enumeration e = nodeTable.elements(); ! while(e.hasMoreElements()) ! { ! Node temp = (Node)e.nextElement(); ! if (temp instanceof NetworkLayerDevice) ! { ! if(temp.getName().equals(inSkipName)) ! { ! NetworkLayerDevice tempNet = (NetworkLayerDevice)temp; ! //tempNet.removeARP(inIPAddress); ! tempNet.getConfig().executeCommand("no arp "+inIPAddress); ! tempNet.getConfig().executeCommand("write mem"); ! } ! ! } ! ! } ! } /** --- 457,466 ---- } ! } ! }*/ ! ! /* */ /** *************** *** 856,860 **** */ ! public int getState(String inNodeName) { if (nodeTable.containsKey(inNodeName)) { return ((Node)nodeTable.get(inNodeName)).getState(); --- 697,701 ---- */ ! /* public int getState(String inNodeName) { if (nodeTable.containsKey(inNodeName)) { return ((Node)nodeTable.get(inNodeName)).getState(); *************** *** 874,878 **** ((Node)nodeTable.get(inNodeName)).Reset(); } ! } --- 715,719 ---- ((Node)nodeTable.get(inNodeName)).Reset(); } ! }*/ *************** *** 884,888 **** */ ! public void addRoute(String inNodeName,Route_entry r){ if (nodeTable.containsKey(inNodeName)) { ((NetworkLayerDevice)nodeTable.get(inNodeName)).addRoute(r); --- 725,729 ---- */ ! /* public void addRoute(String inNodeName,Route_entry r){ if (nodeTable.containsKey(inNodeName)) { ((NetworkLayerDevice)nodeTable.get(inNodeName)).addRoute(r); *************** *** 908,912 **** } return null; ! } /** --- 749,753 ---- } return null; ! }*/ /** *************** *** 1047,1075 **** /** ! * This method is for creating router within the simulation ! * All routers are created with the default of two netork interface ! * @author luke_hamilton ! * @param inRouterName - The Router Name eg: router1 * @throws InvalidNodeNameException - * @version v0.20 **/ ! public void addRouter(String inRouterName, boolean inOn)throws InvalidNodeNameException { ! if (!nodeTable.containsKey(inRouterName)) { ! nodeTable.put(inRouterName, new Router(inRouterName, inOn)); ! } else { ! throw new InvalidNodeNameException("Node already exists with same name"); ! } ! return; ! } ! ! public void addExternalNAT(String inRouterName, boolean inOn)throws InvalidNodeNameException { ! if (!nodeTable.containsKey(inRouterName)) { ! nodeTable.put(inRouterName, new ExternalProxy(inRouterName, inOn)); ! } else { ! throw new InvalidNodeNameException("Node already exists with same name"); ! } ! return; ! } ! public void addNode(String ClassName, String inName, boolean inOn)throws InvalidNodeNameException { try{ --- 888,896 ---- /** ! * This method is for creating new node within the simulation ! * @author key * @throws InvalidNodeNameException **/ ! public void addNode(String ClassName, String inName, boolean inOn)throws InvalidNodeNameException { try{ *************** *** 1092,1103 **** /** ! * This method is for creating a PC within the simulation. ! * All PC are created by default with one network interface ! * @author luke_hamilton ! * @param inPCName - The PC Name eg: PC1 ! * @throws InvalidNodeNameException ! * @version v0.20 **/ ! public void addPC(String inPCName, boolean inOn) throws InvalidNodeNameException { if (!nodeTable.containsKey(inPCName)) { nodeTable.put(inPCName, new PC(inPCName, inOn)); --- 913,920 ---- /** ! * Compability methods for import old config files. Use addNode instead. **/ ! ! public void addPC(String inPCName, boolean inOn) throws InvalidNodeNameException { if (!nodeTable.containsKey(inPCName)) { nodeTable.put(inPCName, new PC(inPCName, inOn)); *************** *** 1107,1138 **** return; } - - public void addPrinter(String inPCName, boolean inOn) throws InvalidNodeNameException { - if (!nodeTable.containsKey(inPCName)) { - nodeTable.put(inPCName, new Printer(inPCName, inOn)); - } else { - throw new InvalidNodeNameException("Node already exists with same name"); - } - return; - } - public void addAP(String inPCName, boolean inOn) throws InvalidNodeNameException { - if (!nodeTable.containsKey(inPCName)) { - nodeTable.put(inPCName, new WirelessAP(inPCName, inOn)); - } else { - throw new InvalidNodeNameException("Node already exists with same name"); - } - return; - } - - /** - * This method will check to see if the hub name is contained within the - * hash table (nodeTable) if it is not it will create a hub object and add it to the nodetable. - * Else throw exceptions. - * @author luke_hamilton - * @param inNodeName - The Hub Name eg: Hub1 - * @throws InvalidNodeNameException - * @version v0.20 - **/ public void addHub(String inNodeName, boolean inOn) throws InvalidNodeNameException { if (!nodeTable.containsKey(inNodeName)) { --- 924,928 ---- *************** *** 1142,1162 **** } } ! ! public void addCSUDSU(String inNodeName, boolean inOn) throws InvalidNodeNameException { ! if (!nodeTable.containsKey(inNodeName)) { ! nodeTable.put(inNodeName, new CSUDSU(inNodeName, inOn)); } else { throw new InvalidNodeNameException("Node already exists with same name"); } } ! /** ! * This method will check to see if the switch name is contained within the ! * hash table (nodeTable) if it is not it will create a switch object and add it to the nodetable. ! * Else throw exceptions. ! * @author luke_hamilton ! * @param inNodeName - The Switch Name eg: Switch1 ! * @throws InvalidNodeNameException ! * @version v0.20 ! **/ public void addSwitch(String inNodeName, boolean inOn) throws InvalidNodeNameException { if(!nodeTable.containsKey(inNodeName)){ --- 932,945 ---- } } ! ! public void addRouter(String inRouterName, boolean inOn)throws InvalidNodeNameException { ! if (!nodeTable.containsKey(inRouterName)) { ! nodeTable.put(inRouterName, new Router(inRouterName, inOn)); } else { throw new InvalidNodeNameException("Node already exists with same name"); } + return; } ! public void addSwitch(String inNodeName, boolean inOn) throws InvalidNodeNameException { if(!nodeTable.containsKey(inNodeName)){ *************** *** 1239,1243 **** * @return String[] List of interface names that are not connected to a link. **/ ! public String[] getAvailableInterfaces(String inNodeName)throws InvalidNetworkLayerDeviceException, InvalidNodeNameException { String strAvailInterfaces[]; if(nodeTable.containsKey(inNodeName)){ --- 1022,1026 ---- * @return String[] List of interface names that are not connected to a link. **/ ! /*public String[] getAvailableInterfaces(String inNodeName)throws InvalidNetworkLayerDeviceException, InvalidNodeNameException { String strAvailInterfaces[]; if(nodeTable.containsKey(inNodeName)){ *************** *** 1248,1252 **** } return strAvailInterfaces; ! } /** --- 1031,1035 ---- } return strAvailInterfaces; ! }*/ /** *************** *** 1256,1260 **** * @throws InvalidNodeNameException */ ! public Object[] getAllInterfaces(String inNodeName)throws InvalidNodeNameException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); --- 1039,1043 ---- * @throws InvalidNodeNameException */ ! /* public Object[] getAllInterfaces(String inNodeName)throws InvalidNodeNameException { if(nodeTable.containsKey(inNodeName)){ Node temp = (Node)nodeTable.get(inNodeName); *************** *** 1271,1275 **** } throw new InvalidNodeNameException("Node does not exist."); ! } /** --- 1054,1058 ---- } throw new InvalidNodeNameException("Node does not exist."); ! }*/ /** *************** *** 1280,1286 **** * @return */ ! public static boolean validateDecIP(String inDecIPAddress){ return IPV4Address.validateDecIP(inDecIPAddress); ! } /** --- 1063,1069 ---- * @return */ ! /*public static boolean validateDecIP(String inDecIPAddress){ return IPV4Address.validateDecIP(inDecIPAddress); ! }*/ /** *************** *** 1291,1297 **** * @return */ ! public static boolean validateDecSubnetMask(String inDecSubnetMask){ return IPV4Address.validateDecSubnetMask(inDecSubnetMask); ! } /** --- 1074,1080 ---- * @return */ ! /*public static boolean validateDecSubnetMask(String inDecSubnetMask){ return IPV4Address.validateDecSubnetMask(inDecSubnetMask); ! }*/ /** *************** *** 1301,1307 **** * @return */ ! public static String getDefaultSubnetMask(String inDecimalIp){ return IPV4Address.getDefaultSubnetMask(inDecimalIp); ! } public Vector getAllNodeInformation(String inNodeName) throws InvalidNodeNameException --- 1084,1090 ---- * @return */ ! /*public static String getDefaultSubnetMask(String inDecimalIp){ return IPV4Address.getDefaultSubnetMask(inDecimalIp); ! }*/ public Vector getAllNodeInformation(String inNodeName) throws InvalidNodeNameException Index: NetworkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkLayerDevice.java,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** NetworkLayerDevice.java 17 Oct 2008 09:10:16 -0000 1.26 --- NetworkLayerDevice.java 21 Oct 2008 11:50:24 -0000 1.27 *************** *** 381,400 **** NodeProtocolStack.removeARP(inIPAddress); } ! ! /** ! * ! * @return ! */ ! public Object[] getAllInterfaces(){ ! ArrayList<String> interfaceArray = new ArrayList<String>(); ! Enumeration keys = NetworkInterfacetable.keys(); ! while(keys.hasMoreElements()){ ! String str = (String) keys.nextElement(); ! NetworkInterface x = (NetworkInterface)NetworkInterfacetable.get(str); ! interfaceArray.add(x.getName()); ! } ! return interfaceArray.toArray(); } --- 381,408 ---- NodeProtocolStack.removeARP(inIPAddress); } ! ! public void setTCPIPSettings(String inInterface, String inIP, String inMask, String inGateway){ ! getConfig().executeCommand("interface "+inInterface+" ip address "+ inIP + " " + inMask); ! if(inGateway != null) ! getConfig().executeCommand("ip route 0.0.0.0 0.0.0.0 " + inGateway + " " + inInterface); ! getConfig().executeCommand("write mem"); ! } ! ! public void setTCPIPSettings(String inGateway){ ! getConfig().executeCommand("ip route 0.0.0.0 0.0.0.0 " + inGateway + " eth0"); ! ! getConfig().executeCommand("write mem"); ! } ! ! public void setTCPIPSettings(String inInterface, String inIP, String inMask){ ! getConfig().executeCommand("interface "+inInterface+" ip address "+ inIP + " " + inMask); ! ! getConfig().executeCommand("write mem"); ! } ! ! public void execCmd(String cmd){ ! getConfig().executeCommand(cmd); } *************** *** 474,476 **** --- 482,522 ---- return nat; } + + + public String[] getFormattedARPTable() + { + String[] arpEntries; + Vector<Vector<String>> ArpTable = getARPTable(); + arpEntries = new String[ArpTable.size()+1]; + + if(ArpTable.size()>0){ + arpEntries[0] = "Internet Address\tPhysical Address\t\tType\n"; + for(int i=0;i<ArpTable.size();i++) + { + arpEntries[i+1] = ArpTable.get(i).get(0) + "\t\t" + ArpTable.get(i).get(1) + "\t\t" + ArpTable.get(i).get(2) + "\n"; + } + }else{ + arpEntries[0] = "No ARP Entries Found\n"; + } + + return arpEntries; + } + + public void addStaticARP(String inIPAddress, String inMACAddress) + { + NetworkLayerDevice tempNet = this; + + tempNet.getConfig().executeCommand("arp "+inIPAddress+" "+inMACAddress); + tempNet.getConfig().executeCommand("write mem"); + + } + + public void deleteARPRecord(String inIPAddress) + { + NetworkLayerDevice tempNet = this; + + tempNet.getConfig().executeCommand("no arp "+inIPAddress); + tempNet.getConfig().executeCommand("write mem"); + + } }//EOF Index: DataLinkLayerDevice.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/DataLinkLayerDevice.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** DataLinkLayerDevice.java 5 Oct 2008 19:12:30 -0000 1.7 --- DataLinkLayerDevice.java 21 Oct 2008 11:50:24 -0000 1.8 *************** *** 64,78 **** } ! public Object[] getAllInterfaces(){ ! ! ArrayList<String> interfaceArray = new ArrayList<String>(); ! Enumeration keys = NetworkInterfacetable.keys(); ! while(keys.hasMoreElements()){ ! String str = (String) keys.nextElement(); ! NetworkInterface x = (NetworkInterface)NetworkInterfacetable.get(str); ! interfaceArray.add(x.getName()); ! } ! ! return interfaceArray.toArray(); ! } } --- 64,67 ---- } ! } Index: Switch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/Switch.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** Switch.java 26 Sep 2008 17:53:49 -0000 1.10 --- Switch.java 21 Oct 2008 11:50:24 -0000 1.11 *************** *** 79,86 **** while(it.hasMoreElements()){ NetworkInterface tempInterface = (NetworkInterface)it.nextElement(); ! nic = tempInterface.getName(); Hashtable outInt = (Hashtable) IntCaches.get(nic); outInt.clear(); } } --- 79,87 ---- while(it.hasMoreElements()){ NetworkInterface tempInterface = (NetworkInterface)it.nextElement(); ! nic = tempInterface.getName(); Hashtable outInt = (Hashtable) IntCaches.get(nic); outInt.clear(); } + super.Reset(); } |
From: Alexander B. <da...@us...> - 2008-10-21 11:50:36
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv14781/core/protocolsuite/tcp_ip Modified Files: ExternalProxyApp.java Log Message: Refactoring of Simulation. Index: ExternalProxyApp.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ExternalProxyApp.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** ExternalProxyApp.java 26 Sep 2008 17:53:49 -0000 1.10 --- ExternalProxyApp.java 21 Oct 2008 11:50:24 -0000 1.11 *************** *** 36,40 **** public class ExternalProxyApp extends Application{ - private int counts; private String externalIP; public int recieved; --- 36,39 ---- *************** *** 49,53 **** this.NAT = NAT; this.externalIP = externalIP; - counts = 0; try { --- 48,51 ---- |
Update of /cvsroot/javanetsim/javaNetSim/core In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20370/core Modified Files: CommandProcessor.java DeviceConfig.java EthernetNetworkInterface.java MultilayerSwitch.java NetworkInterfacePort.java Log Message: DHCP + VLAN commands was corrected Index: CommandProcessor.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/CommandProcessor.java,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** CommandProcessor.java 19 Oct 2008 21:40:19 -0000 1.28 --- CommandProcessor.java 20 Oct 2008 23:46:56 -0000 1.29 *************** *** 26,29 **** --- 26,30 ---- import java.util.ArrayList; + import java.util.Calendar; import java.util.Enumeration; import java.util.Hashtable; *************** *** 1543,1551 **** try{ NetworkInterface ni = device.getNetworkInterface(params.get(0)); ! if(ni instanceof EthernetNetworkInterface){ ! EthernetNetworkInterface eni = (EthernetNetworkInterface) ni; if(add){ try{ int vlanid = Integer.parseInt(params.get(1)); eni.vlan = vlanid; } --- 1544,1553 ---- try{ NetworkInterface ni = device.getNetworkInterface(params.get(0)); ! if(ni instanceof NetworkInterfacePort){ ! NetworkInterfacePort eni = (NetworkInterfacePort) ni; if(add){ try{ int vlanid = Integer.parseInt(params.get(1)); + if(vlanid<=0) throw new NumberFormatException(); eni.vlan = vlanid; } *************** *** 1587,1593 **** try{ NetworkInterface ni = device.getNetworkInterface(params.get(0)); ! if(ni instanceof EthernetNetworkInterface){ ! EthernetNetworkInterface eni = (EthernetNetworkInterface) ni; ! eni.mode = EthernetNetworkInterface.MODE_ACCESS; } else{ --- 1589,1595 ---- try{ NetworkInterface ni = device.getNetworkInterface(params.get(0)); ! if(ni instanceof NetworkInterfacePort){ ! NetworkInterfacePort eni = (NetworkInterfacePort) ni; ! eni.mode = NetworkInterfacePort.MODE_ACCESS; } else{ *************** *** 1620,1626 **** try{ NetworkInterface ni = device.getNetworkInterface(params.get(0)); ! if(ni instanceof EthernetNetworkInterface){ ! EthernetNetworkInterface eni = (EthernetNetworkInterface) ni; ! eni.mode = EthernetNetworkInterface.MODE_TRUNK; } else{ --- 1622,1628 ---- try{ NetworkInterface ni = device.getNetworkInterface(params.get(0)); ! if(ni instanceof NetworkInterfacePort){ ! NetworkInterfacePort eni = (NetworkInterfacePort) ni; ! eni.mode = NetworkInterfacePort.MODE_TRUNK; } else{ *************** *** 2049,2053 **** modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.NO_CALL); call_params = "<network ip> <netmask>"; ! no_call_params = "<network ip> <netmask>"; } public String call(Vector<String> params){ --- 2051,2055 ---- modes = new Modes(CommandInterface.CONF_MODE, CommandInterface.APPLICATION_LAYER, CommandInterface.NO_CALL); call_params = "<network ip> <netmask>"; ! no_call_params = "<cr>"; } public String call(Vector<String> params){ *************** *** 3293,3299 **** } public String call(Vector<String> params){ ! String out = "Command not supported yet.\n"; if(device instanceof ApplicationLayerDevice){ ! } else{ --- 3295,3330 ---- } public String call(Vector<String> params){ ! String out = ""; if(device instanceof ApplicationLayerDevice){ ! DHCPD dhcpd = (DHCPD)((ApplicationLayerDevice)device).getApp(core.ApplicationLayerDevice.DHCP_SERVER_ID); ! if(dhcpd!=null){ ! if(params.size()==0){ ! out += "DHCP server is "+(dhcpd.running?"running\n":"stopped\n"); ! Enumeration<String> leases = dhcpd.leases.keys(); ! while(leases.hasMoreElements()){ ! String name = leases.nextElement(); ! DHCPD.lease lease = (DHCPD.lease) dhcpd.leases.get(name); ! out += " Lease at '"+name+"' is "+(lease.completed?"complete":"not complete")+"\n" + ! " Network: "+((lease.IP==null || lease.IP=="")?"(not set)":lease.IP)+"\n" + ! " Mask: "+((lease.Genmask==null || lease.Genmask=="")?"(not set)":lease.Genmask)+"\n" + ! " Gateway: "+((lease.Gateway==null || lease.Gateway=="")?"(not set)":lease.Gateway)+"\n" + ! " MAC: "+((lease.MAC==null || lease.MAC=="")?"(not set)":lease.MAC)+"\n"; ! if(lease.leased>0){ ! Calendar lt = Calendar.getInstance(); ! lt.setTimeInMillis(lease.leased); ! out += " Leased: "+String.format("%1$tT", lt)+"\n"; ! } ! else{ ! out += " Leased: (none)\n"; ! } ! } ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! } ! else{ ! out += "This instruction not supported by device\n"; ! } } else{ *************** *** 3309,3315 **** } public String call(Vector<String> params){ ! String out = "Command not supported yet.\n"; if(device instanceof ApplicationLayerDevice){ ! } else{ --- 3340,3367 ---- } public String call(Vector<String> params){ ! String out = ""; if(device instanceof ApplicationLayerDevice){ ! DHCPD dhcpd = (DHCPD)((ApplicationLayerDevice)device).getApp(core.ApplicationLayerDevice.DHCP_SERVER_ID); ! if(dhcpd!=null){ ! if(params.size()==0){ ! out += "DHCP server is "+(dhcpd.running?"running\n":"stopped\n"); ! Enumeration<String> pools = dhcpd.pools.keys(); ! while(pools.hasMoreElements()){ ! String name = pools.nextElement(); ! DHCPD.pool pool = (DHCPD.pool) dhcpd.pools.get(name); ! out += " Pool '"+name+"'\n" + ! " Network: "+((pool.IP==null || pool.IP=="")?"(not set)":pool.IP)+"\n" + ! " Mask: "+((pool.Genmask==null || pool.Genmask=="")?"(not set)":pool.Genmask)+"\n" + ! " Gateway: "+((pool.Gateway==null || pool.Gateway=="")?"(not set)":pool.Gateway)+"\n" + ! " MAC: "+((pool.MAC==null || pool.MAC=="")?"(not set)":pool.MAC)+"\n"; ! } ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! } ! else{ ! out += "This instruction not supported by device\n"; ! } } else{ *************** *** 3381,3438 **** public show_interfaces_CommandClass(){ modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "<cr>"; } public String call(Vector<String> params){ String out = ""; ! Object[] ins = device.getAllInterfaces(); ! ! for(int i=0; i<ins.length; i++){ ! try { ! NetworkInterface ni = device.getNetworkInterface((String)ins[i]); ! boolean isLineUp = false; ! if(ni instanceof WiFiPort){ ! isLineUp = ((WiFiPort) ni).associated; ! } ! else{ ! isLineUp = ni.getConnectedLink() != null; ! } ! boolean isUp = ni.isUP(); ! out += "Interface " + (String)ins[i] + " is " + (isUp?"up":"down") + ", line protocol is " + (isLineUp?"up":"down") + "\n"; ! out += " Description: \"" + ni.getDescription() + "\"\n"; ! out += " Hardware address " + device.getMACAddress((String)ins[i]) + "\n"; ! String ip = device.getIPAddress((String)ins[i]); ! String mask = device.getSubnetMask((String)ins[i]); ! out += " Internet address " + (ip==null || ip.equals("")?"Not set":ip) + "/" + (mask==null || mask.equals("")?"Not set":mask) + "\n"; ! if(ni instanceof EthernetNetworkInterface){ ! EthernetNetworkInterface eni = (EthernetNetworkInterface)ni; ! if(eni.vlan > 1){ ! out += " VLAN ID: "+eni.vlan+"\n"; ! } ! } ! if(ni instanceof WiFiPort){ ! WiFiPort wfi = (WiFiPort) ni; ! if(device instanceof WirelessAP || device instanceof Router){ ! out += " BSSID: " + wfi.getBSSID() + "\n"; ! } ! else{ ! out += " Access point BSSID: " + wfi.getAPBSSID() + "\n"; } ! out += " SSID: " + wfi.getSSID() + "\n"; ! out += " Channel: " + wfi.getChannel() + "\n"; ! if(wfi.getMode()==WiFiPort.MODE_AP) ! out += " Station-role is access point\n"; ! else if(wfi.getMode()==WiFiPort.MODE_REPEATER) ! out += " Station-role is repeater\n"; ! else if(wfi.getMode()==WiFiPort.MODE_STATION) ! out += " Station-role is client\n"; ! out += " Authentication type: " + (wfi.isSharedAuth()?"shared":"open") + "\n"; } ! if(ni instanceof SerialNetworkInterface){ ! out += " Clock-rate " + ((SerialNetworkInterface)ni).getClockRate() + "\n"; } ! out += "\n"; ! } catch (InvalidNetworkInterfaceNameException ex) { ! out += "internal error: invalid network interface\n"; } } return out; --- 3433,3508 ---- public show_interfaces_CommandClass(){ modes = new Modes(CommandInterface.STD_CONF_MODE, CommandInterface.NETWORK_LAYER, CommandInterface.CALL_ONLY); ! call_params = "[<interface name>]"; } public String call(Vector<String> params){ String out = ""; ! if(params.size()==1){ ! out += sh_int(params.get(0)); ! } ! else if(params.size()==0){ ! Object[] ins = device.getAllInterfaces(); ! for(int i=0; i<ins.length; i++){ ! out += sh_int((String)ins[i]); ! } ! } ! else{ ! out += "error: invalid parameters\n"; ! } ! return out; ! } ! private String sh_int(String iface){ ! String out = ""; ! try { ! NetworkInterface ni = device.getNetworkInterface(iface); ! boolean isLineUp = false; ! if(ni instanceof WiFiPort){ ! isLineUp = ((WiFiPort) ni).associated; ! } ! else{ ! isLineUp = ni.getConnectedLink() != null; ! } ! boolean isUp = ni.isUP(); ! out += "Interface " + iface + " is " + (isUp?"up":"down") + ", line protocol is " + (isLineUp?"up":"down") + "\n"; ! out += " Description: \"" + ni.getDescription() + "\"\n"; ! out += " Hardware address " + device.getMACAddress(iface) + "\n"; ! String ip = device.getIPAddress(iface); ! String mask = device.getSubnetMask(iface); ! out += " Internet address " + (ip==null || ip.equals("")?"Not set":ip) + "/" + (mask==null || mask.equals("")?"Not set":mask) + "\n"; ! if(ni instanceof NetworkInterfacePort){ ! NetworkInterfacePort eni = (NetworkInterfacePort)ni; ! //if(eni.vlan > 1){ ! out += " VLAN ID: "+eni.vlan+"\n"; ! String vmode = "unknown"; ! switch(eni.mode){ ! case NetworkInterfacePort.MODE_ACCESS: vmode = "access"; break; ! case NetworkInterfacePort.MODE_TRUNK: vmode = "trunk"; break; } ! out += " VLAN mode: "+vmode+"\n"; ! //} ! } ! if(ni instanceof WiFiPort){ ! WiFiPort wfi = (WiFiPort) ni; ! if(device instanceof WirelessAP || device instanceof Router){ ! out += " BSSID: " + wfi.getBSSID() + "\n"; } ! else{ ! out += " Access point BSSID: " + wfi.getAPBSSID() + "\n"; } ! out += " SSID: " + wfi.getSSID() + "\n"; ! out += " Channel: " + wfi.getChannel() + "\n"; ! if(wfi.getMode()==WiFiPort.MODE_AP) ! out += " Station-role is access point\n"; ! else if(wfi.getMode()==WiFiPort.MODE_REPEATER) ! out += " Station-role is repeater\n"; ! else if(wfi.getMode()==WiFiPort.MODE_STATION) ! out += " Station-role is client\n"; ! out += " Authentication type: " + (wfi.isSharedAuth()?"shared":"open") + "\n"; } + if(ni instanceof SerialNetworkInterface){ + out += " Clock-rate " + ((SerialNetworkInterface)ni).getClockRate() + "\n"; + } + out += "\n"; + } catch (InvalidNetworkInterfaceNameException ex) { + out += "invalid network interface\n"; } return out; *************** *** 3813,3829 **** vlans.add(keys.nextElement()); } ! String[] ints = (String[]) device.getAllInterfaces(); for(int i=0; i<ints.length; i++){ try{ ! NetworkInterface ni = device.getNetworkInterface(ints[i]); ! if(ni instanceof EthernetNetworkInterface){ ! EthernetNetworkInterface eni = (EthernetNetworkInterface) ni; int vlanid = eni.vlan; if(vlanport.containsKey(vlanid)){ ! vlanport.get(vlanid).add(ints[i]); } else{ Vector<String> ports = new Vector<String>(1); ! ports.add(ints[i]); vlanport.put(vlanid, ports); if(!vlans.contains(vlanid)){ --- 3883,3899 ---- vlans.add(keys.nextElement()); } ! Object[] ints = device.getAllInterfaces(); for(int i=0; i<ints.length; i++){ try{ ! NetworkInterface ni = device.getNetworkInterface((String)ints[i]); ! if(ni instanceof NetworkInterfacePort){ ! NetworkInterfacePort eni = (NetworkInterfacePort) ni; int vlanid = eni.vlan; if(vlanport.containsKey(vlanid)){ ! vlanport.get(vlanid).add((String)ints[i]); } else{ Vector<String> ports = new Vector<String>(1); ! ports.add((String)ints[i]); vlanport.put(vlanid, ports); if(!vlans.contains(vlanid)){ *************** *** 3838,3842 **** int vlanid = vlansi.next(); String vlanname = msdev.getVlanName(vlanid); ! if(vlanname==null) vlanname = "-vlan not exists-"; String ports = ""; if(vlanport.containsKey(vlanid)){ --- 3908,3912 ---- int vlanid = vlansi.next(); String vlanname = msdev.getVlanName(vlanid); ! if(vlanname==null) vlanname = "(vlan not exists)"; String ports = ""; if(vlanport.containsKey(vlanid)){ *************** *** 3849,3853 **** ports = "no ports found"; } ! out += vlanid+"\t"+String.format("%25s", vlanname)+"\t"+ports+"\n"; } } --- 3919,3923 ---- ports = "no ports found"; } ! out += vlanid+" "+String.format("%20s", vlanname)+" "+ports+"\n"; } } *************** *** 4139,4156 **** if(device instanceof MultilayerSwitch){ MultilayerSwitch msdev = (MultilayerSwitch) device; ! if(params.size()==2 || params.size()==3){ try{ ! int vlanid = Integer.parseInt(params.get(1)); ! String name = ""; ! if(params.size()==3) name = params.get(2); ! if(add){ ! msdev.addVlan(vlanid, name); } else{ ! if(name.equals("")){ ! msdev.removeVlan(vlanid); } ! else if(msdev.getVlanName(vlanid).equals(name)){ ! msdev.removeVlan(vlanid); } } --- 4209,4232 ---- if(device instanceof MultilayerSwitch){ MultilayerSwitch msdev = (MultilayerSwitch) device; ! if(params.size()==1 || params.size()==2){ try{ ! int vlanid = Integer.parseInt(params.get(0)); ! if(vlanid<=0) throw new NumberFormatException(); ! else if(vlanid==1){ ! out += "error: VLAN 1 is reserved!\n"; } else{ ! String name = ""; ! if(params.size()==2) name = params.get(1); ! if(add){ ! msdev.addVlan(vlanid, name); } ! else{ ! if(name.equals("")){ ! msdev.removeVlan(vlanid); ! } ! else if(msdev.getVlanName(vlanid).equals(name)){ ! msdev.removeVlan(vlanid); ! } } } Index: NetworkInterfacePort.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/NetworkInterfacePort.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** NetworkInterfacePort.java 5 Oct 2008 19:12:31 -0000 1.9 --- NetworkInterfacePort.java 20 Oct 2008 23:46:56 -0000 1.10 *************** *** 112,115 **** --- 112,121 ---- */ + + + public int vlan = 1; + final static int MODE_ACCESS = 0; + final static int MODE_TRUNK = 1; + public int mode = MODE_ACCESS; protected NetworkInterfacePort(long UID, String inName, Node inParent) { *************** *** 150,155 **** protected void receivePacket(Packet inPacket) throws LowLinkException { if(!parentNode.On) return; ! ! parentNode.receivePacket(inPacket, name); return; --- 156,165 ---- protected void receivePacket(Packet inPacket) throws LowLinkException { if(!parentNode.On) return; ! ! boolean drop = false; ! if(mode == MODE_ACCESS && (((Ethernet_packet)inPacket).vlan_id != vlan)) ! drop = true; ! ! if(!drop) parentNode.receivePacket(inPacket, name); return; Index: DeviceConfig.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/DeviceConfig.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** DeviceConfig.java 18 Oct 2008 19:55:31 -0000 1.22 --- DeviceConfig.java 20 Oct 2008 23:46:56 -0000 1.23 *************** *** 415,418 **** --- 415,419 ---- EthernetNetworkInterface eni = null; SerialNetworkInterface sni = null; + NetworkInterfacePort pni = null; WiFiPort wfi = null; try{ *************** *** 423,426 **** --- 424,430 ---- } catch(ClassCastException e){}; try{ + pni = (NetworkInterfacePort) ni; + } catch(ClassCastException e){}; + try{ wfi = (WiFiPort) ni; } catch(ClassCastException e){}; *************** *** 456,459 **** --- 460,474 ---- } } + if(pni!=null){ + if(pni.vlan > 1){ + conf.add("interface "+intName+" switchport access vlan "+pni.vlan); + } + switch(pni.mode){ + case NetworkInterfacePort.MODE_ACCESS: break; + case NetworkInterfacePort.MODE_TRUNK: + conf.add("interface "+intName+" switchport mode trunk"); + break; + } + } if(ni.getACLin()!=0) conf.add("interface "+intName+" ip access-group "+ni.getACLin()+" in"); *************** *** 474,481 **** conf.add("no interface "+intName+" ip information-replay"); ! if(ni.isUP()) ! conf.add("no interface "+intName+" shutdown"); ! else conf.add("interface "+intName+" shutdown"); if(device instanceof ApplicationLayerDevice){ --- 489,500 ---- conf.add("no interface "+intName+" ip information-replay"); ! if(ni.isUP()){ ! if(ni.isActive()){ ! conf.add("no interface "+intName+" shutdown"); ! } ! } ! else{ conf.add("interface "+intName+" shutdown"); + } if(device instanceof ApplicationLayerDevice){ Index: MultilayerSwitch.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/MultilayerSwitch.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** MultilayerSwitch.java 19 Oct 2008 21:40:19 -0000 1.2 --- MultilayerSwitch.java 20 Oct 2008 23:46:56 -0000 1.3 *************** *** 177,181 **** it = NetworkInterfacetable.elements(); while (it.hasMoreElements()) { ! EthernetNetworkInterface tempInterface = (EthernetNetworkInterface) it .nextElement(); nic = tempInterface.getName(); --- 177,181 ---- it = NetworkInterfacetable.elements(); while (it.hasMoreElements()) { ! NetworkInterfacePort tempInterface = (NetworkInterfacePort) it .nextElement(); nic = tempInterface.getName(); *************** *** 184,188 **** intFound = true; try { ! if(tempInterface.mode == EthernetNetworkInterface.MODE_TRUNK || tempInterface.vlan == copyPacket.vlan_id) tempInterface.sendPacket(copyPacket); --- 184,188 ---- intFound = true; try { ! if(tempInterface.mode == NetworkInterfacePort.MODE_TRUNK || tempInterface.vlan == copyPacket.vlan_id) tempInterface.sendPacket(copyPacket); *************** *** 198,202 **** // that sent in the packet // if it is skip that interface ! EthernetNetworkInterface tempInterface = (EthernetNetworkInterface) it .nextElement(); --- 198,202 ---- // that sent in the packet // if it is skip that interface ! NetworkInterfacePort tempInterface = (NetworkInterfacePort) it .nextElement(); *************** *** 204,208 **** try { ! if(tempInterface.mode == EthernetNetworkInterface.MODE_TRUNK || tempInterface.vlan == copyPacket.vlan_id) tempInterface.sendPacket(copyPacket); --- 204,208 ---- try { ! if(tempInterface.mode == NetworkInterfacePort.MODE_TRUNK || tempInterface.vlan == copyPacket.vlan_id) tempInterface.sendPacket(copyPacket); Index: EthernetNetworkInterface.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/EthernetNetworkInterface.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** EthernetNetworkInterface.java 17 Oct 2008 09:10:16 -0000 1.18 --- EthernetNetworkInterface.java 20 Oct 2008 23:46:56 -0000 1.19 *************** *** 64,71 **** protected String MACAddress; public String defaultMACAddress; - public int vlan = 1; - final static int MODE_ACCESS = 0; - final static int MODE_TRUNK = 1; - public int mode = MODE_ACCESS; /** --- 64,67 ---- *************** *** 115,120 **** drop = true; - if(mode == MODE_ACCESS && (tempPacket.vlan_id != vlan)) - drop = true; //Test if this packet is for this interface or a broadcast --- 111,114 ---- |
From: QweR <qw...@us...> - 2008-10-20 23:47:10
|
Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv20370/core/protocolsuite/tcp_ip Modified Files: DHCPD.java Log Message: DHCP + VLAN commands was corrected Index: DHCPD.java =================================================================== RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/DHCPD.java,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** DHCPD.java 19 Oct 2008 21:40:19 -0000 1.8 --- DHCPD.java 20 Oct 2008 23:46:56 -0000 1.9 *************** *** 22,31 **** public class pool{ ! public String MAC; ! public String IP; ! public String Genmask; ! public String Gateway; } --- 22,31 ---- public class pool{ ! public String MAC=""; ! public String IP=""; ! public String Genmask=""; ! public String Gateway=""; } *************** *** 58,63 **** public boolean running = false; ! public Hashtable pools = new Hashtable(); ! public Hashtable leases = new Hashtable(); private Vector<Pair> exclude = new Vector<Pair>(0); --- 58,63 ---- public boolean running = false; ! public Hashtable<String, pool> pools = new Hashtable<String, pool>(); ! public Hashtable<String, lease> leases = new Hashtable<String, lease>(); private Vector<Pair> exclude = new Vector<Pair>(0); |