File:  [Qemu by Fabrice Bellard] / qemu / qemu_socket.h
Revision 1.1.1.6 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 17:35:09 2018 UTC (3 years, 6 months ago) by root
Branches: qemu, MAIN
CVS tags: qemu0125, qemu0124, qemu0123, qemu0122, qemu0121, qemu0120, HEAD
qemu 0.12.0

    1: /* headers to use the BSD sockets */
    2: #ifndef QEMU_SOCKET_H
    3: #define QEMU_SOCKET_H
    4: 
    5: #ifdef _WIN32
    6: #include <windows.h>
    7: #include <winsock2.h>
    8: #include <ws2tcpip.h>
    9: 
   10: #define socket_error() WSAGetLastError()
   11: #undef EINTR
   12: #define EWOULDBLOCK WSAEWOULDBLOCK
   13: #define EINTR       WSAEINTR
   14: #define EINPROGRESS WSAEINPROGRESS
   15: 
   16: int inet_aton(const char *cp, struct in_addr *ia);
   17: 
   18: #else
   19: 
   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>
   26: 
   27: #define socket_error() errno
   28: #define closesocket(s) close(s)
   29: 
   30: #endif /* !_WIN32 */
   31: 
   32: #include "qemu-option.h"
   33: 
   34: /* misc helpers */
   35: int qemu_socket(int domain, int type, int protocol);
   36: int qemu_accept(int s, struct sockaddr *addr, socklen_t *addrlen);
   37: void socket_set_nonblock(int fd);
   38: int send_all(int fd, const void *buf, int len1);
   39: 
   40: /* New, ipv6-ready socket helper functions, see qemu-sockets.c */
   41: int inet_listen_opts(QemuOpts *opts, int port_offset);
   42: int inet_listen(const char *str, char *ostr, int olen,
   43:                 int socktype, int port_offset);
   44: int inet_connect_opts(QemuOpts *opts);
   45: int inet_connect(const char *str, int socktype);
   46: int inet_dgram_opts(QemuOpts *opts);
   47: 
   48: int unix_listen_opts(QemuOpts *opts);
   49: int unix_listen(const char *path, char *ostr, int olen);
   50: int unix_connect_opts(QemuOpts *opts);
   51: int unix_connect(const char *path);
   52: 
   53: /* Old, ipv4 only bits.  Don't use for new code. */
   54: int parse_host_port(struct sockaddr_in *saddr, const char *str);
   55: int parse_host_src_port(struct sockaddr_in *haddr,
   56:                         struct sockaddr_in *saddr,
   57:                         const char *str);
   58: 
   59: #endif /* QEMU_SOCKET_H */

unix.superglobalmegacorp.com