Mercurial > hg > nginx-quic
annotate src/core/ngx_resolver.h @ 1907:7d47e1681a62
add "root" to the fastcgi example to set correct included DOCUMENT_ROOT
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 28 Feb 2008 20:44:16 +0000 |
parents | 4a8c9139e579 |
children | c0f873458e2b |
rev | line source |
---|---|
1649 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
11 #ifndef _NGX_RESOLVER_H_INCLUDED_ | |
12 #define _NGX_RESOLVER_H_INCLUDED_ | |
13 | |
14 | |
15 #define NGX_RESOLVE_A 1 | |
16 #define NGX_RESOLVE_CNAME 5 | |
17 #define NGX_RESOLVE_PTR 12 | |
18 #define NGX_RESOLVE_MX 15 | |
19 #define NGX_RESOLVE_TXT 16 | |
20 | |
21 #define NGX_RESOLVE_FORMERR 1 | |
22 #define NGX_RESOLVE_SERVFAIL 2 | |
23 #define NGX_RESOLVE_NXDOMAIN 3 | |
24 #define NGX_RESOLVE_NOTIMP 4 | |
25 #define NGX_RESOLVE_REFUSED 5 | |
26 #define NGX_RESOLVE_TIMEDOUT NGX_ETIMEDOUT | |
27 | |
28 | |
1683
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1649
diff
changeset
|
29 #define NGX_NO_RESOLVER (void *) -1 |
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1649
diff
changeset
|
30 |
1e0b028055ec
allow to use IP addresses without defined resolver
Igor Sysoev <igor@sysoev.ru>
parents:
1649
diff
changeset
|
31 |
1649 | 32 typedef struct { |
33 ngx_connection_t *connection; | |
34 struct sockaddr *sockaddr; | |
35 socklen_t socklen; | |
36 ngx_str_t server; | |
37 ngx_log_t *log; | |
38 } ngx_udp_connection_t; | |
39 | |
40 | |
41 typedef struct ngx_resolver_ctx_s ngx_resolver_ctx_t; | |
42 | |
43 typedef void (*ngx_resolver_handler_pt)(ngx_resolver_ctx_t *ctx); | |
44 | |
45 | |
46 typedef struct { | |
47 ngx_rbtree_node_t node; | |
48 ngx_queue_t queue; | |
49 | |
50 /* PTR: resolved name, A: name to resolve */ | |
51 u_char *name; | |
52 | |
53 u_short nlen; | |
54 u_short qlen; | |
55 | |
56 u_char *query; | |
57 | |
58 union { | |
59 in_addr_t addr; | |
60 in_addr_t *addrs; | |
61 u_char *cname; | |
62 } u; | |
63 | |
64 u_short naddrs; | |
65 u_short cnlen; | |
66 | |
67 time_t expire; | |
68 time_t valid; | |
69 | |
70 ngx_resolver_ctx_t *waiting; | |
71 } ngx_resolver_node_t; | |
72 | |
73 | |
74 typedef struct { | |
75 /* has to be pointer because of "incomplete type" */ | |
76 ngx_event_t *event; | |
77 | |
78 /* TODO: DNS peers balancer */ | |
79 /* STUB */ | |
80 ngx_udp_connection_t *udp_connection; | |
81 | |
82 ngx_log_t *log; | |
83 | |
84 /* ident must be after 3 pointers */ | |
85 ngx_int_t ident; | |
86 | |
87 ngx_rbtree_t name_rbtree; | |
88 ngx_rbtree_node_t name_sentinel; | |
89 | |
90 ngx_rbtree_t addr_rbtree; | |
91 ngx_rbtree_node_t addr_sentinel; | |
92 | |
93 ngx_queue_t name_resend_queue; | |
94 ngx_queue_t addr_resend_queue; | |
95 | |
96 ngx_queue_t name_expire_queue; | |
97 ngx_queue_t addr_expire_queue; | |
98 | |
99 time_t resend_timeout; | |
100 time_t expire; | |
101 time_t valid; | |
102 | |
103 ngx_uint_t log_level; | |
104 } ngx_resolver_t; | |
105 | |
106 | |
107 struct ngx_resolver_ctx_s { | |
108 ngx_resolver_ctx_t *next; | |
109 ngx_resolver_t *resolver; | |
110 ngx_udp_connection_t *udp_connection; | |
111 | |
112 /* ident must be after 3 pointers */ | |
113 ngx_int_t ident; | |
114 | |
115 ngx_int_t state; | |
116 ngx_int_t type; | |
117 ngx_str_t name; | |
118 | |
119 ngx_uint_t naddrs; | |
120 in_addr_t *addrs; | |
121 in_addr_t addr; | |
122 | |
123 /* TODO: DNS peers balancer ctx */ | |
124 | |
125 ngx_resolver_handler_pt handler; | |
126 void *data; | |
127 ngx_msec_t timeout; | |
128 | |
129 ngx_uint_t quick; /* unsigned quick:1; */ | |
130 ngx_event_t *event; | |
131 }; | |
132 | |
133 | |
1906 | 134 ngx_resolver_t *ngx_resolver_create(ngx_pool_t *pool, ngx_peer_addr_t *addr); |
1649 | 135 ngx_resolver_ctx_t *ngx_resolve_start(ngx_resolver_t *r, |
136 ngx_resolver_ctx_t *temp); | |
137 ngx_int_t ngx_resolve_name(ngx_resolver_ctx_t *ctx); | |
138 void ngx_resolve_name_done(ngx_resolver_ctx_t *ctx); | |
139 ngx_int_t ngx_resolve_addr(ngx_resolver_ctx_t *ctx); | |
140 void ngx_resolve_addr_done(ngx_resolver_ctx_t *ctx); | |
141 char *ngx_resolver_strerror(ngx_int_t err); | |
142 | |
143 | |
144 #endif /* _NGX_RESOLVER_H_INCLUDED_ */ |