aboutsummaryrefslogtreecommitdiffstats
path: root/src/filter.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/filter.h')
-rw-r--r--src/filter.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/filter.h b/src/filter.h
new file mode 100644
index 000000000..ce8be7ecd
--- /dev/null
+++ b/src/filter.h
@@ -0,0 +1,43 @@
+#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 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