jaulib v1.3.0
Jau Support Library (C++, Java, ..)
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
org.jau.net.EUI48 Class Reference

A packed 48 bit EUI-48 identifier, formerly known as MAC-48 or simply network device MAC address (Media Access Control address). More...

Collaboration diagram for org.jau.net.EUI48:

Public Member Functions

 EUI48 (final String str) throws IllegalArgumentException
 Construct instance via given string representation. More...
 
 EUI48 (final byte stream[], final int pos, final ByteOrder byte_order)
 Copy address bytes from given source and byte order, while converting them to ByteOrder#nativeOrder(). More...
 
 EUI48 (final byte address[], final ByteOrder byte_order)
 Copy address bytes from given source and byte order, while converting them to ByteOrder#nativeOrder(). More...
 
 EUI48 ()
 Construct empty unset instance. More...
 
final boolean equals (final Object obj)
 
final int hashCode ()
 
void clearHash ()
 Method clears the cached hash value. More...
 
void clear ()
 Method clears the underlying byte array b and cached hash value. More...
 
final void put (final byte[] sink, final int sink_pos, final ByteOrder byte_order)
 Method transfers all bytes representing this instance into the given destination array at the given position and in the given byte order. More...
 
int indexOf (final EUI48Sub needle, final ByteOrder byte_order)
 Finds the index of given EUI48Sub needle within this instance haystack in the given byte order. More...
 
boolean contains (final EUI48Sub needle)
 Returns true, if given EUI48Sub is contained in here. More...
 
final String toString ()
 

Static Public Member Functions

static boolean scanEUI48 (final String str, final EUI48 dest, final StringBuilder errmsg)
 Fills given EUI48 instance via given string representation. More...
 

Public Attributes

final byte b []
 The 6 byte EUI48 address. More...
 

Static Public Attributes

static final EUI48 ANY_DEVICE = new EUI48( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }, ByteOrder.LITTLE_ENDIAN )
 EUI48 MAC address matching any device, i.e. More...
 
static final EUI48 ALL_DEVICE = new EUI48( new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff }, ByteOrder.LITTLE_ENDIAN )
 EUI48 MAC address matching all device, i.e. More...
 
static final EUI48 LOCAL_DEVICE = new EUI48( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0xff }, ByteOrder.LITTLE_ENDIAN )
 EUI48 MAC address matching local device, i.e. More...
 

Detailed Description

A packed 48 bit EUI-48 identifier, formerly known as MAC-48 or simply network device MAC address (Media Access Control address).

Stores value in ByteOrder#nativeOrder() byte order.

Implementation caches the hash value hashCode(), hence users shall take special care when mutating the underlying data b, read its API notes.

Definition at line 42 of file EUI48.java.

Constructor & Destructor Documentation

◆ EUI48() [1/4]

org.jau.net.EUI48.EUI48 ( final String  str) throws IllegalArgumentException

Construct instance via given string representation.

Implementation is consistent with toString().

Parameters
stra string of exactly 17 characters representing 6 bytes as hexadecimal numbers separated via colon "01:02:03:0A:0B:0C".
See also
#scanEUI48(String, byte[], StringBuilder)
toString()
Exceptions
IllegalArgumentExceptionif given string doesn't comply with EUI48

Definition at line 111 of file EUI48.java.

Here is the call graph for this function:

◆ EUI48() [2/4]

org.jau.net.EUI48.EUI48 ( final byte  stream[],
final int  pos,
final ByteOrder  byte_order 
)

Copy address bytes from given source and byte order, while converting them to ByteOrder#nativeOrder().

Parameters
streamaddress bytes
posposition in stream at address
byte_orderByteOrder#LITTLE_ENDIAN or ByteOrder#BIG_ENDIAN byte order of given address bytes, one may pass ByteOrder#nativeOrder().

Definition at line 127 of file EUI48.java.

Here is the call graph for this function:

◆ EUI48() [3/4]

org.jau.net.EUI48.EUI48 ( final byte  address[],
final ByteOrder  byte_order 
)

Copy address bytes from given source and byte order, while converting them to ByteOrder#nativeOrder().

Parameters
addressaddress bytes
byte_orderByteOrder#LITTLE_ENDIAN or ByteOrder#BIG_ENDIAN byte order of given address bytes, one may pass ByteOrder#nativeOrder().

Definition at line 146 of file EUI48.java.

◆ EUI48() [4/4]

org.jau.net.EUI48.EUI48 ( )

Construct empty unset instance.

Definition at line 151 of file EUI48.java.

Here is the caller graph for this function:

