aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_expressions.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-19 15:07:22 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-19 15:07:22 +0000
commit7975f9e568fd660c74fa21e759b85d3b70d38eb3 (patch)
tree4ec831590f3a55f80a54c7ae5260ecffb71006c2 /src/libmime/mime_expressions.h
parentaa8fc9d9a9f35237d2870aa081f43621d3bc78ae (diff)
downloadrspamd-7975f9e568fd660c74fa21e759b85d3b70d38eb3.tar.gz
rspamd-7975f9e568fd660c74fa21e759b85d3b70d38eb3.zip
Start removing old stuff.
Diffstat (limited to 'src/libmime/mime_expressions.h')
-rw-r--r--src/libmime/mime_expressions.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/libmime/mime_expressions.h b/src/libmime/mime_expressions.h
new file mode 100644
index 000000000..343e912e8
--- /dev/null
+++ b/src/libmime/mime_expressions.h
@@ -0,0 +1,59 @@
+/**
+ * @file expressions.h
+ * Rspamd expressions API
+ */
+
+#ifndef RSPAMD_EXPRESSIONS_H
+#define RSPAMD_EXPRESSIONS_H
+
+#include "config.h"
+#include <lua.h>
+
+struct rspamd_task;
+struct rspamd_regexp_element;
+
+/**
+ * Function's argument
+ */
+struct expression_argument {
+ enum {
+ EXPRESSION_ARGUMENT_NORMAL,
+ EXPRESSION_ARGUMENT_BOOL,
+ EXPRESSION_ARGUMENT_EXPR,
+ } type; /**< type of argument (text or other function) */
+ void *data; /**< pointer to its data */
+};
+
+
+typedef gboolean (*rspamd_internal_func_t)(struct rspamd_task *, GList *args,
+ void *user_data);
+
+
+/**
+ * Register specified function to rspamd internal functions list
+ * @param name name of function
+ * @param func pointer to function
+ */
+void register_expression_function (const gchar *name,
+ rspamd_internal_func_t func,
+ void *user_data);
+
+/**
+ * Add regexp to regexp task cache
+ * @param task task object
+ * @param pointer regexp data
+ * @param result numeric result of this regexp
+ */
+void task_cache_add (struct rspamd_task *task,
+ struct rspamd_regexp_element *re,
+ gint32 result);
+
+/**
+ * Check regexp in cache
+ * @param task task object
+ * @param pointer regexp data
+ * @return numeric result if value exists or -1 if not
+ */
+gint32 task_cache_check (struct rspamd_task *task, struct rspamd_regexp_element *re);
+
+#endif