summaryrefslogtreecommitdiffhomepage
path: root/src/nxt_regex.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/nxt_regex.h')
-rw-r--r--src/nxt_regex.h41
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_ */