aboutsummaryrefslogtreecommitdiff
path: root/slirp/util.h
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2019-02-12 17:09:53 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2019-02-12 20:49:13 +0100
commitadf1add2927c7bb652a168f5be627102921cf35f (patch)
tree76a74e00a5185e204cbbf0b8a552a8f553867e08 /slirp/util.h
parentfdbfba8cbf04b587f9bab11b8e6a87afc38556e5 (diff)
slirp: wrap the remaining socket functions
QEMU wraps the socket functions in os-win32.h, but in commit a9d8b3ec4385793815d71217857304, the header inclusion was dropped, breaking libslirp on Windows. Wrap the missing functions. Rename the wrapped function with "slirp_" prefix and "_wrap" suffix, for consistency and to avoid a clash with existing function (such as "slirp_socket"). Fixes: a9d8b3ec ("slirp: replace remaining qemu headers dependency") Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Message-Id: <20190212160953.29051-3-marcandre.lureau@redhat.com> Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Tested-by: Howard Spoelstra
Diffstat (limited to 'slirp/util.h')
-rw-r--r--slirp/util.h56
1 files changed, 47 insertions, 9 deletions
diff --git a/slirp/util.h b/slirp/util.h
index 685b5af099..c4207a49d6 100644
--- a/slirp/util.h
+++ b/slirp/util.h
@@ -83,23 +83,61 @@ struct iovec {
/* FIXME: remove me when made standalone */
#ifdef _WIN32
+#undef accept
+#undef bind
#undef closesocket
+#undef connect
+#undef getpeername
+#undef getsockname
#undef getsockopt
#undef ioctlsocket
+#undef listen
#undef recv
+#undef recvfrom
+#undef send
+#undef sendto
#undef setsockopt
+#undef shutdown
+#undef socket
#endif
#ifdef _WIN32
-#define closesocket slirp_closesocket
-int slirp_closesocket(int fd);
-#define ioctlsocket slirp_ioctlsocket
-int slirp_ioctlsocket(int fd, int req, void *val);
-#define getsockopt(sockfd, level, optname, optval, optlen) \
- getsockopt(sockfd, level, optname, (void *)optval, optlen)
-#define setsockopt(sockfd, level, optname, optval, optlen) \
- setsockopt(sockfd, level, optname, (const void *)optval, optlen)
-#define recv(sockfd, buf, len, flags) recv(sockfd, (void *)buf, len, flags)
+#define connect slirp_connect_wrap
+int slirp_connect_wrap(int fd, const struct sockaddr *addr, int addrlen);
+#define listen slirp_listen_wrap
+int slirp_listen_wrap(int fd, int backlog);
+#define bind slirp_bind_wrap
+int slirp_bind_wrap(int fd, const struct sockaddr *addr, int addrlen);
+#define socket slirp_socket_wrap
+int slirp_socket_wrap(int domain, int type, int protocol);
+#define accept slirp_accept_wrap
+int slirp_accept_wrap(int fd, struct sockaddr *addr, int *addrlen);
+#define shutdown slirp_shutdown_wrap
+int slirp_shutdown_wrap(int fd, int how);
+#define getpeername slirp_getpeername_wrap
+int slirp_getpeername_wrap(int fd, struct sockaddr *addr, int *addrlen);
+#define getsockname slirp_getsockname_wrap
+int slirp_getsockname_wrap(int fd, struct sockaddr *addr, int *addrlen);
+#define send slirp_send_wrap
+ssize_t slirp_send_wrap(int fd, const void *buf, size_t len, int flags);
+#define sendto slirp_sendto_wrap
+ssize_t slirp_sendto_wrap(int fd, const void *buf, size_t len, int flags,
+ const struct sockaddr *dest_addr, int addrlen);
+#define recv slirp_recv_wrap
+ssize_t slirp_recv_wrap(int fd, void *buf, size_t len, int flags);
+#define recvfrom slirp_recvfrom_wrap
+ssize_t slirp_recvfrom_wrap(int fd, void *buf, size_t len, int flags,
+ struct sockaddr *src_addr, int *addrlen);
+#define closesocket slirp_closesocket_wrap
+int slirp_closesocket_wrap(int fd);
+#define ioctlsocket slirp_ioctlsocket_wrap
+int slirp_ioctlsocket_wrap(int fd, int req, void *val);
+#define getsockopt slirp_getsockopt_wrap
+int slirp_getsockopt_wrap(int sockfd, int level, int optname,
+ void *optval, int *optlen);
+#define setsockopt slirp_setsockopt_wrap
+int slirp_setsockopt_wrap(int sockfd, int level, int optname,
+ const void *optval, int optlen);
int inet_aton(const char *cp, struct in_addr *ia);
#else