diff options
author | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-26 18:47:49 +0000 |
---|---|---|
committer | Diego Nehab <diego@tecgraf.puc-rio.br> | 2003-06-26 18:47:49 +0000 |
commit | 71f6bb60bf2b7457091c7106190f92ab7e51f7c6 (patch) | |
tree | 8ad3668667bd3da3c34f7ff7ae0a9a7a4daa4679 /src/buffer.h | |
parent | f330540576031528f0daac231c61d4dd06e8ba1e (diff) | |
download | luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.gz luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.tar.bz2 luasocket-71f6bb60bf2b7457091c7106190f92ab7e51f7c6.zip |
Finished implementation of LuaSocket 2.0 alpha on Linux.
Some testing still needed.
Diffstat (limited to 'src/buffer.h')
-rw-r--r-- | src/buffer.h | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/src/buffer.h b/src/buffer.h index 1502ef0..12b90a0 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
@@ -1,21 +1,31 @@ | |||
1 | #ifndef BUF_H | ||
2 | #define BUF_H | ||
1 | /*=========================================================================*\ | 3 | /*=========================================================================*\ |
2 | * Buffered input/output routines | 4 | * Input/Output interface for Lua programs |
5 | * LuaSocket toolkit | ||
6 | * | ||
7 | * Line patterns require buffering. Reading one character at a time involves | ||
8 | * too many system calls and is very slow. This module implements the | ||
9 | * LuaSocket interface for input/output on connected objects, as seen by | ||
10 | * Lua programs. | ||
11 | * | ||
12 | * Input is buffered. Output is *not* buffered because there was no simple | ||
13 | * way of making sure the buffered output data would ever be sent. | ||
14 | * | ||
15 | * The module is built on top of the I/O abstraction defined in io.h and the | ||
16 | * timeout management is done with the timeout.h interface. | ||
3 | * | 17 | * |
4 | * RCS ID: $Id$ | 18 | * RCS ID: $Id$ |
5 | \*=========================================================================*/ | 19 | \*=========================================================================*/ |
6 | #ifndef BUF_H | ||
7 | #define BUF_H | ||
8 | |||
9 | #include <lua.h> | 20 | #include <lua.h> |
21 | |||
10 | #include "io.h" | 22 | #include "io.h" |
11 | #include "timeout.h" | 23 | #include "timeout.h" |
12 | 24 | ||
13 | /* buffer size in bytes */ | 25 | /* buffer size in bytes */ |
14 | #define BUF_SIZE 8192 | 26 | #define BUF_SIZE 8192 |
15 | 27 | ||
16 | /*-------------------------------------------------------------------------*\ | 28 | /* buffer control structure */ |
17 | * Buffer control structure | ||
18 | \*-------------------------------------------------------------------------*/ | ||
19 | typedef struct t_buf_ { | 29 | typedef struct t_buf_ { |
20 | p_io io; /* IO driver used for this buffer */ | 30 | p_io io; /* IO driver used for this buffer */ |
21 | p_tm tm; /* timeout management for this buffer */ | 31 | p_tm tm; /* timeout management for this buffer */ |
@@ -24,9 +34,6 @@ typedef struct t_buf_ { | |||
24 | } t_buf; | 34 | } t_buf; |
25 | typedef t_buf *p_buf; | 35 | typedef t_buf *p_buf; |
26 | 36 | ||
27 | /*-------------------------------------------------------------------------*\ | ||
28 | * Exported functions | ||
29 | \*-------------------------------------------------------------------------*/ | ||
30 | void buf_open(lua_State *L); | 37 | void buf_open(lua_State *L); |
31 | void buf_init(p_buf buf, p_io io, p_tm tm); | 38 | void buf_init(p_buf buf, p_io io, p_tm tm); |
32 | int buf_meth_send(lua_State *L, p_buf buf); | 39 | int buf_meth_send(lua_State *L, p_buf buf); |