25#ifndef __JOIN_MACADDRESS_HPP__
26#define __JOIN_MACADDRESS_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 ipaddress.hpp:51
MAC address class.
Definition macaddress.hpp:46
socklen_t length() const
get the size in byte of the internal MAC address array.
Definition macaddress.cpp:175
void clear()
clear MAC address (wilcard address).
Definition macaddress.cpp:297
bool isBroadcast() const
check if MAC address is a broadcast address.
Definition macaddress.cpp:195
std::array< uint8_t, IFHWADDRLEN >::const_iterator const_iterator
constant iterator from nested container.
Definition macaddress.hpp:55
~MacAddress()=default
destroy the MacAddress instance.
static const MacAddress broadcast
broadcast MAC address.
Definition macaddress.hpp:309
int family() const
get address family.
Definition macaddress.cpp:157
std::ios_base &(std::ios_base &) CaseConvert
case conversion function.
Definition macaddress.hpp:49
iterator begin()
returns an iterator to the first element of the nested container.
Definition macaddress.cpp:306
MacAddress()
create the MacAddress instance (wilcard address).
Definition macaddress.cpp:55
IpAddress toUniqueLocalIpv6() const
convert MAC address to a unique local IPv6 address using eui-64.
Definition macaddress.cpp:277
static bool isMacAddress(const std::string &address)
check if the specified string is a MAC address.
Definition macaddress.cpp:206
bool isWildcard() const
check if MAC address is a wildcard address.
Definition macaddress.cpp:184
MacAddress & operator+=(int value)
add the provided value to the current MAC address.
Definition macaddress.cpp:437
MacAddress operator~() const
perform NOT operation on MAC address.
Definition macaddress.cpp:501
MacAddress & operator=(const MacAddress &address)
assign the MacAddress instance by copy.
Definition macaddress.cpp:386
const_iterator cbegin() const
returns an iterator to the first element of the nested container.
Definition macaddress.cpp:324
MacAddress & operator++()
perform pre-increment operation on MAC address.
Definition macaddress.cpp:453
IpAddress toLinkLocalIpv6() const
convert MAC address to a link local IPv6 address.
Definition macaddress.cpp:263
const_iterator cend() const
return an iterator to the element following the last element of the nested container.
Definition macaddress.cpp:351
static const MacAddress wildcard
wildcard MAC address.
Definition macaddress.hpp:306
IpAddress toIpv6(const IpAddress &prefix, int len) const
convert MAC address to IPv6 address using prefix.
Definition macaddress.cpp:243
std::string toString(CaseConvert caseConvert=std::nouppercase) const
convert internal address array to string.
Definition macaddress.cpp:224
std::array< uint8_t, IFHWADDRLEN >::iterator iterator
iterator from nested container.
Definition macaddress.hpp:52
const uint8_t * addr() const
get the internal MAC address array address.
Definition macaddress.cpp:166
uint8_t & operator[](size_t position)
returns a reference to the element at the specified location.
Definition macaddress.cpp:473
iterator end()
return an iterator to the element following the last element of the nested container.
Definition macaddress.cpp:333
Definition acceptor.hpp:32
bool operator<(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is lower.
Definition endpoint.hpp:207
IpAddress operator^(const IpAddress &a, const IpAddress &b)
perform XOR operation on IP address.
Definition ipaddress.cpp:1720
bool operator>(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is greater.
Definition endpoint.hpp:219
IpAddress operator&(const IpAddress &a, const IpAddress &b)
perform AND operation on IP address.
Definition ipaddress.cpp:1666
bool operator!=(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoints are not equal.
Definition endpoint.hpp:195
bool operator>=(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is greater or equal.
Definition endpoint.hpp:243
std::ostream & operator<<(std::ostream &os, const BasicUnixEndpoint< Protocol > &endpoint)
push endpoint representation into a stream.
Definition endpoint.hpp:255
bool operator<=(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoint is lower or equal.
Definition endpoint.hpp:231
IpAddress operator|(const IpAddress &a, const IpAddress &b)
perform OR operation on IP address.
Definition ipaddress.cpp:1693
bool operator==(const BasicUnixEndpoint< Protocol > &a, const BasicUnixEndpoint< Protocol > &b) noexcept
compare if endpoints are equal.
Definition endpoint.hpp:183
MacAddress operator+(int value, const MacAddress &a)
add the provided value to the provided MAC address.
Definition macaddress.cpp:517
IpAddress address
Definition tcpacceptor_test.cpp:35