2000-06-02 19:55:14 +02:00
|
|
|
/*=========================================================================*\
|
2002-07-03 21:06:52 +02:00
|
|
|
* Networking support for the Lua language
|
2000-06-02 19:55:14 +02:00
|
|
|
* Diego Nehab
|
|
|
|
* 26/11/1999
|
|
|
|
*
|
2002-07-03 21:06:52 +02:00
|
|
|
* 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.
|
2001-09-13 00:07:08 +02:00
|
|
|
*
|
|
|
|
* RCS ID: $Id$
|
2000-06-02 19:55:14 +02:00
|
|
|
\*=========================================================================*/
|
|
|
|
|
|
|
|
/*=========================================================================*\
|
2002-07-03 21:06:52 +02:00
|
|
|
* Standard include files
|
2000-06-02 19:55:14 +02:00
|
|
|
\*=========================================================================*/
|
2001-01-13 08:10:00 +01:00
|
|
|
#include <lua.h>
|
2002-07-03 21:06:52 +02:00
|
|
|
#include <lauxlib.h>
|
2001-01-13 08:10:00 +01:00
|
|
|
|
2001-01-15 05:16:35 +01:00
|
|
|
/*=========================================================================*\
|
2002-07-03 21:06:52 +02:00
|
|
|
* LuaSocket includes
|
2001-01-15 05:16:35 +01:00
|
|
|
\*=========================================================================*/
|
2002-07-03 21:06:52 +02:00
|
|
|
#include "luasocket.h"
|
|
|
|
#include "lspriv.h"
|
|
|
|
#include "lsselect.h"
|
|
|
|
#include "lscompat.h"
|
|
|
|
#include "lsbase.h"
|
|
|
|
#include "lstm.h"
|
|
|
|
#include "lsbuf.h"
|
|
|
|
#include "lssock.h"
|
|
|
|
#include "lsinet.h"
|
|
|
|
#include "lstcpc.h"
|
|
|
|
#include "lstcps.h"
|
|
|
|
#include "lstcps.h"
|
|
|
|
#include "lsudp.h"
|
2000-06-02 19:55:14 +02:00
|
|
|
|
2001-01-15 05:16:35 +01:00
|
|
|
/*=========================================================================*\
|
2002-07-03 21:06:52 +02:00
|
|
|
* Exported functions
|
2001-01-15 05:16:35 +01:00
|
|
|
\*=========================================================================*/
|
2000-06-02 19:55:14 +02:00
|
|
|
/*-------------------------------------------------------------------------*\
|
2002-07-03 21:06:52 +02:00
|
|
|
* Initializes all library modules.
|
2000-06-02 19:55:14 +02:00
|
|
|
\*-------------------------------------------------------------------------*/
|
2001-09-13 00:07:08 +02:00
|
|
|
LUASOCKET_API int lua_socketlibopen(lua_State *L)
|
2000-06-02 19:55:14 +02:00
|
|
|
{
|
2003-03-21 02:07:23 +01:00
|
|
|
compat_open(L);
|
2002-07-03 21:06:52 +02:00
|
|
|
priv_open(L);
|
|
|
|
select_open(L);
|
|
|
|
base_open(L);
|
|
|
|
tm_open(L);
|
|
|
|
fd_open(L);
|
|
|
|
sock_open(L);
|
|
|
|
inet_open(L);
|
|
|
|
tcpc_open(L);
|
|
|
|
buf_open(L);
|
|
|
|
tcps_open(L);
|
|
|
|
udp_open(L);
|
2003-03-29 00:29:45 +01:00
|
|
|
#ifdef LUASOCKET_DOFILE
|
2002-12-03 00:34:41 +01:00
|
|
|
lua_dofile(L, "concat.lua");
|
|
|
|
lua_dofile(L, "code.lua");
|
|
|
|
lua_dofile(L, "url.lua");
|
|
|
|
lua_dofile(L, "http.lua");
|
|
|
|
lua_dofile(L, "smtp.lua");
|
|
|
|
lua_dofile(L, "ftp.lua");
|
2003-03-28 22:08:50 +01:00
|
|
|
#else
|
|
|
|
#include "concat.loh"
|
|
|
|
#include "code.loh"
|
|
|
|
#include "url.loh"
|
|
|
|
#include "http.loh"
|
|
|
|
#include "smtp.loh"
|
|
|
|
#include "ftp.loh"
|
2002-12-03 00:34:41 +01:00
|
|
|
#endif
|
|
|
|
return 0;
|
2001-01-15 05:16:35 +01:00
|
|
|
}
|