nixio:
[project/luci.git] / libs / nixio / src / nixio.h
1 #ifndef NIXIO_H_
2 #define NIXIO_H_
3
4 #define NIXIO_META "nixio.socket"
5 #define NIXIO_FILE_META "nixio.file"
6 #define NIXIO_BUFFERSIZE 8096
7 #define _FILE_OFFSET_BITS 64
8
9 #define NIXIO_PUSH_CONSTANT(x) \
10         lua_pushinteger(L, x); \
11         lua_setfield(L, -2, #x);
12
13 /* uClibc: broken as always */
14 #define _LARGEFILE_SOURCE
15
16 #include <lua.h>
17 #include <lualib.h>
18 #include <lauxlib.h>
19
20 typedef struct nixio_socket {
21         int fd;
22         int domain;
23         int type;
24         int protocol;
25 } nixio_sock;
26
27 int nixio__perror(lua_State *L);
28 int nixio__pstatus(lua_State *L, int condition);
29 nixio_sock* nixio__checksock(lua_State *L);
30 int nixio__checksockfd(lua_State *L);
31 int nixio__checkfd(lua_State *L, int ud);
32 int nixio__tofd(lua_State *L, int ud);
33 FILE* nixio__checkfile(lua_State *L);
34
35 /* Module functions */
36 void nixio_open_file(lua_State *L);
37 void nixio_open_socket(lua_State *L);
38 void nixio_open_sockopt(lua_State *L);
39 void nixio_open_bind(lua_State *L);
40 void nixio_open_address(lua_State *L);
41 void nixio_open_poll(lua_State *L);
42 void nixio_open_io(lua_State *L);
43 void nixio_open_splice(lua_State *L);
44 void nixio_open_tls_context(lua_State *L);
45 void nixio_open_tls_socket(lua_State *L);
46
47 /* Method functions */
48
49 #endif /* NIXIO_H_ */