#include "address.hpp" #include #include namespace utils::address { constexpr size_t MAC_ADDRESS_LENGTH = 6; std::string mac_bytes_to_string(const std::uint8_t address_bytes[MAC_ADDRESS_LENGTH]) { std::stringstream stream; // write the mac address as a string for (std::size_t i = 0; i < MAC_ADDRESS_LENGTH; i++) { // format the byte stream << std::hex << std::setw(2) << std::setfill('0') << static_cast(address_bytes[i]); // unless this is the last byte, add a separator if (i < MAC_ADDRESS_LENGTH - 1) stream << ":"; } return stream.str(); } }