Mercurial > hg > nginx
annotate src/http/ngx_http_script.h @ 636:21003753acbf
release-0.3.39 tag
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Mon, 17 Apr 2006 19:55:41 +0000 |
parents | 5d2b8078c1c2 |
children | e60fe4cf1d4e |
rev | line source |
---|---|
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
1 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
2 /* |
444
42d11f017717
nginx-0.1.0-2004-09-29-20:00:49 import; remove years from copyright
Igor Sysoev <igor@sysoev.ru>
parents:
441
diff
changeset
|
3 * Copyright (C) Igor Sysoev |
441
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
4 */ |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
5 |
da8c5707af39
nginx-0.1.0-2004-09-28-12:34:51 import; set copyright and remove unused files
Igor Sysoev <igor@sysoev.ru>
parents:
99
diff
changeset
|
6 |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #ifndef _NGX_HTTP_SCRIPT_H_INCLUDED_ |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #define _NGX_HTTP_SCRIPT_H_INCLUDED_ |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
479 | 11 #include <ngx_config.h> |
12 #include <ngx_core.h> | |
13 #include <ngx_http.h> | |
14 | |
15 | |
507 | 16 typedef struct { |
573 | 17 u_char *ip; |
18 u_char *pos; | |
19 ngx_http_variable_value_t *sp; | |
509 | 20 |
573 | 21 ngx_str_t buf; |
22 ngx_str_t line; | |
509 | 23 |
24 /* the start of the rewritten arguments */ | |
573 | 25 u_char *args; |
507 | 26 |
573 | 27 unsigned flushed:1; |
28 unsigned skip:1; | |
29 unsigned quote:1; | |
30 unsigned log:1; | |
509 | 31 |
573 | 32 int *captures; |
33 ngx_uint_t ncaptures; | |
34 | |
35 ngx_int_t status; | |
36 ngx_http_request_t *request; | |
507 | 37 } ngx_http_script_engine_t; |
38 | |
39 | |
509 | 40 typedef struct { |
573 | 41 ngx_conf_t *cf; |
42 ngx_str_t *source; | |
509 | 43 |
573 | 44 ngx_array_t **flushes; |
45 ngx_array_t **lengths; | |
46 ngx_array_t **values; | |
509 | 47 |
573 | 48 ngx_uint_t variables; |
49 ngx_uint_t ncaptures; | |
50 ngx_uint_t size; | |
51 | |
52 void *main; | |
507 | 53 |
573 | 54 unsigned compile_args:1; |
55 unsigned complete_lengths:1; | |
56 unsigned complete_values:1; | |
509 | 57 |
573 | 58 unsigned args:1; |
509 | 59 } ngx_http_script_compile_t; |
60 | |
61 | |
62 typedef void (*ngx_http_script_code_pt) (ngx_http_script_engine_t *e); | |
63 typedef size_t (*ngx_http_script_len_code_pt) (ngx_http_script_engine_t *e); | |
507 | 64 |
479 | 65 |
507 | 66 typedef struct { |
67 ngx_http_script_code_pt code; | |
68 uintptr_t len; | |
69 } ngx_http_script_copy_code_t; | |
70 | |
71 | |
72 typedef struct { | |
73 ngx_http_script_code_pt code; | |
74 uintptr_t index; | |
75 } ngx_http_script_var_code_t; | |
76 | |
77 | |
509 | 78 typedef struct { |
79 ngx_http_script_code_pt code; | |
80 uintptr_t n; | |
81 } ngx_http_script_copy_capture_code_t; | |
82 | |
83 | |
517 | 84 #if (NGX_PCRE) |
85 | |
509 | 86 typedef struct { |
87 ngx_http_script_code_pt code; | |
88 ngx_regex_t *regex; | |
89 ngx_array_t *lengths; | |
90 uintptr_t size; | |
91 uintptr_t ncaptures; | |
92 uintptr_t status; | |
93 uintptr_t next; | |
94 | |
95 uintptr_t test:1; | |
631 | 96 uintptr_t negative_test:1; |
509 | 97 uintptr_t uri:1; |
98 uintptr_t args:1; | |
99 | |
100 /* add the r->args to the new arguments */ | |
101 uintptr_t add_args:1; | |
577 | 102 |
509 | 103 uintptr_t redirect:1; |
104 uintptr_t break_cycle:1; | |
105 | |
106 ngx_str_t name; | |
107 } ngx_http_script_regex_code_t; | |
108 | |
109 | |
110 typedef struct { | |
111 ngx_http_script_code_pt code; | |
112 | |
113 uintptr_t uri:1; | |
114 uintptr_t args:1; | |
115 | |
116 /* add the r->args to the new arguments */ | |
117 uintptr_t add_args:1; | |
118 | |
119 uintptr_t redirect:1; | |
120 } ngx_http_script_regex_end_code_t; | |
507 | 121 |
517 | 122 #endif |
123 | |
507 | 124 |
509 | 125 typedef struct { |
126 ngx_http_script_code_pt code; | |
127 uintptr_t status; | |
128 uintptr_t null; | |
129 } ngx_http_script_return_code_t; | |
130 | |
131 | |
631 | 132 typedef enum { |
133 ngx_http_script_file_plain = 0, | |
134 ngx_http_script_file_not_plain | |
135 } ngx_http_script_file_op_e; | |
136 | |
137 | |
138 typedef struct { | |
139 ngx_http_script_code_pt code; | |
140 uintptr_t op; | |
141 } ngx_http_script_file_code_t; | |
142 | |
143 | |
509 | 144 typedef struct { |
145 ngx_http_script_code_pt code; | |
146 uintptr_t next; | |
147 void **loc_conf; | |
148 } ngx_http_script_if_code_t; | |
149 | |
150 | |
151 typedef struct { | |
152 ngx_http_script_code_pt code; | |
515 | 153 ngx_array_t *lengths; |
154 } ngx_http_script_complex_value_code_t; | |
155 | |
156 | |
157 typedef struct { | |
158 ngx_http_script_code_pt code; | |
509 | 159 uintptr_t value; |
160 uintptr_t text_len; | |
161 uintptr_t text_data; | |
162 } ngx_http_script_value_code_t; | |
163 | |
507 | 164 |
509 | 165 ngx_uint_t ngx_http_script_variables_count(ngx_str_t *value); |
166 ngx_int_t ngx_http_script_compile(ngx_http_script_compile_t *sc); | |
623 | 167 u_char *ngx_http_script_run(ngx_http_request_t *r, ngx_str_t *value, |
168 void *code_lengths, size_t reserved, void *code_values); | |
573 | 169 void ngx_http_script_flush_no_cachable_variables(ngx_http_request_t *r, |
170 ngx_array_t *indices); | |
509 | 171 |
172 void *ngx_http_script_start_code(ngx_pool_t *pool, ngx_array_t **codes, | |
173 size_t size); | |
174 void *ngx_http_script_add_code(ngx_array_t *codes, size_t size, void *code); | |
507 | 175 |
509 | 176 size_t ngx_http_script_copy_len_code(ngx_http_script_engine_t *e); |
177 void ngx_http_script_copy_code(ngx_http_script_engine_t *e); | |
178 size_t ngx_http_script_copy_var_len_code(ngx_http_script_engine_t *e); | |
179 void ngx_http_script_copy_var_code(ngx_http_script_engine_t *e); | |
180 size_t ngx_http_script_copy_capture_len_code(ngx_http_script_engine_t *e); | |
181 void ngx_http_script_copy_capture_code(ngx_http_script_engine_t *e); | |
517 | 182 void ngx_http_script_start_args_code(ngx_http_script_engine_t *e); |
183 #if (NGX_PCRE) | |
509 | 184 void ngx_http_script_regex_start_code(ngx_http_script_engine_t *e); |
185 void ngx_http_script_regex_end_code(ngx_http_script_engine_t *e); | |
517 | 186 #endif |
509 | 187 void ngx_http_script_return_code(ngx_http_script_engine_t *e); |
527 | 188 void ngx_http_script_break_code(ngx_http_script_engine_t *e); |
509 | 189 void ngx_http_script_if_code(ngx_http_script_engine_t *e); |
577 | 190 void ngx_http_script_equal_code(ngx_http_script_engine_t *e); |
191 void ngx_http_script_not_equal_code(ngx_http_script_engine_t *e); | |
631 | 192 void ngx_http_script_file_code(ngx_http_script_engine_t *e); |
515 | 193 void ngx_http_script_complex_value_code(ngx_http_script_engine_t *e); |
509 | 194 void ngx_http_script_value_code(ngx_http_script_engine_t *e); |
195 void ngx_http_script_set_var_code(ngx_http_script_engine_t *e); | |
196 void ngx_http_script_var_code(ngx_http_script_engine_t *e); | |
197 void ngx_http_script_nop_code(ngx_http_script_engine_t *e); | |
99
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
198 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
199 |
a059e1aa65d4
nginx-0.0.1-2003-06-02-19:24:30 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
200 #endif /* _NGX_HTTP_SCRIPT_H_INCLUDED_ */ |