summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2018-06-24 09:07:50 +0100
committerFrediano Ziglio <fziglio@redhat.com>2019-01-08 13:05:20 +0000
commit3e6dedaa51b3e19070b099d951962b6cb4571ff7 (patch)
tree5f574dad9521ca1c3f32ed826ec27dff1cefc20c
parent924f47a653bd87fbd50229ee34b58d7b9a3f1ec8 (diff)
marshaller: Provide spice_marshaller_fill_iovec for Windows
An array of WSABUF can be used with WSASend. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Christophe Fergeau <cfergeau@redhat.com>
-rw-r--r--common/marshaller.c10
-rw-r--r--common/marshaller.h4
2 files changed, 10 insertions, 4 deletions
diff --git a/common/marshaller.c b/common/marshaller.c
index 0b45523..4379aa6 100644
--- a/common/marshaller.c
+++ b/common/marshaller.c
@@ -549,7 +549,14 @@ void spice_marshaller_flush(SpiceMarshaller *m)
}
}
-#ifndef WIN32
+#ifdef WIN32
+// this definition is ABI compatible with WSABUF
+struct iovec {
+ unsigned long iov_len;
+ void *iov_base;
+};
+#endif
+
int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
int n_vec, size_t skip_bytes)
{
@@ -581,7 +588,6 @@ int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
return v;
}
-#endif
void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v)
{
diff --git a/common/marshaller.h b/common/marshaller.h
index 2aeeea1..041d16e 100644
--- a/common/marshaller.h
+++ b/common/marshaller.h
@@ -25,6 +25,8 @@
#include "mem.h"
#ifndef WIN32
#include <sys/uio.h>
+#else
+struct iovec;
#endif
SPICE_BEGIN_DECLS
@@ -52,10 +54,8 @@ size_t spice_marshaller_get_size(SpiceMarshaller *m);
size_t spice_marshaller_get_total_size(SpiceMarshaller *m);
SpiceMarshaller *spice_marshaller_get_submarshaller(SpiceMarshaller *m);
SpiceMarshaller *spice_marshaller_get_ptr_submarshaller(SpiceMarshaller *m, int is_64bit);
-#ifndef WIN32
int spice_marshaller_fill_iovec(SpiceMarshaller *m, struct iovec *vec,
int n_vec, size_t skip_bytes);
-#endif
void *spice_marshaller_add_uint64(SpiceMarshaller *m, uint64_t v);
void *spice_marshaller_add_int64(SpiceMarshaller *m, int64_t v);
void *spice_marshaller_add_uint32(SpiceMarshaller *m, uint32_t v);