if (re->type == RSPAMD_RE_HEADER || re->type == RSPAMD_RE_RAWHEADER) {
ret = rspamd_re_cache_process (task,
- task->re_rt,
re->regexp,
re->type,
re->header,
}
else {
ret = rspamd_re_cache_process (task,
- task->re_rt,
re->regexp,
re->type,
NULL,
#include "libserver/cfg_file.h"
#include "libutil/util.h"
#include "libutil/regexp.h"
+#include "lua/lua_common.h"
#ifdef WITH_HYPERSCAN
#include "hs.h"
#include "unix-std.h"
gint
rspamd_re_cache_process (struct rspamd_task *task,
- struct rspamd_re_runtime *rt,
rspamd_regexp_t *re,
enum rspamd_re_type type,
gpointer type_data,
guint64 re_id;
struct rspamd_re_class *re_class;
struct rspamd_re_cache *cache;
+ struct rspamd_re_runtime *rt;
- g_assert (rt != NULL);
g_assert (task != NULL);
+ rt = task->re_rt;
+ g_assert (rt != NULL);
g_assert (re != NULL);
cache = rt->cache;
return 0;
}
+int
+rspamd_re_cache_process_ffi (void *ptask,
+ void *pre,
+ int type,
+ void *type_data,
+ int is_strong)
+{
+ struct rspamd_lua_regexp **lua_re = pre;
+ struct rspamd_task **real_task = ptask;
+ gsize typelen = 0;
+
+ if (type_data) {
+ typelen = strlen (type_data);
+ }
+
+ return rspamd_re_cache_process (*real_task, (*lua_re)->re,
+ type, type_data, typelen, is_strong);
+}
+
void
rspamd_re_cache_runtime_destroy (struct rspamd_re_runtime *rt)
{
* @param is_strong use case sensitive match when looking for headers
*/
gint rspamd_re_cache_process (struct rspamd_task *task,
- struct rspamd_re_runtime *rt,
rspamd_regexp_t *re,
enum rspamd_re_type type,
gpointer type_data,
gsize datalen,
gboolean is_strong);
+int rspamd_re_cache_process_ffi (void *ptask,
+ void *pre,
+ int type,
+ void *type_data,
+ int is_strong);
+
/**
* Destroy runtime data
*/
"header argument is mandatory for header/rawheader regexps");
}
else {
- ret = rspamd_re_cache_process (task, task->re_rt, re->re, type,
+ ret = rspamd_re_cache_process (task, re->re, type,
(gpointer) header_str, header_len, strong);
}
}