[Javanetsim-cvs] javaNetSim/core/protocolsuite/tcp_ip ARP.java, 1.13, 1.14 ARPTableEntry.java, 1.2,
Status: Beta
Brought to you by:
darkkey
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] |