aboutsummaryrefslogtreecommitdiff
path: root/vendor/luasocket/src/socket.h
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/luasocket/src/socket.h')
-rwxr-xr-xvendor/luasocket/src/socket.h75
1 files changed, 75 insertions, 0 deletions
diff --git a/vendor/luasocket/src/socket.h b/vendor/luasocket/src/socket.h
new file mode 100755
index 00000000..2555bab6
--- /dev/null
+++ b/vendor/luasocket/src/socket.h
@@ -0,0 +1,75 @@
1#ifndef SOCKET_H
2#define SOCKET_H
3/*=========================================================================*\
4* Socket compatibilization module
5* LuaSocket toolkit
6*
7* BSD Sockets and WinSock are similar, but there are a few irritating
8* differences. Also, not all *nix platforms behave the same. This module
9* (and the associated usocket.h and wsocket.h) factor these differences and
10* creates a interface compatible with the io.h module.
11\*=========================================================================*/
12#include "io.h"
13
14/*=========================================================================*\
15* Platform specific compatibilization
16\*=========================================================================*/
17#ifdef _WIN32
18#include "wsocket.h"
19#define LUA_GAI_STRERROR gai_strerrorA
20#else
21#include "usocket.h"
22#define LUA_GAI_STRERROR gai_strerror
23#endif
24
25/*=========================================================================*\
26* The connect and accept functions accept a timeout and their
27* implementations are somewhat complicated. We chose to move
28* the timeout control into this module for these functions in
29* order to simplify the modules that use them.
30\*=========================================================================*/
31#include "timeout.h"
32
33/* convenient shorthand */
34typedef struct sockaddr SA;
35
36/*=========================================================================*\
37* Functions bellow implement a comfortable platform independent
38* interface to sockets
39\*=========================================================================*/
40
41#ifndef _WIN32
42#pragma GCC visibility push(hidden)
43#endif
44
45int socket_waitfd(p_socket ps, int sw, p_timeout tm);
46int socket_open(void);
47int socket_close(void);
48void socket_destroy(p_socket ps);
49int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, p_timeout tm);
50int socket_create(p_socket ps, int domain, int type, int protocol);
51int socket_bind(p_socket ps, SA *addr, socklen_t addr_len);
52int socket_listen(p_socket ps, int backlog);
53void socket_shutdown(p_socket ps, int how);
54int socket_connect(p_socket ps, SA *addr, socklen_t addr_len, p_timeout tm);
55int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *addr_len, p_timeout tm);
56int socket_send(p_socket ps, const char *data, size_t count, size_t *sent, p_timeout tm);
57int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, SA *addr, socklen_t addr_len, p_timeout tm);
58int socket_recv(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm);
59int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, SA *addr, socklen_t *addr_len, p_timeout tm);
60int socket_write(p_socket ps, const char *data, size_t count, size_t *sent, p_timeout tm);
61int socket_read(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm);
62void socket_setblocking(p_socket ps);
63void socket_setnonblocking(p_socket ps);
64int socket_gethostbyaddr(const char *addr, socklen_t len, struct hostent **hp);
65int socket_gethostbyname(const char *addr, struct hostent **hp);
66const char *socket_hoststrerror(int err);
67const char *socket_strerror(int err);
68const char *socket_ioerror(p_socket ps, int err);
69const char *socket_gaistrerror(int err);
70
71#ifndef _WIN32
72#pragma GCC visibility pop
73#endif
74
75#endif /* SOCKET_H */