原始 IPv4 地址 / Raw IPv4 address
More...
#include <net.hpp>
原始 IPv4 地址 / Raw IPv4 address
Definition at line 17 of file net.hpp.
◆ FromString()
| static IPAddressRaw LibXR::IPAddressRaw::FromString |
( |
const char * | str | ) |
|
|
inlinestatic |
Definition at line 21 of file net.hpp.
22 {
23 IPAddressRaw ip{};
24 std::sscanf(str, "%hhu.%hhu.%hhu.%hhu",
25 &ip.bytes[0], &ip.bytes[1], &ip.bytes[2], &ip.bytes[3]);
26 return ip;
27 }
◆ operator!=()
| bool LibXR::IPAddressRaw::operator!= |
( |
const IPAddressRaw & | other | ) |
const |
|
inline |
Definition at line 40 of file net.hpp.
41 {
42 return !(*this == other);
43 }
◆ operator==()
| bool LibXR::IPAddressRaw::operator== |
( |
const IPAddressRaw & | other | ) |
const |
|
inline |
Definition at line 35 of file net.hpp.
36 {
38 }
static int FastCmp(const void *a, const void *b, size_t size)
快速内存比较 / Fast memory comparison
◆ ToString()
| void LibXR::IPAddressRaw::ToString |
( |
char | out[IPADDR_STRLEN] | ) |
const |
|
inline |
Definition at line 29 of file net.hpp.
30 {
31 std::snprintf(out, IPADDR_STRLEN, "%u.%u.%u.%u",
32 bytes[0], bytes[1], bytes[2], bytes[3]);
33 }
◆ bytes
| uint8_t LibXR::IPAddressRaw::bytes[4] {} |
The documentation for this struct was generated from the following file: