#include <iostream>
#include <sstream>
+#include <boost/algorithm/string.hpp>
+
#include "vom/types.hpp"
namespace VOM {
std::copy(i.begin(), i.end(), std::begin(bytes));
}
+mac_address_t::mac_address_t(const std::string& str)
+{
+ std::vector<std::string> parts;
+
+ boost::split(parts, str, boost::is_any_of(":"));
+
+ size_t n_bytes = std::min(bytes.size(), parts.size());
+
+ for (uint32_t ii = 0; ii < n_bytes; ii++) {
+ bytes[ii] = std::stoul(parts[ii], nullptr, 16);
+ }
+}
+
const mac_address_t mac_address_t::ONE({ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff });
const mac_address_t mac_address_t::ZERO({ 0x0 });
s.fill('0');
s << std::hex;
- s << "mac:[";
for (auto byte : bytes) {
if (first)
first = false;
s << ":";
s << std::setw(2) << static_cast<unsigned int>(byte);
}
- s << "]";
return (s.str());
}