aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime/mime_expressions.h
blob: 834f1983f667a69c79c542d198227ee964091e27 (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
/**
 * @file expressions.h
 * Rspamd expressions API
 */

#ifndef RSPAMD_EXPRESSIONS_H
#define RSPAMD_EXPRESSIONS_H

#include "config.h"
#include "expression.h"

struct rspamd_task;

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);

#endif