25#ifndef JOIN_CORE_MAC_ADDRESS_HPP
26#define JOIN_CORE_MAC_ADDRESS_HPP
52 using iterator = std::array<uint8_t, IFHWADDRLEN>::iterator;
132 const uint8_t*
addr ()
const;
138 socklen_t
length ()
const;
297 const uint8_t&
operator[] (
size_t position)
const;
313 std::array<uint8_t, IFHWADDRLEN> _mac = {};
322 MacAddress
operator+ (
int value,
const MacAddress& a);
330 MacAddress
operator+ (
const MacAddress& a,
int value);
338 bool operator== (
const MacAddress& a,
const MacAddress& b);
346 bool operator!= (
const MacAddress& a,
const MacAddress& b);
354 bool operator< (
const MacAddress& a,
const MacAddress& b);
362 bool operator<= (
const MacAddress& a,
const MacAddress& b);
370 bool operator> (
const MacAddress& a,
const MacAddress& b);
378 bool operator>= (
const MacAddress& a,
const MacAddress& b);
386 MacAddress
operator& (
const MacAddress& a,
const MacAddress& b);
394 MacAddress
operator| (
const MacAddress& a,
const MacAddress& b);
402 MacAddress
operator^ (
const MacAddress& a,
const MacAddress& b);
410 std::ostream&
operator<< (std::ostream& out,
const MacAddress& a);
IPv6, IPv4 address class.
Definition ip_address.hpp:51
MAC address class.
Definition mac_address.hpp:46
socklen_t length() const
get the size in byte of the internal MAC address array.
Definition mac_address.cpp:173
void clear()
clear MAC address (wilcard address).
Definition mac_address.cpp:292
bool isBroadcast() const
check if MAC address is a broadcast address.
Definition mac_address.cpp:191
~MacAddress()=default
destroy the MacAddress instance.
static const MacAddress broadcast
broadcast MAC address.
Definition mac_address.hpp:309
std::array< uint8_t, IFHWADDRLEN >::iterator iterator
iterator from nested container.
Definition mac_address.hpp:52
int family() const
get address family.
Definition mac_address.cpp:155
iterator begin()
returns an iterator to the first element of the nested container.
Definition mac_address.cpp:301
MacAddress()
create the MacAddress instance (wilcard address).
Definition mac_address.cpp:55
IpAddress toUniqueLocalIpv6() const
convert MAC address to a unique local IPv6 address using eui-64.
Definition mac_address.cpp:272
static bool isMacAddress(const std::string &address)
check if the specified string is a MAC address.
Definition mac_address.cpp:201
bool isWildcard() const
check if MAC address is a wildcard address.
Definition mac_address.cpp:182
MacAddress & operator+=(int value)
add the provided value to the current MAC address.
Definition mac_address.cpp:432
MacAddress operator~() const
perform NOT operation on MAC address.
Definition mac_address.cpp:496
MacAddress & operator=(const MacAddress &address)
assign the MacAddress instance by copy.
Definition mac_address.cpp:381
const_iterator cbegin() const
returns an iterator to the first element of the nested container.
Definition mac_address.cpp:319
std::array< uint8_t, IFHWADDRLEN >::const_iterator const_iterator
constant iterator from nested container.
Definition mac_address.hpp:55
MacAddress & operator++()
perform pre-increment operation on MAC address.
Definition mac_address.cpp:448
IpAddress toLinkLocalIpv6() const
convert MAC address to a link local IPv6 address.
Definition mac_address.cpp:258
std::ios_base &(std::ios_base &) CaseConvert
case conversion function.
Definition mac_address.hpp:49
const_iterator cend() const
return an iterator to the element following the last element of the nested container.
Definition mac_address.cpp:346
static const MacAddress wildcard
wildcard MAC address.
Definition mac_address.hpp:306
IpAddress toIpv6(const IpAddress &prefix, int len) const
convert MAC address to IPv6 address using prefix.
Definition mac_address.cpp:238
std::string toString(CaseConvert caseConvert=std::nouppercase) const
convert internal address array to string.
Definition mac_address.cpp:219
const uint8_t * addr() const
get the internal MAC address array address.
Definition mac_address.cpp:164
uint8_t & operator[](size_t position)
returns a reference to the element at the specified location.
Definition mac_address.cpp:468
iterator end()
return an iterator to the element following the last element of the nested container.
Definition mac_address.cpp:328
Definition acceptor.hpp:32
bool operator<=(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoint is lower or equal.
Definition endpoint.hpp:234
bool operator==(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:186
IpAddress operator^(const IpAddress &a, const IpAddress &b)
perform XOR operation on IP address.
Definition ip_address.cpp:1719
IpAddress operator&(const IpAddress &a, const IpAddress &b)
perform AND operation on IP address.
Definition ip_address.cpp:1665
bool operator!=(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoints are not equal.
Definition endpoint.hpp:198
bool operator>=(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoint is greater or equal.
Definition endpoint.hpp:246
std::ostream & operator<<(std::ostream &os, const BasicLinkLayerEndpoint< Protocol > &endpoint)
push endpoint representation into a stream.
Definition endpoint.hpp:258
bool operator<(const BasicDatagramSocket< Protocol > &a, const BasicDatagramSocket< Protocol > &b) noexcept
compare if socket handle is inferior.
Definition datagram_socket.hpp:394
IpAddress operator|(const IpAddress &a, const IpAddress &b)
perform OR operation on IP address.
Definition ip_address.cpp:1692
MacAddress operator+(int value, const MacAddress &a)
add the provided value to the provided MAC address.
Definition mac_address.cpp:512
bool operator>(const BasicLinkLayerEndpoint< Protocol > &a, const BasicLinkLayerEndpoint< Protocol > &b) noexcept
compare if endpoint is greater.
Definition endpoint.hpp:222
IpAddress address
Definition tcp_acceptor_test.cpp:35