|
join 1.0
lightweight network framework library
|
MAC address class. More...
#include <macaddress.hpp>

Public Types | |
| using | CaseConvert = std::ios_base& (std::ios_base&) |
| case conversion function. | |
| using | iterator = std::array <uint8_t, IFHWADDRLEN>::iterator |
| iterator from nested container. | |
| using | const_iterator = std::array <uint8_t, IFHWADDRLEN>::const_iterator |
| constant iterator from nested container. | |
Public Member Functions | |
| MacAddress () | |
| create the MacAddress instance (wilcard address). | |
| MacAddress (const MacAddress &address) | |
| create the MacAddress instance by copy. | |
| MacAddress (MacAddress &&address) | |
| create the MacAddress instance by move. | |
| MacAddress (const uint8_t *address, size_t size) | |
| create the MacAddress instance using an array. | |
| MacAddress (const uint8_t(&address)[IFHWADDRLEN]) | |
| create the MacAddress instance using an array. | |
| MacAddress (std::initializer_list< uint8_t > address) | |
| create the MacAddress instance using an initialization list. | |
| MacAddress (const struct sockaddr &address) | |
| create the MacAddress instance using a sockaddr structure. | |
| MacAddress (const char *address) | |
| create the MacAddress instance using a string. | |
| MacAddress (const std::string &address) | |
| create the MacAddress instance using a string. | |
| ~MacAddress ()=default | |
| destroy the MacAddress instance. | |
| int | family () const |
| get address family. | |
| const uint8_t * | addr () const |
| get the internal MAC address array address. | |
| socklen_t | length () const |
| get the size in byte of the internal MAC address array. | |
| bool | isWildcard () const |
| check if MAC address is a wildcard address. | |
| bool | isBroadcast () const |
| check if MAC address is a broadcast address. | |
| std::string | toString (CaseConvert caseConvert=std::nouppercase) const |
| convert internal address array to string. | |
| IpAddress | toIpv6 (const IpAddress &prefix, int len) const |
| convert MAC address to IPv6 address using prefix. | |
| IpAddress | toLinkLocalIpv6 () const |
| convert MAC address to a link local IPv6 address. | |
| IpAddress | toUniqueLocalIpv6 () const |
| convert MAC address to a unique local IPv6 address using eui-64. | |
| void | clear () |
| clear MAC address (wilcard address). | |
| iterator | begin () |
| returns an iterator to the first element of the nested container. | |
| const_iterator | begin () const |
| returns an iterator to the first element of the nested container. | |
| const_iterator | cbegin () const |
| returns an iterator to the first element of the nested container. | |
| iterator | end () |
| return an iterator to the element following the last element of the nested container. | |
| const_iterator | end () const |
| return an iterator to the element following the last element of the nested container. | |
| const_iterator | cend () const |
| return an iterator to the element following the last element of the nested container. | |
| MacAddress & | operator= (const MacAddress &address) |
| assign the MacAddress instance by copy. | |
| MacAddress & | operator= (MacAddress &&address) |
| assign the MacAddress instance by move. | |
| MacAddress & | operator= (std::initializer_list< uint8_t > address) |
| assign the MacAddress using an initialization list. | |
| MacAddress & | operator= (const struct sockaddr &address) |
| assign the MacAddress using a sockaddr structure. | |
| MacAddress & | operator+= (int value) |
| add the provided value to the current MAC address. | |
| MacAddress & | operator++ () |
| perform pre-increment operation on MAC address. | |
| MacAddress | operator++ (int) |
| perform post-increment operation on MAC address. | |
| uint8_t & | operator[] (size_t position) |
| returns a reference to the element at the specified location. | |
| const uint8_t & | operator[] (size_t position) const |
| returns a reference to the element at the specified location. | |
| MacAddress | operator~ () const |
| perform NOT operation on MAC address. | |
Static Public Member Functions | |
| static bool | isMacAddress (const std::string &address) |
| check if the specified string is a MAC address. | |
| static MacAddress | address (const std::string &interface) |
| get the specified interface MAC address. | |
Static Public Attributes | |
| static const MacAddress | wildcard = "00:00:00:00:00:00" |
| wildcard MAC address. | |
| static const MacAddress | broadcast = "ff:ff:ff:ff:ff:ff" |
| broadcast MAC address. | |
MAC address class.
| using join::MacAddress::CaseConvert = std::ios_base& (std::ios_base&) |
case conversion function.
| using join::MacAddress::const_iterator = std::array <uint8_t, IFHWADDRLEN>::const_iterator |
constant iterator from nested container.
| using join::MacAddress::iterator = std::array <uint8_t, IFHWADDRLEN>::iterator |
iterator from nested container.
| MacAddress::MacAddress | ( | ) |
create the MacAddress instance (wilcard address).
| MacAddress::MacAddress | ( | const MacAddress & | address | ) |
create the MacAddress instance by copy.
| address | MAC address to copy. |
| MacAddress::MacAddress | ( | MacAddress && | address | ) |
create the MacAddress instance by move.
| address | MAC address to move. |
| MacAddress::MacAddress | ( | const uint8_t * | address, |
| size_t | size ) |
create the MacAddress instance using an array.
| address | MAC address array. |
| size | MAC address array size. |
| invalid_argument | if out of range. |
| MacAddress::MacAddress | ( | const uint8_t(&) | address[IFHWADDRLEN] | ) |
create the MacAddress instance using an array.
| address | MAC address array. |
| invalid_argument | if out of range. |
| MacAddress::MacAddress | ( | std::initializer_list< uint8_t > | address | ) |
create the MacAddress instance using an initialization list.
| address | MAC address initialization list. |
| invalid_argument | if out of range. |
| MacAddress::MacAddress | ( | const struct sockaddr & | address | ) |
create the MacAddress instance using a sockaddr structure.
| address | address structure to use. |
| invalid_argument | if address is wrong. |
| MacAddress::MacAddress | ( | const char * | address | ) |
create the MacAddress instance using a string.
| address | MAC address string to parse. |
| invalid_argument | if MAC address is invalid. |
| MacAddress::MacAddress | ( | const std::string & | address | ) |
create the MacAddress instance using a string.
| address | MAC address string to parse. |
| invalid_argument | if MAC address is invalid. |
|
default |
destroy the MacAddress instance.
| const uint8_t * MacAddress::addr | ( | ) | const |
get the internal MAC address array address.
|
static |
get the specified interface MAC address.
| interface | interface name. |
| MacAddress::iterator MacAddress::begin | ( | ) |
returns an iterator to the first element of the nested container.
| MacAddress::const_iterator MacAddress::begin | ( | ) | const |
returns an iterator to the first element of the nested container.
| MacAddress::const_iterator MacAddress::cbegin | ( | ) | const |
returns an iterator to the first element of the nested container.
| MacAddress::const_iterator MacAddress::cend | ( | ) | const |
return an iterator to the element following the last element of the nested container.
| void MacAddress::clear | ( | ) |
clear MAC address (wilcard address).
| MacAddress::iterator MacAddress::end | ( | ) |
return an iterator to the element following the last element of the nested container.
| MacAddress::const_iterator MacAddress::end | ( | ) | const |
return an iterator to the element following the last element of the nested container.
| int MacAddress::family | ( | ) | const |
get address family.
| bool MacAddress::isBroadcast | ( | ) | const |
check if MAC address is a broadcast address.
|
static |
check if the specified string is a MAC address.
| address | string that may contain a MAC address. |
| bool MacAddress::isWildcard | ( | ) | const |
check if MAC address is a wildcard address.
| socklen_t MacAddress::length | ( | ) | const |
get the size in byte of the internal MAC address array.
| MacAddress & MacAddress::operator++ | ( | ) |
perform pre-increment operation on MAC address.
| MacAddress MacAddress::operator++ | ( | int | ) |
perform post-increment operation on MAC address.
| MacAddress & MacAddress::operator+= | ( | int | value | ) |
add the provided value to the current MAC address.
| value | value to add to the current MAC address. |
| MacAddress & MacAddress::operator= | ( | const MacAddress & | address | ) |
assign the MacAddress instance by copy.
| address | MAC address to copy. |
| MacAddress & MacAddress::operator= | ( | const struct sockaddr & | address | ) |
assign the MacAddress using a sockaddr structure.
| address | address structure to use. |
| invalid_argument | if address is wrong. |
| MacAddress & MacAddress::operator= | ( | MacAddress && | address | ) |
assign the MacAddress instance by move.
| address | MAC address to move. |
| MacAddress & MacAddress::operator= | ( | std::initializer_list< uint8_t > | address | ) |
assign the MacAddress using an initialization list.
| address | MAC address initialization list. |
| invalid_argument | if out of range. |
| uint8_t & MacAddress::operator[] | ( | size_t | position | ) |
returns a reference to the element at the specified location.
| position | position of the element to return. |
| invalid_argument | if position is out of range. |
| const uint8_t & MacAddress::operator[] | ( | size_t | position | ) | const |
returns a reference to the element at the specified location.
| position | position of the element to return. |
| invalid_argument | if position is out of range. |
| MacAddress MacAddress::operator~ | ( | ) | const |
perform NOT operation on MAC address.
convert MAC address to IPv6 address using prefix.
| prefix | prefix address. |
| len | prefix length. |
| IpAddress MacAddress::toLinkLocalIpv6 | ( | ) | const |
convert MAC address to a link local IPv6 address.
| std::string MacAddress::toString | ( | CaseConvert | caseConvert = std::nouppercase | ) | const |
convert internal address array to string.
| _case | case conversion function (default: std::nouppercase). |
| IpAddress MacAddress::toUniqueLocalIpv6 | ( | ) | const |
convert MAC address to a unique local IPv6 address using eui-64.
|
static |
broadcast MAC address.
Broadcast MAC address.
|
static |
wildcard MAC address.
Wildcard MAC address.