|
uint16_t | port |
|
uint8_t | type {0} |
|
union { |
uint8_t | v4 [4] |
|
uint8_t | v6 [16] |
|
}; | |
|
Definition at line 2334 of file C4NetIO.cpp.
◆ BinAddr() [1/2]
C4NetIOUDP::BinAddr::BinAddr |
( |
| ) |
|
|
default |
◆ BinAddr() [2/2]
Definition at line 2337 of file C4NetIO.cpp.
2344 auto addr4 =
static_cast<const sockaddr_in*
>(&addr);
2345 static_assert(
sizeof(v4) ==
sizeof(addr4->sin_addr),
"unexpected IPv4 address size");
2346 memcpy(&v4, &addr4->sin_addr,
sizeof(v4));
2352 auto addr6 =
static_cast<const sockaddr_in6*
>(&addr);
2353 static_assert(
sizeof(v6) ==
sizeof(addr6->sin6_addr),
"unexpected IPv6 address size");
2354 memcpy(&v6, &addr6->sin6_addr,
sizeof(v6));
2358 assert(!
"Unexpected address family");
AddressFamily GetFamily() const
References C4NetIO::HostAddress::GetFamily(), C4NetIO::EndpointAddress::GetPort(), C4NetIO::HostAddress::IPv4, C4NetIO::HostAddress::IPv6, port, and type.
◆ operator C4NetIO::addr_t()
Definition at line 2363 of file C4NetIO.cpp.
2370 sockaddr_in addr4 = sockaddr_in();
2371 addr4.sin_family = AF_INET;
2372 memcpy(&addr4.sin_addr, &v4,
sizeof(v4));
2373 result.
SetAddress(
reinterpret_cast<sockaddr*
>(&addr4));
2378 sockaddr_in6 addr6 = sockaddr_in6();
2379 addr6.sin6_family = AF_INET6;
2380 memcpy(&addr6.sin6_addr, &v6,
sizeof(v6));
2381 result.
SetAddress(
reinterpret_cast<sockaddr*
>(&addr6));
2385 assert(!
"Invalid address type");
void SetAddress(const sockaddr *addr)
void SetPort(uint16_t port)
References port, C4NetIO::EndpointAddress::SetAddress(), C4NetIO::EndpointAddress::SetPort(), and type.
◆ ToString()
StdStrBuf C4NetIOUDP::BinAddr::ToString |
( |
| ) |
const |
|
inline |
◆ port
uint16_t C4NetIOUDP::BinAddr::port |
◆ type
uint8_t C4NetIOUDP::BinAddr::type {0} |
The documentation for this struct was generated from the following file: