comparison src/imap/ngx_imap.h @ 521:6f00349b98e5 release-0.1.35

nginx-0.1.35-RELEASE import *) Feature: the "working_directory" directive. *) Feature: the "port_in_redirect" directive. *) Bugfix: the segmentation fault was occurred if the backend response header was in several packets; the bug had appeared in 0.1.29. *) Bugfix: if more than 10 servers were configured or some server did not use the "listen" directive, then the segmentation fault was occurred on the start. *) Bugfix: the segmentation fault might occur if the response was bigger than the temporary file. *) Bugfix: nginx returned the 400 response on requests like "GET http://www.domain.com/uri HTTP/1.0"; the bug had appeared in 0.1.28.
author Igor Sysoev <igor@sysoev.ru>
date Tue, 07 Jun 2005 15:56:31 +0000
parents 42d11f017717
children 09b42134ac0c
comparison
equal deleted inserted replaced
520:1fecc7e0d717 521:6f00349b98e5
13 #include <ngx_event.h> 13 #include <ngx_event.h>
14 #include <ngx_event_connect.h> 14 #include <ngx_event_connect.h>
15 15
16 16
17 typedef struct { 17 typedef struct {
18 ngx_peer_connection_t upstream; 18 void **main_conf;
19 void **srv_conf;
20 } ngx_imap_conf_ctx_t;
19 21
20 ngx_buf_t *buffer; 22
21 } ngx_imap_proxy_ctx_t; 23 typedef struct {
24 ngx_array_t servers; /* ngx_imap_core_srv_conf_t */
25 } ngx_imap_core_main_conf_t;
26
27
28 #define NGX_IMAP_POP3_PROTOCOL 0
29 #define NGX_IMAP_IMAP_PROTOCOL 1
30
31 typedef struct {
32 ngx_msec_t timeout;
33
34 size_t imap_client_buffer_size;
35 size_t proxy_buffer_size;
36
37 ngx_uint_t protocol;
38
39 /* server ctx */
40 ngx_imap_conf_ctx_t *ctx;
41 } ngx_imap_core_srv_conf_t;
42
43
44 typedef struct {
45 void *(*create_main_conf)(ngx_conf_t *cf);
46 char *(*init_main_conf)(ngx_conf_t *cf, void *conf);
47
48 void *(*create_srv_conf)(ngx_conf_t *cf);
49 char *(*merge_srv_conf)(ngx_conf_t *cf, void *prev, void *conf);
50 } ngx_imap_module_t;
22 51
23 52
24 typedef enum { 53 typedef enum {
25 ngx_pop3_start = 0, 54 ngx_pop3_start = 0,
26 ngx_pop3_user 55 ngx_pop3_user
27 } ngx_imap_state_e; 56 } ngx_imap_state_e;
28 57
29 58
30 typedef struct { 59 typedef struct {
60 ngx_peer_connection_t upstream;
61 ngx_buf_t *buffer;
62 } ngx_imap_proxy_ctx_t;
63
64
65 typedef struct {
31 uint32_t signature; /* "IMAP" */ 66 uint32_t signature; /* "IMAP" */
32 67
33 ngx_connection_t *connection; 68 ngx_connection_t *connection;
69
34 ngx_buf_t *buffer; 70 ngx_buf_t *buffer;
71
72 void **ctx;
73 void **main_conf;
74 void **srv_conf;
75
76 ngx_imap_proxy_ctx_t *proxy;
35 77
36 ngx_imap_state_e imap_state; 78 ngx_imap_state_e imap_state;
37 79
38 ngx_imap_proxy_ctx_t *proxy; 80 unsigned protocol:1;
39 81
40 ngx_str_t login; 82 ngx_str_t login;
41 ngx_str_t passwd; 83 ngx_str_t passwd;
42 84
43 ngx_uint_t command; 85 ngx_uint_t command;
72 #define NGX_IMAP_PROXY_ERROR 11 114 #define NGX_IMAP_PROXY_ERROR 11
73 115
74 116
75 #define NGX_IMAP_MODULE 0x50414D49 /* "IMAP" */ 117 #define NGX_IMAP_MODULE 0x50414D49 /* "IMAP" */
76 118
77 #define NGX_IMAP_SRV_CONF 0x02000000 119 #define NGX_IMAP_MAIN_CONF 0x02000000
78 #define NGX_IMAP_IMAP_CONF 0x04000000 120 #define NGX_IMAP_SRV_CONF 0x04000000
79 #define NGX_IMAP_POP3_CONF 0x08000000 121
122
123 #define NGX_IMAP_MAIN_CONF_OFFSET offsetof(ngx_imap_conf_ctx_t, main_conf)
124 #define NGX_IMAP_SRV_CONF_OFFSET offsetof(ngx_imap_conf_ctx_t, srv_conf)
125
126
127 #define ngx_imap_get_module_ctx(s, module) (s)->ctx[module.ctx_index]
128 #define ngx_imap_set_ctx(s, c, module) s->ctx[module.ctx_index] = c;
129 #define ngx_imap_delete_ctx(s, module) s->ctx[module.ctx_index] = NULL;
130
131
132 #define ngx_imap_get_module_main_conf(s, module) \
133 (s)->main_conf[module.ctx_index]
134 #define ngx_imap_get_module_srv_conf(s, module) (s)->srv_conf[module.ctx_index]
80 135
81 136
82 void ngx_imap_init_connection(ngx_connection_t *c); 137 void ngx_imap_init_connection(ngx_connection_t *c);
83 void ngx_imap_close_connection(ngx_connection_t *c); 138 void ngx_imap_close_connection(ngx_connection_t *c);
84 139
85 void ngx_imap_proxy_init(ngx_imap_session_t *s);
86
87 ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s); 140 ngx_int_t ngx_pop3_parse_command(ngx_imap_session_t *s);
88 141
89 142
143 /* STUB */
144 void ngx_imap_proxy_init(ngx_imap_session_t *s, ngx_peers_t *peers);
145 void ngx_imap_auth_http_init(ngx_imap_session_t *s);
146 /**/
147
148
149 extern ngx_uint_t ngx_imap_max_module;
150 extern ngx_module_t ngx_imap_core_module;
151
152
90 #endif /* _NGX_IMAP_H_INCLUDED_ */ 153 #endif /* _NGX_IMAP_H_INCLUDED_ */