summaryrefslogtreecommitdiff
path: root/ngx_lua-0.10.28/src/ngx_http_lua_log_ringbuf.h
blob: c9c2c2d14839157698d85a0d5dba436f550e3534 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef _NGX_HTTP_LUA_RINGBUF_H_INCLUDED_
#define _NGX_HTTP_LUA_RINGBUF_H_INCLUDED_


#include "ngx_http_lua_common.h"


typedef struct {
    ngx_uint_t   filter_level;
    char        *tail;              /* writed point */
    char        *head;              /* readed point */
    char        *data;              /* buffer */
    char        *sentinel;
    size_t       size;              /* buffer total size */
    size_t       count;             /* count of logs */
} ngx_http_lua_log_ringbuf_t;


void ngx_http_lua_log_ringbuf_init(ngx_http_lua_log_ringbuf_t *rb,
    void *buf, size_t len);
void ngx_http_lua_log_ringbuf_reset(ngx_http_lua_log_ringbuf_t *rb);
ngx_int_t ngx_http_lua_log_ringbuf_read(ngx_http_lua_log_ringbuf_t *rb,
    int *log_level, void **buf, size_t *n, double *log_time);
ngx_int_t ngx_http_lua_log_ringbuf_write(ngx_http_lua_log_ringbuf_t *rb,
    int log_level, void *buf, size_t n);


#endif /* _NGX_HTTP_LUA_RINGBUF_H_INCLUDED_ */

/* vi:set ft=c ts=4 sw=4 et fdm=marker: */