aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/utils/windows.h
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2014-11-06 12:11:25 +0100
committerMartin Willi <martin@revosec.ch>2014-11-21 11:16:48 +0100
commitfc829ec9fb2f29c4415c5c0b054139a2f47231b0 (patch)
tree860e589e036639964ac88ebe9e00de6ddf7bc52d /src/libstrongswan/utils/windows.h
parente796b88e86a719c03d551318dda359b373496ce5 (diff)
downloadstrongswan-fc829ec9fb2f29c4415c5c0b054139a2f47231b0.tar.bz2
strongswan-fc829ec9fb2f29c4415c5c0b054139a2f47231b0.tar.xz
windows: Provide a poll(2) wrapper calling WSAPoll()
Diffstat (limited to 'src/libstrongswan/utils/windows.h')
-rw-r--r--src/libstrongswan/utils/windows.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/libstrongswan/utils/windows.h b/src/libstrongswan/utils/windows.h
index 3761e10ab..80106ecdb 100644
--- a/src/libstrongswan/utils/windows.h
+++ b/src/libstrongswan/utils/windows.h
@@ -362,6 +362,34 @@ ssize_t windows_send(int sockfd, const void *buf, size_t len, int flags);
ssize_t windows_sendto(int sockfd, const void *buf, size_t len, int flags,
const struct sockaddr *dest_addr, socklen_t addrlen);
+#if _WIN32_WINNT < 0x0600
+/**
+ * Define pollfd and flags on our own if not specified
+ */
+struct pollfd {
+ SOCKET fd;
+ short events;
+ short revents;
+};
+enum {
+ POLLERR = 0x0001,
+ POLLHUP = 0x0002,
+ POLLNVAL = 0x0004,
+ POLLWRNORM = 0x0010,
+ POLLWRBAND = 0x0020,
+ POLLPRI = 0x0400,
+ POLLRDNORM = 0x0100,
+ POLLRDBAND = 0x0200,
+ POLLIN = POLLRDNORM | POLLRDBAND,
+ POLLOUT = POLLWRNORM,
+};
+#endif /* _WIN32_WINNT < 0x0600 */
+
+/**
+ * poll(2), implemented using Winsock2 WSAPoll()
+ */
+int poll(struct pollfd *fds, int nfds, int timeout);
+
/**
* Declaration missing on older WinGW
*/