30 #include <boost/functional/hash.hpp>
44 Address::Address(uint8_t a1, uint8_t a2, uint8_t a3, uint8_t a4, uint8_t a5, uint8_t a6)
56 std::copy(octets, octets + size(), begin());
68 return (at(0) & 1) != 0;
85 snprintf(s,
sizeof(s),
"%02x%c%02x%c%02x%c%02x%c%02x%c%02x",
86 at(0), sep, at(1), sep, at(2), sep, at(3), sep, at(4), sep, at(5));
88 return std::string(s);
95 unsigned short temp[a.size()];
100 int ret = std::sscanf(str.c_str(),
"%2hx%1[:-]%2hx%1[:-]%2hx%1[:-]%2hx%1[:-]%2hx%1[:-]%2hx%n",
101 &temp[0], &sep[0][0], &temp[1], &sep[1][0], &temp[2], &sep[2][0],
102 &temp[3], &sep[3][0], &temp[4], &sep[4][0], &temp[5], &n);
104 if (ret < 11 ||
static_cast<size_t>(n) != str.length())
107 for (
size_t i = 0; i < a.size(); ++i) {
109 if (i < 5 && sep[i][0] != sep[0][0])
116 a[i] =
static_cast<uint8_t
>(temp[i]);
125 return { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
131 return { 0x01, 0x00, 0x5E, 0x00, 0x17, 0xAA };
146 return boost::hash_range(a.cbegin(), a.cend());