4 #define NIXIO_OOM "out of memory"
6 #define NIXIO_META "nixio.socket"
7 #define NIXIO_FILE_META "nixio.file"
8 #define NIXIO_GLOB_META "nixio.glob"
9 #define NIXIO_DIR_META "nixio.dir"
10 #define _FILE_OFFSET_BITS 64
12 #define NIXIO_PUSH_CONSTANT(x) \
13 lua_pushinteger(L, x); \
14 lua_setfield(L, -2, #x);
16 /* uClibc: broken as always */
17 #define _LARGEFILE_SOURCE
24 #define NIXIO_BUFFERSIZE 8192
26 typedef struct nixio_socket {
33 typedef struct nixio_address {
40 int nixio__perror(lua_State *L);
41 int nixio__pstatus(lua_State *L, int condition);
43 #if defined(LUA_NUMBER_DOUBLE) || defined(LNUM_DOUBLE) || defined(LNUM_LDOUBLE)
44 #define NIXIO_DOUBLE 1
45 #define nixio__checknumber luaL_checknumber
46 #define nixio__pushnumber lua_pushnumber
47 #define nixio__optnumber luaL_optnumber
49 #define nixio__checknumber luaL_checkinteger
50 #define nixio__pushnumber lua_pushinteger
51 #define nixio__optnumber luaL_optinteger
57 #define NIXIO_API extern
59 #include <sys/types.h>
60 #include <sys/socket.h>
61 #include <arpa/inet.h>
62 #include <netinet/in.h>
63 #include <netinet/tcp.h>
71 #define NIXIO_PATHSEP ":"
73 #define nixio__perror_s nixio__perror
74 #define nixio__pstatus_s nixio__pstatus
76 int nixio__check_group(lua_State *L, int idx);
77 int nixio__check_user(lua_State *L, int idx);
79 typedef struct stat nixio_stat_t;
83 #define NIXIO_API extern __declspec(dllexport)
84 #define NIXIO_SEP "\\"
85 #define NIXIO_PATHSEP ";"
86 #include "mingw-compat.h"
88 typedef struct _stati64 nixio_stat_t;
92 nixio_sock* nixio__checksock(lua_State *L);
93 int nixio__checksockfd(lua_State *L);
94 int nixio__checkfd(lua_State *L, int ud);
95 int nixio__tofd(lua_State *L, int ud);
96 int nixio__nulliter(lua_State *L);
98 int nixio__addr_parse(nixio_addr *addr, struct sockaddr *saddr);
99 int nixio__addr_write(nixio_addr *addr, struct sockaddr *saddr);
101 int nixio__check_mode(lua_State *L, int idx, int def);
102 int nixio__mode_write(int mode, char *modestr);
104 int nixio__push_stat(lua_State *L, nixio_stat_t *buf);
106 const char nixio__bin2hex[16];
108 /* Module functions */
109 void nixio_open_file(lua_State *L);
110 void nixio_open_socket(lua_State *L);
111 void nixio_open_sockopt(lua_State *L);
112 void nixio_open_bind(lua_State *L);
113 void nixio_open_address(lua_State *L);
114 void nixio_open_protoent(lua_State *L);
115 void nixio_open_poll(lua_State *L);
116 void nixio_open_io(lua_State *L);
117 void nixio_open_splice(lua_State *L);
118 void nixio_open_process(lua_State *L);
119 void nixio_open_syslog(lua_State *L);
120 void nixio_open_bit(lua_State *L);
121 void nixio_open_bin(lua_State *L);
122 void nixio_open_fs(lua_State *L);
123 void nixio_open_user(lua_State *L);
126 void nixio_open_tls_crypto(lua_State *L);
127 void nixio_open_tls_context(lua_State *L);
128 void nixio_open_tls_socket(lua_State *L);
131 /* Method functions */
133 #endif /* NIXIO_H_ */