aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_expressions.h
blob: 9350274826c0be7c1f8c9cf5b7e28b6d7176da86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/**
 * @file expressions.h
 * Rspamd expressions API
 */

#ifndef RSPAMD_EXPRESSIONS_H
#define RSPAMD_EXPRESSIONS_H

#include "config.h"
#include "expression.h"
#include "contrib/libucl/ucl.h"

#ifdef  __cplusplus
extern "C" {
#endif

struct rspamd_task;
struct rspamd_config;

struct rspamd_mime_expr_ud {
	struct rspamd_config *cfg;
	const ucl_object_t *conf_obj;
};

extern const struct rspamd_atom_subr mime_expr_subr;

/**
 * Function's argument
 */
enum rspamd_expression_type {
	EXPRESSION_ARGUMENT_NORMAL = 0,
	EXPRESSION_ARGUMENT_BOOL,
	EXPRESSION_ARGUMENT_REGEXP
};
struct expression_argument {
	enum rspamd_expression_type type;                           /**< type of argument (text or other function)		*/
	void *data;                                                 /**< pointer to its data							*/
};


typedef gboolean (*rspamd_internal_func_t) (struct rspamd_task *,
											GArray *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);

/**
 * Set global limit of regexp data size to be processed
 * @param limit new limit in bytes
 * @return old limit value
 */
guint rspamd_mime_expression_set_re_limit (guint limit);

#ifdef  __cplusplus
}
#endif

#endif