Mercurial > hg > nginx-quic
annotate src/mail/ngx_mail.h @ 3163:34cbd6e86218
handle short pwrite() to log an error cause: ENOSPC, EDQUOT, or EFBIG
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Fri, 25 Sep 2009 13:55:46 +0000 |
parents | a96a8c916b0c |
children | f0d596e84634 |
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 |
1136 | 7 #ifndef _NGX_MAIL_H_INCLUDED_ |
8 #define _NGX_MAIL_H_INCLUDED_ | |
417
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 |
1136 | 16 #if (NGX_MAIL_SSL) |
17 #include <ngx_mail_ssl_module.h> | |
539 | 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; | |
1136 | 25 } ngx_mail_conf_ctx_t; |
521 | 26 |
27 | |
28 typedef struct { | |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
29 u_char sockaddr[NGX_SOCKADDRLEN]; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
30 socklen_t socklen; |
641 | 31 |
32 /* server ctx */ | |
1136 | 33 ngx_mail_conf_ctx_t *ctx; |
641 | 34 |
35 unsigned bind:1; | |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
36 unsigned wildcard:1; |
2224 | 37 #if (NGX_MAIL_SSL) |
38 unsigned ssl:1; | |
39 #endif | |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
40 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
41 unsigned ipv6only:2; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
42 #endif |
1136 | 43 } ngx_mail_listen_t; |
641 | 44 |
45 | |
46 typedef struct { | |
1136 | 47 ngx_mail_conf_ctx_t *ctx; |
641 | 48 ngx_str_t addr_text; |
2224 | 49 #if (NGX_MAIL_SSL) |
50 ngx_uint_t ssl; /* unsigned ssl:1; */ | |
51 #endif | |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
52 } ngx_mail_addr_conf_t; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
53 |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
54 typedef struct { |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
55 in_addr_t addr; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
56 ngx_mail_addr_conf_t conf; |
1136 | 57 } ngx_mail_in_addr_t; |
641 | 58 |
59 | |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
60 #if (NGX_HAVE_INET6) |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
61 |
641 | 62 typedef struct { |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
63 struct in6_addr addr6; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
64 ngx_mail_addr_conf_t conf; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
65 } ngx_mail_in6_addr_t; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
66 |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
67 #endif |
641 | 68 |
69 | |
70 typedef struct { | |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
71 /* ngx_mail_in_addr_t or ngx_mail_in6_addr_t */ |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
72 void *addrs; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
73 ngx_uint_t naddrs; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
74 } ngx_mail_port_t; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
75 |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
76 |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
77 typedef struct { |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
78 int family; |
641 | 79 in_port_t port; |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
80 ngx_array_t addrs; /* array of ngx_mail_conf_addr_t */ |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
81 } ngx_mail_conf_port_t; |
641 | 82 |
83 | |
84 typedef struct { | |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
85 struct sockaddr *sockaddr; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
86 socklen_t socklen; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
87 |
1136 | 88 ngx_mail_conf_ctx_t *ctx; |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
89 |
641 | 90 unsigned bind:1; |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
91 unsigned wildcard:1; |
2224 | 92 #if (NGX_MAIL_SSL) |
93 unsigned ssl:1; | |
94 #endif | |
2855
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
95 #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY) |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
96 unsigned ipv6only:2; |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
97 #endif |
a96a8c916b0c
mail proxy listen IPv6 support
Igor Sysoev <igor@sysoev.ru>
parents:
2497
diff
changeset
|
98 } ngx_mail_conf_addr_t; |
641 | 99 |
100 | |
101 typedef struct { | |
1136 | 102 ngx_array_t servers; /* ngx_mail_core_srv_conf_t */ |
103 ngx_array_t listen; /* ngx_mail_listen_t */ | |
104 } ngx_mail_core_main_conf_t; | |
521 | 105 |
106 | |
1136 | 107 #define NGX_MAIL_POP3_PROTOCOL 0 |
108 #define NGX_MAIL_IMAP_PROTOCOL 1 | |
109 #define NGX_MAIL_SMTP_PROTOCOL 2 | |
521 | 110 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
111 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
112 typedef struct ngx_mail_protocol_s ngx_mail_protocol_t; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
113 |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
114 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
115 typedef struct { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
116 ngx_mail_protocol_t *protocol; |
521 | 117 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
118 ngx_msec_t timeout; |
1892
057d362ee50e
resolver in smtp proxy module
Igor Sysoev <igor@sysoev.ru>
parents:
1673
diff
changeset
|
119 ngx_msec_t resolver_timeout; |
521 | 120 |
587 | 121 ngx_flag_t so_keepalive; |
122 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
123 ngx_str_t server_name; |
527 | 124 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
125 u_char *file_name; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
126 ngx_int_t line; |
527 | 127 |
1892
057d362ee50e
resolver in smtp proxy module
Igor Sysoev <igor@sysoev.ru>
parents:
1673
diff
changeset
|
128 ngx_resolver_t *resolver; |
057d362ee50e
resolver in smtp proxy module
Igor Sysoev <igor@sysoev.ru>
parents:
1673
diff
changeset
|
129 |
521 | 130 /* server ctx */ |
1136 | 131 ngx_mail_conf_ctx_t *ctx; |
132 } ngx_mail_core_srv_conf_t; | |
521 | 133 |
134 | |
527 | 135 typedef enum { |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
136 ngx_pop3_start = 0, |
527 | 137 ngx_pop3_user, |
809 | 138 ngx_pop3_passwd, |
139 ngx_pop3_auth_login_username, | |
140 ngx_pop3_auth_login_password, | |
141 ngx_pop3_auth_plain, | |
142 ngx_pop3_auth_cram_md5 | |
1673 | 143 } ngx_pop3_state_e; |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
144 |
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
145 |
1136 | 146 typedef enum { |
147 ngx_imap_start = 0, | |
1323 | 148 ngx_imap_auth_login_username, |
149 ngx_imap_auth_login_password, | |
150 ngx_imap_auth_plain, | |
151 ngx_imap_auth_cram_md5, | |
1136 | 152 ngx_imap_login, |
153 ngx_imap_user, | |
154 ngx_imap_passwd | |
155 } ngx_imap_state_e; | |
156 | |
157 | |
158 typedef enum { | |
159 ngx_smtp_start = 0, | |
160 ngx_smtp_auth_login_username, | |
161 ngx_smtp_auth_login_password, | |
162 ngx_smtp_auth_plain, | |
163 ngx_smtp_auth_cram_md5, | |
164 ngx_smtp_helo, | |
2309 | 165 ngx_smtp_helo_xclient, |
166 ngx_smtp_helo_from, | |
167 ngx_smtp_xclient, | |
168 ngx_smtp_xclient_from, | |
2497 | 169 ngx_smtp_xclient_helo, |
2309 | 170 ngx_smtp_from, |
171 ngx_smtp_to | |
1136 | 172 } ngx_smtp_state_e; |
173 | |
174 | |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
175 typedef struct { |
521 | 176 ngx_peer_connection_t upstream; |
177 ngx_buf_t *buffer; | |
1136 | 178 } ngx_mail_proxy_ctx_t; |
521 | 179 |
180 | |
181 typedef struct { | |
1136 | 182 uint32_t signature; /* "MAIL" */ |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
183 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
184 ngx_connection_t *connection; |
521 | 185 |
539 | 186 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
|
187 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
|
188 |
521 | 189 void **ctx; |
190 void **main_conf; | |
191 void **srv_conf; | |
192 | |
1892
057d362ee50e
resolver in smtp proxy module
Igor Sysoev <igor@sysoev.ru>
parents:
1673
diff
changeset
|
193 ngx_resolver_ctx_t *resolver_ctx; |
057d362ee50e
resolver in smtp proxy module
Igor Sysoev <igor@sysoev.ru>
parents:
1673
diff
changeset
|
194 |
1136 | 195 ngx_mail_proxy_ctx_t *proxy; |
521 | 196 |
1136 | 197 ngx_uint_t mail_state; |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
198 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
199 unsigned protocol:3; |
539 | 200 unsigned blocked:1; |
201 unsigned quit:1; | |
527 | 202 unsigned quoted:1; |
543 | 203 unsigned backslash:1; |
204 unsigned no_sync_literal:1; | |
641 | 205 unsigned starttls:1; |
1136 | 206 unsigned esmtp:1; |
2309 | 207 unsigned auth_method:3; |
883 | 208 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
|
209 |
422
edaefb2a20fc
nginx-0.0.10-2004-09-12-00:22:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
421
diff
changeset
|
210 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
|
211 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
|
212 |
800 | 213 ngx_str_t salt; |
527 | 214 ngx_str_t tag; |
539 | 215 ngx_str_t tagged_line; |
1476
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
216 ngx_str_t text; |
527 | 217 |
641 | 218 ngx_str_t *addr_text; |
1892
057d362ee50e
resolver in smtp proxy module
Igor Sysoev <igor@sysoev.ru>
parents:
1673
diff
changeset
|
219 ngx_str_t host; |
1136 | 220 ngx_str_t smtp_helo; |
2309 | 221 ngx_str_t smtp_from; |
222 ngx_str_t smtp_to; | |
641 | 223 |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
224 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
|
225 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
|
226 |
527 | 227 ngx_uint_t login_attempt; |
228 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
229 /* used to parse POP3/IMAP/SMTP command */ |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
230 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
231 ngx_uint_t state; |
527 | 232 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
|
233 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
|
234 u_char *arg_end; |
527 | 235 ngx_uint_t literal_len; |
1136 | 236 } ngx_mail_session_t; |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
237 |
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
238 |
541 | 239 typedef struct { |
583 | 240 ngx_str_t *client; |
1136 | 241 ngx_mail_session_t *session; |
242 } ngx_mail_log_ctx_t; | |
541 | 243 |
244 | |
1323 | 245 #define NGX_POP3_USER 1 |
246 #define NGX_POP3_PASS 2 | |
247 #define NGX_POP3_CAPA 3 | |
248 #define NGX_POP3_QUIT 4 | |
249 #define NGX_POP3_NOOP 5 | |
250 #define NGX_POP3_STLS 6 | |
251 #define NGX_POP3_APOP 7 | |
252 #define NGX_POP3_AUTH 8 | |
253 #define NGX_POP3_STAT 9 | |
254 #define NGX_POP3_LIST 10 | |
255 #define NGX_POP3_RETR 11 | |
256 #define NGX_POP3_DELE 12 | |
257 #define NGX_POP3_RSET 13 | |
258 #define NGX_POP3_TOP 14 | |
259 #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
|
260 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
261 |
1323 | 262 #define NGX_IMAP_LOGIN 1 |
263 #define NGX_IMAP_LOGOUT 2 | |
264 #define NGX_IMAP_CAPABILITY 3 | |
265 #define NGX_IMAP_NOOP 4 | |
266 #define NGX_IMAP_STARTTLS 5 | |
800 | 267 |
1323 | 268 #define NGX_IMAP_NEXT 6 |
269 | |
270 #define NGX_IMAP_AUTHENTICATE 7 | |
527 | 271 |
800 | 272 |
1323 | 273 #define NGX_SMTP_HELO 1 |
274 #define NGX_SMTP_EHLO 2 | |
275 #define NGX_SMTP_AUTH 3 | |
276 #define NGX_SMTP_QUIT 4 | |
277 #define NGX_SMTP_NOOP 5 | |
278 #define NGX_SMTP_MAIL 6 | |
279 #define NGX_SMTP_RSET 7 | |
280 #define NGX_SMTP_RCPT 8 | |
281 #define NGX_SMTP_DATA 9 | |
282 #define NGX_SMTP_VRFY 10 | |
283 #define NGX_SMTP_EXPN 11 | |
284 #define NGX_SMTP_HELP 12 | |
285 #define NGX_SMTP_STARTTLS 13 | |
527 | 286 |
287 | |
2495
a59b26eee816
compatibility with Microsoft's
Igor Sysoev <igor@sysoev.ru>
parents:
2309
diff
changeset
|
288 #define NGX_MAIL_AUTH_PLAIN 0 |
a59b26eee816
compatibility with Microsoft's
Igor Sysoev <igor@sysoev.ru>
parents:
2309
diff
changeset
|
289 #define NGX_MAIL_AUTH_LOGIN 1 |
a59b26eee816
compatibility with Microsoft's
Igor Sysoev <igor@sysoev.ru>
parents:
2309
diff
changeset
|
290 #define NGX_MAIL_AUTH_LOGIN_USERNAME 2 |
a59b26eee816
compatibility with Microsoft's
Igor Sysoev <igor@sysoev.ru>
parents:
2309
diff
changeset
|
291 #define NGX_MAIL_AUTH_APOP 3 |
a59b26eee816
compatibility with Microsoft's
Igor Sysoev <igor@sysoev.ru>
parents:
2309
diff
changeset
|
292 #define NGX_MAIL_AUTH_CRAM_MD5 4 |
a59b26eee816
compatibility with Microsoft's
Igor Sysoev <igor@sysoev.ru>
parents:
2309
diff
changeset
|
293 #define NGX_MAIL_AUTH_NONE 5 |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
294 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
295 |
1136 | 296 #define NGX_MAIL_AUTH_PLAIN_ENABLED 0x0002 |
297 #define NGX_MAIL_AUTH_LOGIN_ENABLED 0x0004 | |
298 #define NGX_MAIL_AUTH_APOP_ENABLED 0x0008 | |
299 #define NGX_MAIL_AUTH_CRAM_MD5_ENABLED 0x0010 | |
2309 | 300 #define NGX_MAIL_AUTH_NONE_ENABLED 0x0020 |
521 | 301 |
302 | |
1136 | 303 #define NGX_MAIL_PARSE_INVALID_COMMAND 20 |
521 | 304 |
305 | |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
306 typedef void (*ngx_mail_init_session_pt)(ngx_mail_session_t *s, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
307 ngx_connection_t *c); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
308 typedef void (*ngx_mail_init_protocol_pt)(ngx_event_t *rev); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
309 typedef void (*ngx_mail_auth_state_pt)(ngx_event_t *rev); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
310 typedef ngx_int_t (*ngx_mail_parse_command_pt)(ngx_mail_session_t *s); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
311 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
312 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
313 struct ngx_mail_protocol_s { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
314 ngx_str_t name; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
315 in_port_t port[4]; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
316 ngx_uint_t type; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
317 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
318 ngx_mail_init_session_pt init_session; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
319 ngx_mail_init_protocol_pt init_protocol; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
320 ngx_mail_parse_command_pt parse_command; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
321 ngx_mail_auth_state_pt auth_state; |
1136 | 322 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
323 ngx_str_t internal_server_error; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
324 }; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
325 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
326 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
327 typedef struct { |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
328 ngx_mail_protocol_t *protocol; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
329 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
330 void *(*create_main_conf)(ngx_conf_t *cf); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
331 char *(*init_main_conf)(ngx_conf_t *cf, void *conf); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
332 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
333 void *(*create_srv_conf)(ngx_conf_t *cf); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
334 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
335 void *conf); |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
336 } ngx_mail_module_t; |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
337 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
338 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
339 #define NGX_MAIL_MODULE 0x4C49414D /* "MAIL" */ |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
340 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
341 #define NGX_MAIL_MAIN_CONF 0x02000000 |
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
342 #define NGX_MAIL_SRV_CONF 0x04000000 |
1136 | 343 |
344 | |
345 #define NGX_MAIL_MAIN_CONF_OFFSET offsetof(ngx_mail_conf_ctx_t, main_conf) | |
346 #define NGX_MAIL_SRV_CONF_OFFSET offsetof(ngx_mail_conf_ctx_t, srv_conf) | |
347 | |
348 | |
349 #define ngx_mail_get_module_ctx(s, module) (s)->ctx[module.ctx_index] | |
350 #define ngx_mail_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; | |
351 #define ngx_mail_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; | |
521 | 352 |
353 | |
1136 | 354 #define ngx_mail_get_module_main_conf(s, module) \ |
521 | 355 (s)->main_conf[module.ctx_index] |
1136 | 356 #define ngx_mail_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
|
357 |
1136 | 358 #define ngx_mail_conf_get_module_main_conf(cf, module) \ |
359 ((ngx_mail_conf_ctx_t *) cf->ctx)->main_conf[module.ctx_index] | |
1322 | 360 #define ngx_mail_conf_get_module_srv_conf(cf, module) \ |
361 ((ngx_mail_conf_ctx_t *) cf->ctx)->srv_conf[module.ctx_index] | |
641 | 362 |
1476
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
363 |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
364 #if (NGX_MAIL_SSL) |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
365 void ngx_mail_starttls_handler(ngx_event_t *rev); |
1479 | 366 ngx_int_t ngx_mail_starttls_only(ngx_mail_session_t *s, ngx_connection_t *c); |
1476
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
367 #endif |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
368 |
423
fda5987b188d
nginx-0.0.10-2004-09-13-20:18:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
422
diff
changeset
|
369 |
1136 | 370 void ngx_mail_init_connection(ngx_connection_t *c); |
1476
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
371 |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
372 ngx_int_t ngx_mail_salt(ngx_mail_session_t *s, ngx_connection_t *c, |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
373 ngx_mail_core_srv_conf_t *cscf); |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
374 ngx_int_t ngx_mail_auth_plain(ngx_mail_session_t *s, ngx_connection_t *c, |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
375 ngx_uint_t n); |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
376 ngx_int_t ngx_mail_auth_login_username(ngx_mail_session_t *s, |
2495
a59b26eee816
compatibility with Microsoft's
Igor Sysoev <igor@sysoev.ru>
parents:
2309
diff
changeset
|
377 ngx_connection_t *c, ngx_uint_t n); |
1476
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
378 ngx_int_t ngx_mail_auth_login_password(ngx_mail_session_t *s, |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
379 ngx_connection_t *c); |
1479 | 380 ngx_int_t ngx_mail_auth_cram_md5_salt(ngx_mail_session_t *s, |
381 ngx_connection_t *c, char *prefix, size_t len); | |
1476
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
382 ngx_int_t ngx_mail_auth_cram_md5(ngx_mail_session_t *s, ngx_connection_t *c); |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
383 ngx_int_t ngx_mail_auth_parse(ngx_mail_session_t *s, ngx_connection_t *c); |
1476
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
384 |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
385 void ngx_mail_send(ngx_event_t *wev); |
1482 | 386 ngx_int_t ngx_mail_read_command(ngx_mail_session_t *s, ngx_connection_t *c); |
387 void ngx_mail_auth(ngx_mail_session_t *s, ngx_connection_t *c); | |
1136 | 388 void ngx_mail_close_connection(ngx_connection_t *c); |
389 void ngx_mail_session_internal_server_error(ngx_mail_session_t *s); | |
1476
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
390 u_char *ngx_mail_log_error(ngx_log_t *log, u_char *buf, size_t len); |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
391 |
67578e966dcc
split pop3, imap, and smtp handlers
Igor Sysoev <igor@sysoev.ru>
parents:
1323
diff
changeset
|
392 |
1487
f69493e8faab
ngx_mail_pop3_module, ngx_mail_imap_module, and ngx_mail_smtp_module
Igor Sysoev <igor@sysoev.ru>
parents:
1482
diff
changeset
|
393 char *ngx_mail_capabilities(ngx_conf_t *cf, ngx_command_t *cmd, void *conf); |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
394 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
395 |
521 | 396 /* STUB */ |
1136 | 397 void ngx_mail_proxy_init(ngx_mail_session_t *s, ngx_peer_addr_t *peer); |
398 void ngx_mail_auth_http_init(ngx_mail_session_t *s); | |
521 | 399 /**/ |
400 | |
401 | |
1136 | 402 extern ngx_uint_t ngx_mail_max_module; |
403 extern ngx_module_t ngx_mail_core_module; | |
521 | 404 |
405 | |
1136 | 406 #endif /* _NGX_MAIL_H_INCLUDED_ */ |