e4bb6d6de9505d793fbaccb9d99a21f3feebefd2
[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 /* uClibc: broken as always */
10 #define _LARGEFILE_SOURCE
11
12 #include <lua.h>
13 #include <lualib.h>
14 #include <lauxlib.h>
15
16 struct nixio_socket {
17         int fd;
18         int domain;
19         int type;
20         int protocol;
21 };
22
23 typedef struct nixio_socket nixio_sock;
24
25 int nixio__perror(lua_State *L);
26 int nixio__pstatus(lua_State *L, int condition);
27 nixio_sock* nixio__checksock(lua_State *L);
28 int nixio__checksockfd(lua_State *L);
29 int nixio__checkfd(lua_State *L, int ud);
30 int nixio__tofd(lua_State *L, int ud);
31 FILE* nixio__checkfile(lua_State *L);
32
33 /* Module functions */
34 void nixio_open_file(lua_State *L);
35 void nixio_open_socket(lua_State *L);
36 void nixio_open_sockopt(lua_State *L);
37 void nixio_open_bind(lua_State *L);
38 void nixio_open_address(lua_State *L);
39 void nixio_open_poll(lua_State *L);
40 void nixio_open_io(lua_State *L);
41 void nixio_open_splice(lua_State *L);
42
43 /* Method functions */
44
45 #endif /* NIXIO_H_ */