eu.emi.security.authn.x509.helpers.proxy
Class IPAddressHelper

java.lang.Object
  extended by eu.emi.security.authn.x509.helpers.proxy.IPAddressHelper

public class IPAddressHelper
extends Object

Helpers for IP addresses comparison. Mostly the code from Tigran's ipmatcher library (GNU license).

Author:
Tigran Mkrtchyan, K. Benedyczak

Constructor Summary
IPAddressHelper()
           
 
Method Summary
static boolean isWithinAddressSpace(byte[] ipBytes, 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
 

Constructor Detail

IPAddressHelper

public IPAddressHelper()
Method Detail

isWithinAddressSpace

public static boolean isWithinAddressSpace(byte[] ipBytes,
                                           byte[] ipAddressWithNetmask)
Tests whether the ipAddress is within the address space defined by the ipAddressWithNetmask.

Parameters:
ipBytes - 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 ip matches subnet.


Copyright © 2012-2013 European Middleware Initiative. All Rights Reserved.