aboutsummaryrefslogtreecommitdiff
path: root/src/buffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/buffer.h')
-rw-r--r--src/buffer.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/buffer.h b/src/buffer.h
new file mode 100644
index 0000000..7463a67
--- /dev/null
+++ b/src/buffer.h
@@ -0,0 +1,33 @@
1/*=========================================================================*\
2* Buffered input/output routines
3* RCS ID: $Id$
4\*=========================================================================*/
5#ifndef BUF_H_
6#define BUF_H_
7
8#include <lua.h>
9#include "lsbase.h"
10
11/* buffer size in bytes */
12#define BUF_SIZE 8192
13
14/*-------------------------------------------------------------------------*\
15* Buffer control structure
16\*-------------------------------------------------------------------------*/
17typedef struct t_buf_tag {
18 size_t buf_first, buf_last;
19 uchar buf_data[BUF_SIZE];
20 p_base buf_base;
21} t_buf;
22typedef t_buf *p_buf;
23
24/*-------------------------------------------------------------------------*\
25* Exported functions
26\*-------------------------------------------------------------------------*/
27void buf_open(lua_State *L);
28void buf_init(lua_State *L, p_buf buf, p_base base);
29int buf_send(lua_State *L, p_buf buf);
30int buf_receive(lua_State *L, p_buf buf);
31int buf_isempty(lua_State *L, p_buf buf);
32
33#endif /* BUF_H_ */