diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-21 13:39:39 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2014-04-21 13:39:39 +0100 |
commit | 5f25b69c03972b0adff6bc649e1922111d0ebb2b (patch) | |
tree | 62fb361ba8eab64f59a1874e5d045d404727ae4e /src/classifiers | |
parent | bc997b7b94a36103a3d409d0de422a71df0a19d6 (diff) | |
download | rspamd-5f25b69c03972b0adff6bc649e1922111d0ebb2b.tar.gz rspamd-5f25b69c03972b0adff6bc649e1922111d0ebb2b.zip |
Refactor worker task structure and API.
Diffstat (limited to 'src/classifiers')
-rw-r--r-- | src/classifiers/bayes.c | 6 | ||||
-rw-r--r-- | src/classifiers/classifiers.h | 20 | ||||
-rw-r--r-- | src/classifiers/winnow.c | 6 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/classifiers/bayes.c b/src/classifiers/bayes.c index 405336be7..9c81b2370 100644 --- a/src/classifiers/bayes.c +++ b/src/classifiers/bayes.c @@ -202,7 +202,7 @@ bayes_init (rspamd_mempool_t *pool, struct classifier_config *cfg) } gboolean -bayes_classify (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task, lua_State *L) +bayes_classify (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct rspamd_task *task, lua_State *L) { struct bayes_callback_data data; gchar *value; @@ -428,7 +428,7 @@ bayes_learn (struct classifier_ctx* ctx, statfile_pool_t *pool, const char *symb gboolean bayes_learn_spam (struct classifier_ctx* ctx, statfile_pool_t *pool, - GTree *input, struct worker_task *task, gboolean is_spam, lua_State *L, GError **err) + GTree *input, struct rspamd_task *task, gboolean is_spam, lua_State *L, GError **err) { struct bayes_callback_data data; gchar *value; @@ -528,7 +528,7 @@ bayes_learn_spam (struct classifier_ctx* ctx, statfile_pool_t *pool, } GList * -bayes_weights (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task) +bayes_weights (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct rspamd_task *task) { /* This function is unimplemented with new normalizer */ return NULL; diff --git a/src/classifiers/classifiers.h b/src/classifiers/classifiers.h index a316008cd..3f7b755f4 100644 --- a/src/classifiers/classifiers.h +++ b/src/classifiers/classifiers.h @@ -11,7 +11,7 @@ #define ALPHA 0.0001 struct classifier_config; -struct worker_task; +struct rspamd_task; struct classifier_ctx { rspamd_mempool_t *pool; @@ -29,13 +29,13 @@ struct classify_weight { struct classifier { char *name; struct classifier_ctx* (*init_func)(rspamd_mempool_t *pool, struct classifier_config *cf); - gboolean (*classify_func)(struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task, lua_State *L); + gboolean (*classify_func)(struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct rspamd_task *task, lua_State *L); gboolean (*learn_func)(struct classifier_ctx* ctx, statfile_pool_t *pool, const char *symbol, GTree *input, gboolean in_class, double *sum, double multiplier, GError **err); gboolean (*learn_spam_func)(struct classifier_ctx* ctx, statfile_pool_t *pool, - GTree *input, struct worker_task *task, gboolean is_spam, lua_State *L, GError **err); - GList* (*weights_func)(struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task); + GTree *input, struct rspamd_task *task, gboolean is_spam, lua_State *L, GError **err); + GList* (*weights_func)(struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct rspamd_task *task); }; /* Get classifier structure by name or return NULL if this name is not found */ @@ -43,21 +43,21 @@ struct classifier* get_classifier (const char *name); /* Winnow algorithm */ struct classifier_ctx* winnow_init (rspamd_mempool_t *pool, struct classifier_config *cf); -gboolean winnow_classify (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task, lua_State *L); +gboolean winnow_classify (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct rspamd_task *task, lua_State *L); gboolean winnow_learn (struct classifier_ctx* ctx, statfile_pool_t *pool, const char *symbol, GTree *input, gboolean in_class, double *sum, double multiplier, GError **err); gboolean winnow_learn_spam (struct classifier_ctx* ctx, statfile_pool_t *pool, - GTree *input, struct worker_task *task, gboolean is_spam, lua_State *L, GError **err); -GList *winnow_weights (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task); + GTree *input, struct rspamd_task *task, gboolean is_spam, lua_State *L, GError **err); +GList *winnow_weights (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct rspamd_task *task); /* Bayes algorithm */ struct classifier_ctx* bayes_init (rspamd_mempool_t *pool, struct classifier_config *cf); -gboolean bayes_classify (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task, lua_State *L); +gboolean bayes_classify (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct rspamd_task *task, lua_State *L); gboolean bayes_learn (struct classifier_ctx* ctx, statfile_pool_t *pool, const char *symbol, GTree *input, gboolean in_class, double *sum, double multiplier, GError **err); gboolean bayes_learn_spam (struct classifier_ctx* ctx, statfile_pool_t *pool, - GTree *input, struct worker_task *task, gboolean is_spam, lua_State *L, GError **err); -GList *bayes_weights (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct worker_task *task); + GTree *input, struct rspamd_task *task, gboolean is_spam, lua_State *L, GError **err); +GList *bayes_weights (struct classifier_ctx* ctx, statfile_pool_t *pool, GTree *input, struct rspamd_task *task); /* Array of all defined classifiers */ extern struct classifier classifiers[]; diff --git a/src/classifiers/winnow.c b/src/classifiers/winnow.c index b9b5b7af9..91d06aaf4 100644 --- a/src/classifiers/winnow.c +++ b/src/classifiers/winnow.c @@ -193,7 +193,7 @@ winnow_init (rspamd_mempool_t * pool, struct classifier_config *cfg) } gboolean -winnow_classify (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * input, struct worker_task *task, lua_State *L) +winnow_classify (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * input, struct rspamd_task *task, lua_State *L) { struct winnow_callback_data data; char *sumbuf, *value; @@ -282,7 +282,7 @@ winnow_classify (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * inp } GList * -winnow_weights (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * input, struct worker_task *task) +winnow_weights (struct classifier_ctx *ctx, statfile_pool_t * pool, GTree * input, struct rspamd_task *task) { struct winnow_callback_data data; long double res = 0.; @@ -593,7 +593,7 @@ end: gboolean winnow_learn_spam (struct classifier_ctx* ctx, statfile_pool_t *pool, - GTree *input, struct worker_task *task, gboolean is_spam, lua_State *L, GError **err) + GTree *input, struct rspamd_task *task, gboolean is_spam, lua_State *L, GError **err) { g_set_error (err, winnow_error_quark(), /* error domain */ |