diff options
Diffstat (limited to 'vendor/luasocket/src/io.c')
-rw-r--r-- | vendor/luasocket/src/io.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/luasocket/src/io.c b/vendor/luasocket/src/io.c new file mode 100644 index 00000000..5ad4b3af --- /dev/null +++ b/vendor/luasocket/src/io.c | |||
@@ -0,0 +1,28 @@ | |||
1 | /*=========================================================================*\ | ||
2 | * Input/Output abstraction | ||
3 | * LuaSocket toolkit | ||
4 | \*=========================================================================*/ | ||
5 | #include "luasocket.h" | ||
6 | #include "io.h" | ||
7 | |||
8 | /*-------------------------------------------------------------------------*\ | ||
9 | * Initializes C structure | ||
10 | \*-------------------------------------------------------------------------*/ | ||
11 | void io_init(p_io io, p_send send, p_recv recv, p_error error, void *ctx) { | ||
12 | io->send = send; | ||
13 | io->recv = recv; | ||
14 | io->error = error; | ||
15 | io->ctx = ctx; | ||
16 | } | ||
17 | |||
18 | /*-------------------------------------------------------------------------*\ | ||
19 | * I/O error strings | ||
20 | \*-------------------------------------------------------------------------*/ | ||
21 | const char *io_strerror(int err) { | ||
22 | switch (err) { | ||
23 | case IO_DONE: return NULL; | ||
24 | case IO_CLOSED: return "closed"; | ||
25 | case IO_TIMEOUT: return "timeout"; | ||
26 | default: return "unknown error"; | ||
27 | } | ||
28 | } | ||