Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
jau::EUI48Sub Struct Reference

A 48 bit EUI-48 sub-identifier, see EUI48. More...

#include <eui48.hpp>

Collaboration diagram for jau::EUI48Sub:

Public Member Functions

constexpr EUI48Sub () noexcept
 
constexpr EUI48Sub (const EUI48Sub &o) noexcept=default
 
 EUI48Sub (const std::string &str)
 Construct a sub EUI48 via given string representation. More...
 
 EUI48Sub (const uint8_t *b_, const jau::nsize_t len_, const lb_endian_t byte_order) noexcept
 Copy len_ address bytes from given source and byte_order, while converting them to lb_endian::native byte order. More...
 
 EUI48Sub (EUI48Sub &&o) noexcept=default
 
void clear ()
 Method clears the underlying byte array b and sets length to zero. More...
 
bool contains (const EUI48Sub &needle) const noexcept
 Returns true, if given EUI48Sub needle is contained in this instance haystack. More...
 
constexpr std::size_t hash_code () const noexcept
 
jau::snsize_t indexOf (const EUI48Sub &needle, const lb_endian_t byte_order) const noexcept
 Finds the index of given EUI48Sub needle within this instance haystack in the given byte order. More...
 
constexpr EUI48Suboperator= (const EUI48Sub &o) noexcept=default
 
EUI48Suboperator= (EUI48Sub &&o) noexcept=default
 
std::string toString () const noexcept
 Returns the EUI48 sub-string representation with MSB first (lb_endian::big), less or equal 17 characters representing less or equal 6 bytes as upper case hexadecimal numbers separated via colon, e.g. More...
 

Static Public Member Functions

static jau::snsize_t indexOf (const uint8_t haystack_b[], const jau::nsize_t haystack_length, const uint8_t needle_b[], const jau::nsize_t needle_length, const lb_endian_t byte_order) noexcept
 Find index of needle within haystack in the given byte order. More...
 
static bool scanEUI48Sub (const std::string &str, EUI48Sub &dest, std::string &errmsg)
 Fills given EUI48Sub instance via given string representation. More...
 

Public Attributes

uint8_t b [6]
 The <= 6 byte EUI48 sub-address. More...
 
jau::nsize_t length
 The actual length in bytes of the EUI48 sub-address, less or equal 6 bytes. More...
 

Static Public Attributes

static const EUI48Sub ALL_DEVICE
 EUI48 MAC address matching all device, i.e. More...
 
static const EUI48Sub ANY_DEVICE
 EUI48 MAC address matching any device, i.e. More...
 
static const EUI48Sub LOCAL_DEVICE
 EUI48 MAC address matching local device, i.e. More...
 

Detailed Description

A 48 bit EUI-48 sub-identifier, see EUI48.

Stores value in lb_endian::native byte order.

Definition at line 51 of file eui48.hpp.

Constructor & Destructor Documentation

◆ EUI48Sub() [1/5]

constexpr jau::EUI48Sub::EUI48Sub ( )
inlineconstexprnoexcept

Definition at line 70 of file eui48.hpp.

◆ EUI48Sub() [2/5]

EUI48Sub::EUI48Sub ( const uint8_t *  b_,
const jau::nsize_t  len_,
const lb_endian_t  byte_order 
)
noexcept

Copy len_ address bytes from given source and byte_order, while converting them to lb_endian::native byte order.

Parameters
b_sub address bytes in lb_endian::native byte order
len_length
byte_orderlb_endian::little or lb_endian::big byte order of given sub_address, one may pass lb_endian::native.

Definition at line 114 of file eui48.cpp.

◆ EUI48Sub() [3/5]

EUI48Sub::EUI48Sub ( const std::string &  str)

Construct a sub EUI48 via given string representation.

Implementation is consistent with EUI48Sub::toString().

Parameters
stra string of less or equal of 17 characters representing less or equal of 6 bytes as hexadecimal numbers separated via colon, e.g. 01:02:03:0A:0B:0C, 01:02:03:0A, :, (empty).
See also
EUI48Sub::scanEUI48Sub()
EUI48Sub::toString()
Exceptions
jau::IllegalArgumentExceptionif given string doesn't comply with EUI48

Definition at line 107 of file eui48.cpp.

◆ EUI48Sub() [4/5]

constexpr jau::EUI48Sub::EUI48Sub ( const EUI48Sub o)
constexprdefaultnoexcept

◆ EUI48Sub() [5/5]

jau::EUI48Sub::EUI48Sub ( EUI48Sub &&  o)
defaultnoexcept

Member Function Documentation

◆ scanEUI48Sub()

