aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-24 16:34:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2020-02-24 16:34:14 +0000
commitbf798c5fc6ad20da1c2b7a8436a27182a1b7c2e6 (patch)
tree4612efd1eb5a3bc67833a216f93a2b8d6dccfc6a /src
parent136560c66397009a313b61239a455aad11f724f2 (diff)
downloadrspamd-bf798c5fc6ad20da1c2b7a8436a27182a1b7c2e6.tar.gz
rspamd-bf798c5fc6ad20da1c2b7a8436a27182a1b7c2e6.zip
[Minor] Add method to check hyperscan support to multipattern library
Diffstat (limited to 'src')
-rw-r--r--src/lua/lua_trie.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lua/lua_trie.c b/src/lua/lua_trie.c
index a1b0de118..3941a5a85 100644
--- a/src/lua/lua_trie.c
+++ b/src/lua/lua_trie.c
@@ -39,6 +39,7 @@ trie:match('some big text', trie_callback)
/* Suffix trie */
LUA_FUNCTION_DEF (trie, create);
+LUA_FUNCTION_DEF (trie, has_hyperscan);
LUA_FUNCTION_DEF (trie, match);
LUA_FUNCTION_DEF (trie, search_mime);
LUA_FUNCTION_DEF (trie, search_rawmsg);
@@ -56,6 +57,7 @@ static const struct luaL_reg trielib_m[] = {
};
static const struct luaL_reg trielib_f[] = {
LUA_INTERFACE_DEF (trie, create),
+ LUA_INTERFACE_DEF (trie, has_hyperscan),
{NULL, NULL}
};
@@ -81,6 +83,19 @@ lua_trie_destroy (lua_State *L)
}
/***
+ * function trie.has_hyperscan()
+ * Checks for hyperscan support
+ *
+ * @return {bool} true if hyperscan is supported
+ */
+static gint
+lua_trie_has_hyperscan (lua_State *L)
+{
+ lua_pushboolean (L, rspamd_multipattern_has_hyperscan ());
+ return 1;
+}
+
+/***
* function trie.create(patterns, [flags])
* Creates new trie data structure
* @param {table} array of string patterns