public boolean isValid(String id) { return addr2Bytes(id) != null; } }
public boolean isValid(String id) { String parts[] = id.split("/", 2); byte aclAddr[] = addr2Bytes(parts[0]); if (aclAddr == null) { return false; } if (parts.length == 2) { try { int bits = Integer.parseInt(parts[1]); if (bits < 0 || bits > aclAddr.length * 8) { return false; } } catch (NumberFormatException e) { return false; } } return true; } }
public boolean matches(String id, String aclExpr) { String parts[] = aclExpr.split("/", 2); byte aclAddr[] = addr2Bytes(parts[0]); if (aclAddr == null) { return false; } int bits = aclAddr.length * 8; if (parts.length == 2) { try { bits = Integer.parseInt(parts[1]); if (bits < 0 || bits > aclAddr.length * 8) { return false; } } catch (NumberFormatException e) { return false; } } mask(aclAddr, bits); byte remoteAddr[] = addr2Bytes(id); if (remoteAddr == null) { return false; } mask(remoteAddr, bits); for (int i = 0; i < remoteAddr.length; i++) { if (remoteAddr[i] != aclAddr[i]) { return false; } } return true; }
public boolean matches(String id, String aclExpr) { String parts[] = aclExpr.split("/", 2); byte aclAddr[] = addr2Bytes(parts[0]); if (aclAddr == null) { return false; } int bits = aclAddr.length * 8; if (parts.length == 2) { try { bits = Integer.parseInt(parts[1]); if (bits < 0 || bits > aclAddr.length * 8) { return false; } } catch (NumberFormatException e) { return false; } } mask(aclAddr, bits); byte remoteAddr[] = addr2Bytes(id); if (remoteAddr == null) { return false; } mask(remoteAddr, bits); for (int i = 0; i < remoteAddr.length; i++) { if (remoteAddr[i] != aclAddr[i]) { return false; } } return true; }
public boolean isValid(String id) { return addr2Bytes(id) != null; } }
public boolean matches(String id, String aclExpr) { String parts[] = aclExpr.split("/", 2); byte aclAddr[] = addr2Bytes(parts[0]); if (aclAddr == null) { return false; } int bits = aclAddr.length * 8; if (parts.length == 2) { try { bits = Integer.parseInt(parts[1]); if (bits < 0 || bits > aclAddr.length * 8) { return false; } } catch (NumberFormatException e) { return false; } } mask(aclAddr, bits); byte remoteAddr[] = addr2Bytes(id); if (remoteAddr == null) { return false; } mask(remoteAddr, bits); for (int i = 0; i < remoteAddr.length; i++) { if (remoteAddr[i] != aclAddr[i]) { return false; } } return true; }