public class IPv6Address extends IPAddress<IPv6Address> implements Writeable
Modifier and Type | Field and Description |
---|---|
static IPv6Address |
FULL_MASK |
static IPv6Address |
NO_MASK |
static IPv6Address |
NONE |
static org.projectfloodlight.openflow.types.IPv6Address.Reader |
READER |
Modifier and Type | Method and Description |
---|---|
IPv6Address |
and(IPv6Address other)
Perform a low level AND operation on the bits of two IPAddress objects
|
IPv6Address |
applyMask(IPv6Address mask) |
int |
asCidrMaskLength()
If this IPAddress represents a valid CIDR style netmask (see
isCidrMask()) returns the length of the prefix (the number of "1" bits).
|
int |
compareTo(IPv6Address o) |
boolean |
equals(Object obj) |
byte[] |
getBytes()
Returns the raw IP address of this
IPAddress object. |
IPVersion |
getIpVersion()
Returns the Internet Protocol (IP) version of this object
|
int |
getLength() |
int |
getUnsignedShortWord(int i) |
int |
getZeroCompressStart()
get the index of the first word where to apply IPv6 zero compression
|
int |
hashCode() |
boolean |
isBroadcast()
Checks if the IPAddress is the global broadcast address
255.255.255.255 in case of IPv4
|
boolean |
isCidrMask()
Checks if this IPAddress represents a valid CIDR style netmask, i.e.,
it has a set of leading "1" bits followed by only "0" bits
|
boolean |
isLinkLocal()
Returns
true if the IPAddress is a link local address. |
boolean |
isLoopback()
Returns
true if the IPAddress is a loopback address. |
boolean |
isModifiedEui64Derived(MacAddress macAddress)
Returns
true if the second (lower-order) 64-bit block of
this address is equal to the Modified EUI-64 format interface
identifier that corresponds to the specified MAC address. |
boolean |
isMulticast()
IPv6 multicast addresses are defined by the prefix ff00::/8
|
boolean |
isUnspecified()
Returns
true if the IPAddress is unspecified. |
IPv6Address |
not()
Returns a new IPAddress object with the bits inverted
|
static IPv6Address |
of(byte[] address)
Returns an
IPv6Address object that represents the given
IP address. |
static IPv6Address |
of(Inet6Address address)
Returns an
IPv6Address object that represents the given
IP address. |
static IPv6Address |
of(IPv6AddressWithMask network,
MacAddress macAddress)
Returns an
IPv6Address object that represents the given
MAC address in the specified network. |
static IPv6Address |
of(long raw1,
long raw2)
Returns an
IPv6Address object that represents the given
IP address. |
static IPv6Address |
of(String string)
Returns an
IPv6Address object that represents the given
IP address. |
static IPv6Address |
ofCidrMaskLength(int cidrMaskLength)
Returns an
IPv6Address object that represents the
CIDR subnet mask of the given prefix length. |
IPv6Address |
or(IPv6Address other)
Perform a low level OR operation on the bits of two IPAddress objects
|
void |
putTo(com.google.common.hash.PrimitiveSink sink) |
static IPv6Address |
read16Bytes(io.netty.buffer.ByteBuf c) |
Inet6Address |
toInetAddress()
Returns an
InetAddress object representing this IP address. |
String |
toString() |
String |
toString(boolean zeroCompression,
boolean leadingZeros) |
IPv6AddressWithMask |
withMask(IPv6Address mask)
Returns an
IPv6AddressWithMask object that represents this
IP address masked by the given IP address mask. |
IPv6AddressWithMask |
withMaskOfLength(int cidrMaskLength)
Returns an
IPv6AddressWithMask object that represents this
IP address masked by the CIDR subnet mask of the given prefix length. |
void |
write16Bytes(io.netty.buffer.ByteBuf c) |
void |
writeTo(io.netty.buffer.ByteBuf bb) |
fromInetAddress, of
public static final IPv6Address NONE
public static final IPv6Address NO_MASK
public static final IPv6Address FULL_MASK
public static final org.projectfloodlight.openflow.types.IPv6Address.Reader READER
public IPVersion getIpVersion()
IPAddress
getIpVersion
in class IPAddress<IPv6Address>
public boolean isCidrMask()
IPAddress
isCidrMask
in class IPAddress<IPv6Address>
public int asCidrMaskLength()
IPAddress
asCidrMaskLength
in class IPAddress<IPv6Address>
public boolean isUnspecified()
IPAddress
true
if the IPAddress is unspecified.
The unspecified addresses, also known as the wildcard addresses, refer to:
IPv4Address
of 0.0.0.0
IPv6Address
of ::
isUnspecified
in class IPAddress<IPv6Address>
public boolean isLoopback()
IPAddress
true
if the IPAddress is a loopback address.
Loopback addresses refer to:
IPv4Address
within 127.0.0.0/8
IPv6Address
of ::1
isLoopback
in class IPAddress<IPv6Address>
public boolean isLinkLocal()
IPAddress
true
if the IPAddress is a link local address.
Link local addresses refer to:
IPv4Address
within 169.254.0.0/16
IPv6Address
within fe80::/10
isLinkLocal
in class IPAddress<IPv6Address>
public boolean isBroadcast()
IPAddress
isBroadcast
in class IPAddress<IPv6Address>
public boolean isMulticast()
isMulticast
in class IPAddress<IPv6Address>
public boolean isModifiedEui64Derived(@Nonnull MacAddress macAddress)
true
if the second (lower-order) 64-bit block of
this address is equal to the Modified EUI-64 format interface
identifier that corresponds to the specified MAC address.
Refer to the followings for the details of conversions between MAC addresses and Modified EUI-64 format interface identifiers:
This method assumes the second (lower-order) 64-bit block to be a 64-bit interface identifier, which may not always be true.
public IPv6Address and(IPv6Address other)
IPAddress
and
in class IPAddress<IPv6Address>
other
- IPAddresspublic IPv6Address or(IPv6Address other)
IPAddress
or
in class IPAddress<IPv6Address>
other
- IPAddresspublic IPv6Address not()
IPAddress
not
in class IPAddress<IPv6Address>
@Nonnull public static IPv6Address of(@Nonnull byte[] address)
IPv6Address
object that represents the given
IP address. The argument is in network byte order: the highest
order byte of the address is in address[0]
.
The address byte array must be 16 bytes long (128 bits long).
Similar to InetAddress.getByAddress(byte[])
.
address
- the raw IP address in network byte orderIPv6Address
object that represents the given
raw IP addressNullPointerException
- if the given address was null
IllegalArgumentException
- if the given address was of an invalid
byte array lengthInetAddress.getByAddress(byte[])
@Nonnull public static IPv6Address of(@Nonnull String string) throws IllegalArgumentException
IPv6Address
object that represents the given
IP address. The argument is in the conventional string representation
of IPv6 addresses.
Expects up to 8 groups of 16-bit hex words seperated by colons (e.g., 2001:db8:85a3:8d3:1319:8a2e:370:7348).
Supports zero compression (e.g., 2001:db8::7348). Does not currently support embedding a dotted-quad IPv4 address into the IPv6 address (e.g., 2001:db8::192.168.0.1).
string
- the IP address in the conventional string representation
of IPv6 addressesIPv6Address
object that represents the given
IP addressNullPointerException
- if the given string was null
IllegalArgumentException
- if the given string was not a valid
IPv6 address@Nonnull public static IPv6Address of(long raw1, long raw2)
IPv6Address
object that represents the given
IP address. The arguments are the two 64-bit integers representing
the first (higher-order) and second (lower-order) 64-bit blocks
of the IP address.raw1
- the first (higher-order) 64-bit block of the IP addressraw2
- the second (lower-order) 64-bit block of the IP addressIPv6Address
object that represents the given
raw IP address@Nonnull public static IPv6Address of(@Nonnull Inet6Address address)
IPv6Address
object that represents the given
IP address. The argument is given as an Inet6Address
object.address
- the IP address as an Inet6Address
objectIPv6Address
object that represents the
given IP addressNullPointerException
- if the given Inet6Address
was
null
@Nonnull public static IPv6Address of(@Nonnull IPv6AddressWithMask network, @Nonnull MacAddress macAddress)
IPv6Address
object that represents the given
MAC address in the specified network.
The first (higher-order) 64-bit block of the returned address will be the network prefix derived from the specified network. The specified network must satisfy the followings:
isCidrMask()
== true
asCidrMaskLength()
<= 64
The second (lower-order) 64-bit block of the returned address will be equal to the Modified EUI-64 format interface identifier that corresponds to the specified MAC address.
Refer to the followings for the details of conversions between MAC addresses and Modified EUI-64 format interface identifiers:
IllegalArgumentException
- if the specified network does not
meet the aforementioned requirements@Nonnull public static IPv6Address ofCidrMaskLength(int cidrMaskLength)
IPv6Address
object that represents the
CIDR subnet mask of the given prefix length.cidrMaskLength
- the prefix length of the CIDR subnet mask
(i.e. the number of leading one-bits),
where 0 <= cidrMaskLength <= 128
IPv6Address
object that represents the
CIDR subnet mask of the given prefix lengthIllegalArgumentException
- if the given prefix length was invalid@Nonnull public IPv6AddressWithMask withMask(@Nonnull IPv6Address mask)
IPv6AddressWithMask
object that represents this
IP address masked by the given IP address mask.withMask
in class IPAddress<IPv6Address>
mask
- the IPv6Address
object that represents the maskIPv6AddressWithMask
object that represents this
IP address masked by the given maskNullPointerException
- if the given mask was null
@Nonnull public IPv6AddressWithMask withMaskOfLength(int cidrMaskLength)
IPv6AddressWithMask
object that represents this
IP address masked by the CIDR subnet mask of the given prefix length.withMaskOfLength
in class IPAddress<IPv6Address>
cidrMaskLength
- the prefix length of the CIDR subnet mask
(i.e. the number of leading one-bits),
where 0 <= cidrMaskLength <= 128
IPv6AddressWithMask
object that
represents this IP address masked by the CIDR
subnet mask of the given prefix lengthIllegalArgumentException
- if the given prefix length was invalidofCidrMaskLength(int)
public byte[] getBytes()
IPAddress
IPAddress
object. The result
is in network byte order: the highest order byte of the address is in
getBytes()[0]
.
Similar to InetAddress.getAddress()
getBytes
in class IPAddress<IPv6Address>
InetAddress.getAddress()
public int getLength()
getLength
in interface OFValueType<IPv6Address>
@Nonnull public Inet6Address toInetAddress()
IPAddress
InetAddress
object representing this IP address.
The resulting InetAddress
object:
Inet6Address
toInetAddress
in class IPAddress<IPv6Address>
public String toString()
toString
in class IPAddress<IPv6Address>
public int getUnsignedShortWord(int i)
public int getZeroCompressStart()
public String toString(boolean zeroCompression, boolean leadingZeros)
public int hashCode()
hashCode
in class IPAddress<IPv6Address>
public boolean equals(Object obj)
equals
in class IPAddress<IPv6Address>
public void write16Bytes(io.netty.buffer.ByteBuf c)
public static IPv6Address read16Bytes(io.netty.buffer.ByteBuf c) throws OFParseError
OFParseError
public IPv6Address applyMask(IPv6Address mask)
applyMask
in interface OFValueType<IPv6Address>
public int compareTo(IPv6Address o)
compareTo
in interface Comparable<IPv6Address>
public void putTo(com.google.common.hash.PrimitiveSink sink)
putTo
in interface PrimitiveSinkable
Copyright © 2015. All rights reserved.