XMMS2
src/include/xmmsc/xmmsc_sockets.h
Go to the documentation of this file.
00001 #ifndef XMMSC_SOCKETS_H
00002 #define XMMSC_SOCKETS_H
00003 
00004 #include <xmmsc/xmmsc_stdbool.h>
00005 
00006 /* Windows */
00007 #ifdef HAVE_WINSOCK2
00008 #include <winsock2.h>
00009 #include <ws2tcpip.h>
00010 typedef SOCKET xmms_socket_t;
00011 typedef int socklen_t;
00012 #define XMMS_EINTR WSAEINTR
00013 #define XMMS_EAGAIN WSAEWOULDBLOCK
00014 #define XMMS_EINPROGRESS WSAEINPROGRESS
00015 /* UNIX */
00016 #else
00017 #define SOCKET_ERROR (-1)
00018 #define XMMS_EINTR EINTR
00019 #define XMMS_EINPROGRESS EINPROGRESS
00020 #ifdef __hpux
00021 /* on HP-UX EAGAIN != EWOULDBLOCK */
00022 #define XMMS_EAGAIN EAGAIN
00023 #else
00024 #define XMMS_EAGAIN EWOULDBLOCK
00025 #endif
00026 #include <sys/types.h>
00027 #include <sys/socket.h>
00028 #include <sys/select.h>
00029 #include <sys/time.h>
00030 #include <netinet/in.h>
00031 #include <netinet/tcp.h>
00032 #include <arpa/inet.h>
00033 #include <netdb.h>
00034 #include <fcntl.h>
00035 #include <unistd.h>
00036 #include <errno.h>
00037 typedef int xmms_socket_t;
00038 #endif
00039 
00040 int xmms_sockets_initialize(void);
00041 int xmms_socket_set_nonblock(xmms_socket_t socket);
00042 int xmms_socket_valid(xmms_socket_t socket);
00043 void xmms_socket_invalidate (xmms_socket_t *socket);
00044 void xmms_socket_close(xmms_socket_t socket);
00045 int xmms_socket_errno(void);
00046 bool xmms_socket_error_recoverable(void);
00047 int xmms_getaddrinfo (const char *node, const char *service,
00048                       const struct addrinfo *hints, struct addrinfo **res);
00049 void xmms_freeaddrinfo (struct addrinfo *res);
00050 
00051 #endif