eu.emi.security.authn.x509.helpers.proxy
Class IPAddressHelper
java.lang.Object
eu.emi.security.authn.x509.helpers.proxy.IPAddressHelper
public class IPAddressHelper
- extends Object
Helpers for IP addresses comparison.
- Author:
- Joni Hahkala, K. Benedyczak
Method Summary |
static byte[] |
andBytes(byte[] ip,
byte[] netmask)
This method does bitwise and between the two byte arrays. |
static boolean |
isWithinAddressSpace(byte[] ipAddress,
byte[] ipAddressWithNetmask)
Tests whether the ipAddress is within the address space defined by
the ipAddressWithNetmask. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IPAddressHelper
public IPAddressHelper()
isWithinAddressSpace
public static boolean isWithinAddressSpace(byte[] ipAddress,
byte[] ipAddressWithNetmask)
- Tests whether the ipAddress is within the address space defined by
the ipAddressWithNetmask.
- Parameters:
ipAddress
- The IP address bytes to compare against the address
space.ipAddressWithNetmask
- The 8 (IPv4) or 32 (IPv6) byte array containing in the
first half the base IP address bytes and in the second
half the netmask bytes.
- Returns:
- true if
andBytes
public static byte[] andBytes(byte[] ip,
byte[] netmask)
- This method does bitwise and between the two byte arrays. The arrays
have to have the same size.
- Parameters:
ip
- The first array to use for the and operation.netmask
- The second array to use for the and operation.
- Returns:
- The resulting byte array containing the bytes after the
bitwise and operation.
Copyright © 2012 European Middleware Initiative. All Rights Reserved.