Back to home page

Nginx displayed by LXR

Source navigation ]
Diff markup ]
Identifier search ]
general search ]
 
 
Version: nginx-1.13.12 ]​[ nginx-1.12.2 ]​

0001 
0002 /*
0003  * Copyright (C) Igor Sysoev
0004  * Copyright (C) Nginx, Inc.
0005  */
0006 
0007 
0008 #ifndef _NGX_STREAM_SCRIPT_H_INCLUDED_
0009 #define _NGX_STREAM_SCRIPT_H_INCLUDED_
0010 
0011 
0012 #include <ngx_config.h>
0013 #include <ngx_core.h>
0014 #include <ngx_stream.h>
0015 
0016 
0017 typedef struct {
0018     u_char                       *ip;
0019     u_char                       *pos;
0020     ngx_stream_variable_value_t  *sp;
0021 
0022     ngx_str_t                     buf;
0023     ngx_str_t                     line;
0024 
0025     unsigned                      flushed:1;
0026     unsigned                      skip:1;
0027 
0028     ngx_stream_session_t         *session;
0029 } ngx_stream_script_engine_t;
0030 
0031 
0032 typedef struct {
0033     ngx_conf_t                   *cf;
0034     ngx_str_t                    *source;
0035 
0036     ngx_array_t                 **flushes;
0037     ngx_array_t                 **lengths;
0038     ngx_array_t                 **values;
0039 
0040     ngx_uint_t                    variables;
0041     ngx_uint_t                    ncaptures;
0042     ngx_uint_t                    size;
0043 
0044     void                         *main;
0045 
0046     unsigned                      complete_lengths:1;
0047     unsigned                      complete_values:1;
0048     unsigned                      zero:1;
0049     unsigned                      conf_prefix:1;
0050     unsigned                      root_prefix:1;
0051 } ngx_stream_script_compile_t;
0052 
0053 
0054 typedef struct {
0055     ngx_str_t                     value;
0056     ngx_uint_t                   *flushes;
0057     void                         *lengths;
0058     void                         *values;
0059 } ngx_stream_complex_value_t;
0060 
0061 
0062 typedef struct {
0063     ngx_conf_t                   *cf;
0064     ngx_str_t                    *value;
0065     ngx_stream_complex_value_t   *complex_value;
0066 
0067     unsigned                      zero:1;
0068     unsigned                      conf_prefix:1;
0069     unsigned                      root_prefix:1;
0070 } ngx_stream_compile_complex_value_t;
0071 
0072 
0073 typedef void (*ngx_stream_script_code_pt) (ngx_stream_script_engine_t *e);
0074 typedef size_t (*ngx_stream_script_len_code_pt) (ngx_stream_script_engine_t *e);
0075 
0076 
0077 typedef struct {
0078     ngx_stream_script_code_pt     code;
0079     uintptr_t                     len;
0080 } ngx_stream_script_copy_code_t;
0081 
0082 
0083 typedef struct {
0084     ngx_stream_script_code_pt     code;
0085     uintptr_t                     index;
0086 } ngx_stream_script_var_code_t;
0087 
0088 
0089 typedef struct {
0090     ngx_stream_script_code_pt     code;
0091     uintptr_t                     n;
0092 } ngx_stream_script_copy_capture_code_t;
0093 
0094 
0095 typedef struct {
0096     ngx_stream_script_code_pt     code;
0097     uintptr_t                     conf_prefix;
0098 } ngx_stream_script_full_name_code_t;
0099 
0100 
0101 void ngx_stream_script_flush_complex_value(ngx_stream_session_t *s,
0102     ngx_stream_complex_value_t *val);
0103 ngx_int_t ngx_stream_complex_value(ngx_stream_session_t *s,
0104     ngx_stream_complex_value_t *val, ngx_str_t *value);
0105 ngx_int_t ngx_stream_compile_complex_value(
0106     ngx_stream_compile_complex_value_t *ccv);
0107 char *ngx_stream_set_complex_value_slot(ngx_conf_t *cf, ngx_command_t *cmd,
0108     void *conf);
0109 
0110 
0111 ngx_uint_t ngx_stream_script_variables_count(ngx_str_t *value);
0112 ngx_int_t ngx_stream_script_compile(ngx_stream_script_compile_t *sc);
0113 u_char *ngx_stream_script_run(ngx_stream_session_t *s, ngx_str_t *value,
0114     void *code_lengths, size_t reserved, void *code_values);
0115 void ngx_stream_script_flush_no_cacheable_variables(ngx_stream_session_t *s,
0116     ngx_array_t *indices);
0117 
0118 void *ngx_stream_script_add_code(ngx_array_t *codes, size_t size, void *code);
0119 
0120 size_t ngx_stream_script_copy_len_code(ngx_stream_script_engine_t *e);
0121 void ngx_stream_script_copy_code(ngx_stream_script_engine_t *e);
0122 size_t ngx_stream_script_copy_var_len_code(ngx_stream_script_engine_t *e);
0123 void ngx_stream_script_copy_var_code(ngx_stream_script_engine_t *e);
0124 size_t ngx_stream_script_copy_capture_len_code(ngx_stream_script_engine_t *e);
0125 void ngx_stream_script_copy_capture_code(ngx_stream_script_engine_t *e);
0126 
0127 #endif /* _NGX_STREAM_SCRIPT_H_INCLUDED_ */