summaryrefslogtreecommitdiff
path: root/src/socket/io.c
diff options
context:
space:
mode:
authormniip <mniip@mniip.com>2013-05-02 18:41:01 (GMT)
committer mniip <mniip@mniip.com>2013-05-02 18:41:01 (GMT)
commite7b29ab9b5e037a8896c62f0473cae8d353d5114 (patch)
tree503fc881969e57cb521fbf551fcede513c1f12fe /src/socket/io.c
parent2eaed9c9d478292f18d8a6aea9d2c9c869b26911 (diff)
downloadpowder-e7b29ab9b5e037a8896c62f0473cae8d353d5114.zip
powder-e7b29ab9b5e037a8896c62f0473cae8d353d5114.tar.gz
statically linked, or better to say, builtin luasocket
Diffstat (limited to 'src/socket/io.c')
-rw-r--r--src/socket/io.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/socket/io.c b/src/socket/io.c
new file mode 100644
index 0000000..06dc50e
--- /dev/null
+++ b/src/socket/io.c
@@ -0,0 +1,32 @@
+/*=========================================================================*\
+* Input/Output abstraction
+* LuaSocket toolkit
+*
+* RCS ID: $Id: io.c,v 1.6 2005/09/29 06:11:41 diego Exp $
+\*=========================================================================*/
+#include "io.h"
+
+/*=========================================================================*\
+* Exported functions
+\*=========================================================================*/
+/*-------------------------------------------------------------------------*\
+* Initializes C structure
+\*-------------------------------------------------------------------------*/
+void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx) {
+ io->send = send;
+ io->recv = recv;
+ io->error = error;
+ io->ctx = ctx;
+}
+
+/*-------------------------------------------------------------------------*\
+* I/O error strings
+\*-------------------------------------------------------------------------*/
+const char *io_strerror(int err) {
+ switch (err) {
+ case IO_DONE: return NULL;
+ case IO_CLOSED: return "closed";
+ case IO_TIMEOUT: return "timeout";
+ default: return "unknown error";
+ }
+}