src/event/ngx_event_pipe.h - nginx-1.7.10

Data types defined

Macros defined

Source code


  1. /*
  2. * Copyright (C) Igor Sysoev
  3. * Copyright (C) Nginx, Inc.
  4. */


  5. #ifndef _NGX_EVENT_PIPE_H_INCLUDED_
  6. #define _NGX_EVENT_PIPE_H_INCLUDED_


  7. #include <ngx_config.h>
  8. #include <ngx_core.h>
  9. #include <ngx_event.h>


  10. typedef struct ngx_event_pipe_s  ngx_event_pipe_t;

  11. typedef ngx_int_t (*ngx_event_pipe_input_filter_pt)(ngx_event_pipe_t *p,
  12.                                                     ngx_buf_t *buf);
  13. typedef ngx_int_t (*ngx_event_pipe_output_filter_pt)(void *data,
  14.                                                      ngx_chain_t *chain);


  15. struct ngx_event_pipe_s {
  16.     ngx_connection_t  *upstream;
  17.     ngx_connection_t  *downstream;

  18.     ngx_chain_t       *free_raw_bufs;
  19.     ngx_chain_t       *in;
  20.     ngx_chain_t      **last_in;

  21.     ngx_chain_t       *out;
  22.     ngx_chain_t       *free;
  23.     ngx_chain_t       *busy;

  24.     /*
  25.      * the input filter i.e. that moves HTTP/1.1 chunks
  26.      * from the raw bufs to an incoming chain
  27.      */

  28.     ngx_event_pipe_input_filter_pt    input_filter;
  29.     void                             *input_ctx;

  30.     ngx_event_pipe_output_filter_pt   output_filter;
  31.     void                             *output_ctx;

  32.     unsigned           read:1;
  33.     unsigned           cacheable:1;
  34.     unsigned           single_buf:1;
  35.     unsigned           free_bufs:1;
  36.     unsigned           upstream_done:1;
  37.     unsigned           upstream_error:1;
  38.     unsigned           upstream_eof:1;
  39.     unsigned           upstream_blocked:1;
  40.     unsigned           downstream_done:1;
  41.     unsigned           downstream_error:1;
  42.     unsigned           cyclic_temp_file:1;

  43.     ngx_int_t          allocated;
  44.     ngx_bufs_t         bufs;
  45.     ngx_buf_tag_t      tag;

  46.     ssize_t            busy_size;

  47.     off_t              read_length;
  48.     off_t              length;

  49.     off_t              max_temp_file_size;
  50.     ssize_t            temp_file_write_size;

  51.     ngx_msec_t         read_timeout;
  52.     ngx_msec_t         send_timeout;
  53.     ssize_t            send_lowat;

  54.     ngx_pool_t        *pool;
  55.     ngx_log_t         *log;

  56.     ngx_chain_t       *preread_bufs;
  57.     size_t             preread_size;
  58.     ngx_buf_t         *buf_to_file;

  59.     size_t             limit_rate;
  60.     time_t             start_sec;

  61.     ngx_temp_file_t   *temp_file;

  62.     /* STUB */ int     num;
  63. };


  64. ngx_int_t ngx_event_pipe(ngx_event_pipe_t *p, ngx_int_t do_write);
  65. ngx_int_t ngx_event_pipe_copy_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf);
  66. ngx_int_t ngx_event_pipe_add_free_buf(ngx_event_pipe_t *p, ngx_buf_t *b);


  67. #endif /* _NGX_EVENT_PIPE_H_INCLUDED_ */