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>
This commit is contained in:
Frediano Ziglio 2018-06-24 09:07:50 +01:00
parent 924f47a653
commit 3e6dedaa51
2 changed files with 10 additions and 4 deletions

View File

@ -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)
{

View File

@ -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);