diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-05 19:48:07 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2009-02-05 19:48:07 +0300 |
commit | bf6f2838403722ea571daaeec5981831313d474b (patch) | |
tree | 25fe553ce04b9f724537364c44889a7d326566b7 /src/filter.h | |
parent | 32a96e82d075bdba6e9e567080977a76830cbce2 (diff) | |
download | rspamd-bf6f2838403722ea571daaeec5981831313d474b.tar.gz rspamd-bf6f2838403722ea571daaeec5981831313d474b.zip |
* Add some comments and documentation
Diffstat (limited to 'src/filter.h')
-rw-r--r-- | src/filter.h | 66 |
1 files changed, 55 insertions, 11 deletions
diff --git a/src/filter.h b/src/filter.h index 33c55b162..d732a8fbc 100644 --- a/src/filter.h +++ b/src/filter.h @@ -9,6 +9,10 @@ #endif #include <glib.h> +/** + * Filters logic implemetation + */ + struct worker_task; typedef double (*metric_cons_func)(struct worker_task *task, const char *metric_name); @@ -16,30 +20,70 @@ typedef void (*filter_func)(struct worker_task *task); enum filter_type { C_FILTER, PERL_FILTER }; +/** + * Filter structure + */ struct filter { - char *func_name; - enum filter_type type; - LIST_ENTRY (filter) next; + char *func_name; /** < function name */ + enum filter_type type; /** < filter type (c or perl) */ + LIST_ENTRY (filter) next; /** < chain link */ }; +/** + * Common definition of metric + */ struct metric { - char *name; - char *func_name; - metric_cons_func func; - double required_score; - struct classifier *classifier; + char *name; /** < name of metric */ + char *func_name; /** < name of consolidation function */ + metric_cons_func func; /** < c consolidation function */ + double required_score; /** < required score for this metric */ + struct classifier *classifier; /** < classifier that is used for metric */ }; +/** + * Result of metric processing + */ struct metric_result { - struct metric *metric; - double score; - GHashTable *symbols; + struct metric *metric; /** < pointer to metric structure */ + double score; /** < total score */ + GHashTable *symbols; /** < symbols of metric */ }; +/** + * Process all filters + * @param task worker's task that present message from user + * @return 0 - if there is non-finished tasks and 1 if processing is completed + */ int process_filters (struct worker_task *task); + +/** + * Process message with statfiles + * @param task worker's task that present message from user + */ void process_statfiles (struct worker_task *task); + +/** + * Insert a result to task + * @param task worker's task that present message from user + * @param metric_name metric's name to which we need to insert result + * @param symbol symbol to insert + * @param flag numeric weight for symbol + */ void insert_result (struct worker_task *task, const char *metric_name, const char *symbol, double flag); + +/** + * Process all results and form composite metrics from existent metrics as it is defined in config + * @param task worker's task that present message from user + */ void make_composites (struct worker_task *task); + +/** + * Default consolidation function for metric, it get all symbols and multiply symbol + * weight by some factor that is specified in config. Default factor is 1. + * @param task worker's task that present message from user + * @param metric_name name of metric + * @return result metric weight + */ double factor_consolidation_func (struct worker_task *task, const char *metric_name); #endif |