public class MacAddress extends Object implements OFValueType<MacAddress>
| Modifier and Type | Field and Description |
|---|---|
static MacAddress |
BROADCAST |
static MacAddress |
FULL_MASK |
static MacAddress |
NO_MASK |
static MacAddress |
NONE |
| Modifier and Type | Method and Description |
|---|---|
MacAddress |
applyMask(MacAddress mask) |
int |
compareTo(MacAddress o) |
boolean |
equals(Object obj) |
static MacAddress |
forIPv4MulticastAddress(IPv4Address ipv4) |
static MacAddress |
forIPv6MulticastAddr(IPv6Address ipv6)
Generate a MAC address corresponding to multicast IPv6 address.
|
byte[] |
getBytes() |
int |
getLength() |
long |
getLong() |
int |
hashCode() |
boolean |
isBroadcast()
Returns
true if the MAC address is the broadcast address. |
boolean |
isLLDPAddress()
Returns
true if the MAC address is an LLDP mac address. |
boolean |
isMulticast()
Returns
true if the MAC address is a multicast address. |
static MacAddress |
of(byte[] address) |
static MacAddress |
of(DatapathId dpid)
Creates a
MacAddress from a DatapathId. |
static MacAddress |
of(long raw) |
static MacAddress |
of(String macString)
Parse a mac adress from a string representation as
6 hex bytes separated by colons or hyphens (01:02:03:04:05:06,
01-02-03-04-05-06).
|
void |
putTo(com.google.common.hash.PrimitiveSink sink) |
static MacAddress |
read6Bytes(io.netty.buffer.ByteBuf c) |
String |
toString() |
void |
write6Bytes(io.netty.buffer.ByteBuf c) |
public static final MacAddress NONE
public static final MacAddress BROADCAST
public static final MacAddress NO_MASK
public static final MacAddress FULL_MASK
public static MacAddress of(byte[] address)
public static MacAddress of(long raw)
@Nonnull public static MacAddress of(@Nonnull String macString) throws IllegalArgumentException
macString - - a mac address in string representationIllegalArgumentException - if macString is not a valid mac adddresspublic static MacAddress of(@Nonnull DatapathId dpid)
MacAddress from a DatapathId. This factory
method assumes that the first two bytes of the DatapathId are 0 bytes.dpid - the DatapathId to create the MacAddress fromMacAddress derived from the supplied DatapathIdpublic byte[] getBytes()
public boolean isBroadcast()
true if the MAC address is the broadcast address.true if the MAC address is the broadcast address.public boolean isMulticast()
true if the MAC address is a multicast address.true if the MAC address is a multicast address.public boolean isLLDPAddress()
true if the MAC address is an LLDP mac address.true if the MAC address is an LLDP mac address.public int getLength()
getLength in interface OFValueType<MacAddress>public long getLong()
public void write6Bytes(io.netty.buffer.ByteBuf c)
public static MacAddress read6Bytes(io.netty.buffer.ByteBuf c) throws OFParseError
OFParseErrorpublic MacAddress applyMask(MacAddress mask)
applyMask in interface OFValueType<MacAddress>public int compareTo(MacAddress o)
compareTo in interface Comparable<MacAddress>public void putTo(com.google.common.hash.PrimitiveSink sink)
putTo in interface PrimitiveSinkable@Nonnull public static MacAddress forIPv4MulticastAddress(IPv4Address ipv4) throws IllegalArgumentException
IllegalArgumentException@Nonnull public static MacAddress forIPv6MulticastAddr(IPv6Address ipv6) throws IllegalArgumentException
ipv6 - - IPv6 address corresponding to which multicast MAC addr
need to be generated.IllegalArgumentException - if ipv6 address is not a valid IPv6
multicast address.Copyright © 2018. All rights reserved.