aboutsummaryrefslogtreecommitdiffstats
path: root/src/classifiers/classifiers.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-07-23 12:57:31 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-07-23 12:57:31 +0100
commit379055dbbb4af997b4d3ffb161d447872d7ca357 (patch)
tree3774553d470f93e12ddeb454aad9b3b607cf8918 /src/classifiers/classifiers.h
parent602ae7a0b7e215ba2677131b8fdc70abc156b3ca (diff)
downloadrspamd-379055dbbb4af997b4d3ffb161d447872d7ca357.tar.gz
rspamd-379055dbbb4af997b4d3ffb161d447872d7ca357.zip
Unify style without sorting headers.
Diffstat (limited to 'src/classifiers/classifiers.h')
-rw-r--r--src/classifiers/classifiers.h90
1 files changed, 67 insertions, 23 deletions
diff --git a/src/classifiers/classifiers.h b/src/classifiers/classifiers.h
index 2b36d8c02..8e59fc555 100644
--- a/src/classifiers/classifiers.h
+++ b/src/classifiers/classifiers.h
@@ -28,36 +28,80 @@ struct classify_weight {
/* Common classifier structure */
struct classifier {
char *name;
- struct classifier_ctx* (*init_func)(rspamd_mempool_t *pool, struct rspamd_classifier_config *cf);
- 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 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);
+ struct classifier_ctx * (*init_func)(rspamd_mempool_t *pool,
+ struct rspamd_classifier_config *cf);
+ 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 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 */
-struct classifier* get_classifier (const char *name);
+struct classifier * get_classifier (const char *name);
/* Winnow algorithm */
-struct classifier_ctx* winnow_init (rspamd_mempool_t *pool, struct rspamd_classifier_config *cf);
-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 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);
+struct classifier_ctx * winnow_init (rspamd_mempool_t *pool,
+ struct rspamd_classifier_config *cf);
+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 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 rspamd_classifier_config *cf);
-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 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);
+struct classifier_ctx * bayes_init (rspamd_mempool_t *pool,
+ struct rspamd_classifier_config *cf);
+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 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[];