summaryrefslogtreecommitdiffstats
path: root/src/common/socket_types.h
diff options
context:
space:
mode:
authorFearlessTobi <thm.frey@gmail.com>2022-07-30 05:58:23 +0200
committerFearlessTobi <thm.frey@gmail.com>2022-08-15 20:25:42 +0200
commitf80c7c4cd5c090b9a31f89a0eb3d86cbe928c50b (patch)
treead359908ba2d3cd003082b39cc7217b61e5b18f6 /src/common/socket_types.h
parentweb_service: Correct jwt issuer string (diff)
downloadyuzu-f80c7c4cd5c090b9a31f89a0eb3d86cbe928c50b.tar
yuzu-f80c7c4cd5c090b9a31f89a0eb3d86cbe928c50b.tar.gz
yuzu-f80c7c4cd5c090b9a31f89a0eb3d86cbe928c50b.tar.bz2
yuzu-f80c7c4cd5c090b9a31f89a0eb3d86cbe928c50b.tar.lz
yuzu-f80c7c4cd5c090b9a31f89a0eb3d86cbe928c50b.tar.xz
yuzu-f80c7c4cd5c090b9a31f89a0eb3d86cbe928c50b.tar.zst
yuzu-f80c7c4cd5c090b9a31f89a0eb3d86cbe928c50b.zip
Diffstat (limited to '')
-rw-r--r--src/common/socket_types.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/common/socket_types.h b/src/common/socket_types.h
new file mode 100644
index 000000000..5bb309a44
--- /dev/null
+++ b/src/common/socket_types.h
@@ -0,0 +1,52 @@
+// Copyright 2022 yuzu emulator team
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "common/common_types.h"
+
+namespace Network {
+
+/// Address families
+enum class Domain : u8 {
+ INET, ///< Address family for IPv4
+};
+
+/// Socket types
+enum class Type {
+ STREAM,
+ DGRAM,
+ RAW,
+ SEQPACKET,
+};
+
+/// Protocol values for sockets
+enum class Protocol : u8 {
+ ICMP,
+ TCP,
+ UDP,
+};
+
+/// Shutdown mode
+enum class ShutdownHow {
+ RD,
+ WR,
+ RDWR,
+};
+
+/// Array of IPv4 address
+using IPv4Address = std::array<u8, 4>;
+
+/// Cross-platform sockaddr structure
+struct SockAddrIn {
+ Domain family;
+ IPv4Address ip;
+ u16 portno;
+};
+
+constexpr u32 FLAG_MSG_PEEK = 0x2;
+constexpr u32 FLAG_MSG_DONTWAIT = 0x80;
+constexpr u32 FLAG_O_NONBLOCK = 0x800;
+
+} // namespace Network