MEDIUM: lua: socket: add "socket" class for TCP I/O
This patch adds the TCP I/O functionnality. The class implemented
provides the same functions than the "lua socket" project. This
make network compatibility with another LUA project. The documentation
is located here:
http://w3.impa.br/~diego/software/luasocket/tcp.html
diff --git a/include/types/hlua.h b/include/types/hlua.h
index f21f4e1..4925155 100644
--- a/include/types/hlua.h
+++ b/include/types/hlua.h
@@ -2,9 +2,14 @@
#define _TYPES_HLUA_H
#include <lua.h>
+#include <lauxlib.h>
+
+#include <types/proxy.h>
+#include <types/server.h>
#define CLASS_CORE "Core"
#define CLASS_TXN "TXN"
+#define CLASS_SOCKET "Socket"
struct session;
@@ -100,4 +105,12 @@
unsigned int wakeup_ms; /* hour to wakeup. */
};
+/* This struct is used to create coprocess doing TCP or
+ * SSL I/O. It uses a fake session.
+ */
+struct hlua_socket {
+ struct session *s; /* Session used for socket I/O. */
+ luaL_Buffer b; /* buffer used to prepare strings. */
+};
+
#endif /* _TYPES_HLUA_H */