summaryrefslogtreecommitdiffstats
path: root/src/filter.h
blob: dec13fd72815e78c26d9c335145ef56fc63eb4b2 (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
#ifndef RSPAMD_FILTER_H
#define RSPAMD_FILTER_H

#include <sys/types.h>
#ifndef HAVE_OWN_QUEUE_H
#include <sys/queue.h>
#else
#include "queue.h"
#endif
#include <glib.h>

struct worker_task;

typedef double (*metric_cons_func)(struct worker_task *task, const char *metric_name);
typedef void (*filter_func)(struct worker_task *task);

enum filter_type { C_FILTER, PERL_FILTER };

struct filter {
	char *func_name;
	enum filter_type type;
	LIST_ENTRY (filter) next;
};

struct metric {
	char *name;
	char *func_name;
	metric_cons_func func;
	double required_score;
};

struct metric_result {
	struct metric *metric;
	double score;
	GHashTable *symbols;
};

int process_filters (struct worker_task *task);
void process_statfiles (struct worker_task *task);
void insert_result (struct worker_task *task, const char *metric_name, const char *symbol, u_char flag);
void make_composites (struct worker_task *task);
double factor_consolidation_func (struct worker_task *task, const char *metric_name);

#endif