src/stream/ngx_stream_script.h - nginx-1.31.4 nginx/ @ 8d9666701

Data types defined

Macros defined

Source code


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


  5. #ifndef _NGX_STREAM_SCRIPT_H_INCLUDED_
  6. #define _NGX_STREAM_SCRIPT_H_INCLUDED_


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


  10. typedef struct {
  11.     u_char                       *ip;
  12.     u_char                       *pos;
  13.     u_char                       *end;
  14.     ngx_stream_variable_value_t  *sp;

  15.     ngx_str_t                     buf;
  16.     ngx_str_t                     line;

  17.     unsigned                      flushed:1;
  18.     unsigned                      skip:1;

  19.     ngx_int_t                     status;
  20.     ngx_stream_session_t         *session;
  21. } ngx_stream_script_engine_t;


  22. typedef struct {
  23.     ngx_conf_t                   *cf;
  24.     ngx_str_t                    *source;

  25.     ngx_array_t                 **flushes;
  26.     ngx_array_t                 **lengths;
  27.     ngx_array_t                 **values;

  28.     ngx_uint_t                    variables;
  29.     ngx_uint_t                    ncaptures;
  30.     ngx_uint_t                    size;

  31.     void                         *main;

  32.     unsigned                      complete_lengths:1;
  33.     unsigned                      complete_values:1;
  34.     unsigned                      zero:1;
  35.     unsigned                      conf_prefix:1;
  36.     unsigned                      root_prefix:1;
  37. } ngx_stream_script_compile_t;


  38. typedef struct {
  39.     ngx_str_t                     value;
  40.     ngx_uint_t                   *flushes;
  41.     void                         *lengths;
  42.     void                         *values;

  43.     union {
  44.         size_t                    size;
  45.     } u;
  46. } ngx_stream_complex_value_t;


  47. typedef struct {
  48.     ngx_conf_t                   *cf;
  49.     ngx_str_t                    *value;
  50.     ngx_stream_complex_value_t   *complex_value;

  51.     unsigned                      zero:1;
  52.     unsigned                      conf_prefix:1;
  53.     unsigned                      root_prefix:1;
  54. } ngx_stream_compile_complex_value_t;


  55. typedef void (*ngx_stream_script_code_pt) (ngx_stream_script_engine_t *e);
  56. typedef size_t (*ngx_stream_script_len_code_pt) (ngx_stream_script_engine_t *e);


  57. typedef struct {
  58.     ngx_stream_script_code_pt     code;
  59.     uintptr_t                     len;
  60. } ngx_stream_script_copy_code_t;


  61. typedef struct {
  62.     ngx_stream_script_code_pt     code;
  63.     uintptr_t                     index;
  64. } ngx_stream_script_var_code_t;


  65. typedef struct {
  66.     ngx_stream_script_code_pt     code;
  67.     uintptr_t                     n;
  68. } ngx_stream_script_copy_capture_code_t;


  69. typedef struct {
  70.     ngx_stream_script_code_pt     code;
  71.     uintptr_t                     conf_prefix;
  72. } ngx_stream_script_full_name_code_t;


  73. void ngx_stream_script_flush_complex_value(ngx_stream_session_t *s,
  74.     ngx_stream_complex_value_t *val);
  75. ngx_int_t ngx_stream_complex_value(ngx_stream_session_t *s,
  76.     ngx_stream_complex_value_t *val, ngx_str_t *value);
  77. size_t ngx_stream_complex_value_size(ngx_stream_session_t *s,
  78.     ngx_stream_complex_value_t *val, size_t default_value);
  79. ngx_int_t ngx_stream_compile_complex_value(
  80.     ngx_stream_compile_complex_value_t *ccv);
  81. char *ngx_stream_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd,
  82.     void *conf);
  83. char *ngx_stream_set_complex_value_zero_slot(ngx_conf_t *cf, ngx_command_t *cmd,
  84.     void *conf);
  85. char *ngx_stream_set_complex_value_size_slot(ngx_conf_t *cf, ngx_command_t *cmd,
  86.     void *conf);


  87. ngx_uint_t ngx_stream_script_variables_count(ngx_str_t *value);
  88. ngx_int_t ngx_stream_script_compile(ngx_stream_script_compile_t *sc);
  89. u_char *ngx_stream_script_run(ngx_stream_session_t *s, ngx_str_t *value,
  90.     void *code_lengths, size_t reserved, void *code_values);
  91. void ngx_stream_script_flush_no_cacheable_variables(ngx_stream_session_t *s,
  92.     ngx_array_t *indices);

  93. void *ngx_stream_script_add_code(ngx_array_t *codes, size_t size, void *code);

  94. ngx_int_t ngx_stream_script_check_length(ngx_stream_script_engine_t *e,
  95.     size_t len);

  96. size_t ngx_stream_script_copy_len_code(ngx_stream_script_engine_t *e);
  97. void ngx_stream_script_copy_code(ngx_stream_script_engine_t *e);
  98. size_t ngx_stream_script_copy_var_len_code(ngx_stream_script_engine_t *e);
  99. void ngx_stream_script_copy_var_code(ngx_stream_script_engine_t *e);
  100. size_t ngx_stream_script_copy_capture_len_code(ngx_stream_script_engine_t *e);
  101. void ngx_stream_script_copy_capture_code(ngx_stream_script_engine_t *e);

  102. #endif /* _NGX_STREAM_SCRIPT_H_INCLUDED_ */