luasocket/src/buffer.h

35 lines
1.0 KiB
C
Raw Normal View History

2002-03-27 19:00:00 +01:00
/*=========================================================================*\
* Buffered input/output routines
2003-03-28 22:08:50 +01:00
*
2002-03-27 19:00:00 +01:00
* RCS ID: $Id$
\*=========================================================================*/
#ifndef BUF_H_
#define BUF_H_
#include <lua.h>
#include "lsbase.h"
/* buffer size in bytes */
#define BUF_SIZE 8192
/*-------------------------------------------------------------------------*\
* Buffer control structure
\*-------------------------------------------------------------------------*/
typedef struct t_buf_tag {
size_t buf_first, buf_last;
2003-03-28 22:08:50 +01:00
char buf_data[BUF_SIZE];
2002-03-27 19:00:00 +01:00
p_base buf_base;
} t_buf;
typedef t_buf *p_buf;
/*-------------------------------------------------------------------------*\
* Exported functions
\*-------------------------------------------------------------------------*/
void buf_open(lua_State *L);
void buf_init(lua_State *L, p_buf buf, p_base base);
int buf_send(lua_State *L, p_buf buf);
int buf_receive(lua_State *L, p_buf buf);
int buf_isempty(lua_State *L, p_buf buf);
#endif /* BUF_H_ */