1 | /*=========================================================================*\ |
2 | * Unix domain socket |
3 | * LuaSocket toolkit |
4 | \*=========================================================================*/ |
5 | #include "lua.h" |
6 | #include "lauxlib.h" |
7 | |
8 | #include "unixtcp.h" |
9 | #include "unixudp.h" |
10 | |
11 | /*-------------------------------------------------------------------------*\ |
12 | * Modules and functions |
13 | \*-------------------------------------------------------------------------*/ |
14 | static const luaL_Reg mod[] = { |
15 | {"tcp" , unixtcp_open}, |
16 | {"udp" , unixudp_open}, |
17 | {NULL, NULL} |
18 | }; |
19 | |
20 | /*-------------------------------------------------------------------------*\ |
21 | * Initializes module |
22 | \*-------------------------------------------------------------------------*/ |
23 | int luaopen_socket_unix(lua_State *L) |
24 | { |
25 | int i; |
26 | lua_newtable(L); |
27 | for (i = 0; mod[i].name; i++) mod[i].func(L); |
28 | return 1; |
29 | } |
30 | |
31 | |