summaryrefslogtreecommitdiff
path: root/librabbitmq/windows/socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'librabbitmq/windows/socket.c')
-rw-r--r--librabbitmq/windows/socket.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/librabbitmq/windows/socket.c b/librabbitmq/windows/socket.c
index 72ad200..43b919b 100644
--- a/librabbitmq/windows/socket.c
+++ b/librabbitmq/windows/socket.c
@@ -37,13 +37,11 @@
#include "config.h"
#endif
-#include <windows.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "amqp.h"
#include "amqp_private.h"
#include "socket.h"
+#include <stdint.h>
+#include <stdlib.h>
+#include <windows.h>
static int called_wsastartup;
@@ -76,3 +74,28 @@ char *amqp_os_error_string(int err)
LocalFree(msg);
return copy;
}
+
+int
+amqp_socket_setsockopt(int sock, int level, int optname,
+ const void *optval, size_t optlen)
+{
+ /* the winsock setsockopt function has its 4th argument as a
+ const char * */
+ return setsockopt(sock, level, optname, (const char *)optval, optlen);
+}
+
+int
+amqp_socket_writev(int sock, struct iovec *iov, int nvecs)
+{
+ DWORD ret;
+ if (WSASend(sock, (LPWSABUF)iov, nvecs, &ret, 0, NULL, NULL) == 0)
+ return ret;
+ else
+ return -1;
+}
+
+int
+amqp_socket_error(void)
+{
+ return WSAGetLastError() | ERROR_CATEGORY_OS;
+}