48
|
1
|
|
2 /*
|
|
3 * Copyright (C) Igor Sysoev
|
|
4 */
|
|
5
|
|
6
|
|
7 #ifndef _NGX_HTTP_VARIABLES_H_INCLUDED_
|
|
8 #define _NGX_HTTP_VARIABLES_H_INCLUDED_
|
|
9
|
|
10
|
|
11 #include <ngx_config.h>
|
|
12 #include <ngx_core.h>
|
|
13 #include <ngx_event.h>
|
|
14 #include <ngx_http.h>
|
|
15
|
|
16
|
58
|
17 #define NGX_HTTP_VAR_NOT_FOUND (ngx_http_variable_value_t *) -1
|
48
|
18
|
|
19
|
58
|
20 typedef struct {
|
48
|
21 ngx_uint_t value;
|
|
22 ngx_str_t text;
|
58
|
23 } ngx_http_variable_value_t;
|
48
|
24
|
|
25 typedef struct ngx_http_variable_s ngx_http_variable_t;
|
|
26
|
|
27 typedef ngx_http_variable_value_t *
|
50
|
28 (*ngx_http_get_variable_pt) (ngx_http_request_t *r, uintptr_t data);
|
48
|
29
|
|
30
|
58
|
31 #define NGX_HTTP_VAR_CHANGABLE 1
|
|
32 #define NGX_HTTP_VAR_NOCACHABLE 2
|
68
|
33 #define NGX_HTTP_VAR_INDEXED 4
|
58
|
34
|
|
35
|
48
|
36 struct ngx_http_variable_s {
|
58
|
37 ngx_str_t name; /* must be first to build the hash */
|
50
|
38 ngx_http_get_variable_pt handler;
|
|
39 uintptr_t data;
|
58
|
40 ngx_uint_t flags;
|
48
|
41 };
|
|
42
|
|
43
|
50
|
44 ngx_http_variable_t *ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name,
|
58
|
45 ngx_uint_t flags);
|
|
46 ngx_int_t ngx_http_get_variable_index(ngx_conf_t *cf, ngx_str_t *name);
|
48
|
47 ngx_http_variable_value_t *ngx_http_get_indexed_variable(ngx_http_request_t *r,
|
|
48 ngx_uint_t index);
|
|
49 ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r,
|
|
50 ngx_str_t *name);
|
58
|
51
|
|
52 ngx_int_t ngx_http_variables_add_core_vars(ngx_conf_t *cf);
|
|
53 ngx_int_t ngx_http_variables_init_vars(ngx_conf_t *cf);
|
48
|
54
|
|
55
|
|
56 #endif /* _NGX_HTTP_VARIABLES_H_INCLUDED_ */
|