diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-09 18:23:40 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-09 18:23:40 +0000 |
commit | 58bdb658aaa1c30a8f3bed46eef880d308fae582 (patch) | |
tree | 5bf880c715daff79c1a2062f2f3ae8336858c83f /src/socket.h | |
parent | b2724ad2d1cc3768a04270ed3f8014ec65ad133b (diff) | |
download | luasocket-58bdb658aaa1c30a8f3bed46eef880d308fae582.tar.gz luasocket-58bdb658aaa1c30a8f3bed46eef880d308fae582.tar.bz2 luasocket-58bdb658aaa1c30a8f3bed46eef880d308fae582.zip |
Select re-implemented in a nicer way.
Few changes in internal class and group registration.
Lua modules are compiled and built into library.
Dynamic library tested in Linux and Mac OS X.
Diffstat (limited to 'src/socket.h')
-rw-r--r-- | src/socket.h | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/socket.h b/src/socket.h index f8c5d8f..70ebc52 100644 --- a/src/socket.h +++ b/src/socket.h | |||
@@ -6,16 +6,15 @@ | |||
6 | #ifndef SOCK_H | 6 | #ifndef SOCK_H |
7 | #define SOCK_H | 7 | #define SOCK_H |
8 | 8 | ||
9 | #include <lua.h> | 9 | #include "io.h" |
10 | #include "error.h" | ||
11 | 10 | ||
12 | /*=========================================================================*\ | 11 | /*=========================================================================*\ |
13 | * Platform specific compatibilization | 12 | * Platform specific compatibilization |
14 | \*=========================================================================*/ | 13 | \*=========================================================================*/ |
15 | #ifdef WIN32 | 14 | #ifdef WIN32 |
16 | #include "sockwin32.h" | 15 | #include "wsocket.h" |
17 | #else | 16 | #else |
18 | #include "sockunix.h" | 17 | #include "usocket.h" |
19 | #endif | 18 | #endif |
20 | 19 | ||
21 | /* we are lazy... */ | 20 | /* we are lazy... */ |
@@ -25,13 +24,13 @@ typedef struct sockaddr SA; | |||
25 | * Functions bellow implement a comfortable platform independent | 24 | * Functions bellow implement a comfortable platform independent |
26 | * interface to sockets | 25 | * interface to sockets |
27 | \*=========================================================================*/ | 26 | \*=========================================================================*/ |
28 | int sock_open(lua_State *L); | 27 | int sock_open(void); |
29 | |||
30 | const char *sock_create(p_sock ps, int domain, int type, int protocol); | 28 | const char *sock_create(p_sock ps, int domain, int type, int protocol); |
31 | void sock_destroy(p_sock ps); | 29 | void sock_destroy(p_sock ps); |
32 | void sock_accept(p_sock ps, p_sock pa, SA *addr, size_t *addr_len, int timeout); | 30 | int sock_accept(p_sock ps, p_sock pa, SA *addr, socklen_t *addr_len, |
33 | const char *sock_connect(p_sock ps, SA *addr, size_t addr_len); | 31 | int timeout); |
34 | const char *sock_bind(p_sock ps, SA *addr, size_t addr_len); | 32 | const char *sock_connect(p_sock ps, SA *addr, socklen_t addr_len); |
33 | const char *sock_bind(p_sock ps, SA *addr, socklen_t addr_len); | ||
35 | void sock_listen(p_sock ps, int backlog); | 34 | void sock_listen(p_sock ps, int backlog); |
36 | 35 | ||
37 | int sock_send(p_sock ps, const char *data, size_t count, | 36 | int sock_send(p_sock ps, const char *data, size_t count, |
@@ -39,9 +38,9 @@ int sock_send(p_sock ps, const char *data, size_t count, | |||
39 | int sock_recv(p_sock ps, char *data, size_t count, | 38 | int sock_recv(p_sock ps, char *data, size_t count, |
40 | size_t *got, int timeout); | 39 | size_t *got, int timeout); |
41 | int sock_sendto(p_sock ps, const char *data, size_t count, | 40 | int sock_sendto(p_sock ps, const char *data, size_t count, |
42 | size_t *sent, SA *addr, size_t addr_len, int timeout); | 41 | size_t *sent, SA *addr, socklen_t addr_len, int timeout); |
43 | int sock_recvfrom(p_sock ps, char *data, size_t count, | 42 | int sock_recvfrom(p_sock ps, char *data, size_t count, |
44 | size_t *got, SA *addr, size_t *addr_len, int timeout); | 43 | size_t *got, SA *addr, socklen_t *addr_len, int timeout); |
45 | 44 | ||
46 | void sock_setnonblocking(p_sock ps); | 45 | void sock_setnonblocking(p_sock ps); |
47 | void sock_setblocking(p_sock ps); | 46 | void sock_setblocking(p_sock ps); |
@@ -52,6 +51,4 @@ const char *sock_createstrerror(void); | |||
52 | const char *sock_bindstrerror(void); | 51 | const char *sock_bindstrerror(void); |
53 | const char *sock_connectstrerror(void); | 52 | const char *sock_connectstrerror(void); |
54 | 53 | ||
55 | const char *sock_trysetoptions(lua_State *L, p_sock ps); | ||
56 | |||
57 | #endif /* SOCK_H */ | 54 | #endif /* SOCK_H */ |