Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 1 | #ifndef _NGX_EVENT_PROXY_H_INCLUDED_ |
| 2 | #define _NGX_EVENT_PROXY_H_INCLUDED_ |
| 3 | |
| 4 | |
| 5 | #include <ngx_config.h> |
| 6 | #include <ngx_core.h> |
Igor Sysoev | 931a400 | 2003-10-07 15:30:05 +0000 | [diff] [blame^] | 7 | #include <ngx_event.h> |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 8 | |
| 9 | |
| 10 | typedef struct ngx_event_proxy_s ngx_event_proxy_t; |
| 11 | |
Igor Sysoev | 153d743 | 2003-04-15 15:06:52 +0000 | [diff] [blame] | 12 | typedef int (*ngx_event_proxy_input_filter_pt)(ngx_event_proxy_t *p, |
| 13 | ngx_chain_t *chain); |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 14 | typedef int (*ngx_event_proxy_output_filter_pt)(void *data, ngx_hunk_t *hunk); |
| 15 | |
| 16 | |
| 17 | struct ngx_event_proxy_s { |
| 18 | ngx_chain_t *read_hunks; |
| 19 | ngx_chain_t *last_read_hunk; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 20 | |
Igor Sysoev | b1ab5d0 | 2003-04-21 14:55:47 +0000 | [diff] [blame] | 21 | ngx_chain_t *file_hunks; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 22 | |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 23 | ngx_chain_t *in_hunks; |
| 24 | ngx_chain_t *last_in_hunk; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 25 | |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 26 | ngx_chain_t *out_hunks; |
| 27 | ngx_chain_t *last_out_hunk; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 28 | |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 29 | ngx_chain_t *free_hunks; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 30 | #if 0 |
| 31 | ngx_chain_t *last_free_hunk; |
| 32 | #endif |
| 33 | |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 34 | ngx_hunk_t *busy_hunk; |
| 35 | |
| 36 | ngx_event_proxy_input_filter_pt input_filter; |
| 37 | void *input_data; |
| 38 | |
| 39 | ngx_event_proxy_output_filter_pt output_filter; |
| 40 | void *output_data; |
| 41 | |
| 42 | unsigned cachable:1; |
Igor Sysoev | b1ab5d0 | 2003-04-21 14:55:47 +0000 | [diff] [blame] | 43 | unsigned fatal_error:1; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 44 | unsigned block_upstream:1; |
| 45 | unsigned upstream_eof:1; |
| 46 | unsigned upstream_error:1; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 47 | unsigned downstream_eof:1; |
| 48 | unsigned downstream_error:1; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 49 | |
Igor Sysoev | b1ab5d0 | 2003-04-21 14:55:47 +0000 | [diff] [blame] | 50 | int upstream_level; |
| 51 | int downstream_level; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 52 | |
| 53 | int allocated; |
| 54 | int block_size; |
| 55 | int max_block_size; |
| 56 | |
| 57 | off_t temp_offset; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 58 | off_t max_temp_file_size; |
| 59 | int temp_file_write_size; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 60 | |
| 61 | ngx_connection_t *upstream; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 62 | ngx_connection_t *downstream; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 63 | |
| 64 | ngx_pool_t *pool; |
| 65 | ngx_log_t *log; |
| 66 | |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 67 | ngx_chain_t *preread_hunks; |
| 68 | #if 0 |
| 69 | ngx_chain_t *last_preread_hunk; |
| 70 | #endif |
| 71 | int preread_size; |
| 72 | |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 73 | ngx_file_t *temp_file; |
| 74 | ngx_path_t *temp_path; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 75 | char *temp_file_warn; |
| 76 | }; |
| 77 | |
| 78 | |
| 79 | int ngx_event_proxy_read_upstream(ngx_event_proxy_t *p); |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 80 | int ngx_event_proxy_write_to_downstream(ngx_event_proxy_t *p); |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 81 | int ngx_event_proxy_write_chain_to_temp_file(ngx_event_proxy_t *p); |
| 82 | |
| 83 | |
| 84 | #endif /* _NGX_EVENT_PROXY_H_INCLUDED_ */ |