bool EUI48Sub::scanEUI48Sub ( const std::string &  str,
EUI48Sub dest,
std::string &  errmsg 
)
static

Fills given EUI48Sub instance via given string representation.

Implementation is consistent with EUI48Sub::toString().

Parameters
stra string of less or equal of 17 characters representing less or equal of 6 bytes as hexadecimal numbers separated via colon, e.g. 01:02:03:0A:0B:0C, 01:02:03:0A, :, (empty).
destEUI48Sub to set its value
errmsgerror parsing message if returning false
Returns
true if successful, otherwise false
See also
EUI48Sub::EUI48Sub
EUI48Sub::toString()

Definition at line 66 of file eui48.cpp.

Here is the caller graph for this function:

◆ operator=() [1/2]

constexpr EUI48Sub & jau::EUI48Sub::operator= ( const EUI48Sub o)
constexprdefaultnoexcept

◆ operator=() [2/2]

EUI48Sub & jau::EUI48Sub::operator= ( EUI48Sub &&  o)
defaultnoexcept

◆ hash_code()

constexpr std::size_t jau::EUI48Sub::hash_code ( ) const
inlineconstexprnoexcept

Definition at line 115 of file eui48.hpp.

◆ clear()

void jau::EUI48Sub::clear ( )
inline

Method clears the underlying byte array b and sets length to zero.

Definition at line 127 of file eui48.hpp.

Here is the caller graph for this function:

◆ indexOf() [1/2]

jau::snsize_t EUI48Sub::indexOf ( const uint8_t  haystack_b[],
const jau::nsize_t  haystack_length,
const uint8_t  needle_b[],
const jau::nsize_t  needle_length,
const lb_endian_t  byte_order 
)
staticnoexcept

Find index of needle within haystack in the given byte order.

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

  • lb_endian::big will return index 0 for the leading byte like the toString() representation from left (MSB) to right (LSB).
  • lb_endian::little will return index 5 for the leading byte
Parameters
haystack_bhaystack data
haystack_lengthhaystack length
needle_bneedle data
needle_lengthneedle length
byte_orderbyte order will adjust the returned index, lb_endian::big is equivalent with toString() representation from left (MSB) to right (LSB).
Returns
index of first element of needle within haystack or -1 if not found. If the needle length is zero, 0 (found) is returned.

Definition at line 129 of file eui48.cpp.

Here is the caller graph for this function:

◆ indexOf() [2/2]

jau::snsize_t jau::EUI48Sub::indexOf ( const EUI48Sub needle,
const lb_endian_t  byte_order 
) const
inlinenoexcept

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.

  • lb_endian::big will return index 0 for the leading byte like the toString() representation from left (MSB) to right (LSB).
  • lb_endian::little will return index 5 for the leading byte
Parameters
needle
byte_orderbyte order will adjust the returned index, lb_endian::big 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()

Definition at line 163 of file eui48.hpp.

◆ contains()

bool jau::EUI48Sub::contains ( const EUI48Sub needle) const
inlinenoexcept

Returns true, if given EUI48Sub needle is contained in this instance haystack.

If the sub is zero, true is returned.

Definition at line 173 of file eui48.hpp.

◆ toString()

std::string EUI48Sub::toString ( ) const
noexcept

Returns the EUI48 sub-string representation with MSB first (lb_endian::big), less or equal 17 characters representing less or equal 6 bytes as upper case hexadecimal numbers separated via colon, e.g.

01:02:03:0A:0B:0C, 01:02:03:0A, :, (empty).

Definition at line 36 of file eui48.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ ANY_DEVICE

const EUI48Sub jau::EUI48Sub::ANY_DEVICE
static

EUI48 MAC address matching any device, i.e.

0:0:0:0:0:0.

Definition at line 54 of file eui48.hpp.

◆ ALL_DEVICE

const EUI48Sub jau::EUI48Sub::ALL_DEVICE
static

EUI48 MAC address matching all device, i.e.

ff:ff:ff:ff:ff:ff.

Definition at line 56 of file eui48.hpp.

◆ LOCAL_DEVICE

const EUI48Sub jau::EUI48Sub::LOCAL_DEVICE
static

EUI48 MAC address matching local device, i.e.

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

Definition at line 58 of file eui48.hpp.

◆ b

uint8_t jau::EUI48Sub::b[6]

The <= 6 byte EUI48 sub-address.

Definition at line 63 of file eui48.hpp.

◆ length

jau::nsize_t jau::EUI48Sub::length

The actual length in bytes of the EUI48 sub-address, less or equal 6 bytes.

Definition at line 68 of file eui48.hpp.


The documentation for this struct was generated from the following files: