1 
2 /*
3  * Copyright (C) Axel Duch
4  * Copyright (C) NGINX, Inc.
5  */
6 
7 #ifndef _NXT_REGEX_H_INCLUDED_
8 #define _NXT_REGEX_H_INCLUDED_
9 
10 #if (NXT_HAVE_REGEX)
11 
12 typedef struct nxt_regex_s        nxt_regex_t;
13 
14  #if (NXT_HAVE_PCRE2)
15 typedef void                      nxt_regex_match_t;
16 #else
17 typedef struct nxt_regex_match_s  nxt_regex_match_t;
18 #endif
19 
20 typedef struct {
21     size_t      offset;
22 
23 #if (NXT_HAVE_PCRE2)
24 #define ERR_BUF_SIZE  256
25     u_char      msg[ERR_BUF_SIZE];
26 #else
27     const char  *msg;
28 #endif
29 } nxt_regex_err_t;
30 
31 
32 NXT_EXPORT void nxt_regex_init(void);
33 NXT_EXPORT nxt_regex_t *nxt_regex_compile(nxt_mp_t *mp, nxt_str_t *source,
34     nxt_regex_err_t *err);
35 NXT_EXPORT nxt_regex_match_t *nxt_regex_match_create(nxt_mp_t *mp, size_t size);
36 NXT_EXPORT nxt_int_t nxt_regex_match(nxt_regex_t *re, u_char *subject,
37     size_t length, nxt_regex_match_t *match);
38 
39 #endif /* NXT_HAVE_REGEX */
40 
41 #endif /* _NXT_REGEX_H_INCLUDED_ */
42