XMMS2
xmmsc_sockets.h
Go to the documentation of this file.
1 #ifndef XMMSC_SOCKETS_H
2 #define XMMSC_SOCKETS_H
3 
4 #include <xmmsc/xmmsc_stdbool.h>
5 
6 /* Windows */
7 #ifdef HAVE_WINSOCK2
8 #include <winsock2.h>
9 #include <ws2tcpip.h>
10 typedef SOCKET xmms_socket_t;
11 typedef int socklen_t;
12 #define XMMS_EINTR WSAEINTR
13 #define XMMS_EAGAIN WSAEWOULDBLOCK
14 #define XMMS_EINPROGRESS WSAEINPROGRESS
15 /* UNIX */
16 #else
17 #define SOCKET_ERROR (-1)
18 #define XMMS_EINTR EINTR
19 #define XMMS_EINPROGRESS EINPROGRESS
20 #ifdef __hpux
21 /* on HP-UX EAGAIN != EWOULDBLOCK */
22 #define XMMS_EAGAIN EAGAIN
23 #else
24 #define XMMS_EAGAIN EWOULDBLOCK
25 #endif
26 #include <sys/types.h>
27 #include <sys/socket.h>
28 #include <sys/select.h>
29 #include <sys/time.h>
30 #include <netinet/in.h>
31 #include <netinet/tcp.h>
32 #include <arpa/inet.h>
33 #include <netdb.h>
34 #include <fcntl.h>
35 #include <unistd.h>
36 #include <errno.h>
37 typedef int xmms_socket_t;
38 #endif
39 
40 int xmms_sockets_initialize(void);
44 void xmms_socket_close(xmms_socket_t socket);
45 int xmms_socket_errno(void);
47 int xmms_getaddrinfo (const char *node, const char *service,
48  const struct addrinfo *hints, struct addrinfo **res);
49 void xmms_freeaddrinfo (struct addrinfo *res);
50 
51 #endif
bool xmms_socket_error_recoverable(void)
Definition: socket_common.c:9
int xmms_getaddrinfo(const char *node, const char *service, const struct addrinfo *hints, struct addrinfo **res)
Definition: socket_common.c:19
int xmms_socket_set_nonblock(xmms_socket_t socket)
Tries to set socket to non-blocking mode.
Definition: socket_unix.c:15
int xmms_sockets_initialize(void)
Definition: socket_unix.c:5
void xmms_socket_invalidate(xmms_socket_t *socket)
Definition: socket_unix.c:43
int xmms_socket_t
Definition: xmmsc_sockets.h:37
int xmms_socket_errno(void)
Definition: socket_unix.c:51
void xmms_freeaddrinfo(struct addrinfo *res)
Definition: socket_common.c:26
void xmms_socket_close(xmms_socket_t socket)
Definition: socket_unix.c:47
int xmms_socket_valid(xmms_socket_t socket)
Definition: socket_unix.c:36