diff options
| author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 18:40:52 +0000 |
|---|---|---|
| committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2004-01-21 18:40:52 +0000 |
| commit | 195069cf5f929f445b0ce20e531cd482d2559083 (patch) | |
| tree | 6444d37c4ce32395428ba26ee0d16c0c372bd9da /src/socket.h | |
| parent | e63f500d24ff0238425c9e13f220daf09a277ef5 (diff) | |
| download | luasocket-195069cf5f929f445b0ce20e531cd482d2559083.tar.gz luasocket-195069cf5f929f445b0ce20e531cd482d2559083.tar.bz2 luasocket-195069cf5f929f445b0ce20e531cd482d2559083.zip | |
Fixed functions that return messages in ?socket.c.
Moved complexity of connect and accept there.
Created a new options.c module to take care of options.
Auxiliar.c is now cleaner.
Diffstat (limited to 'src/socket.h')
| -rw-r--r-- | src/socket.h | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/socket.h b/src/socket.h index 739dedd..7c84baa 100644 --- a/src/socket.h +++ b/src/socket.h | |||
| @@ -22,6 +22,14 @@ | |||
| 22 | #include "usocket.h" | 22 | #include "usocket.h" |
| 23 | #endif | 23 | #endif |
| 24 | 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 | |||
| 25 | /* we are lazy... */ | 33 | /* we are lazy... */ |
| 26 | typedef struct sockaddr SA; | 34 | typedef struct sockaddr SA; |
| 27 | 35 | ||
| @@ -30,12 +38,7 @@ typedef struct sockaddr SA; | |||
| 30 | * interface to sockets | 38 | * interface to sockets |
| 31 | \*=========================================================================*/ | 39 | \*=========================================================================*/ |
| 32 | int sock_open(void); | 40 | int sock_open(void); |
| 33 | int sock_create(p_sock ps, int domain, int type, int protocol); | ||
| 34 | void sock_destroy(p_sock ps); | 41 | void sock_destroy(p_sock ps); |
| 35 | int sock_accept(p_sock ps, p_sock pa, SA *addr, socklen_t *addr_len, | ||
| 36 | int timeout); | ||
| 37 | int sock_connect(p_sock ps, SA *addr, socklen_t addr_len, int timeout); | ||
| 38 | int sock_bind(p_sock ps, SA *addr, socklen_t addr_len); | ||
| 39 | void sock_listen(p_sock ps, int backlog); | 42 | void sock_listen(p_sock ps, int backlog); |
| 40 | void sock_shutdown(p_sock ps, int how); | 43 | void sock_shutdown(p_sock ps, int how); |
| 41 | int sock_send(p_sock ps, const char *data, size_t count, | 44 | int sock_send(p_sock ps, const char *data, size_t count, |
| @@ -48,10 +51,10 @@ int sock_recvfrom(p_sock ps, char *data, size_t count, | |||
| 48 | size_t *got, SA *addr, socklen_t *addr_len, int timeout); | 51 | size_t *got, SA *addr, socklen_t *addr_len, int timeout); |
| 49 | void sock_setnonblocking(p_sock ps); | 52 | void sock_setnonblocking(p_sock ps); |
| 50 | void sock_setblocking(p_sock ps); | 53 | void sock_setblocking(p_sock ps); |
| 51 | 54 | int sock_accept(p_sock ps, p_sock pa, SA *addr, socklen_t *addr_len, p_tm tm); | |
| 55 | const char *sock_connect(p_sock ps, SA *addr, socklen_t addr_len, p_tm tm); | ||
| 56 | const char *sock_create(p_sock ps, int domain, int type, int protocol); | ||
| 57 | const char *sock_bind(p_sock ps, SA *addr, socklen_t addr_len); | ||
| 52 | const char *sock_hoststrerror(void); | 58 | const char *sock_hoststrerror(void); |
| 53 | const char *sock_createstrerror(void); | ||
| 54 | const char *sock_bindstrerror(void); | ||
| 55 | const char *sock_connectstrerror(void); | ||
| 56 | 59 | ||
| 57 | #endif /* SOCK_H */ | 60 | #endif /* SOCK_H */ |
