luasocket/src/luasocket.c

60 lines
1.9 KiB
C
Raw Normal View History

2000-06-02 19:55:14 +02:00
/*=========================================================================*\
* LuaSocket toolkit
* Networking support for the Lua language
2000-06-02 19:55:14 +02:00
* Diego Nehab
* 26/11/1999
*
* This library is part of an effort to progressively increase the network
* connectivity of the Lua language. The Lua interface to networking
* functions follows the Sockets API closely, trying to simplify all tasks
* involved in setting up both client and server connections. The provided
* IO routines, however, follow the Lua style, being very similar to the
* standard Lua read and write functions.
*
* RCS ID: $Id$
2000-06-02 19:55:14 +02:00
\*=========================================================================*/
/*=========================================================================*\
* Standard include files
2000-06-02 19:55:14 +02:00
\*=========================================================================*/
#include <lua.h>
#include <lauxlib.h>
/*=========================================================================*\
* LuaSocket includes
\*=========================================================================*/
#include "luasocket.h"
2003-05-25 03:54:13 +02:00
#include "auxiliar.h"
2004-05-30 23:36:22 +02:00
#include "base.h"
#include "timeout.h"
#include "buffer.h"
2003-05-25 03:54:13 +02:00
#include "inet.h"
#include "tcp.h"
#include "udp.h"
#include "select.h"
/*-------------------------------------------------------------------------*\
* Modules
\*-------------------------------------------------------------------------*/
static const luaL_reg mod[] = {
2004-05-30 23:36:22 +02:00
{"auxiliar", aux_open},
{"base", base_open},
2004-05-30 23:36:22 +02:00
{"timeout", tm_open},
{"buffer", buf_open},
{"inet", inet_open},
{"tcp", tcp_open},
{"udp", udp_open},
{"select", select_open},
{NULL, NULL}
};
/*-------------------------------------------------------------------------*\
* Initializes all library modules.
\*-------------------------------------------------------------------------*/
2004-05-30 23:36:22 +02:00
LUASOCKET_API int luaopen_socket(lua_State *L) {
2004-05-28 08:16:43 +02:00
int i;
2004-06-04 17:15:45 +02:00
for (i = 0; mod[i].name; i++) mod[i].func(L);
return 1;
}