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