Mercurial > hg > nginx-quic
annotate src/imap/ngx_imap.h @ 588:0a2c30f516e6
release-0.3.15 tag
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Wed, 07 Dec 2005 14:51:31 +0000 |
parents | 284cc140593b |
children | 5e8fb59c18c1 |
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 { | |
583 | 29 ngx_array_t servers; /* ngx_imap_core_srv_conf_t */ |
521 | 30 } ngx_imap_core_main_conf_t; |
31 | |
32 | |
33 #define NGX_IMAP_POP3_PROTOCOL 0 | |
34 #define NGX_IMAP_IMAP_PROTOCOL 1 | |
35 | |
36 typedef struct { | |
583 | 37 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
|
38 |
583 | 39 size_t imap_client_buffer_size; |
521 | 40 |
583 | 41 ngx_uint_t protocol; |
521 | 42 |
587 | 43 ngx_flag_t so_keepalive; |
44 | |
583 | 45 ngx_str_t pop3_capability; |
46 ngx_str_t pop3_starttls_capability; | |
47 ngx_str_t imap_capability; | |
48 ngx_str_t imap_starttls_capability; | |
49 ngx_str_t imap_starttls_only_capability; | |
527 | 50 |
583 | 51 ngx_array_t pop3_capabilities; |
52 ngx_array_t imap_capabilities; | |
527 | 53 |
521 | 54 /* server ctx */ |
55 ngx_imap_conf_ctx_t *ctx; | |
56 } ngx_imap_core_srv_conf_t; | |
57 | |
58 | |
59 typedef struct { | |
583 | 60 void *(*create_main_conf)(ngx_conf_t *cf); |
61 char *(*init_main_conf)(ngx_conf_t *cf, void *conf); | |
521 | 62 |
583 | 63 void *(*create_srv_conf)(ngx_conf_t *cf); |
64 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, | |
65 void *conf); | |
521 | 66 } 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
|
67 |
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
68 |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
69 typedef enum { |
527 | 70 ngx_imap_start = 0, |
71 ngx_imap_login, | |
72 ngx_imap_user, | |
73 ngx_imap_passwd, | |
74 } ngx_imap_state_e; | |
75 | |
76 | |
77 typedef enum { | |
421
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
78 ngx_pop3_start = 0, |
527 | 79 ngx_pop3_user, |
80 ngx_pop3_passwd | |
81 } 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
|
82 |
01456a419cf9
nginx-0.0.10-2004-09-10-18:32:02 import
Igor Sysoev <igor@sysoev.ru>
parents:
419
diff
changeset
|
83 |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
84 typedef struct { |
521 | 85 ngx_peer_connection_t upstream; |
86 ngx_buf_t *buffer; | |
87 } ngx_imap_proxy_ctx_t; | |
88 | |
89 | |
90 typedef struct { | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
91 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
|
92 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
93 ngx_connection_t *connection; |
521 | 94 |
539 | 95 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
|
96 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
|
97 |
521 | 98 void **ctx; |
99 void **main_conf; | |
100 void **srv_conf; | |
101 | |
102 ngx_imap_proxy_ctx_t *proxy; | |
103 | |
527 | 104 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
|
105 |
539 | 106 unsigned blocked:1; |
107 unsigned quit:1; | |
521 | 108 unsigned protocol:1; |
527 | 109 unsigned quoted:1; |
543 | 110 unsigned backslash:1; |
111 unsigned no_sync_literal:1; | |
418
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
112 |
422
edaefb2a20fc
nginx-0.0.10-2004-09-12-00:22:11 import
Igor Sysoev <igor@sysoev.ru>
parents:
421
diff
changeset
|
113 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
|
114 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
|
115 |
527 | 116 ngx_str_t tag; |
539 | 117 ngx_str_t tagged_line; |
527 | 118 |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
119 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
|
120 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
|
121 |
527 | 122 ngx_uint_t login_attempt; |
123 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
124 /* 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
|
125 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
126 ngx_uint_t state; |
527 | 127 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
|
128 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
|
129 u_char *arg_end; |
527 | 130 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
|
131 } 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
|
132 |
cf072d26d6d6
nginx-0.0.10-2004-09-08-09:18:51 import
Igor Sysoev <igor@sysoev.ru>
parents:
417
diff
changeset
|
133 |
541 | 134 typedef struct { |
583 | 135 ngx_str_t *client; |
136 ngx_imap_session_t *session; | |
541 | 137 } ngx_imap_log_ctx_t; |
138 | |
139 | |
419
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
140 #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
|
141 #define NGX_POP3_PASS 2 |
527 | 142 #define NGX_POP3_CAPA 3 |
143 #define NGX_POP3_QUIT 4 | |
144 #define NGX_POP3_NOOP 5 | |
583 | 145 #define NGX_POP3_STLS 6 |
146 #define NGX_POP3_APOP 7 | |
147 #define NGX_POP3_STAT 8 | |
148 #define NGX_POP3_LIST 9 | |
149 #define NGX_POP3_RETR 10 | |
150 #define NGX_POP3_DELE 11 | |
151 #define NGX_POP3_RSET 12 | |
152 #define NGX_POP3_TOP 13 | |
153 #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
|
154 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
155 |
527 | 156 #define NGX_IMAP_LOGIN 1 |
157 #define NGX_IMAP_LOGOUT 2 | |
158 #define NGX_IMAP_CAPABILITY 3 | |
159 #define NGX_IMAP_NOOP 4 | |
583 | 160 #define NGX_IMAP_STARTTLS 5 |
527 | 161 |
583 | 162 #define NGX_IMAP_NEXT 6 |
527 | 163 |
164 | |
165 #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
|
166 |
47709bff4468
nginx-0.0.10-2004-09-09-19:40:48 import
Igor Sysoev <igor@sysoev.ru>
parents:
418
diff
changeset
|
167 |
424
84c527908237
nginx-0.0.10-2004-09-14-09:45:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
423
diff
changeset
|
168 #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
|
169 |
521 | 170 #define NGX_IMAP_MAIN_CONF 0x02000000 |
171 #define NGX_IMAP_SRV_CONF 0x04000000 | |
172 | |
173 | |
174 #define NGX_IMAP_MAIN_CONF_OFFSET offsetof(ngx_imap_conf_ctx_t, main_conf) | |
175 #define NGX_IMAP_SRV_CONF_OFFSET offsetof(ngx_imap_conf_ctx_t, srv_conf) | |
176 | |
177 | |
178 #define ngx_imap_get_module_ctx(s, module) (s)->ctx[module.ctx_index] | |
179 #define ngx_imap_set_ctx(s, c, module) s->ctx[module.ctx_index] = c; | |
180 #define ngx_imap_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL; | |
181 | |
182 | |
183 #define ngx_imap_get_module_main_conf(s, module) \ | |
184 (s)->main_conf[module.ctx_index] | |
185 #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
|
186 |
fda5987b188d
nginx-0.0.10-2004-09-13-20:18:09 import
Igor Sysoev <igor@sysoev.ru>
parents:
422
diff
changeset
|
187 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
188 void ngx_imap_init_connection(ngx_connection_t *c); |
539 | 189 void ngx_imap_send(ngx_event_t *wev); |
527 | 190 void ngx_imap_auth_state(ngx_event_t *rev); |
191 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
|
192 void ngx_imap_close_connection(ngx_connection_t *c); |
525 | 193 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
|
194 |
527 | 195 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
|
196 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
|
197 |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
198 |
521 | 199 /* STUB */ |
200 void ngx_imap_proxy_init(ngx_imap_session_t *s, ngx_peers_t *peers); | |
201 void ngx_imap_auth_http_init(ngx_imap_session_t *s); | |
202 /**/ | |
203 | |
204 | |
205 extern ngx_uint_t ngx_imap_max_module; | |
206 extern ngx_module_t ngx_imap_core_module; | |
207 | |
208 | |
417
0526206251f6
nginx-0.0.10-2004-09-07-19:29:22 import
Igor Sysoev <igor@sysoev.ru>
parents:
diff
changeset
|
209 #endif /* _NGX_IMAP_H_INCLUDED_ */ |