]> git.proxmox.com Git - qemu.git/blame - qemu_socket.h
pseries: Remove unused fields from VIOsPAPRBus structure
[qemu.git] / qemu_socket.h
CommitLineData
6ca957f0
FB
1/* headers to use the BSD sockets */
2#ifndef QEMU_SOCKET_H
3#define QEMU_SOCKET_H
4
5#ifdef _WIN32
6ca957f0
FB
6#include <windows.h>
7#include <winsock2.h>
8#include <ws2tcpip.h>
9
10#define socket_error() WSAGetLastError()
6cec29c4 11#undef EWOULDBLOCK
6ca957f0 12#undef EINTR
6cec29c4 13#undef EINPROGRESS
6ca957f0
FB
14#define EWOULDBLOCK WSAEWOULDBLOCK
15#define EINTR WSAEINTR
16#define EINPROGRESS WSAEINPROGRESS
17
03ff3ca3
AL
18int inet_aton(const char *cp, struct in_addr *ia);
19
6ca957f0
FB
20#else
21
80bb8cba 22#include <sys/types.h>
6ca957f0
FB
23#include <sys/socket.h>
24#include <netinet/in.h>
25#include <netinet/tcp.h>
03ff3ca3
AL
26#include <arpa/inet.h>
27#include <netdb.h>
ffd843bc 28#include <sys/un.h>
6ca957f0
FB
29
30#define socket_error() errno
31#define closesocket(s) close(s)
32
33#endif /* !_WIN32 */
34
2af2bf67
GH
35#include "qemu-option.h"
36
d247d25f 37/* misc helpers */
40ff6d7e
KW
38int qemu_socket(int domain, int type, int protocol);
39int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
128aa589 40int socket_set_cork(int fd, int v);
154b9a0c 41void socket_set_block(int fd);
6ca957f0 42void socket_set_nonblock(int fd);
d247d25f
AL
43int send_all(int fd, const void *buf, int len1);
44
45/* New, ipv6-ready socket helper functions, see qemu-sockets.c */
e5bc776f 46int inet_listen_opts(QemuOpts *opts, int port_offset);
d247d25f
AL
47int inet_listen(const char *str, char *ostr, int olen,
48 int socktype, int port_offset);
f4c94c7c 49int inet_connect_opts(QemuOpts *opts);
d247d25f 50int inet_connect(const char *str, int socktype);
7e1b35b4 51int inet_dgram_opts(QemuOpts *opts);
c9c4b34e 52const char *inet_strfamily(int family);
d247d25f 53
62b6adfb 54int unix_listen_opts(QemuOpts *opts);
d247d25f 55int unix_listen(const char *path, char *ostr, int olen);
2af2bf67 56int unix_connect_opts(QemuOpts *opts);
d247d25f
AL
57int unix_connect(const char *path);
58
59/* Old, ipv4 only bits. Don't use for new code. */
5bb7910a 60int parse_host_port(struct sockaddr_in *saddr, const char *str);
0706a4dc 61int socket_init(void);
6ca957f0
FB
62
63#endif /* QEMU_SOCKET_H */