2004-09-28 16:34:51 +08:00
|
|
|
|
|
|
|
/*
|
2004-09-30 00:00:49 +08:00
|
|
|
* Copyright (C) Igor Sysoev
|
2004-09-28 16:34:51 +08:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
2003-10-22 00:49:56 +08:00
|
|
|
#ifndef _NGX_EVENT_PIPE_H_INCLUDED_
|
|
|
|
#define _NGX_EVENT_PIPE_H_INCLUDED_
|
2003-04-15 01:04:58 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include <ngx_config.h>
|
|
|
|
#include <ngx_core.h>
|
2003-10-07 23:30:05 +08:00
|
|
|
#include <ngx_event.h>
|
2003-04-15 01:04:58 +08:00
|
|
|
|
|
|
|
|
2003-10-22 00:49:56 +08:00
|
|
|
typedef struct ngx_event_pipe_s ngx_event_pipe_t;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
typedef ngx_int_t (*ngx_event_pipe_input_filter_pt)(ngx_event_pipe_t *p,
|
|
|
|
ngx_buf_t *buf);
|
|
|
|
typedef ngx_int_t (*ngx_event_pipe_output_filter_pt)(void *data,
|
|
|
|
ngx_chain_t *chain);
|
2003-04-15 01:04:58 +08:00
|
|
|
|
|
|
|
|
2003-10-22 00:49:56 +08:00
|
|
|
struct ngx_event_pipe_s {
|
2003-11-18 00:15:03 +08:00
|
|
|
ngx_connection_t *upstream;
|
|
|
|
ngx_connection_t *downstream;
|
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
ngx_chain_t *free_raw_bufs;
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_chain_t *in;
|
|
|
|
ngx_chain_t **last_in;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_chain_t *out;
|
|
|
|
ngx_chain_t **last_out;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
ngx_chain_t *free;
|
|
|
|
ngx_chain_t *busy;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-17 04:19:16 +08:00
|
|
|
/*
|
|
|
|
* the input filter i.e. that moves HTTP/1.1 chunks
|
2004-05-28 23:49:23 +08:00
|
|
|
* from the raw bufs to an incoming chain
|
2003-10-17 04:19:16 +08:00
|
|
|
*/
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-22 00:49:56 +08:00
|
|
|
ngx_event_pipe_input_filter_pt input_filter;
|
2004-05-28 23:49:23 +08:00
|
|
|
void *input_ctx;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-10-22 00:49:56 +08:00
|
|
|
ngx_event_pipe_output_filter_pt output_filter;
|
2004-05-28 23:49:23 +08:00
|
|
|
void *output_ctx;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2003-10-20 03:57:23 +08:00
|
|
|
unsigned read:1;
|
2003-04-15 01:04:58 +08:00
|
|
|
unsigned cachable:1;
|
2003-10-30 16:51:06 +08:00
|
|
|
unsigned single_buf:1;
|
2003-10-31 15:10:36 +08:00
|
|
|
unsigned free_bufs:1;
|
2003-10-17 04:19:16 +08:00
|
|
|
unsigned upstream_done:1;
|
2003-04-15 01:04:58 +08:00
|
|
|
unsigned upstream_error:1;
|
2003-10-22 15:05:29 +08:00
|
|
|
unsigned upstream_eof:1;
|
|
|
|
unsigned upstream_blocked:1;
|
2003-10-17 04:19:16 +08:00
|
|
|
unsigned downstream_done:1;
|
2003-04-18 01:59:35 +08:00
|
|
|
unsigned downstream_error:1;
|
2003-10-22 15:05:29 +08:00
|
|
|
unsigned cyclic_temp_file:1;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
ngx_int_t allocated;
|
2003-10-14 00:32:29 +08:00
|
|
|
ngx_bufs_t bufs;
|
2004-05-28 23:49:23 +08:00
|
|
|
ngx_buf_tag_t tag;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2004-12-03 02:40:46 +08:00
|
|
|
ssize_t busy_size;
|
2003-10-17 04:19:16 +08:00
|
|
|
|
2003-11-06 01:03:41 +08:00
|
|
|
off_t read_length;
|
|
|
|
|
2003-04-18 01:59:35 +08:00
|
|
|
off_t max_temp_file_size;
|
2004-06-18 14:09:25 +08:00
|
|
|
ssize_t temp_file_write_size;
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2003-10-29 16:30:44 +08:00
|
|
|
ngx_msec_t read_timeout;
|
|
|
|
ngx_msec_t send_timeout;
|
|
|
|
ssize_t send_lowat;
|
|
|
|
|
2003-04-15 01:04:58 +08:00
|
|
|
ngx_pool_t *pool;
|
|
|
|
ngx_log_t *log;
|
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
ngx_chain_t *preread_bufs;
|
|
|
|
size_t preread_size;
|
|
|
|
ngx_buf_t *buf_to_file;
|
2003-04-18 01:59:35 +08:00
|
|
|
|
2003-11-03 06:56:18 +08:00
|
|
|
ngx_temp_file_t *temp_file;
|
|
|
|
|
2003-10-22 15:05:29 +08:00
|
|
|
/* STUB */ int num;
|
2003-04-15 01:04:58 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-28 23:49:23 +08:00
|
|
|
ngx_int_t ngx_event_pipe(ngx_event_pipe_t *p, int do_write);
|
|
|
|
ngx_int_t ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf);
|
2005-01-25 20:27:35 +08:00
|
|
|
ngx_int_t ngx_event_pipe_add_free_buf(ngx_event_pipe_t *p, ngx_buf_t *b);
|
2003-10-20 03:57:23 +08:00
|
|
|
|
2003-04-15 01:04:58 +08:00
|
|
|
|
2003-10-22 00:49:56 +08:00
|
|
|
#endif /* _NGX_EVENT_PIPE_H_INCLUDED_ */
|