X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fcompat%2Fwindows%2Fwincompat.h;h=8f62240c68be2e3cc9f9c57bfc1b98f283d503a2;hb=4ac8d5e93bf09c86e8352cdc2099b35ec89ba3a9;hp=f76dbc4835a1012160d863060f2928dda145ce82;hpb=473963ea000bfe23a0d4754988223e4e6e2fb3f2;p=catta diff --git a/src/compat/windows/wincompat.h b/src/compat/windows/wincompat.h index f76dbc4..8f62240 100644 --- a/src/compat/windows/wincompat.h +++ b/src/compat/windows/wincompat.h @@ -16,6 +16,15 @@ #include +// wrappers around WSAStartup/WSACleanup to avoid clutter +void winsock_init(void); +void winsock_exit(void); + + +// the equivalent of strerror(errno) for Windows sockets +char *errnostrsocket(void); + + // Winsock doesn't have recvmsg/sendmsg but offers the same functionality // with WSARecvMsg/WSASendMsg, so we implement the former in terms of the // latter. @@ -77,6 +86,20 @@ ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags); #endif +// Windows doesn't have ioctl but offers ioctlsocket for some socket-related +// functions. Unfortunately, argument types differ, so we implement a +// (restricted) wrapper. +int ioctl(int d, unsigned long request, int *p); + + +// Windows lacks poll, but WSAPoll is good enough for us. +#define poll(fds, nfds, timeout) WSAPoll(fds, nfds, timeout) + +// Windows lacks pipe. It has an equivalent CreatePipe but we really need +// something to give to WSAPoll, so we fake it with a local TCP socket. (ugh) +int pipe(int pipefd[2]); + + // Windows logically doesn't have uname, so we supply a replacement. struct utsname {