1 /** 2 * @file expressions.h 3 * Rspamd expressions API 4 */ 5 6 #ifndef RSPAMD_EXPRESSIONS_H 7 #define RSPAMD_EXPRESSIONS_H 8 9 #include "config.h" 10 #include "expression.h" 11 #include "contrib/libucl/ucl.h" 12 13 #ifdef __cplusplus 14 extern "C" { 15 #endif 16 17 struct rspamd_task; 18 struct rspamd_config; 19 20 struct rspamd_mime_expr_ud { 21 struct rspamd_config *cfg; 22 const ucl_object_t *conf_obj; 23 }; 24 25 extern const struct rspamd_atom_subr mime_expr_subr; 26 27 /** 28 * Function's argument 29 */ 30 enum rspamd_expression_type { 31 EXPRESSION_ARGUMENT_NORMAL = 0, 32 EXPRESSION_ARGUMENT_BOOL, 33 EXPRESSION_ARGUMENT_REGEXP 34 }; 35 struct expression_argument { 36 enum rspamd_expression_type type; /**< type of argument (text or other function) */ 37 void *data; /**< pointer to its data */ 38 }; 39 40 41 typedef gboolean (*rspamd_internal_func_t) (struct rspamd_task *, 42 GArray *args, void *user_data); 43 44 45 /** 46 * Register specified function to rspamd internal functions list 47 * @param name name of function 48 * @param func pointer to function 49 */ 50 void register_expression_function (const gchar *name, 51 rspamd_internal_func_t func, 52 void *user_data); 53 54 /** 55 * Set global limit of regexp data size to be processed 56 * @param limit new limit in bytes 57 * @return old limit value 58 */ 59 guint rspamd_mime_expression_set_re_limit (guint limit); 60 61 #ifdef __cplusplus 62 } 63 #endif 64 65 #endif 66