1 
2 #ifndef _NGX_HTTP_LUA_RINGBUF_H_INCLUDED_
3 #define _NGX_HTTP_LUA_RINGBUF_H_INCLUDED_
4 
5 
6 #include "ngx_http_lua_common.h"
7 
8 
9 typedef struct {
10     ngx_uint_t   filter_level;
11     char        *tail;              /* writed point */
12     char        *head;              /* readed point */
13     char        *data;              /* buffer */
14     char        *sentinel;
15     size_t       size;              /* buffer total size */
16     size_t       count;             /* count of logs */
17 } ngx_http_lua_log_ringbuf_t;
18 
19 
20 void ngx_http_lua_log_ringbuf_init(ngx_http_lua_log_ringbuf_t *rb,
21     void *buf, size_t len);
22 void ngx_http_lua_log_ringbuf_reset(ngx_http_lua_log_ringbuf_t *rb);
23 ngx_int_t ngx_http_lua_log_ringbuf_read(ngx_http_lua_log_ringbuf_t *rb,
24     int *log_level, void **buf, size_t *n, double *log_time);
25 ngx_int_t ngx_http_lua_log_ringbuf_write(ngx_http_lua_log_ringbuf_t *rb,
26     int log_level, void *buf, size_t n);
27 
28 
29 #endif /* _NGX_HTTP_LUA_RINGBUF_H_INCLUDED_ */
30 
31 /* vi:set ft=c ts=4 sw=4 et fdm=marker: */
32