diff options
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/socket_types.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/socket_types.h b/src/common/socket_types.h index 0a801a443..b2191c2e8 100644 --- a/src/common/socket_types.h +++ b/src/common/socket_types.h | |||
| @@ -5,15 +5,19 @@ | |||
| 5 | 5 | ||
| 6 | #include "common/common_types.h" | 6 | #include "common/common_types.h" |
| 7 | 7 | ||
| 8 | #include <optional> | ||
| 9 | |||
| 8 | namespace Network { | 10 | namespace Network { |
| 9 | 11 | ||
| 10 | /// Address families | 12 | /// Address families |
| 11 | enum class Domain : u8 { | 13 | enum class Domain : u8 { |
| 12 | INET, ///< Address family for IPv4 | 14 | Unspecified, ///< Represents 0, used in getaddrinfo hints |
| 15 | INET, ///< Address family for IPv4 | ||
| 13 | }; | 16 | }; |
| 14 | 17 | ||
| 15 | /// Socket types | 18 | /// Socket types |
| 16 | enum class Type { | 19 | enum class Type { |
| 20 | Unspecified, ///< Represents 0, used in getaddrinfo hints | ||
| 17 | STREAM, | 21 | STREAM, |
| 18 | DGRAM, | 22 | DGRAM, |
| 19 | RAW, | 23 | RAW, |
| @@ -22,6 +26,7 @@ enum class Type { | |||
| 22 | 26 | ||
| 23 | /// Protocol values for sockets | 27 | /// Protocol values for sockets |
| 24 | enum class Protocol : u8 { | 28 | enum class Protocol : u8 { |
| 29 | Unspecified, ///< Represents 0, usable in various places | ||
| 25 | ICMP, | 30 | ICMP, |
| 26 | TCP, | 31 | TCP, |
| 27 | UDP, | 32 | UDP, |
| @@ -48,4 +53,13 @@ constexpr u32 FLAG_MSG_PEEK = 0x2; | |||
| 48 | constexpr u32 FLAG_MSG_DONTWAIT = 0x80; | 53 | constexpr u32 FLAG_MSG_DONTWAIT = 0x80; |
| 49 | constexpr u32 FLAG_O_NONBLOCK = 0x800; | 54 | constexpr u32 FLAG_O_NONBLOCK = 0x800; |
| 50 | 55 | ||
| 56 | /// Cross-platform addrinfo structure | ||
| 57 | struct AddrInfo { | ||
| 58 | Domain family; | ||
| 59 | Type socket_type; | ||
| 60 | Protocol protocol; | ||
| 61 | SockAddrIn addr; | ||
| 62 | std::optional<std::string> canon_name; | ||
| 63 | }; | ||
| 64 | |||
| 51 | } // namespace Network | 65 | } // namespace Network |