summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Modules/socketmodule.h
diff options
context:
space:
mode:
authorshadchin <[email protected]>2024-02-12 07:53:52 +0300
committerDaniil Cherednik <[email protected]>2024-02-14 14:26:16 +0000
commit31f2a419764a8ba77c2a970cfc80056c6cd06756 (patch)
treec1995d239eba8571cefc640f6648e1d5dd4ce9e2 /contrib/tools/python3/src/Modules/socketmodule.h
parentfe2ef02b38d9c85d80060963b265a1df9f38c3bb (diff)
Update Python from 3.11.8 to 3.12.2
Diffstat (limited to 'contrib/tools/python3/src/Modules/socketmodule.h')
-rw-r--r--contrib/tools/python3/src/Modules/socketmodule.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/contrib/tools/python3/src/Modules/socketmodule.h b/contrib/tools/python3/src/Modules/socketmodule.h
index 8df3fef1915..7d4d7d32e9b 100644
--- a/contrib/tools/python3/src/Modules/socketmodule.h
+++ b/contrib/tools/python3/src/Modules/socketmodule.h
@@ -76,6 +76,15 @@ struct SOCKADDR_BTH_REDEF {
# else
typedef int socklen_t;
# endif /* IPPROTO_IPV6 */
+
+/* Remove ifdef once Py_WINVER >= 0x0604
+ * socket.h only defines AF_HYPERV if _WIN32_WINNT is at that level or higher
+ * so for now it's just manually defined.
+ */
+# ifndef AF_HYPERV
+# define AF_HYPERV 34
+# endif
+# include <hvsocket.h>
#endif /* MS_WINDOWS */
#ifdef HAVE_SYS_UN_H
@@ -240,6 +249,11 @@ typedef int SOCKET_T;
#define PyLong_AsSocket_t(fd) (SOCKET_T)PyLong_AsLongLong(fd)
#endif
+// AF_HYPERV is only supported on Windows
+#if defined(AF_HYPERV) && defined(MS_WINDOWS)
+# define HAVE_AF_HYPERV
+#endif
+
/* Socket address */
typedef union sock_addr {
struct sockaddr_in in;
@@ -288,6 +302,9 @@ typedef union sock_addr {
#ifdef HAVE_LINUX_TIPC_H
struct sockaddr_tipc tipc;
#endif
+#ifdef HAVE_AF_HYPERV
+ SOCKADDR_HV hv;
+#endif
} sock_addr_t;
/* The object holding a socket. It holds some extra information,
@@ -305,6 +322,7 @@ typedef struct {
sets a Python exception */
_PyTime_t sock_timeout; /* Operation timeout in seconds;
0.0 means non-blocking */
+ struct _socket_state *state;
} PySocketSockObject;
/* --- C API ----------------------------------------------------*/