1 /* headers to use the BSD sockets */
10 #define socket_error() WSAGetLastError()
14 #define EWOULDBLOCK WSAEWOULDBLOCK
15 #define EINTR WSAEINTR
16 #define EINPROGRESS WSAEINPROGRESS
18 int inet_aton(const char *cp
, struct in_addr
*ia
);
22 #include <sys/types.h>
23 #include <sys/socket.h>
24 #include <netinet/in.h>
25 #include <netinet/tcp.h>
26 #include <arpa/inet.h>
30 #define socket_error() errno
31 #define closesocket(s) close(s)
35 #include "qemu-option.h"
38 int qemu_socket(int domain
, int type
, int protocol
);
39 int qemu_accept(int s
, struct sockaddr
*addr
, socklen_t
*addrlen
);
40 int socket_set_cork(int fd
, int v
);
41 void socket_set_block(int fd
);
42 void socket_set_nonblock(int fd
);
43 int send_all(int fd
, const void *buf
, int len1
);
45 /* New, ipv6-ready socket helper functions, see qemu-sockets.c */
46 int inet_listen_opts(QemuOpts
*opts
, int port_offset
);
47 int inet_listen(const char *str
, char *ostr
, int olen
,
48 int socktype
, int port_offset
);
49 int inet_connect_opts(QemuOpts
*opts
);
50 int inet_connect(const char *str
, int socktype
);
51 int inet_dgram_opts(QemuOpts
*opts
);
52 const char *inet_strfamily(int family
);
54 int unix_listen_opts(QemuOpts
*opts
);
55 int unix_listen(const char *path
, char *ostr
, int olen
);
56 int unix_connect_opts(QemuOpts
*opts
);
57 int unix_connect(const char *path
);
59 /* Old, ipv4 only bits. Don't use for new code. */
60 int parse_host_port(struct sockaddr_in
*saddr
, const char *str
);
61 int socket_init(void);
63 #endif /* QEMU_SOCKET_H */