summaryrefslogtreecommitdiff
path: root/src/win32/socket.h
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2011-11-08 17:29:16 -0500
committerAdam <Adam@anope.org>2011-11-08 17:29:16 -0500
commitb5ff856f47d8e54d12c568462a06351633c29610 (patch)
treea4e2f96c59ee49aa5e6cacdfd30db6155151ad36 /src/win32/socket.h
parent97b9055f92f21cd91af44a3d5dacce0024536cff (diff)
Windows
Diffstat (limited to 'src/win32/socket.h')
-rw-r--r--src/win32/socket.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/win32/socket.h b/src/win32/socket.h
new file mode 100644
index 000000000..106b9310e
--- /dev/null
+++ b/src/win32/socket.h
@@ -0,0 +1,32 @@
+ /* POSIX emulation layer for Windows.
+ *
+ * Copyright (C) 2008-2011 Anope Team <team@anope.org>
+ *
+ * Please read COPYING and README for further details.
+ */
+
+#define read read_not_used
+#define write write_not_used
+#include <io.h>
+#undef read
+#undef write
+
+#define F_GETFL 0
+#define F_SETFL 1
+
+#define O_NONBLOCK 1
+
+extern CoreExport int read(int fd, char *buf, size_t count);
+extern CoreExport int write(int fd, const char *buf, size_t count);
+extern CoreExport int windows_close(int fd);
+extern CoreExport int windows_accept(int fd, struct sockaddr *addr, int *addrlen);
+extern CoreExport int windows_inet_pton(int af, const char *src, void *dst);
+extern CoreExport const char *windows_inet_ntop(int af, const void *src, char *dst, size_t size);
+extern CoreExport int fcntl(int fd, int cmd, int arg);
+
+#ifndef WIN32_NO_OVERRIDE
+# define close windows_close
+# define accept windows_accept
+# define inet_pton windows_inet_pton
+# define inet_ntop windows_inet_ntop
+#endif