Package org.jboss.netty.handler.ipfilter
Class CIDR6
- java.lang.Object
-
- org.jboss.netty.handler.ipfilter.CIDR
-
- org.jboss.netty.handler.ipfilter.CIDR6
-
-
Field Summary
Fields Modifier and Type Field Description private java.math.BigInteger
addressBigInt
The big integer for the base addressprivate java.math.BigInteger
addressEndBigInt
The big integer for the end addressprivate static InternalLogger
logger
-
Fields inherited from class org.jboss.netty.handler.ipfilter.CIDR
baseAddress, cidrMask
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CIDR6(java.net.Inet6Address newaddress, int newmask)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static java.net.InetAddress
bigIntToIPv6Address(java.math.BigInteger addr)
Convert a big integer into an IPv6 address.int
compareTo(CIDR arg)
boolean
contains(java.net.InetAddress inetAddress)
Compares the given InetAddress against the CIDR and returns true if the ip is in the subnet-ip-range and false if not.java.net.InetAddress
getEndAddress()
private static java.math.BigInteger
ipv6AddressToBigInteger(java.net.InetAddress addr)
Given an IPv6 address, convert it into a BigInteger.private static java.math.BigInteger
ipv6CidrMaskToBaseAddress(int cidrMask)
Given an IPv6 baseAddress length, return the block length.private static java.math.BigInteger
ipv6CidrMaskToMask(int cidrMask)
-
Methods inherited from class org.jboss.netty.handler.ipfilter.CIDR
equals, getBaseAddress, getIpV4FromIpV6, getIpV6FromIpV4, getMask, hashCode, newCIDR, newCIDR, newCIDR, toString
-
-
-
-
Field Detail
-
logger
private static final InternalLogger logger
-
addressBigInt
private java.math.BigInteger addressBigInt
The big integer for the base address
-
addressEndBigInt
private final java.math.BigInteger addressEndBigInt
The big integer for the end address
-
-
Method Detail
-
getEndAddress
public java.net.InetAddress getEndAddress()
- Specified by:
getEndAddress
in classCIDR
- Returns:
- the end address of this block.
-
compareTo
public int compareTo(CIDR arg)
-
contains
public boolean contains(java.net.InetAddress inetAddress)
Description copied from class:CIDR
Compares the given InetAddress against the CIDR and returns true if the ip is in the subnet-ip-range and false if not.
-
ipv6CidrMaskToBaseAddress
private static java.math.BigInteger ipv6CidrMaskToBaseAddress(int cidrMask)
Given an IPv6 baseAddress length, return the block length. I.e., a baseAddress length of 96 will return 2**32.
-
ipv6CidrMaskToMask
private static java.math.BigInteger ipv6CidrMaskToMask(int cidrMask)
-
ipv6AddressToBigInteger
private static java.math.BigInteger ipv6AddressToBigInteger(java.net.InetAddress addr)
Given an IPv6 address, convert it into a BigInteger.- Returns:
- the integer representation of the InetAddress
- Throws:
java.lang.IllegalArgumentException
- if the address is not an IPv6 address.
-
bigIntToIPv6Address
private static java.net.InetAddress bigIntToIPv6Address(java.math.BigInteger addr) throws java.net.UnknownHostException
Convert a big integer into an IPv6 address.- Returns:
- the inetAddress from the integer
- Throws:
java.net.UnknownHostException
- if the big integer is too large, and thus an invalid IPv6 address.
-
-