diff options
Diffstat (limited to '')
-rw-r--r-- | src/common/socket_types.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/common/socket_types.h b/src/common/socket_types.h index 0a801a443..63824a5c4 100644 --- a/src/common/socket_types.h +++ b/src/common/socket_types.h @@ -3,17 +3,22 @@ #pragma once +#include <optional> +#include <string> + #include "common/common_types.h" namespace Network { /// Address families enum class Domain : u8 { - INET, ///< Address family for IPv4 + Unspecified, ///< Represents 0, used in getaddrinfo hints + INET, ///< Address family for IPv4 }; /// Socket types enum class Type { + Unspecified, ///< Represents 0, used in getaddrinfo hints STREAM, DGRAM, RAW, @@ -22,6 +27,7 @@ enum class Type { /// Protocol values for sockets enum class Protocol : u8 { + Unspecified, ///< Represents 0, usable in various places ICMP, TCP, UDP, @@ -48,4 +54,13 @@ constexpr u32 FLAG_MSG_PEEK = 0x2; constexpr u32 FLAG_MSG_DONTWAIT = 0x80; constexpr u32 FLAG_O_NONBLOCK = 0x800; +/// Cross-platform addrinfo structure +struct AddrInfo { + Domain family; + Type socket_type; + Protocol protocol; + SockAddrIn addr; + std::optional<std::string> canon_name; +}; + } // namespace Network |