11#include <userver/utils/encoding/hex.hpp>
13USERVER_NAMESPACE_BEGIN
20template <std::size_t N>
21class MacaddrBase final {
22 static_assert(N == 6 || N == 8,
"Address can only be 6 or 8 bytes size");
25 using OctetsType = std::array<
unsigned char, N>;
27 MacaddrBase() =
default;
29 explicit MacaddrBase(
const OctetsType& macaddr)
noexcept
30 : macaddr_(macaddr) {}
33 const OctetsType&
GetOctets()
const noexcept {
return macaddr_; }
35 friend bool operator==(
const MacaddrBase<N>& a,
36 const MacaddrBase<N>& b)
noexcept {
37 return a.GetOctets() == b.GetOctets();
40 friend bool operator!=(
const MacaddrBase<N>& a,
41 const MacaddrBase<N>& b)
noexcept {
46 OctetsType macaddr_ = {0};
52using Macaddr = MacaddrBase<6>;
57using Macaddr8 = MacaddrBase<8>;