diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-17 15:46:20 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2019-05-17 15:46:20 +0100 |
commit | 957e21258d23679a0b4b9f46a720750ff86d8cf8 (patch) | |
tree | b88a710e28eb954ab54ab4ccf7491ca1f01a3ef9 /src/libutil/expression.h | |
parent | 29a3b94f4dc310b1f8b77ec982b9062f80192424 (diff) | |
download | rspamd-957e21258d23679a0b4b9f46a720750ff86d8cf8.tar.gz rspamd-957e21258d23679a0b4b9f46a720750ff86d8cf8.zip |
[Rework] Rework expression API
Diffstat (limited to 'src/libutil/expression.h')
-rw-r--r-- | src/libutil/expression.h | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/libutil/expression.h b/src/libutil/expression.h index 4f16812e6..bd336b87b 100644 --- a/src/libutil/expression.h +++ b/src/libutil/expression.h @@ -56,24 +56,9 @@ typedef struct rspamd_expression_atom_s { gint priority; } rspamd_expression_atom_t; -struct rspamd_expr_process_data; - -typedef gdouble (*rspamd_expression_process_cb)(struct rspamd_expr_process_data *process_data, +typedef gdouble (*rspamd_expression_process_cb)(gpointer runtime_data, rspamd_expression_atom_t *atom); -struct rspamd_expr_process_data { - /* Current Lua state to run atom processing */ - struct lua_State *L; - /* Parameter of lua-function processing atom*/ - gint stack_item; - gint flags; - /* != NULL if trace is collected */ - GPtrArray *trace; - struct composites_data *cd; - struct rspamd_task *task; - rspamd_expression_process_cb process_closure; -}; - struct rspamd_atom_subr { /* Parses atom from string and returns atom structure */ rspamd_expression_atom_t * (*parse)(const gchar *line, gsize len, @@ -111,7 +96,8 @@ gboolean rspamd_parse_expression (const gchar *line, gsize len, * @return the value of expression */ gdouble rspamd_process_expression (struct rspamd_expression *expr, - struct rspamd_expr_process_data *process_data); + gint flags, + gpointer runtime_ud); /** * Process the expression and return its value using atom 'process' functions with the specified data pointer. @@ -122,7 +108,9 @@ gdouble rspamd_process_expression (struct rspamd_expression *expr, * @return the value of expression */ gdouble rspamd_process_expression_track (struct rspamd_expression *expr, - struct rspamd_expr_process_data *process_data); + gint flags, + gpointer runtime_ud, + GPtrArray **track); /** * Process the expression with the custom processor @@ -133,7 +121,9 @@ gdouble rspamd_process_expression_track (struct rspamd_expression *expr, */ gdouble rspamd_process_expression_closure (struct rspamd_expression *expr, rspamd_expression_process_cb cb, - struct rspamd_expr_process_data *process_data); + gint flags, + gpointer runtime_ud, + GPtrArray **track); /** * Shows string representation of an expression * @param expr expression to show |