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
|
|
17 #define NGX_HTTP_VARIABLE_NOT_FOUND (ngx_http_variable_value_t *) -1
|
|
18
|
|
19
|
|
20 typedef struct {
|
|
21 ngx_uint_t value;
|
|
22 ngx_str_t text;
|
|
23 } ngx_http_variable_value_t;
|
|
24
|
|
25
|
|
26 typedef struct ngx_http_variable_s ngx_http_variable_t;
|
|
27
|
|
28 typedef ngx_http_variable_value_t *
|
|
29 (*ngx_http_get_variable_pt) (ngx_http_request_t *r, void *var);
|
|
30
|
|
31
|
|
32 struct ngx_http_variable_s {
|
|
33 ngx_str_t name;
|
|
34 ngx_uint_t index;
|
|
35 ngx_http_get_variable_pt handler;
|
|
36 void *data;
|
|
37 ngx_uint_t uses;
|
|
38 };
|
|
39
|
|
40
|
|
41 typedef ngx_http_variable_value_t *
|
|
42 (*ngx_http_get_core_variable_pt) (ngx_http_request_t *r, uintptr_t data);
|
|
43
|
|
44 typedef struct {
|
|
45 ngx_str_t name;
|
|
46 ngx_http_get_core_variable_pt handler;
|
|
47 uintptr_t data;
|
|
48 } ngx_http_core_variable_t;
|
|
49
|
|
50
|
|
51 ngx_http_variable_t *ngx_http_add_variable(ngx_conf_t *cf);
|
|
52 ngx_int_t ngx_http_get_variable_index(ngx_http_core_main_conf_t *cmcf,
|
|
53 ngx_str_t *name);
|
|
54 ngx_http_variable_value_t *ngx_http_get_indexed_variable(ngx_http_request_t *r,
|
|
55 ngx_uint_t index);
|
|
56 ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r,
|
|
57 ngx_str_t *name);
|
|
58 ngx_int_t ngx_http_core_variables_init(ngx_cycle_t *cycle);
|
|
59
|
|
60
|
|
61 #endif /* _NGX_HTTP_VARIABLES_H_INCLUDED_ */
|