blob: e85fc617084ed963673ea260ca5af3d38395642c [file] [log] [blame]
Igor Sysoev419f9ac2003-10-21 16:49:56 +00001#ifndef _NGX_EVENT_PIPE_H_INCLUDED_
2#define _NGX_EVENT_PIPE_H_INCLUDED_
Igor Sysoev9e4920b2003-04-14 17:04:58 +00003
4
5#include <ngx_config.h>
6#include <ngx_core.h>
Igor Sysoev931a4002003-10-07 15:30:05 +00007#include <ngx_event.h>
Igor Sysoev9e4920b2003-04-14 17:04:58 +00008
9
Igor Sysoev419f9ac2003-10-21 16:49:56 +000010typedef struct ngx_event_pipe_s ngx_event_pipe_t;
Igor Sysoev9e4920b2003-04-14 17:04:58 +000011
Igor Sysoev369145c2004-05-28 15:49:23 +000012typedef ngx_int_t (*ngx_event_pipe_input_filter_pt)(ngx_event_pipe_t *p,
13 ngx_buf_t *buf);
14typedef ngx_int_t (*ngx_event_pipe_output_filter_pt)(void *data,
15 ngx_chain_t *chain);
Igor Sysoev9e4920b2003-04-14 17:04:58 +000016
17
Igor Sysoev419f9ac2003-10-21 16:49:56 +000018struct ngx_event_pipe_s {
Igor Sysoevd7fdb352003-11-17 16:15:03 +000019 ngx_connection_t *upstream;
20 ngx_connection_t *downstream;
21
Igor Sysoev369145c2004-05-28 15:49:23 +000022 ngx_chain_t *free_raw_bufs;
Igor Sysoevd404c972003-10-16 20:19:16 +000023 ngx_chain_t *in;
24 ngx_chain_t **last_in;
Igor Sysoev6a7fd112003-04-17 17:59:35 +000025
Igor Sysoevd404c972003-10-16 20:19:16 +000026 ngx_chain_t *out;
27 ngx_chain_t **last_out;
Igor Sysoev6a7fd112003-04-17 17:59:35 +000028
Igor Sysoevd404c972003-10-16 20:19:16 +000029 ngx_chain_t *free;
30 ngx_chain_t *busy;
Igor Sysoev6a7fd112003-04-17 17:59:35 +000031
Igor Sysoevd404c972003-10-16 20:19:16 +000032 /*
33 * the input filter i.e. that moves HTTP/1.1 chunks
Igor Sysoev369145c2004-05-28 15:49:23 +000034 * from the raw bufs to an incoming chain
Igor Sysoevd404c972003-10-16 20:19:16 +000035 */
Igor Sysoev6a7fd112003-04-17 17:59:35 +000036
Igor Sysoev419f9ac2003-10-21 16:49:56 +000037 ngx_event_pipe_input_filter_pt input_filter;
Igor Sysoev369145c2004-05-28 15:49:23 +000038 void *input_ctx;
Igor Sysoev6a7fd112003-04-17 17:59:35 +000039
Igor Sysoev419f9ac2003-10-21 16:49:56 +000040 ngx_event_pipe_output_filter_pt output_filter;
Igor Sysoev369145c2004-05-28 15:49:23 +000041 void *output_ctx;
Igor Sysoev9e4920b2003-04-14 17:04:58 +000042
Igor Sysoev13829b72003-10-19 19:57:23 +000043 unsigned read:1;
Igor Sysoev9e4920b2003-04-14 17:04:58 +000044 unsigned cachable:1;
Igor Sysoev68ee8f12003-10-30 08:51:06 +000045 unsigned single_buf:1;
Igor Sysoev219d44d2003-10-31 07:10:36 +000046 unsigned free_bufs:1;
Igor Sysoevd404c972003-10-16 20:19:16 +000047 unsigned upstream_done:1;
Igor Sysoev9e4920b2003-04-14 17:04:58 +000048 unsigned upstream_error:1;
Igor Sysoev5bf3d252003-10-22 07:05:29 +000049 unsigned upstream_eof:1;
50 unsigned upstream_blocked:1;
Igor Sysoevd404c972003-10-16 20:19:16 +000051 unsigned downstream_done:1;
Igor Sysoev6a7fd112003-04-17 17:59:35 +000052 unsigned downstream_error:1;
Igor Sysoev5bf3d252003-10-22 07:05:29 +000053 unsigned cyclic_temp_file:1;
Igor Sysoev9e4920b2003-04-14 17:04:58 +000054
Igor Sysoev369145c2004-05-28 15:49:23 +000055 ngx_int_t allocated;
Igor Sysoev913d0d42003-10-13 16:32:29 +000056 ngx_bufs_t bufs;
Igor Sysoev369145c2004-05-28 15:49:23 +000057 ngx_buf_tag_t tag;
Igor Sysoev9e4920b2003-04-14 17:04:58 +000058
Igor Sysoevdc9dd432003-10-22 16:38:26 +000059 size_t busy_size;
Igor Sysoevd404c972003-10-16 20:19:16 +000060
Igor Sysoeve8732b02003-11-05 17:03:41 +000061 off_t read_length;
62
Igor Sysoev6a7fd112003-04-17 17:59:35 +000063 off_t max_temp_file_size;
Igor Sysoevbf880142004-06-18 06:09:25 +000064 ssize_t temp_file_write_size;
Igor Sysoev9e4920b2003-04-14 17:04:58 +000065
Igor Sysoevb5faed22003-10-29 08:30:44 +000066 ngx_msec_t read_timeout;
67 ngx_msec_t send_timeout;
68 ssize_t send_lowat;
69
Igor Sysoev9e4920b2003-04-14 17:04:58 +000070 ngx_pool_t *pool;
71 ngx_log_t *log;
72
Igor Sysoev369145c2004-05-28 15:49:23 +000073 ngx_chain_t *preread_bufs;
74 size_t preread_size;
75 ngx_buf_t *buf_to_file;
Igor Sysoev6a7fd112003-04-17 17:59:35 +000076
Igor Sysoev65977492003-11-02 22:56:18 +000077 ngx_temp_file_t *temp_file;
78
Igor Sysoev5bf3d252003-10-22 07:05:29 +000079 /* STUB */ int num;
Igor Sysoev9e4920b2003-04-14 17:04:58 +000080};
81
82
Igor Sysoev369145c2004-05-28 15:49:23 +000083ngx_int_t ngx_event_pipe(ngx_event_pipe_t *p, int do_write);
84ngx_int_t ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf);
Igor Sysoev9e4920b2003-04-14 17:04:58 +000085
86
Igor Sysoev419f9ac2003-10-21 16:49:56 +000087#endif /* _NGX_EVENT_PIPE_H_INCLUDED_ */