upstream nginx-0.7.34
[nginx.git] / nginx / src / http / modules / ngx_http_ssi_filter_module.h
1
2 /*
3  * Copyright (C) Igor Sysoev
4  */
5
6
7 #ifndef _NGX_HTTP_SSI_FILTER_H_INCLUDED_
8 #define _NGX_HTTP_SSI_FILTER_H_INCLUDED_
9
10
11 #include <ngx_config.h>
12 #include <ngx_core.h>
13 #include <ngx_http.h>
14
15
16 #define NGX_HTTP_SSI_MAX_PARAMS       16
17
18 #define NGX_HTTP_SSI_COMMAND_LEN      32
19 #define NGX_HTTP_SSI_PARAM_LEN        32
20 #define NGX_HTTP_SSI_PARAMS_N         4
21
22
23 #define NGX_HTTP_SSI_COND_IF          1
24 #define NGX_HTTP_SSI_COND_ELSE        2
25
26
27 #define NGX_HTTP_SSI_NO_ENCODING      0
28 #define NGX_HTTP_SSI_URL_ENCODING     1
29 #define NGX_HTTP_SSI_ENTITY_ENCODING  2
30
31
32 typedef struct {
33     ngx_hash_t                hash;
34     ngx_hash_keys_arrays_t    commands;
35 } ngx_http_ssi_main_conf_t;
36
37
38 typedef struct {
39     ngx_buf_t                *buf;
40
41     u_char                   *pos;
42     u_char                   *copy_start;
43     u_char                   *copy_end;
44
45     ngx_uint_t                key;
46     ngx_str_t                 command;
47     ngx_array_t               params;
48     ngx_table_elt_t          *param;
49     ngx_table_elt_t           params_array[NGX_HTTP_SSI_PARAMS_N];
50
51     ngx_chain_t              *in;
52     ngx_chain_t              *out;
53     ngx_chain_t             **last_out;
54     ngx_chain_t              *busy;
55     ngx_chain_t              *free;
56
57     ngx_uint_t                state;
58     ngx_uint_t                saved_state;
59     size_t                    saved;
60     size_t                    looked;
61
62     size_t                    value_len;
63
64     ngx_list_t               *variables;
65     ngx_array_t              *blocks;
66
67     unsigned                  conditional:2;
68     unsigned                  encoding:2;
69     unsigned                  block:1;
70     unsigned                  output:1;
71     unsigned                  output_chosen:1;
72
73     ngx_http_request_t       *wait;
74     void                     *value_buf;
75     ngx_str_t                 timefmt;
76     ngx_str_t                 errmsg;
77 } ngx_http_ssi_ctx_t;
78
79
80 typedef ngx_int_t (*ngx_http_ssi_command_pt) (ngx_http_request_t *r,
81     ngx_http_ssi_ctx_t *ctx, ngx_str_t **);
82
83
84 typedef struct {
85     ngx_str_t                 name;
86     ngx_uint_t                index;
87
88     unsigned                  mandatory:1;
89     unsigned                  multiple:1;
90 } ngx_http_ssi_param_t;
91
92
93 typedef struct {
94     ngx_str_t                 name;
95     ngx_http_ssi_command_pt   handler;
96     ngx_http_ssi_param_t     *params;
97
98     unsigned                  conditional:2;
99     unsigned                  block:1;
100     unsigned                  flush:1;
101 } ngx_http_ssi_command_t;
102
103
104 extern ngx_module_t  ngx_http_ssi_filter_module;
105
106
107 #endif /* _NGX_HTTP_SSI_FILTER_H_INCLUDED_ */