qemu-img: add dirty flag status
[qemu/ar7.git] / qemu_socket.h
blobfe4cf6ca61b02c04c5c6f9ed10d7808bce6e06e3
1 /* headers to use the BSD sockets */
2 #ifndef QEMU_SOCKET_H
3 #define QEMU_SOCKET_H
5 #ifdef _WIN32
6 #include <windows.h>
7 #include <winsock2.h>
8 #include <ws2tcpip.h>
10 #define socket_error() WSAGetLastError()
11 #undef EINTR
12 #define EWOULDBLOCK WSAEWOULDBLOCK
13 #define EINTR WSAEINTR
14 #define EINPROGRESS WSAEINPROGRESS
16 int inet_aton(const char *cp, struct in_addr *ia);
18 #else
20 #include <sys/types.h>
21 #include <sys/socket.h>
22 #include <netinet/in.h>
23 #include <netinet/tcp.h>
24 #include <arpa/inet.h>
25 #include <netdb.h>
26 #include <sys/un.h>
28 #define socket_error() errno
29 #define closesocket(s) close(s)
31 #endif /* !_WIN32 */
33 #include "qemu-option.h"
35 /* misc helpers */
36 int qemu_socket(int domain, int type, int protocol);
37 int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
38 int socket_set_cork(int fd, int v);
39 void socket_set_block(int fd);
40 void socket_set_nonblock(int fd);
41 int send_all(int fd, const void *buf, int len1);
43 /* New, ipv6-ready socket helper functions, see qemu-sockets.c */
44 int inet_listen_opts(QemuOpts *opts, int port_offset);
45 int inet_listen(const char *str, char *ostr, int olen,
46 int socktype, int port_offset);
47 int inet_connect_opts(QemuOpts *opts);
48 int inet_connect(const char *str, int socktype);
49 int inet_dgram_opts(QemuOpts *opts);
50 const char *inet_strfamily(int family);
52 int unix_listen_opts(QemuOpts *opts);
53 int unix_listen(const char *path, char *ostr, int olen);
54 int unix_connect_opts(QemuOpts *opts);
55 int unix_connect(const char *path);
57 /* Old, ipv4 only bits. Don't use for new code. */
58 int parse_host_port(struct sockaddr_in *saddr, const char *str);
59 int socket_init(void);
61 #endif /* QEMU_SOCKET_H */