diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-09-30 17:30:03 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2013-09-30 17:30:03 +0100 |
commit | 085a720344b7019a1d44b356388e7ec009e1e0e4 (patch) | |
tree | a24808c52e9fdae58c9dfffd114eacc4acdf9bac | |
parent | 486f0cdddcd8170913429e14094233299e9c4106 (diff) | |
download | rspamd-085a720344b7019a1d44b356388e7ec009e1e0e4.tar.gz rspamd-085a720344b7019a1d44b356388e7ec009e1e0e4.zip |
Adopt fuzzy storage and controller.
-rw-r--r-- | src/controller.c | 13 | ||||
-rw-r--r-- | src/fuzzy_storage.c | 40 |
2 files changed, 35 insertions, 18 deletions
diff --git a/src/controller.c b/src/controller.c index 2459d3a7d..f8335b8ec 100644 --- a/src/controller.c +++ b/src/controller.c @@ -50,7 +50,7 @@ #define CONTROLLER_RRD_STEP 60 /* Init functions */ -gpointer init_controller (void); +gpointer init_controller (struct config_file *cfg); void start_controller (struct rspamd_worker *worker); worker_t controller_worker = { @@ -1887,7 +1887,7 @@ controller_update_rrd (gint fd, short what, void *arg) } gpointer -init_controller (void) +init_controller (struct config_file *cfg) { struct rspamd_controller_ctx *ctx; GQuark type; @@ -1897,8 +1897,13 @@ init_controller (void) ctx->timeout = CONTROLLER_IO_TIMEOUT * 1000; - register_worker_opt (type, "password", xml_handle_string, ctx, G_STRUCT_OFFSET (struct rspamd_controller_ctx, password)); - register_worker_opt (type, "timeout", xml_handle_seconds, ctx, G_STRUCT_OFFSET (struct rspamd_controller_ctx, timeout)); + rspamd_rcl_register_worker_option (cfg, type, "password", + rspamd_rcl_parse_struct_string, ctx, + G_STRUCT_OFFSET (struct rspamd_controller_ctx, password), 0); + + rspamd_rcl_register_worker_option (cfg, type, "timeout", + rspamd_rcl_parse_struct_time, ctx, + G_STRUCT_OFFSET (struct rspamd_controller_ctx, timeout), RSPAMD_CL_FLAG_TIME_UINT_32); return ctx; } diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 14df0e54d..c516faafe 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -64,7 +64,7 @@ #define CURRENT_FUZZY_VERSION 1 /* Init functions */ -gpointer init_fuzzy (void); +gpointer init_fuzzy (struct config_file *cfg); void start_fuzzy (struct rspamd_worker *worker); worker_t fuzzy_worker = { @@ -981,7 +981,7 @@ parse_fuzzy_update_list (struct rspamd_fuzzy_storage_ctx *ctx) } gpointer -init_fuzzy (void) +init_fuzzy (struct config_file *cfg) { struct rspamd_fuzzy_storage_ctx *ctx; GQuark type; @@ -1002,18 +1002,30 @@ init_fuzzy (void) ctx->update_cond = g_cond_new (); #endif - register_worker_opt (type, "hashfile", xml_handle_string, ctx, - G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, hashfile)); - register_worker_opt (type, "max_mods", xml_handle_uint32, ctx, - G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, max_mods)); - register_worker_opt (type, "frequent_score", xml_handle_uint32, ctx, - G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, frequent_score)); - register_worker_opt (type, "expire", xml_handle_seconds, ctx, - G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, expire)); - register_worker_opt (type, "use_judy", xml_handle_boolean, ctx, - G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, use_judy)); - register_worker_opt (type, "allow_update", xml_handle_string, ctx, - G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, update_map)); + rspamd_rcl_register_worker_option (cfg, type, "hashfile", + rspamd_rcl_parse_struct_string, ctx, + G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, hashfile), 0); + + rspamd_rcl_register_worker_option (cfg, type, "max_mods", + rspamd_rcl_parse_struct_integer, ctx, + G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, max_mods), RSPAMD_CL_FLAG_INT_32); + + rspamd_rcl_register_worker_option (cfg, type, "frequent_score", + rspamd_rcl_parse_struct_integer, ctx, + G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, frequent_score), RSPAMD_CL_FLAG_INT_32); + + rspamd_rcl_register_worker_option (cfg, type, "expire", + rspamd_rcl_parse_struct_time, ctx, + G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, expire), RSPAMD_CL_FLAG_TIME_UINT_32); + + rspamd_rcl_register_worker_option (cfg, type, "use_judy", + rspamd_rcl_parse_struct_boolean, ctx, + G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, use_judy), 0); + + rspamd_rcl_register_worker_option (cfg, type, "allow_update", + rspamd_rcl_parse_struct_string, ctx, + G_STRUCT_OFFSET (struct rspamd_fuzzy_storage_ctx, update_map), 0); + return ctx; } |