diff options
author | Axel Duch <axel.duch@nginx.com> | 2020-11-17 15:03:30 +0000 |
---|---|---|
committer | Axel Duch <axel.duch@nginx.com> | 2020-11-17 15:03:30 +0000 |
commit | e3af18834d7cc32734cba7532d8864bb343b416b (patch) | |
tree | 578c68e31396926abff818cdaf6cb83116157511 /src/nxt_regex.h | |
parent | 2a381a82a6e1bc2bd5d2f43a08fce50a1994f2e8 (diff) | |
download | unit-e3af18834d7cc32734cba7532d8864bb343b416b.tar.gz unit-e3af18834d7cc32734cba7532d8864bb343b416b.tar.bz2 |
Router: matching regular expressions support.
Diffstat (limited to 'src/nxt_regex.h')
-rw-r--r-- | src/nxt_regex.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/nxt_regex.h b/src/nxt_regex.h new file mode 100644 index 00000000..a24c50f8 --- /dev/null +++ b/src/nxt_regex.h @@ -0,0 +1,41 @@ + +/* + * Copyright (C) Axel Duch + * Copyright (C) NGINX, Inc. + */ + +#ifndef _NXT_REGEX_H_INCLUDED_ +#define _NXT_REGEX_H_INCLUDED_ + +#if (NXT_HAVE_REGEX) + +typedef struct nxt_regex_s nxt_regex_t; + + #if (NXT_HAVE_PCRE2) +typedef void nxt_regex_match_t; +#else +typedef struct nxt_regex_match_s nxt_regex_match_t; +#endif + +typedef struct { + size_t offset; + +#if (NXT_HAVE_PCRE2) +#define ERR_BUF_SIZE 256 + u_char msg[ERR_BUF_SIZE]; +#else + const char *msg; +#endif +} nxt_regex_err_t; + + +NXT_EXPORT void nxt_regex_init(void); +NXT_EXPORT nxt_regex_t *nxt_regex_compile(nxt_mp_t *mp, nxt_str_t *source, + nxt_regex_err_t *err); +NXT_EXPORT nxt_regex_match_t *nxt_regex_match_create(nxt_mp_t *mp, size_t size); +NXT_EXPORT nxt_int_t nxt_regex_match(nxt_regex_t *re, u_char *subject, + size_t length, nxt_regex_match_t *match); + +#endif /* NXT_HAVE_REGEX */ + +#endif /* _NXT_REGEX_H_INCLUDED_ */ |