原始 MAC 地址 / Raw MAC address
More...
#include <net.hpp>
原始 MAC 地址 / Raw MAC address
Definition at line 68 of file net.hpp.
◆ FromString()
static MACAddressRaw LibXR::MACAddressRaw::FromString |
( |
const char * | str | ) |
|
|
inlinestatic |
Definition at line 72 of file net.hpp.
73 {
74 MACAddressRaw mac{};
75 std::sscanf(str, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
76 &mac.bytes[0], &mac.bytes[1], &mac.bytes[2],
77 &mac.bytes[3], &mac.bytes[4], &mac.bytes[5]);
78 return mac;
79 }
◆ operator!=()
bool LibXR::MACAddressRaw::operator!= |
( |
const MACAddressRaw & | other | ) |
const |
|
inline |
Definition at line 93 of file net.hpp.
94 {
95 return !(*this == other);
96 }
◆ operator==()
bool LibXR::MACAddressRaw::operator== |
( |
const MACAddressRaw & | other | ) |
const |
|
inline |
Definition at line 88 of file net.hpp.
89 {
90 return std::memcmp(bytes, other.bytes, 6) == 0;
91 }
◆ ToString()
void LibXR::MACAddressRaw::ToString |
( |
char | out[MACADDR_STRLEN] | ) |
const |
|
inline |
Definition at line 81 of file net.hpp.
82 {
83 std::snprintf(out, MACADDR_STRLEN, "%02X:%02X:%02X:%02X:%02X:%02X",
84 bytes[0], bytes[1], bytes[2],
85 bytes[3], bytes[4], bytes[5]);
86 }
◆ bytes
uint8_t LibXR::MACAddressRaw::bytes[6] {} |
The documentation for this struct was generated from the following file: