summaryrefslogtreecommitdiffstats
path: root/server/conn.h
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-03-08 16:42:03 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2013-03-08 16:51:15 +0100
commit3e2d86693f6e8920c97fe296491e7741e31f922c (patch)
tree1c755422fd27c7f192243e8eb7f7811193efa1f6 /server/conn.h
parente0cabd6295204fe8a6b54edfc9141302943fdbfb (diff)
downloadprivsep-master.tar.bz2
privsep-master.tar.xz
implement one lua state per connectionHEADmaster
This allows you load various modules into a server lua state and give a performance boost when calling the privileged functions
Diffstat (limited to 'server/conn.h')
-rw-r--r--server/conn.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/server/conn.h b/server/conn.h
new file mode 100644
index 0000000..f698054
--- /dev/null
+++ b/server/conn.h
@@ -0,0 +1,21 @@
+#ifndef CONN_H
+#define CONN_H
+
+#include <ev.h>
+#include <lua.h>
+
+#ifndef MSG_MAX_SIZE
+#define MSG_MAX_SIZE 16386
+#endif
+
+struct conn {
+ struct ev_io io;
+ struct ev_timer timeout;
+ size_t num_read;
+ lua_State *L;
+ char msg[MSG_MAX_SIZE];
+};
+
+int conn_init(struct ev_loop *loop, const char *socket_path);
+
+#endif