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_REGEX_H_INCLUDED_
0009 #define _NGX_REGEX_H_INCLUDED_
0010 
0011 
0012 #include <ngx_config.h>
0013 #include <ngx_core.h>
0014 
0015 #include <pcre.h>
0016 
0017 
0018 #define NGX_REGEX_NO_MATCHED  PCRE_ERROR_NOMATCH   /* -1 */
0019 
0020 #define NGX_REGEX_CASELESS    PCRE_CASELESS
0021 
0022 
0023 typedef struct {
0024     pcre        *code;
0025     pcre_extra  *extra;
0026 } ngx_regex_t;
0027 
0028 
0029 typedef struct {
0030     ngx_str_t     pattern;
0031     ngx_pool_t   *pool;
0032     ngx_int_t     options;
0033 
0034     ngx_regex_t  *regex;
0035     int           captures;
0036     int           named_captures;
0037     int           name_size;
0038     u_char       *names;
0039     ngx_str_t     err;
0040 } ngx_regex_compile_t;
0041 
0042 
0043 typedef struct {
0044     ngx_regex_t  *regex;
0045     u_char       *name;
0046 } ngx_regex_elt_t;
0047 
0048 
0049 void ngx_regex_init(void);
0050 ngx_int_t ngx_regex_compile(ngx_regex_compile_t *rc);
0051 
0052 #define ngx_regex_exec(re, s, captures, size)                                \
0053     pcre_exec(re->code, re->extra, (const char *) (s)->data, (s)->len, 0, 0, \
0054               captures, size)
0055 #define ngx_regex_exec_n      "pcre_exec()"
0056 
0057 ngx_int_t ngx_regex_exec_array(ngx_array_t *a, ngx_str_t *s, ngx_log_t *log);
0058 
0059 
0060 #endif /* _NGX_REGEX_H_INCLUDED_ */