Exemple #1
0
 public static boolean isCompatIPv4Address(Inet6Address paramInet6Address) {
   if (!paramInet6Address.isIPv4CompatibleAddress()) {
     return false;
   }
   byte[] arrayOfByte = paramInet6Address.getAddress();
   return (arrayOfByte[12] != 0)
       || (arrayOfByte[13] != 0)
       || (arrayOfByte[14] != 0)
       || ((arrayOfByte[15] != 0) && (arrayOfByte[15] != 1));
 }
 /**
  * Evaluate the provided IP address against the information processed during the IP bind rule
  * expression decode.
  *
  * @param remoteAddr A IP address to evaluate.
  * @return An enumeration representing the result of the evaluation.
  */
 public EnumEvalResult evaluate(InetAddress remoteAddr) {
   EnumEvalResult matched = EnumEvalResult.FALSE;
   IPType ipType = IPType.IPv4;
   byte[] addressBytes = remoteAddr.getAddress();
   if (remoteAddr instanceof Inet6Address) {
     ipType = IPType.IPv6;
     Inet6Address addr6 = (Inet6Address) remoteAddr;
     addressBytes = addr6.getAddress();
     if (addr6.isIPv4CompatibleAddress()) ipType = IPType.IPv4;
   }
   if (ipType != this.ipType) return EnumEvalResult.FALSE;
   if (matchAddress(addressBytes)) matched = EnumEvalResult.TRUE;
   return matched;
 }