]>
Commit | Line | Data |
---|---|---|
6ca957f0 FB |
1 | /* headers to use the BSD sockets */ |
2 | #ifndef QEMU_SOCKET_H | |
3 | #define QEMU_SOCKET_H | |
4 | ||
5 | #ifdef _WIN32 | |
4fddf62a | 6 | #define WIN32_LEAN_AND_MEAN |
6ca957f0 FB |
7 | #include <windows.h> |
8 | #include <winsock2.h> | |
9 | #include <ws2tcpip.h> | |
10 | ||
11 | #define socket_error() WSAGetLastError() | |
12 | #undef EINTR | |
13 | #define EWOULDBLOCK WSAEWOULDBLOCK | |
14 | #define EINTR WSAEINTR | |
15 | #define EINPROGRESS WSAEINPROGRESS | |
16 | ||
03ff3ca3 AL |
17 | int inet_aton(const char *cp, struct in_addr *ia); |
18 | ||
6ca957f0 FB |
19 | #else |
20 | ||
21 | #include <sys/socket.h> | |
22 | #include <netinet/in.h> | |
23 | #include <netinet/tcp.h> | |
03ff3ca3 AL |
24 | #include <arpa/inet.h> |
25 | #include <netdb.h> | |
ffd843bc | 26 | #include <sys/un.h> |
6ca957f0 FB |
27 | |
28 | #define socket_error() errno | |
29 | #define closesocket(s) close(s) | |
30 | ||
0e82f34d AL |
31 | int parse_unix_path(struct sockaddr_un *uaddr, const char *str); |
32 | ||
6ca957f0 FB |
33 | #endif /* !_WIN32 */ |
34 | ||
35 | void socket_set_nonblock(int fd); | |
5bb7910a | 36 | int parse_host_port(struct sockaddr_in *saddr, const char *str); |
0e82f34d AL |
37 | int parse_host_src_port(struct sockaddr_in *haddr, |
38 | struct sockaddr_in *saddr, | |
39 | const char *str); | |
40 | int send_all(int fd, const uint8_t *buf, int len1); | |
6ca957f0 FB |
41 | |
42 | #endif /* QEMU_SOCKET_H */ |