Member Function Documentation

◆ clear()

void org.jau.net.EUI48.clear ( )

Method clears the underlying byte array b and cached hash value.

See also
clearHash()

Definition at line 215 of file EUI48.java.

◆ clearHash()

void org.jau.net.EUI48.clearHash ( )

Method clears the cached hash value.

See also
clear()

Definition at line 209 of file EUI48.java.

◆ contains()

boolean org.jau.net.EUI48.contains ( final EUI48Sub  needle)

Returns true, if given EUI48Sub is contained in here.

If the sub is zero, true is returned.

Definition at line 266 of file EUI48.java.

Here is the call graph for this function:

◆ equals()

final boolean org.jau.net.EUI48.equals ( final Object  obj)

Definition at line 156 of file EUI48.java.

Here is the call graph for this function:

◆ hashCode()

final int org.jau.net.EUI48.hashCode ( )

Implementation uses a lock-free volatile cache.

See also
clearHash()

Definition at line 180 of file EUI48.java.

◆ indexOf()

int org.jau.net.EUI48.indexOf ( final EUI48Sub  needle,
final ByteOrder  byte_order 
)

Finds the index of given EUI48Sub needle within this instance haystack in the given byte order.

The returned index will be adjusted for the desired byte order.

Parameters
needle
byte_orderbyte order will adjust the returned index, ByteOrder#BIG_ENDIAN is equivalent with toString() representation from left (MSB) to right (LSB).
Returns
index of first element of needle within this instance haystack or -1 if not found. If the needle length is zero, 0 (found) is returned.
See also
#indexOf(byte[], int, byte[], int, ByteOrder)

Definition at line 256 of file EUI48.java.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ put()

final void org.jau.net.EUI48.put ( final byte[]  sink,
final int  sink_pos,
final ByteOrder  byte_order 
)

Method transfers all bytes representing this instance into the given destination array at the given position and in the given byte order.

Implementation is consistent with EUI48(byte[], int, ByteOrder).

Parameters
sinkthe destination array
sink_posstarting position in the destination array
byte_orderdestination buffer byte order
Exceptions
IllegalArgumentException
See also
EUI48(byte[], int, ByteOrder)

Definition at line 233 of file EUI48.java.

Here is the call graph for this function:

◆ scanEUI48()

static boolean org.jau.net.EUI48.scanEUI48 ( final String  str,
final EUI48  dest,
final StringBuilder  errmsg 
)
static

Fills given EUI48 instance via given string representation.

Implementation is consistent with toString().

Parameters
stra string of exactly 17 characters representing 6 bytes as hexadecimal numbers separated via colon "01:02:03:0A:0B:0C".
destEUI48 to set its value
errmsgerror parsing message if returning false
Returns
true if successful, otherwise false
See also
EUI48(String)
toString()

Definition at line 79 of file EUI48.java.

Here is the caller graph for this function:

◆ toString()

final String org.jau.net.EUI48.toString ( )

Returns the EUI48 string representation, exactly 17 characters representing 6 bytes as upper case hexadecimal numbers separated via colon "01:02:03:0A:0B:0C".

See also
EUI48(String)

Definition at line 279 of file EUI48.java.

Here is the call graph for this function:

Member Data Documentation

◆ ALL_DEVICE

final EUI48 org.jau.net.EUI48.ALL_DEVICE = new EUI48( new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff }, ByteOrder.LITTLE_ENDIAN )
static

EUI48 MAC address matching all device, i.e.

'ff:ff:ff:ff:ff:ff'.

Definition at line 46 of file EUI48.java.

◆ ANY_DEVICE

final EUI48 org.jau.net.EUI48.ANY_DEVICE = new EUI48( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }, ByteOrder.LITTLE_ENDIAN )
static

EUI48 MAC address matching any device, i.e.

'0:0:0:0:0:0'.

Definition at line 44 of file EUI48.java.

◆ b

final byte org.jau.net.EUI48.b[]

The 6 byte EUI48 address.

If modifying, it is the user's responsibility to avoid data races.
Further, call clearHash() after mutation is complete.

Definition at line 57 of file EUI48.java.

◆ LOCAL_DEVICE

final EUI48 org.jau.net.EUI48.LOCAL_DEVICE = new EUI48( new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0xff, (byte)0xff, (byte)0xff }, ByteOrder.LITTLE_ENDIAN )
static

EUI48 MAC address matching local device, i.e.

'0:0:0:ff:ff:ff'.

Definition at line 48 of file EUI48.java.


The documentation for this class was generated from the following file: