原始 IPv4 地址 / Raw IPv4 address
More...
#include <net.hpp>
原始 IPv4 地址 / Raw IPv4 address
Definition at line 16 of file net.hpp.
◆ FromString()
static IPAddressRaw LibXR::IPAddressRaw::FromString |
( |
const char * | str | ) |
|
|
inlinestatic |
Definition at line 20 of file net.hpp.
21 {
22 IPAddressRaw ip{};
23 std::sscanf(str, "%hhu.%hhu.%hhu.%hhu",
24 &ip.bytes[0], &ip.bytes[1], &ip.bytes[2], &ip.bytes[3]);
25 return ip;
26 }
◆ operator!=()
bool LibXR::IPAddressRaw::operator!= |
( |
const IPAddressRaw & | other | ) |
const |
|
inline |
Definition at line 39 of file net.hpp.
40 {
41 return !(*this == other);
42 }
◆ operator==()
bool LibXR::IPAddressRaw::operator== |
( |
const IPAddressRaw & | other | ) |
const |
|
inline |
Definition at line 34 of file net.hpp.
35 {
36 return std::memcmp(bytes, other.bytes, 4) == 0;
37 }
◆ ToString()
void LibXR::IPAddressRaw::ToString |
( |
char | out[IPADDR_STRLEN] | ) |
const |
|
inline |
Definition at line 28 of file net.hpp.
29 {
30 std::snprintf(out, IPADDR_STRLEN, "%u.%u.%u.%u",
31 bytes[0], bytes[1], bytes[2], bytes[3]);
32 }
◆ bytes
uint8_t LibXR::IPAddressRaw::bytes[4] {} |
The documentation for this struct was generated from the following file: