diff options
Diffstat (limited to 'src/io.h')
-rw-r--r-- | src/io.h | 29 |
1 files changed, 22 insertions, 7 deletions
@@ -1,16 +1,30 @@ | |||
1 | #ifndef IO_H | 1 | #ifndef IO_H |
2 | #define IO_H | 2 | #define IO_H |
3 | 3 | /*=========================================================================*\ | |
4 | * Input/Output abstraction | ||
5 | * LuaSocket toolkit | ||
6 | * | ||
7 | * This module defines the interface that LuaSocket expects from the | ||
8 | * transport layer for streamed input/output. The idea is that if any | ||
9 | * transport implements this interface, then the buffer.c functions | ||
10 | * automatically work on it. | ||
11 | * | ||
12 | * The module socket.h implements this interface, and thus the module tcp.h | ||
13 | * is very simple. | ||
14 | * | ||
15 | * RCS ID: $Id$ | ||
16 | \*=========================================================================*/ | ||
4 | #include <stdio.h> | 17 | #include <stdio.h> |
18 | #include <lua.h> | ||
5 | 19 | ||
6 | /* IO error codes */ | 20 | /* IO error codes */ |
7 | enum { | 21 | enum { |
8 | IO_DONE, /* operation completed successfully */ | 22 | IO_DONE, /* operation completed successfully */ |
9 | IO_TIMEOUT, /* operation timed out */ | 23 | IO_TIMEOUT, /* operation timed out */ |
10 | IO_CLOSED, /* the connection has been closed */ | 24 | IO_CLOSED, /* the connection has been closed */ |
11 | IO_ERROR, /* something wrong... */ | 25 | IO_ERROR, /* something wrong... */ |
12 | IO_REFUSED, /* transfer has been refused */ | 26 | IO_REFUSED, /* transfer has been refused */ |
13 | IO_LIMITED /* maximum number of bytes reached */ | 27 | IO_LIMITED /* maximum number of bytes reached */ |
14 | }; | 28 | }; |
15 | 29 | ||
16 | /* interface to send function */ | 30 | /* interface to send function */ |
@@ -39,6 +53,7 @@ typedef struct t_io_ { | |||
39 | } t_io; | 53 | } t_io; |
40 | typedef t_io *p_io; | 54 | typedef t_io *p_io; |
41 | 55 | ||
56 | void io_pusherror(lua_State *L, int code); | ||
42 | void io_init(p_io io, p_send send, p_recv recv, void *ctx); | 57 | void io_init(p_io io, p_send send, p_recv recv, void *ctx); |
43 | 58 | ||
44 | #endif /* IO_H */ | 59 | #endif /* IO_H */ |