Igor Sysoev | d90282d | 2004-09-28 08:34:51 +0000 | [diff] [blame] | 1 | |
| 2 | /* |
Igor Sysoev | ff8da91 | 2004-09-29 16:00:49 +0000 | [diff] [blame] | 3 | * Copyright (C) Igor Sysoev |
Igor Sysoev | d90282d | 2004-09-28 08:34:51 +0000 | [diff] [blame] | 4 | */ |
| 5 | |
| 6 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame] | 7 | #ifndef _NGX_EVENT_PIPE_H_INCLUDED_ |
| 8 | #define _NGX_EVENT_PIPE_H_INCLUDED_ |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 9 | |
| 10 | |
| 11 | #include <ngx_config.h> |
| 12 | #include <ngx_core.h> |
Igor Sysoev | 931a400 | 2003-10-07 15:30:05 +0000 | [diff] [blame] | 13 | #include <ngx_event.h> |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 14 | |
| 15 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame] | 16 | typedef struct ngx_event_pipe_s ngx_event_pipe_t; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 17 | |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 18 | typedef ngx_int_t (*ngx_event_pipe_input_filter_pt)(ngx_event_pipe_t *p, |
| 19 | ngx_buf_t *buf); |
| 20 | typedef ngx_int_t (*ngx_event_pipe_output_filter_pt)(void *data, |
| 21 | ngx_chain_t *chain); |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 22 | |
| 23 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame] | 24 | struct ngx_event_pipe_s { |
Igor Sysoev | d7fdb35 | 2003-11-17 16:15:03 +0000 | [diff] [blame] | 25 | ngx_connection_t *upstream; |
| 26 | ngx_connection_t *downstream; |
| 27 | |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 28 | ngx_chain_t *free_raw_bufs; |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 29 | ngx_chain_t *in; |
| 30 | ngx_chain_t **last_in; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 31 | |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 32 | ngx_chain_t *out; |
| 33 | ngx_chain_t **last_out; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 34 | |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 35 | ngx_chain_t *free; |
| 36 | ngx_chain_t *busy; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 37 | |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 38 | /* |
| 39 | * the input filter i.e. that moves HTTP/1.1 chunks |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 40 | * from the raw bufs to an incoming chain |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 41 | */ |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 42 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame] | 43 | ngx_event_pipe_input_filter_pt input_filter; |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 44 | void *input_ctx; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 45 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame] | 46 | ngx_event_pipe_output_filter_pt output_filter; |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 47 | void *output_ctx; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 48 | |
Igor Sysoev | 13829b7 | 2003-10-19 19:57:23 +0000 | [diff] [blame] | 49 | unsigned read:1; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 50 | unsigned cachable:1; |
Igor Sysoev | 68ee8f1 | 2003-10-30 08:51:06 +0000 | [diff] [blame] | 51 | unsigned single_buf:1; |
Igor Sysoev | 219d44d | 2003-10-31 07:10:36 +0000 | [diff] [blame] | 52 | unsigned free_bufs:1; |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 53 | unsigned upstream_done:1; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 54 | unsigned upstream_error:1; |
Igor Sysoev | 5bf3d25 | 2003-10-22 07:05:29 +0000 | [diff] [blame] | 55 | unsigned upstream_eof:1; |
| 56 | unsigned upstream_blocked:1; |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 57 | unsigned downstream_done:1; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 58 | unsigned downstream_error:1; |
Igor Sysoev | 5bf3d25 | 2003-10-22 07:05:29 +0000 | [diff] [blame] | 59 | unsigned cyclic_temp_file:1; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 60 | |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 61 | ngx_int_t allocated; |
Igor Sysoev | 913d0d4 | 2003-10-13 16:32:29 +0000 | [diff] [blame] | 62 | ngx_bufs_t bufs; |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 63 | ngx_buf_tag_t tag; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 64 | |
Igor Sysoev | 42b12b3 | 2004-12-02 18:40:46 +0000 | [diff] [blame] | 65 | ssize_t busy_size; |
Igor Sysoev | d404c97 | 2003-10-16 20:19:16 +0000 | [diff] [blame] | 66 | |
Igor Sysoev | e8732b0 | 2003-11-05 17:03:41 +0000 | [diff] [blame] | 67 | off_t read_length; |
| 68 | |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 69 | off_t max_temp_file_size; |
Igor Sysoev | bf88014 | 2004-06-18 06:09:25 +0000 | [diff] [blame] | 70 | ssize_t temp_file_write_size; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 71 | |
Igor Sysoev | b5faed2 | 2003-10-29 08:30:44 +0000 | [diff] [blame] | 72 | ngx_msec_t read_timeout; |
| 73 | ngx_msec_t send_timeout; |
| 74 | ssize_t send_lowat; |
| 75 | |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 76 | ngx_pool_t *pool; |
| 77 | ngx_log_t *log; |
| 78 | |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 79 | ngx_chain_t *preread_bufs; |
| 80 | size_t preread_size; |
| 81 | ngx_buf_t *buf_to_file; |
Igor Sysoev | 6a7fd11 | 2003-04-17 17:59:35 +0000 | [diff] [blame] | 82 | |
Igor Sysoev | 6597749 | 2003-11-02 22:56:18 +0000 | [diff] [blame] | 83 | ngx_temp_file_t *temp_file; |
| 84 | |
Igor Sysoev | 5bf3d25 | 2003-10-22 07:05:29 +0000 | [diff] [blame] | 85 | /* STUB */ int num; |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 86 | }; |
| 87 | |
| 88 | |
Igor Sysoev | 369145c | 2004-05-28 15:49:23 +0000 | [diff] [blame] | 89 | ngx_int_t ngx_event_pipe(ngx_event_pipe_t *p, int do_write); |
| 90 | ngx_int_t ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf); |
Igor Sysoev | e5a222c | 2005-01-25 12:27:35 +0000 | [diff] [blame] | 91 | ngx_int_t ngx_event_pipe_add_free_buf(ngx_event_pipe_t *p, ngx_buf_t *b); |
Igor Sysoev | 9e4920b | 2003-04-14 17:04:58 +0000 | [diff] [blame] | 92 | |
| 93 | |
Igor Sysoev | 419f9ac | 2003-10-21 16:49:56 +0000 | [diff] [blame] | 94 | #endif /* _NGX_EVENT_PIPE_H_INCLUDED_ */ |