Mercurial > hg > nginx-quic
annotate src/imap/ngx_imap.h @ 935:db8e718447f1
use light-weight sync on ppc64
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 19 Dec 2006 15:23:20 +0000 |
parents | 4d68c486fcb0 |
children |
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:
424
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:
424
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:
424
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:
424
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:
424
diff
changeset
|
6 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
7 #ifndef _NGX_IMAP_H_INCLUDED_ |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
8 #define _NGX_IMAP_H_INCLUDED_ |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
9 |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
10 |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
11 #include <ngx_config.h> |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
12 #include <ngx_core.h> |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
13 #include <ngx_event.h> |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
14 #include <ngx_event_connect.h> |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
15 |
539 | 16 #if (NGX_IMAP_SSL) |
17 #include <ngx_imap_ssl_module.h> | |
18 #endif | |
19 | |
20 | |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
21 |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
22 typedef struct { |
583 | 23 void **main_conf; |
24 void **srv_conf; | |
521 | 25 } ngx_imap_conf_ctx_t; |
26 | |
27 | |
28 typedef struct { | |
641 | 29 in_addr_t addr; |
30 in_port_t port; | |
31 int family; | |
32 | |
33 /* server ctx */ | |
34 ngx_imap_conf_ctx_t *ctx; | |
35 | |
36 unsigned bind:1; | |
37 } ngx_imap_listen_t; | |
38 | |
39 | |
40 typedef struct { | |
41 in_addr_t addr; | |
42 ngx_imap_conf_ctx_t *ctx; | |
43 ngx_str_t addr_text; | |
44 } ngx_imap_in_addr_t; | |
45 | |
46 | |
47 typedef struct { | |
48 ngx_imap_in_addr_t *addrs; /* array of ngx_imap_in_addr_t */ | |
49 ngx_uint_t naddrs; | |
50 } ngx_imap_in_port_t; | |
51 | |
52 | |
53 typedef struct { | |
54 in_port_t port; | |
55 ngx_array_t addrs; /* array of ngx_imap_conf_in_addr_t */ | |
56 } ngx_imap_conf_in_port_t; | |
57 | |
58 | |
59 typedef struct { | |
60 in_addr_t addr; | |
61 ngx_imap_conf_ctx_t *ctx; | |
62 unsigned bind:1; | |
63 } ngx_imap_conf_in_addr_t; | |
64 | |
65 | |
66 typedef struct { | |
67 ngx_array_t servers; /* ngx_imap_core_srv_conf_t */ | |
68 ngx_array_t listen; /* ngx_imap_listen_t */ | |
521 | 69 } ngx_imap_core_main_conf_t; |
70 | |
71 | |
72 #define NGX_IMAP_POP3_PROTOCOL 0 | |
73 #define NGX_IMAP_IMAP_PROTOCOL 1 | |
74 | |
75 typedef struct { | |
583 | 76 ngx_msec_t timeout; |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
77 |
583 | 78 size_t imap_client_buffer_size; |
521 | 79 |
583 | 80 ngx_uint_t protocol; |
521 | 81 |
587 | 82 ngx_flag_t so_keepalive; |
83 | |
583 | 84 ngx_str_t pop3_capability; |
85 ngx_str_t pop3_starttls_capability; | |
809 | 86 ngx_str_t pop3_auth_capability; |
87 | |
583 | 88 ngx_str_t imap_capability; |
89 ngx_str_t imap_starttls_capability; | |
90 ngx_str_t imap_starttls_only_capability; | |
527 | 91 |
800 | 92 ngx_str_t server_name; |
93 | |
94 ngx_uint_t auth_methods; | |
95 | |
583 | 96 ngx_array_t pop3_capabilities; |
97 ngx_array_t imap_capabilities; | |
527 | 98 |
521 | 99 /* server ctx */ |
641 | 100 ngx_imap_conf_ctx_t *ctx; |
521 | 101 } ngx_imap_core_srv_conf_t; |
102 | |
103 | |
104 typedef struct { | |
583 | 105 void *(*create_main_conf)(ngx_conf_t *cf); |
106 char *(*init_main_conf)(ngx_conf_t *cf, void *conf); | |
521 | 107 |
583 | 108 void *(*create_srv_conf)(ngx_conf_t *cf); |
109 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, | |
110 void *conf); | |
521 | 111 } ngx_imap_module_t; |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
112 |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
113 |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
114 typedef enum { |
527 | 115 ngx_imap_start = 0, |
116 ngx_imap_login, | |
117 ngx_imap_user, | |
663 | 118 ngx_imap_passwd |
527 | 119 } ngx_imap_state_e; |
120 | |
121 | |
122 typedef enum { | |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
123 ngx_pop3_start = 0, |
527 | 124 ngx_pop3_user, |
809 | 125 ngx_pop3_passwd, |
126 ngx_pop3_auth_login_username, | |
127 ngx_pop3_auth_login_password, | |
128 ngx_pop3_auth_plain, | |
129 ngx_pop3_auth_cram_md5 | |
527 | 130 } ngx_po3_state_e; |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
131 |
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
132 |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
133 typedef struct { |
521 | 134 ngx_peer_connection_t upstream; |
135 ngx_buf_t *buffer; | |
136 } ngx_imap_proxy_ctx_t; | |
137 | |
138 | |
139 typedef struct { | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
140 uint32_t signature; /* "IMAP" */ |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
141 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
142 ngx_connection_t *connection; |
521 | 143 |
539 | 144 ngx_str_t out; |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
145 ngx_buf_t *buffer; |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
146 |
521 | 147 void **ctx; |
148 void **main_conf; | |
149 void **srv_conf; | |
150 | |
151 ngx_imap_proxy_ctx_t *proxy; | |
152 | |
527 | 153 ngx_uint_t imap_state; |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
154 |
539 | 155 unsigned blocked:1; |
156 unsigned quit:1; | |
521 | 157 unsigned protocol:1; |
527 | 158 unsigned quoted:1; |
543 | 159 unsigned backslash:1; |
160 unsigned no_sync_literal:1; | |
641 | 161 unsigned starttls:1; |
809 | 162 unsigned auth_method:2; |
883 | 163 unsigned auth_wait:1; |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
164 |
422
edaefb2a20fc
nginx-0.0.10-2004-09-12-00:22:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
421
diff
changeset
|
165 ngx_str_t login; |
edaefb2a20fc
nginx-0.0.10-2004-09-12-00:22:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
421
diff
changeset
|
166 ngx_str_t passwd; |
edaefb2a20fc
nginx-0.0.10-2004-09-12-00:22:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
421
diff
changeset
|
167 |
800 | 168 ngx_str_t salt; |
527 | 169 ngx_str_t tag; |
539 | 170 ngx_str_t tagged_line; |
527 | 171 |
641 | 172 ngx_str_t *addr_text; |
173 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
174 ngx_uint_t command; |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
175 ngx_array_t args; |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
176 |
527 | 177 ngx_uint_t login_attempt; |
178 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
179 /* used to parse IMAP/POP3 command */ |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
180 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
181 ngx_uint_t state; |
527 | 182 u_char *cmd_start; |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
183 u_char *arg_start; |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
184 u_char *arg_end; |
527 | 185 ngx_uint_t literal_len; |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
186 } ngx_imap_session_t; |
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
187 |
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
188 |
541 | 189 typedef struct { |
583 | 190 ngx_str_t *client; |
191 ngx_imap_session_t *session; | |
541 | 192 } ngx_imap_log_ctx_t; |
193 | |
194 | |
800 | 195 #define NGX_POP3_USER 1 |
196 #define NGX_POP3_PASS 2 | |
197 #define NGX_POP3_CAPA 3 | |
198 #define NGX_POP3_QUIT 4 | |
199 #define NGX_POP3_NOOP 5 | |
200 #define NGX_POP3_STLS 6 | |
201 #define NGX_POP3_APOP 7 | |
809 | 202 #define NGX_POP3_AUTH 8 |
203 #define NGX_POP3_STAT 9 | |
204 #define NGX_POP3_LIST 10 | |
205 #define NGX_POP3_RETR 11 | |
206 #define NGX_POP3_DELE 12 | |
207 #define NGX_POP3_RSET 13 | |
208 #define NGX_POP3_TOP 14 | |
209 #define NGX_POP3_UIDL 15 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
210 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
211 |
800 | 212 #define NGX_IMAP_LOGIN 1 |
213 #define NGX_IMAP_LOGOUT 2 | |
214 #define NGX_IMAP_CAPABILITY 3 | |
215 #define NGX_IMAP_NOOP 4 | |
216 #define NGX_IMAP_STARTTLS 5 | |
217 | |
218 #define NGX_IMAP_NEXT 6 | |
527 | 219 |
800 | 220 |
809 | 221 #define NGX_IMAP_AUTH_PLAIN 0 |
222 #define NGX_IMAP_AUTH_APOP 1 | |
223 #define NGX_IMAP_AUTH_CRAM_MD5 2 | |
800 | 224 |
225 | |
809 | 226 #define NGX_IMAP_AUTH_PLAIN_ENABLED 0x0002 |
227 #define NGX_IMAP_AUTH_APOP_ENABLED 0x0004 | |
228 #define NGX_IMAP_AUTH_CRAM_MD5_ENABLED 0x0008 | |
527 | 229 |
230 | |
231 #define NGX_IMAP_PARSE_INVALID_COMMAND 20 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
232 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
233 |
424
84c527908237
nginx-0.0.10-2004-09-14-09:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
234 #define NGX_IMAP_MODULE 0x50414D49 /* "IMAP" */ |
423
fda5987b188d
nginx-0.0.10-2004-09-13-20:18:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
422
diff
changeset
|
235 |
521 | 236 #define NGX_IMAP_MAIN_CONF 0x02000000 |
237 #define NGX_IMAP_SRV_CONF 0x04000000 | |
238 | |
239 | |
240 #define NGX_IMAP_MAIN_CONF_OFFSET offsetof(ngx_imap_conf_ctx_t, main_conf) | |
241 #define NGX_IMAP_SRV_CONF_OFFSET offsetof(ngx_imap_conf_ctx_t, srv_conf) | |
242 | |
243 | |
244 #define ngx_imap_get_module_ctx(s, module) (s)->ctx[module.ctx_index] | |
245 #define ngx_imap_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; | |
246 #define ngx_imap_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; | |
247 | |
248 | |
249 #define ngx_imap_get_module_main_conf(s, module) \ | |
250 (s)->main_conf[module.ctx_index] | |
251 #define ngx_imap_get_module_srv_conf(s, module) (s)->srv_conf[module.ctx_index] | |
423
fda5987b188d
nginx-0.0.10-2004-09-13-20:18:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
422
diff
changeset
|
252 |
641 | 253 #define ngx_imap_conf_get_module_main_conf(cf, module) \ |
254 ((ngx_imap_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] | |
255 | |
423
fda5987b188d
nginx-0.0.10-2004-09-13-20:18:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
422
diff
changeset
|
256 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
257 void ngx_imap_init_connection(ngx_connection_t *c); |
539 | 258 void ngx_imap_send(ngx_event_t *wev); |
527 | 259 void ngx_imap_auth_state(ngx_event_t *rev); |
260 void ngx_pop3_auth_state(ngx_event_t *rev); | |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
261 void ngx_imap_close_connection(ngx_connection_t *c); |
525 | 262 void ngx_imap_session_internal_server_error(ngx_imap_session_t *s); |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
263 |
527 | 264 ngx_int_t ngx_imap_parse_command(ngx_imap_session_t *s); |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
265 ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s); |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
266 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
267 |
521 | 268 /* STUB */ |
884 | 269 void ngx_imap_proxy_init(ngx_imap_session_t *s, ngx_peer_addr_t *peer); |
521 | 270 void ngx_imap_auth_http_init(ngx_imap_session_t *s); |
271 /**/ | |
272 | |
273 | |
274 extern ngx_uint_t ngx_imap_max_module; | |
275 extern ngx_module_t ngx_imap_core_module; | |
276 | |
277 | |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
278 #endif /* _NGX_IMAP_H_INCLUDED_ */ |