summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Modules/socketmodule.h
diff options
context:
space:
mode:
authorAlexSm <[email protected]>2024-02-16 11:51:30 +0100
committerGitHub <[email protected]>2024-02-16 11:51:30 +0100
commit506ecaee93b52cc12c2e2f97c3d42e3ca2a7f59e (patch)
treed096fb9eb988fbb0ca1ba970041773207ce3aa70 /contrib/tools/python3/src/Modules/socketmodule.h
parent4749b9e5d260714490997e6f5ee1ee8c1c8fc46c (diff)
parentf200f72c9d7a89c1018e3dc6b46c49fe2ecf84fb (diff)
Merge pull request #1940 from dcherednik/importlib
Library import 14
Diffstat (limited to 'contrib/tools/python3/src/Modules/socketmodule.h')
-rw-r--r--contrib/tools/python3/src/Modules/socketmodule.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/contrib/tools/python3/src/Modules/socketmodule.h b/contrib/tools/python3/src/Modules/socketmodule.h
index 8df3fef1915..d55c02fd156 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
@@ -103,15 +112,15 @@ typedef int socklen_t;
#endif
#ifdef HAVE_BLUETOOTH_BLUETOOTH_H
-#include <bluetooth/bluetooth.h>
-#include <bluetooth/rfcomm.h>
-#include <bluetooth/l2cap.h>
-#include <bluetooth/sco.h>
-#include <bluetooth/hci.h>
+#error #include <bluetooth/bluetooth.h>
+#error #include <bluetooth/rfcomm.h>
+#error #include <bluetooth/l2cap.h>
+#error #include <bluetooth/sco.h>
+#error #include <bluetooth/hci.h>
#endif
#ifdef HAVE_BLUETOOTH_H
-#include <bluetooth.h>
+#error #include <bluetooth.h>
#endif
#ifdef HAVE_NET_IF_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 ----------------------------------------------------*/