summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_regex.h
blob: a24c50f80804ba81fa9719ee7fa42fe034ca40e4 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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_ */