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.
This commit is contained in:
Diego Nehab
2003-06-09 18:23:40 +00:00
parent b2724ad2d1
commit 58bdb658aa
28 changed files with 496 additions and 397 deletions

View File

@ -6,16 +6,15 @@
#ifndef SOCK_H
#define SOCK_H
#include <lua.h>
#include "error.h"
#include "io.h"
/*=========================================================================*\
* Platform specific compatibilization
\*=========================================================================*/
#ifdef WIN32
#include "sockwin32.h"
#include "wsocket.h"
#else
#include "sockunix.h"
#include "usocket.h"
#endif
/* we are lazy... */
@ -25,13 +24,13 @@ typedef struct sockaddr SA;
* Functions bellow implement a comfortable platform independent
* interface to sockets
\*=========================================================================*/
int sock_open(lua_State *L);
int sock_open(void);
const char *sock_create(p_sock ps, int domain, int type, int protocol);
void sock_destroy(p_sock ps);
void sock_accept(p_sock ps, p_sock pa, SA *addr, size_t *addr_len, int timeout);
const char *sock_connect(p_sock ps, SA *addr, size_t addr_len);
const char *sock_bind(p_sock ps, SA *addr, size_t addr_len);
int sock_accept(p_sock ps, p_sock pa, SA *addr, socklen_t *addr_len,
int timeout);
const char *sock_connect(p_sock ps, SA *addr, socklen_t addr_len);
const char *sock_bind(p_sock ps, SA *addr, socklen_t addr_len);
void sock_listen(p_sock ps, int backlog);
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,
int sock_recv(p_sock ps, char *data, size_t count,
size_t *got, int timeout);
int sock_sendto(p_sock ps, const char *data, size_t count,
size_t *sent, SA *addr, size_t addr_len, int timeout);
size_t *sent, SA *addr, socklen_t addr_len, int timeout);
int sock_recvfrom(p_sock ps, char *data, size_t count,
size_t *got, SA *addr, size_t *addr_len, int timeout);
size_t *got, SA *addr, socklen_t *addr_len, int timeout);
void sock_setnonblocking(p_sock ps);
void sock_setblocking(p_sock ps);
@ -52,6 +51,4 @@ const char *sock_createstrerror(void);
const char *sock_bindstrerror(void);
const char *sock_connectstrerror(void);
const char *sock_trysetoptions(lua_State *L, p_sock ps);
#endif /* SOCK_H */