aboutsummaryrefslogtreecommitdiff
path: root/qemu_socket.h
diff options
context:
space:
mode:
Diffstat (limited to 'qemu_socket.h')
-rw-r--r--qemu_socket.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/qemu_socket.h b/qemu_socket.h
new file mode 100644
index 0000000000..64b7d4e5ef
--- /dev/null
+++ b/qemu_socket.h
@@ -0,0 +1,30 @@
+/* headers to use the BSD sockets */
+#ifndef QEMU_SOCKET_H
+#define QEMU_SOCKET_H
+
+#ifdef _WIN32
+
+#include <windows.h>
+#include <winsock2.h>
+#include <ws2tcpip.h>
+
+#define socket_error() WSAGetLastError()
+#undef EINTR
+#define EWOULDBLOCK WSAEWOULDBLOCK
+#define EINTR WSAEINTR
+#define EINPROGRESS WSAEINPROGRESS
+
+#else
+
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+
+#define socket_error() errno
+#define closesocket(s) close(s)
+
+#endif /* !_WIN32 */
+
+void socket_set_nonblock(int fd);
+
+#endif /* QEMU_SOCKET_H */