Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame^] | 1 | #ifndef _NGX_EVENT_PIPE_H_INCLUDED_ |
| 2 | #define _NGX_EVENT_PIPE_H_INCLUDED_ |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 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 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame^] | 10 | typedef struct ngx_event_pipe_s ngx_event_pipe_t; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 11 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame^] | 12 | typedef int (*ngx_event_pipe_input_filter_pt)(ngx_event_pipe_t *p, |
| 13 | ngx_hunk_t *hunk); |
| 14 | typedef int (*ngx_event_pipe_output_filter_pt)(void *data, ngx_chain_t *chain); |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 15 | |
| 16 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame^] | 17 | struct ngx_event_pipe_s { |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 18 | ngx_chain_t *free_raw_hunks; |
| 19 | ngx_chain_t *in; |
| 20 | ngx_chain_t **last_in; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 21 | |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 22 | ngx_chain_t *out; |
| 23 | ngx_chain_t **last_out; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 24 | |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 25 | ngx_chain_t *free; |
| 26 | ngx_chain_t *busy; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 27 | |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 28 | /* |
| 29 | * the input filter i.e. that moves HTTP/1.1 chunks |
| 30 | * from the raw hunks to an incoming chain |
| 31 | */ |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 32 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame^] | 33 | ngx_event_pipe_input_filter_pt input_filter; |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 34 | void *input_ctx; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 35 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame^] | 36 | ngx_event_pipe_output_filter_pt output_filter; |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 37 | void *output_ctx; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 38 | |
Igor Sysoev | 13829b7 | 2003-10-19 19:57:23 +0000 | [diff] [blame] | 39 | unsigned read:1; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 40 | unsigned cachable:1; |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 41 | unsigned upstream_done:1; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 42 | unsigned upstream_eof:1; |
| 43 | unsigned upstream_error:1; |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 44 | unsigned downstream_done:1; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 45 | unsigned downstream_error:1; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 46 | |
Igor Sysoev | 913d0d4 | 2003-10-13 16:32:29 +0000 | [diff] [blame] | 47 | int hunks; |
| 48 | ngx_bufs_t bufs; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 49 | |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 50 | size_t max_busy_len; |
| 51 | |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 52 | off_t temp_offset; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 53 | off_t max_temp_file_size; |
| 54 | int temp_file_write_size; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 55 | |
| 56 | ngx_connection_t *upstream; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 57 | ngx_connection_t *downstream; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 58 | |
| 59 | ngx_pool_t *pool; |
| 60 | ngx_log_t *log; |
| 61 | |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 62 | ngx_chain_t *preread_hunks; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 63 | int preread_size; |
| 64 | |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 65 | ngx_file_t *temp_file; |
| 66 | ngx_path_t *temp_path; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 67 | char *temp_file_warn; |
| 68 | }; |
| 69 | |
| 70 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame^] | 71 | int ngx_event_pipe(ngx_event_pipe_t *p, int do_write); |
| 72 | int ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_hunk_t *hunk); |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 73 | |
| 74 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame^] | 75 | #endif /* _NGX_EVENT_PIPE_H_INCLUDED_ */ |