linux-user/syscall.c: define _ATFILE_SOURCE
[qemu-kvm.git] / qemu_socket.h
blobfc5b5889b790c5dd60e7808089c97f69401cb0a6
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/socket.h>
21 #include <netinet/in.h>
22 #include <netinet/tcp.h>
23 #include <arpa/inet.h>
24 #include <netdb.h>
25 #include <sys/un.h>
27 #define socket_error() errno
28 #define closesocket(s) close(s)
30 #endif /* !_WIN32 */
32 /* misc helpers */
33 void socket_set_nonblock(int fd);
34 int send_all(int fd, const void *buf, int len1);
36 /* New, ipv6-ready socket helper functions, see qemu-sockets.c */
37 int inet_listen(const char *str, char *ostr, int olen,
38 int socktype, int port_offset);
39 int inet_connect(const char *str, int socktype);
41 int unix_listen(const char *path, char *ostr, int olen);
42 int unix_connect(const char *path);
44 /* Old, ipv4 only bits. Don't use for new code. */
45 int parse_host_port(struct sockaddr_in *saddr, const char *str);
46 int parse_host_src_port(struct sockaddr_in *haddr,
47 struct sockaddr_in *saddr,
48 const char *str);
50 #endif /* QEMU_SOCKET_H */