Mercurial > hg > nginx-quic
annotate src/imap/ngx_imap.h @ 646:f198dec3e3af
release-0.3.44 tag
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Thu, 04 May 2006 15:32:46 +0000 |
parents | 5e8fb59c18c1 |
children | 6d5c1535bb9d |
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; | |
86 ngx_str_t imap_capability; | |
87 ngx_str_t imap_starttls_capability; | |
88 ngx_str_t imap_starttls_only_capability; | |
527 | 89 |
583 | 90 ngx_array_t pop3_capabilities; |
91 ngx_array_t imap_capabilities; | |
527 | 92 |
521 | 93 /* server ctx */ |
641 | 94 ngx_imap_conf_ctx_t *ctx; |
521 | 95 } ngx_imap_core_srv_conf_t; |
96 | |
97 | |
98 typedef struct { | |
583 | 99 void *(*create_main_conf)(ngx_conf_t *cf); |
100 char *(*init_main_conf)(ngx_conf_t *cf, void *conf); | |
521 | 101 |
583 | 102 void *(*create_srv_conf)(ngx_conf_t *cf); |
103 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, | |
104 void *conf); | |
521 | 105 } 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
|
106 |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
107 |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
108 typedef enum { |
527 | 109 ngx_imap_start = 0, |
110 ngx_imap_login, | |
111 ngx_imap_user, | |
112 ngx_imap_passwd, | |
113 } ngx_imap_state_e; | |
114 | |
115 | |
116 typedef enum { | |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
117 ngx_pop3_start = 0, |
527 | 118 ngx_pop3_user, |
119 ngx_pop3_passwd | |
120 } 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
|
121 |
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
122 |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
123 typedef struct { |
521 | 124 ngx_peer_connection_t upstream; |
125 ngx_buf_t *buffer; | |
126 } ngx_imap_proxy_ctx_t; | |
127 | |
128 | |
129 typedef struct { | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
130 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
|
131 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
132 ngx_connection_t *connection; |
521 | 133 |
539 | 134 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
|
135 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
|
136 |
521 | 137 void **ctx; |
138 void **main_conf; | |
139 void **srv_conf; | |
140 | |
141 ngx_imap_proxy_ctx_t *proxy; | |
142 | |
527 | 143 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
|
144 |
539 | 145 unsigned blocked:1; |
146 unsigned quit:1; | |
521 | 147 unsigned protocol:1; |
527 | 148 unsigned quoted:1; |
543 | 149 unsigned backslash:1; |
150 unsigned no_sync_literal:1; | |
641 | 151 unsigned starttls:1; |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
152 |
422
edaefb2a20fc
nginx-0.0.10-2004-09-12-00:22:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
421
diff
changeset
|
153 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
|
154 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
|
155 |
527 | 156 ngx_str_t tag; |
539 | 157 ngx_str_t tagged_line; |
527 | 158 |
641 | 159 ngx_str_t *addr_text; |
160 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
161 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
|
162 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
|
163 |
527 | 164 ngx_uint_t login_attempt; |
165 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
166 /* 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
|
167 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
168 ngx_uint_t state; |
527 | 169 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
|
170 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
|
171 u_char *arg_end; |
527 | 172 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
|
173 } 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
|
174 |
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
175 |
541 | 176 typedef struct { |
583 | 177 ngx_str_t *client; |
178 ngx_imap_session_t *session; | |
541 | 179 } ngx_imap_log_ctx_t; |
180 | |
181 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
182 #define NGX_POP3_USER 1 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
183 #define NGX_POP3_PASS 2 |
527 | 184 #define NGX_POP3_CAPA 3 |
185 #define NGX_POP3_QUIT 4 | |
186 #define NGX_POP3_NOOP 5 | |
583 | 187 #define NGX_POP3_STLS 6 |
188 #define NGX_POP3_APOP 7 | |
189 #define NGX_POP3_STAT 8 | |
190 #define NGX_POP3_LIST 9 | |
191 #define NGX_POP3_RETR 10 | |
192 #define NGX_POP3_DELE 11 | |
193 #define NGX_POP3_RSET 12 | |
194 #define NGX_POP3_TOP 13 | |
195 #define NGX_POP3_UIDL 14 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
196 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
197 |
527 | 198 #define NGX_IMAP_LOGIN 1 |
199 #define NGX_IMAP_LOGOUT 2 | |
200 #define NGX_IMAP_CAPABILITY 3 | |
201 #define NGX_IMAP_NOOP 4 | |
583 | 202 #define NGX_IMAP_STARTTLS 5 |
527 | 203 |
583 | 204 #define NGX_IMAP_NEXT 6 |
527 | 205 |
206 | |
207 #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
|
208 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
209 |
424
84c527908237
nginx-0.0.10-2004-09-14-09:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
210 #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
|
211 |
521 | 212 #define NGX_IMAP_MAIN_CONF 0x02000000 |
213 #define NGX_IMAP_SRV_CONF 0x04000000 | |
214 | |
215 | |
216 #define NGX_IMAP_MAIN_CONF_OFFSET offsetof(ngx_imap_conf_ctx_t, main_conf) | |
217 #define NGX_IMAP_SRV_CONF_OFFSET offsetof(ngx_imap_conf_ctx_t, srv_conf) | |
218 | |
219 | |
220 #define ngx_imap_get_module_ctx(s, module) (s)->ctx[module.ctx_index] | |
221 #define ngx_imap_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; | |
222 #define ngx_imap_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; | |
223 | |
224 | |
225 #define ngx_imap_get_module_main_conf(s, module) \ | |
226 (s)->main_conf[module.ctx_index] | |
227 #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
|
228 |
641 | 229 #define ngx_imap_conf_get_module_main_conf(cf, module) \ |
230 ((ngx_imap_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] | |
231 | |
423
fda5987b188d
nginx-0.0.10-2004-09-13-20:18:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
422
diff
changeset
|
232 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
233 void ngx_imap_init_connection(ngx_connection_t *c); |
539 | 234 void ngx_imap_send(ngx_event_t *wev); |
527 | 235 void ngx_imap_auth_state(ngx_event_t *rev); |
236 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
|
237 void ngx_imap_close_connection(ngx_connection_t *c); |
525 | 238 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
|
239 |
527 | 240 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
|
241 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
|
242 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
243 |
521 | 244 /* STUB */ |
245 void ngx_imap_proxy_init(ngx_imap_session_t *s, ngx_peers_t *peers); | |
246 void ngx_imap_auth_http_init(ngx_imap_session_t *s); | |
247 /**/ | |
248 | |
249 | |
250 extern ngx_uint_t ngx_imap_max_module; | |
251 extern ngx_module_t ngx_imap_core_module; | |
252 | |
253 | |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
254 #endif /* _NGX_IMAP_H_INCLUDED_ */ |