|
1 | | -#ifndef _NGX_HTTP_UPSTREAM_CHECK_H_INCLUDED_ |
2 | | -#define _NGX_HTTP_UPSTREAM_CHECK_H_INCLUDED_ |
| 1 | +#ifndef _NGX_HTTP_UPSTREAM_CHECK_HANDLER_H_INCLUDED_ |
| 2 | +#define _NGX_HTTP_UPSTREAM_CHECK_HANDLER_H_INCLUDED_ |
3 | 3 |
|
4 | 4 |
|
5 | 5 | #include <ngx_config.h> |
|
8 | 8 | #include <ngx_event_connect.h> |
9 | 9 | #include <ngx_event_pipe.h> |
10 | 10 | #include <ngx_http.h> |
| 11 | +#include "ngx_http_upstream_check_module.h" |
11 | 12 |
|
12 | | -/* make nginx-0.8.22+ happy */ |
13 | | -#if defined(nginx_version) && nginx_version >= 8022 |
14 | | -typedef ngx_addr_t ngx_peer_addr_t; |
15 | | -#endif |
16 | 13 |
|
17 | 14 | typedef struct { |
18 | 15 | u_char major; |
@@ -81,53 +78,6 @@ typedef struct { |
81 | 78 | ngx_http_check_peer_shm_t peers[0]; |
82 | 79 | } ngx_http_check_peers_shm_t; |
83 | 80 |
|
84 | | -typedef ngx_int_t (*ngx_http_check_packet_init_pt)(ngx_http_check_peer_conf_t *peer_conf); |
85 | | -typedef ngx_int_t (*ngx_http_check_packet_parse_pt)(ngx_http_check_peer_conf_t *peer_conf); |
86 | | -typedef void (*ngx_http_check_packet_clean_pt)(ngx_http_check_peer_conf_t *peer_conf); |
87 | | - |
88 | | -#define NGX_HTTP_CHECK_TCP 0x0001 |
89 | | -#define NGX_HTTP_CHECK_HTTP 0x0002 |
90 | | -#define NGX_HTTP_CHECK_SSL_HELLO 0x0004 |
91 | | -#define NGX_HTTP_CHECK_SMTP 0x0008 |
92 | | -#define NGX_HTTP_CHECK_MYSQL 0x0010 |
93 | | -#define NGX_HTTP_CHECK_POP3 0x0020 |
94 | | -#define NGX_HTTP_CHECK_IMAP 0x0040 |
95 | | - |
96 | | - |
97 | | -#define NGX_CHECK_HTTP_2XX 0x0002 |
98 | | -#define NGX_CHECK_HTTP_3XX 0x0004 |
99 | | -#define NGX_CHECK_HTTP_4XX 0x0008 |
100 | | -#define NGX_CHECK_HTTP_5XX 0x0010 |
101 | | -#define NGX_CHECK_HTTP_6XX 0x0020 |
102 | | -#define NGX_CHECK_HTTP_ERR 0x8000 |
103 | | - |
104 | | -#define NGX_CHECK_SMTP_2XX 0x0002 |
105 | | -#define NGX_CHECK_SMTP_3XX 0x0004 |
106 | | -#define NGX_CHECK_SMTP_4XX 0x0008 |
107 | | -#define NGX_CHECK_SMTP_5XX 0x0010 |
108 | | -#define NGX_CHECK_SMTP_6XX 0x0020 |
109 | | -#define NGX_CHECK_SMTP_ERR 0x8000 |
110 | | - |
111 | | -struct check_conf_s { |
112 | | - ngx_uint_t type; |
113 | | - |
114 | | - char *name; |
115 | | - |
116 | | - ngx_str_t default_send; |
117 | | - |
118 | | - /*HTTP*/ |
119 | | - ngx_uint_t default_status_alive; |
120 | | - |
121 | | - ngx_event_handler_pt send_handler; |
122 | | - ngx_event_handler_pt recv_handler; |
123 | | - |
124 | | - ngx_http_check_packet_init_pt init; |
125 | | - ngx_http_check_packet_parse_pt parse; |
126 | | - ngx_http_check_packet_clean_pt reinit; |
127 | | - |
128 | | - unsigned need_pool; |
129 | | -}; |
130 | | - |
131 | 81 | struct ngx_http_check_peer_conf_s { |
132 | 82 |
|
133 | 83 | ngx_flag_t state; |
@@ -220,21 +170,12 @@ int smtp_parser_is_finished(smtp_parser *parser); |
220 | 170 | #define http_parser_nread(parser) (parser)->nread |
221 | 171 |
|
222 | 172 |
|
223 | | -ngx_int_t ngx_http_upstream_init_main_check_conf(ngx_conf_t *cf, void*conf); |
224 | | - |
225 | | -ngx_int_t ngx_http_check_init_process(ngx_cycle_t *cycle); |
226 | | - |
227 | 173 | ngx_int_t ngx_http_upstream_check_status_handler(ngx_http_request_t *r); |
228 | 174 |
|
229 | | -ngx_uint_t ngx_http_check_add_peer(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *uscf, |
230 | | - ngx_peer_addr_t *peer); |
231 | | - |
232 | 175 | ngx_uint_t ngx_http_check_peer_down(ngx_uint_t index); |
233 | 176 |
|
234 | 177 | void ngx_http_check_get_peer(ngx_uint_t index); |
235 | 178 | void ngx_http_check_free_peer(ngx_uint_t index); |
236 | 179 |
|
237 | | -check_conf_t *ngx_http_get_check_type_conf(ngx_str_t *str); |
238 | | - |
239 | | -#endif //_NGX_HTTP_UPSTREAM_CHECK_H_INCLUDED_ |
| 180 | +#endif //_NGX_HTTP_UPSTREAM_CHECK_HANDLER_H_INCLUDED_ |
240 | 181 |
|
0 commit comments