aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-19 15:18:18 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2015-03-19 15:18:18 +0000
commitb1abe43bb8842ce4c625036994faf4e7a029b58f (patch)
tree533fb17ed51695d716721ddc389dc72e83218072
parent7975f9e568fd660c74fa21e759b85d3b70d38eb3 (diff)
downloadrspamd-b1abe43bb8842ce4c625036994faf4e7a029b58f.tar.gz
rspamd-b1abe43bb8842ce4c625036994faf4e7a029b58f.zip
Write atom parser skeleton.
-rw-r--r--src/libmime/mime_expressions.c38
-rw-r--r--src/libmime/mime_expressions.h6
2 files changed, 41 insertions, 3 deletions
diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c
index 779553ed9..3b9aba934 100644
--- a/src/libmime/mime_expressions.c
+++ b/src/libmime/mime_expressions.c
@@ -64,6 +64,12 @@ gboolean rspamd_has_fake_html (struct rspamd_task *task,
GList * args,
void *unused);
+static rspamd_expression_atom_t * rspamd_mime_expr_parse (const gchar *line, gsize len,
+ rspamd_mempool_t *pool, gpointer ud, GError **err);
+static gint rspamd_mime_expr_process (gpointer input, rspamd_expression_atom_t *atom);
+static gint rspamd_mime_expr_priority (rspamd_expression_atom_t *atom);
+static void rspamd_mime_expr_destroy (rspamd_expression_atom_t *atom);
+
/**
* Regexp type: /H - header, /M - mime, /U - url /X - raw header
*/
@@ -121,6 +127,13 @@ static struct _fl {
{"is_recipients_sorted", rspamd_is_recipients_sorted, NULL}
};
+const struct rspamd_atom_subr mime_expr_subr = {
+ .parse = rspamd_mime_expr_parse,
+ .process = rspamd_mime_expr_process,
+ .priority = rspamd_mime_expr_priority,
+ .destroy = rspamd_mime_expr_destroy
+};
+
static struct _fl *list_ptr = &rspamd_functions_list[0];
static guint32 functions_number = sizeof (rspamd_functions_list) /
sizeof (struct _fl);
@@ -315,6 +328,31 @@ rspamd_parse_regexp_atom (rspamd_mempool_t * pool, const gchar *line)
return result;
}
+static
+rspamd_expression_atom_t * rspamd_mime_expr_parse (const gchar *line, gsize len,
+ rspamd_mempool_t *pool, gpointer ud, GError **err)
+{
+
+}
+
+static gint
+rspamd_mime_expr_process (gpointer input, rspamd_expression_atom_t *atom)
+{
+
+}
+
+static gint
+rspamd_mime_expr_priority (rspamd_expression_atom_t *atom)
+{
+
+}
+
+static void
+rspamd_mime_expr_destroy (rspamd_expression_atom_t *atom)
+{
+
+}
+
gboolean
call_expression_function (struct expression_function * func,
struct rspamd_task * task,
diff --git a/src/libmime/mime_expressions.h b/src/libmime/mime_expressions.h
index 343e912e8..b8a240f3e 100644
--- a/src/libmime/mime_expressions.h
+++ b/src/libmime/mime_expressions.h
@@ -7,10 +7,11 @@
#define RSPAMD_EXPRESSIONS_H
#include "config.h"
-#include <lua.h>
+#include "expression.h"
struct rspamd_task;
-struct rspamd_regexp_element;
+
+extern const struct rspamd_atom_subr mime_expr_subr;
/**
* Function's argument
@@ -19,7 +20,6 @@ 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 */
};