diff -urN libssh2-0.18.orig/configure.in libssh2-0.18.mingw/configure.in --- libssh2-0.18.orig/configure.in 2007-07-31 10:55:29.000000000 +0100 +++ libssh2-0.18.mingw/configure.in 2008-11-10 14:12:07.000000000 +0000 @@ -249,6 +250,7 @@ AC_CHECK_HEADERS([errno.h fcntl.h stdio.h stdlib.h unistd.h sys/uio.h]) AC_CHECK_HEADERS([sys/select.h sys/socket.h sys/ioctl.h sys/time.h]) AC_CHECK_HEADERS([arpa/inet.h netinet/in.h]) +AC_CHECK_HEADERS([windows.h ws2tcpip.h winsock2.h]) AC_CHECK_FUNCS(poll gettimeofday select) AC_FUNC_ALLOCA diff -urN libssh2-0.18.orig/src/libssh2_priv.h libssh2-0.18.mingw/src/libssh2_priv.h --- libssh2-0.18.orig/src/libssh2_priv.h 2007-08-10 23:30:30.000000000 +0100 +++ libssh2-0.18.mingw/src/libssh2_priv.h 2008-11-10 13:57:49.000000000 +0000 @@ -41,6 +41,14 @@ #define LIBSSH2_LIBRARY #include "libssh2_config.h" +#ifdef HAVE_WINDOWS_H +#include +#endif + +#ifdef HAVE_WS2TCPIP_H +#include +#endif + /* The following CPP block should really only be in session.c and packet.c. However, AIX have #define's for 'events' and 'revents' and we are using those names in libssh2.h, so we need to include @@ -70,6 +78,28 @@ #include "libssh2_publickey.h" #include "libssh2_sftp.h" +/* Provide iovec / writev on WIN32 platform. */ +#ifdef WIN32 + +/* same as WSABUF */ +struct iovec { + u_long iov_len; + char *iov_base; +}; + +#define inline __inline + +static inline int writev(int sock, struct iovec *iov, int nvecs) +{ + DWORD ret; + if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0) { + return ret; + } + return -1; +} + +#endif /* WIN32 */ + /* Needed for struct iovec on some platforms */ #ifdef HAVE_SYS_UIO_H #include