blob: f36f2e1b45cfd3648751af4dbb43a89214fd275c (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
/** @file view.h **/
#ifndef RSPAMD_VIEW_H
#define RSPAMD_VIEW_H
#include "config.h"
#include "main.h"
#include "radix.h"
struct config_file;
struct rspamd_view {
struct config_file *cfg;
GList *from_re_list;
GHashTable *from_hash;
GList *rcpt_re_list;
GHashTable *rcpt_hash;
radix_tree_t *ip_tree;
radix_tree_t *client_ip_tree;
GHashTable *symbols_hash;
GList *symbols_re_list;
gboolean skip_check;
memory_pool_t *pool;
};
/**
* Init a new view
* @param pool pool for view
* @return
*/
struct rspamd_view* init_view (struct config_file *cfg, memory_pool_t *pool);
/**
* Add from option for this view
* @param view view
* @param line from line for this view
* @return
*/
gboolean add_view_from (struct rspamd_view *view, gchar *line);
/**
* Add recipient for this view
* @param view view object
* @param line recipient description
* @return
*/
gboolean add_view_rcpt (struct rspamd_view *view, gchar *line);
/**
* Add ip option for this view
* @param view view object
* @param line ip description
* @return
*/
gboolean add_view_ip (struct rspamd_view *view, gchar *line);
/**
* Add client ip option for this view
* @param view view object
* @param line ip description
* @return
*/
gboolean add_view_client_ip (struct rspamd_view *view, gchar *line);
/**
* Add symbols option for this view
* @param view view object
* @param line symbols description
* @return
*/
gboolean add_view_symbols (struct rspamd_view *view, gchar *line);
/**
* Check view for this task for specified symbol
* @param views list of defined views
* @param symbol symbol to check
* @param task task object
* @return whether to check this symbol for this task
*/
gboolean check_view (GList *views, const gchar *symbol, struct worker_task *task);
/**
* Check whether this task should be skipped from checks
* @param views list of defined views
* @param task task object
* @return
*/
gboolean check_skip (GList *views, struct worker_task *task);
#endif
|