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) |
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 DatapathId
public 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
OFParseError
public 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
Copyright © 2015. All rights reserved.