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