RetroArch
socket.h
Go to the documentation of this file.
1 #pragma once
2 #include <wiiu/types.h>
3 #include <stdint.h>
4 #include <sys/time.h>
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 #define SOL_SOCKET -1
11 
12 #define INADDR_ANY 0
13 
14 #define AF_UNSPEC 0
15 #define AF_INET 2
16 
17 #define SOCK_STREAM 1
18 #define SOCK_DGRAM 2
19 
20 #define MSG_DONTWAIT 0x0020
21 /* #define MSG_DONTWAIT 0x0004 */
22 
23 #define SO_REUSEADDR 0x0004
24 #define SO_NBIO 0x1014
25 #define SO_NONBLOCK 0x1016
26 
27 
28 /* return codes */
29 #define SO_SUCCESS 0
30 #define SO_EWOULDBLOCK 6
31 #define SO_EINVAL 11
32 
33 #define EWOULDBLOCK SO_EWOULDBLOCK
34 #define EAGAIN SO_EWOULDBLOCK
35 #define ENOBUFS 105 /* No buffer space available */
36 
39 
40 struct sockaddr
41 {
43  char sa_data[];
44 };
45 
46 /* Wii U only supports IPv4 so we make sockaddr_storage
47  be sockaddr_in for compatibility.
48  */
49 #define sockaddr_storage sockaddr_in
50 
51 struct linger
52 {
53  int l_onoff;
54  int l_linger;
55 };
56 
57 void socket_lib_init();
58 int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
59 int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
60 int socketclose(int sockfd);
61 int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);
62 int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
63 int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);
64 int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);
65 int listen(int sockfd, int backlog);
66 ssize_t recv(int sockfd, void *buf, size_t len, int flags);
67 ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);
68 ssize_t send(int sockfd, const void *buf, size_t len, int flags);
69 ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);
70 int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);
71 int shutdown(int sockfd, int how);
72 int socket(int domain, int type, int protocol);
73 int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
74 
75 int socketlasterr(void);
76 
77 #ifdef __cplusplus
78 }
79 #endif
GLbitfield GLuint64 timeout
Definition: glext.h:7831
int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
Definition: sockets.h:204
char sa_data[14]
Definition: sockets.h:49
int l_linger
Definition: sockets.h:96
void socket_lib_init()
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:8418
ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen)
GLenum GLsizei len
Definition: glext.h:7389
ssize_t recv(int sockfd, void *buf, size_t len, int flags)
Definition: sockets.h:94
int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
uint32_t socklen_t
Definition: socket.h:37
GLenum type
Definition: glext.h:6233
int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
ssize_t send(int sockfd, const void *buf, size_t len, int flags)
GLenum const GLvoid * addr
Definition: glext.h:10528
int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen)
GLint level
Definition: glext.h:6293
Definition: sockets.h:217
ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen)
Definition: sockets.h:46
int socketclose(int sockfd)
int socket(int domain, int type, int protocol)
int shutdown(int sockfd, int how)
int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout)
int socketlasterr(void)
int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen)
int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen)
sa_family_t sa_family
Definition: socket.h:42
int listen(int sockfd, int backlog)
uint16_t sa_family_t
Definition: socket.h:38
GLbitfield flags
Definition: glext.h:7828
unsigned short uint16_t
Definition: stdint.h:125
int l_onoff
Definition: sockets.h:95
unsigned int uint32_t
Definition: stdint.h:126
uint32_t socklen_t
Definition: netdb.h:10