summaryrefslogtreecommitdiffhomepage
path: root/libs/nixio/src/nixio.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/nixio/src/nixio.h')
-rw-r--r--libs/nixio/src/nixio.h66
1 files changed, 65 insertions, 1 deletions
diff --git a/libs/nixio/src/nixio.h b/libs/nixio/src/nixio.h
index 23da17d440..8caa5b9698 100644
--- a/libs/nixio/src/nixio.h
+++ b/libs/nixio/src/nixio.h
@@ -1,9 +1,12 @@
#ifndef NIXIO_H_
#define NIXIO_H_
+#define NIXIO_OOM "out of memory"
+
#define NIXIO_META "nixio.socket"
#define NIXIO_FILE_META "nixio.file"
-#define NIXIO_BUFFERSIZE 8096
+#define NIXIO_GLOB_META "nixio.glob"
+#define NIXIO_DIR_META "nixio.dir"
#define _FILE_OFFSET_BITS 64
#define NIXIO_PUSH_CONSTANT(x) \
@@ -17,6 +20,8 @@
#include <lualib.h>
#include <lauxlib.h>
+#define NIXIO_BUFFERSIZE 8192
+
typedef struct nixio_socket {
int fd;
int domain;
@@ -24,12 +29,66 @@ typedef struct nixio_socket {
int protocol;
} nixio_sock;
+typedef struct nixio_address {
+ int family;
+ char host[128];
+ int port;
+} nixio_addr;
+
int nixio__perror(lua_State *L);
int nixio__pstatus(lua_State *L, int condition);
+
+#ifndef __WINNT__
+
+#define NIXIO_API extern
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+#include <netinet/in.h>
+#include <netinet/tcp.h>
+#include <net/if.h>
+#include <sys/un.h>
+#include <netdb.h>
+#include <poll.h>
+#include <sys/stat.h>
+#include <errno.h>
+
+#define NIXIO_SEP "/"
+#define NIXIO_PATHSEP ":"
+
+#define nixio__perror_s nixio__perror
+#define nixio__pstatus_s nixio__pstatus
+
+int nixio__check_group(lua_State *L, int idx);
+int nixio__check_user(lua_State *L, int idx);
+
+typedef struct stat nixio_stat_t;
+
+#else /* __WINNT__ */
+
+#define NIXIO_API extern __declspec(dllexport)
+#define NIXIO_SEP "\\"
+#define NIXIO_PATHSEP ";"
+#include "mingw-compat.h"
+
+typedef struct _stati64 nixio_stat_t;
+
+#endif
+
nixio_sock* nixio__checksock(lua_State *L);
int nixio__checksockfd(lua_State *L);
int nixio__checkfd(lua_State *L, int ud);
int nixio__tofd(lua_State *L, int ud);
+int nixio__nulliter(lua_State *L);
+
+int nixio__addr_parse(nixio_addr *addr, struct sockaddr *saddr);
+int nixio__addr_write(nixio_addr *addr, struct sockaddr *saddr);
+
+int nixio__check_mode(lua_State *L, int idx, int def);
+int nixio__mode_write(int mode, char *modestr);
+
+int nixio__push_stat(lua_State *L, nixio_stat_t *buf);
/* Module functions */
void nixio_open_file(lua_State *L);
@@ -42,6 +101,11 @@ void nixio_open_io(lua_State *L);
void nixio_open_splice(lua_State *L);
void nixio_open_process(lua_State *L);
void nixio_open_syslog(lua_State *L);
+void nixio_open_bit(lua_State *L);
+void nixio_open_bin(lua_State *L);
+void nixio_open_fs(lua_State *L);
+void nixio_open_user(lua_State *L);
+void nixio_open_tls_crypto(lua_State *L);
void nixio_open_tls_context(lua_State *L);
void nixio_open_tls_socket(lua_State *L);