Update of /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip
In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv12670/core/protocolsuite/tcp_ip
Modified Files:
IPV4Address.java ProtocolStack.java socketLayer.java
Log Message:
Index: ProtocolStack.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/ProtocolStack.java,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -d -r1.74 -r1.75
*** ProtocolStack.java 24 Oct 2008 16:18:48 -0000 1.74
--- ProtocolStack.java 26 Oct 2008 15:37:40 -0000 1.75
***************
*** 668,671 ****
--- 668,678 ----
LowLinkException {
ICMP_packet pingPacket = null;
+
+ if(!IPV4Address.isValidIp(inDestIPAddress)){
+ if(mParentNode instanceof core.ApplicationLayerDevice){
+ //inDestIPAddress = ResolveDNS
+ }
+ }
+
if (IPV4Address.validateDecIP(inDestIPAddress)) {
pingPacket = mICMPprotocol.sendPing(inDestIPAddress);
Index: socketLayer.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/socketLayer.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** socketLayer.java 24 Oct 2008 16:18:48 -0000 1.15
--- socketLayer.java 26 Oct 2008 15:37:40 -0000 1.16
***************
*** 61,64 ****
--- 61,69 ----
public boolean connect(int sock, String ipaddr, int port) throws LowLinkException, CommunicationException, TransportLayerException{
boolean result = false;
+
+ if(!IPV4Address.isValidIp(ipaddr)){
+ //inDestIPAddress = ResolveDNS
+ }
+
jnSocket jnsock = get_socket(sock);
if(jnsock.type == jnSocket.TCP_socket){
***************
*** 107,110 ****
--- 112,119 ----
public void writeTo(int sock, String data, String IP, int port) throws LowLinkException, TransportLayerException{
+
+ if(!IPV4Address.isValidIp(IP)){
+ //inDestIPAddress = ResolveDNS
+ }
//
//if()
Index: IPV4Address.java
===================================================================
RCS file: /cvsroot/javanetsim/javaNetSim/core/protocolsuite/tcp_ip/IPV4Address.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** IPV4Address.java 24 Oct 2008 16:18:48 -0000 1.8
--- IPV4Address.java 26 Oct 2008 15:37:40 -0000 1.9
***************
*** 77,80 ****
--- 77,86 ----
}
+
+ public static boolean isValidIp(final String ip)
+ {
+ return ip.matches("^[\\d]{1,3}\\.[\\d]{1,3}\\.[\\d]{1,3}\\.[\\d]{1,3}$");
+ }
+
/**
* This method returns the binary subnetmask in decimal
|