summaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-30 13:26:51 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-04-30 13:26:51 +0100
commitd6643f35d783784911ad2e2ca754bcfed29eb11d (patch)
tree55554d57d4439e278788a261eb5ad7e5016a1372 /src/libserver
parent7e66b3bd08dbca9356013a3777f786076d1dacea (diff)
downloadrspamd-d6643f35d783784911ad2e2ca754bcfed29eb11d.tar.gz
rspamd-d6643f35d783784911ad2e2ca754bcfed29eb11d.zip
Refactor config API.
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/binlog.c4
-rw-r--r--src/libserver/binlog.h6
-rw-r--r--src/libserver/cfg_file.h80
-rw-r--r--src/libserver/cfg_rcl.c148
-rw-r--r--src/libserver/cfg_rcl.h26
-rw-r--r--src/libserver/cfg_utils.c78
-rw-r--r--src/libserver/dns.c2
-rw-r--r--src/libserver/dns.h2
-rw-r--r--src/libserver/dynamic_cfg.c12
-rw-r--r--src/libserver/dynamic_cfg.h8
-rw-r--r--src/libserver/settings.c4
-rw-r--r--src/libserver/settings.h4
-rw-r--r--src/libserver/statfile.c4
-rw-r--r--src/libserver/statfile.h8
-rw-r--r--src/libserver/statfile_sync.c10
-rw-r--r--src/libserver/statfile_sync.h2
-rw-r--r--src/libserver/symbols_cache.c12
-rw-r--r--src/libserver/symbols_cache.h8
-rw-r--r--src/libserver/task.h2
-rw-r--r--src/libserver/worker_util.c10
-rw-r--r--src/libserver/worker_util.h8
21 files changed, 223 insertions, 215 deletions
diff --git a/src/libserver/binlog.c b/src/libserver/binlog.c
index f085a7de0..ec191eac7 100644
--- a/src/libserver/binlog.c
+++ b/src/libserver/binlog.c
@@ -518,7 +518,7 @@ maybe_init_static (void)
}
gboolean
-maybe_write_binlog (struct classifier_config *ccf, struct statfile *st, stat_file_t *file, GTree *nodes)
+maybe_write_binlog (struct rspamd_classifier_config *ccf, struct rspamd_statfile_config *st, stat_file_t *file, GTree *nodes)
{
struct rspamd_binlog *log;
@@ -554,7 +554,7 @@ maybe_write_binlog (struct classifier_config *ccf, struct statfile *st, stat_fil
}
struct rspamd_binlog*
-get_binlog_by_statfile (struct statfile *st)
+get_binlog_by_statfile (struct rspamd_statfile_config *st)
{
struct rspamd_binlog *log;
diff --git a/src/libserver/binlog.h b/src/libserver/binlog.h
index 9e1a786d3..6b77a7613 100644
--- a/src/libserver/binlog.h
+++ b/src/libserver/binlog.h
@@ -53,7 +53,7 @@ struct rspamd_binlog {
struct rspamd_index_block *cur_idx;
};
-struct classifier_config;
+struct rspamd_classifier_config;
/*
* Open binlog at specified path with specified rotate params
@@ -63,7 +63,7 @@ struct rspamd_binlog* binlog_open (rspamd_mempool_t *pool, const gchar *path, ti
/*
* Get and open binlog for specified statfile
*/
-struct rspamd_binlog* get_binlog_by_statfile (struct statfile *st);
+struct rspamd_binlog* get_binlog_by_statfile (struct rspamd_statfile_config *st);
/*
* Close binlog
@@ -88,6 +88,6 @@ gboolean binlog_sync (struct rspamd_binlog *log, guint64 from_rev, guint64 *from
/*
* Conditional write to a binlog for specified statfile
*/
-gboolean maybe_write_binlog (struct classifier_config *ccf, struct statfile *st, stat_file_t *file, GTree *nodes);
+gboolean maybe_write_binlog (struct rspamd_classifier_config *ccf, struct rspamd_statfile_config *st, stat_file_t *file, GTree *nodes);
#endif
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index 6ecb441fd..ae809ea25 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -119,7 +119,7 @@ enum lua_var_type {
/**
* Module option
*/
-struct module_opt {
+struct rspamd_module_opt {
gchar *param; /**< parameter name */
gchar *value; /**< parameter value */
gchar *description; /**< parameter description */
@@ -129,15 +129,10 @@ struct module_opt {
enum lua_var_type lua_type; /**< type of lua variable */
};
-struct module_meta_opt {
- gchar *name; /**< Name of meta option */
- GList *options; /**< List of struct module_opt */
-};
-
/**
* Symbol definition
*/
-struct symbol_def {
+struct rspamd_symbol_def {
gchar *name;
gchar *description;
gdouble *weight_ptr;
@@ -146,7 +141,7 @@ struct symbol_def {
/**
* Symbols group
*/
-struct symbols_group {
+struct rspamd_symbols_group {
gchar *name;
GList *symbols;
};
@@ -154,7 +149,7 @@ struct symbols_group {
/**
* Statfile section definition
*/
-struct statfile_section {
+struct rspamd_statfile_section {
guint32 code; /**< section's code */
guint64 size; /**< size of section */
double weight; /**< weight coefficient for section */
@@ -189,12 +184,12 @@ struct statfile_binlog_params {
guint16 master_port;
};
-typedef double (*statfile_normalize_func)(struct config_file *cfg, long double score, void *params);
+typedef double (*statfile_normalize_func)(struct rspamd_config *cfg, long double score, void *params);
/**
* Statfile config definition
*/
-struct statfile {
+struct rspamd_statfile_config {
gchar *symbol; /**< symbol of statfile */
gchar *path; /**< filesystem pattern (with %r or %f) */
gchar *label; /**< label of this statfile */
@@ -212,7 +207,7 @@ struct statfile {
/**
* Classifier config definition
*/
-struct classifier_config {
+struct rspamd_classifier_config {
GList *statfiles; /**< statfiles list */
GHashTable *labels; /**< statfiles with labels */
gchar *metric; /**< metric of this classifier */
@@ -249,7 +244,7 @@ struct rspamd_worker_cfg_parser {
/**
* Config params for rspamd worker
*/
-struct worker_conf {
+struct rspamd_worker_conf {
worker_t *worker; /**< pointer to worker type */
GQuark type; /**< type of worker */
struct rspamd_worker_bind_conf *bind_conf; /**< bind configuration */
@@ -267,7 +262,7 @@ struct worker_conf {
/**
* Structure that stores all config data
*/
-struct config_file {
+struct rspamd_config {
gchar *rspamd_user; /**< user to run as */
gchar *rspamd_group; /**< group to run as */
rspamd_mempool_t *cfg_pool; /**< memory pool for config */
@@ -379,7 +374,8 @@ struct config_file {
* @param priority priority
* @return TRUE if string was parsed
*/
-gboolean parse_host_port_priority (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint16 *port, guint *priority);
+gboolean rspamd_parse_host_port_priority (rspamd_mempool_t *pool,
+ const gchar *str, gchar **addr, guint16 *port, guint *priority);
/**
* Parse host:port line
@@ -387,7 +383,8 @@ gboolean parse_host_port_priority (rspamd_mempool_t *pool, const gchar *str, gch
* @param port port
* @return TRUE if string was parsed
*/
-gboolean parse_host_port (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint16 *port);
+gboolean rspamd_parse_host_port (rspamd_mempool_t *pool, const gchar *str,
+ gchar **addr, guint16 *port);
/**
* Parse host:priority line
@@ -395,7 +392,8 @@ gboolean parse_host_port (rspamd_mempool_t *pool, const gchar *str, gchar **addr
* @param priority priority
* @return TRUE if string was parsed
*/
-gboolean parse_host_priority (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint *priority);
+gboolean rspamd_parse_host_priority (rspamd_mempool_t *pool, const gchar *str,
+ gchar **addr, guint *priority);
/**
* Parse bind credits
@@ -404,19 +402,20 @@ gboolean parse_host_priority (rspamd_mempool_t *pool, const gchar *str, gchar **
* @param type type of credits
* @return 1 if line was successfully parsed and 0 in case of error
*/
-gboolean parse_bind_line (struct config_file *cfg, struct worker_conf *cf, const gchar *str);
+gboolean rspamd_parse_bind_line (struct rspamd_config *cfg,
+ struct rspamd_worker_conf *cf, const gchar *str);
/**
* Init default values
* @param cfg config file
*/
-void init_defaults (struct config_file *cfg);
+void rspamd_config_defaults (struct rspamd_config *cfg);
/**
* Free memory used by config structure
* @param cfg config file
*/
-void free_config (struct config_file *cfg);
+void rspamd_config_free (struct rspamd_config *cfg);
/**
* Gets module option with specified name
@@ -425,7 +424,8 @@ void free_config (struct config_file *cfg);
* @param opt_name name of option to get
* @return module value or NULL if option does not defined
*/
-const ucl_object_t* get_module_opt (struct config_file *cfg, const gchar *module_name,
+const ucl_object_t* rspamd_config_get_module_opt (struct rspamd_config *cfg,
+ const gchar *module_name,
const gchar *opt_name);
/**
@@ -433,82 +433,90 @@ const ucl_object_t* get_module_opt (struct config_file *cfg, const gchar *module
* @param limit string representation of limit (eg. 1M)
* @return numeric value of limit
*/
-guint64 parse_limit (const gchar *limit, guint len);
+guint64 rspamd_config_parse_limit (const gchar *limit, guint len);
/**
* Parse flag
* @param str string representation of flag (eg. 'on')
* @return numeric value of flag (0 or 1)
*/
-gchar parse_flag (const gchar *str);
+gchar rspamd_config_parse_flag (const gchar *str);
/**
* Do post load actions for config
* @param cfg config file
*/
-void post_load_config (struct config_file *cfg);
+void rspamd_config_post_load (struct rspamd_config *cfg);
/**
* Calculate checksum for config file
* @param cfg config file
*/
-gboolean get_config_checksum (struct config_file *cfg);
+gboolean rspamd_config_calculate_checksum (struct rspamd_config *cfg);
/**
* Replace all \" with a single " in given string
* @param line input string
*/
-void unescape_quotes (gchar *line);
+void rspamd_config_unescape_quotes (gchar *line);
/*
* Convert comma separated string to a list of strings
*/
-GList* parse_comma_list (rspamd_mempool_t *pool, const gchar *line);
+GList* rspamd_config_parse_comma_list (rspamd_mempool_t *pool,
+ const gchar *line);
/*
* Return a new classifier_config structure, setting default and non-conflicting attributes
*/
-struct classifier_config* check_classifier_conf (struct config_file *cfg, struct classifier_config *c);
+struct rspamd_classifier_config* rspamd_config_new_classifier (struct rspamd_config *cfg,
+ struct rspamd_classifier_config *c);
/*
* Return a new worker_conf structure, setting default and non-conflicting attributes
*/
-struct worker_conf* check_worker_conf (struct config_file *cfg, struct worker_conf *c);
+struct rspamd_worker_conf* rspamd_config_new_worker (struct rspamd_config *cfg,
+ struct rspamd_worker_conf *c);
/*
* Return a new metric structure, setting default and non-conflicting attributes
*/
-struct metric* check_metric_conf (struct config_file *cfg, struct metric *c);
+struct metric* rspamd_config_new_metric (struct rspamd_config *cfg,
+ struct metric *c);
/*
* Return a new statfile structure, setting default and non-conflicting attributes
*/
-struct statfile* check_statfile_conf (struct config_file *cfg, struct statfile *c);
+struct rspamd_statfile_config* rspamd_config_new_statfile (struct rspamd_config *cfg,
+ struct rspamd_statfile_config *c);
/*
* Read XML configuration file
*/
-gboolean read_rspamd_config (struct config_file *cfg,
+gboolean rspamd_config_read (struct rspamd_config *cfg,
const gchar *filename, const gchar *convert_to,
rspamd_rcl_section_fin_t logger_fin, gpointer logger_ud);
/*
* Register symbols of classifiers inside metrics
*/
-void insert_classifier_symbols (struct config_file *cfg);
+void rspamd_config_insert_classify_symbols (struct rspamd_config *cfg);
/*
* Check statfiles inside a classifier
*/
-gboolean check_classifier_statfiles (struct classifier_config *cf);
+gboolean rspamd_config_check_statfiles (struct rspamd_classifier_config *cf);
/*
* Find classifier config by name
*/
-struct classifier_config* find_classifier_conf (struct config_file *cfg, const gchar *name);
+struct rspamd_classifier_config* rspamd_config_find_classifier (
+ struct rspamd_config *cfg,
+ const gchar *name);
/*
* Parse input `ip_list` to radix tree `tree`. Now supports only IPv4 addresses.
*/
-gboolean rspamd_parse_ip_list (const gchar *ip_list, radix_tree_t **tree);
+gboolean rspamd_config_parse_ip_list (const gchar *ip_list,
+ radix_tree_t **tree);
#endif /* ifdef CFG_FILE_H */
/*
diff --git a/src/libserver/cfg_rcl.c b/src/libserver/cfg_rcl.c
index 37b554dec..be9f63593 100644
--- a/src/libserver/cfg_rcl.c
+++ b/src/libserver/cfg_rcl.c
@@ -34,7 +34,7 @@
* Common section handlers
*/
static gboolean
-rspamd_rcl_logging_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_logging_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const ucl_object_t *val;
@@ -154,7 +154,7 @@ rspamd_rcl_logging_handler (struct config_file *cfg, const ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_options_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_options_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const ucl_object_t *val;
@@ -185,7 +185,7 @@ rspamd_rcl_options_handler (struct config_file *cfg, const ucl_object_t *obj,
static gint
rspamd_symbols_group_find_func (gconstpointer a, gconstpointer b)
{
- const struct symbols_group *gr = a;
+ const struct rspamd_symbols_group *gr = a;
const gchar *uv = b;
return g_ascii_strcasecmp (gr->name, uv);
@@ -200,14 +200,14 @@ rspamd_symbols_group_find_func (gconstpointer a, gconstpointer b)
* @return
*/
static gboolean
-rspamd_rcl_insert_symbol (struct config_file *cfg, struct metric *metric,
+rspamd_rcl_insert_symbol (struct rspamd_config *cfg, struct metric *metric,
const ucl_object_t *obj, gboolean is_legacy, GError **err)
{
const gchar *group = "ungrouped", *description = NULL, *sym_name;
gdouble symbol_score, *score_ptr;
const ucl_object_t *val;
- struct symbols_group *sym_group;
- struct symbol_def *sym_def;
+ struct rspamd_symbols_group *sym_group;
+ struct rspamd_symbol_def *sym_def;
GList *metric_list, *group_list;
/*
@@ -254,7 +254,7 @@ rspamd_rcl_insert_symbol (struct config_file *cfg, struct metric *metric,
return FALSE;
}
- sym_def = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (struct symbol_def));
+ sym_def = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (struct rspamd_symbol_def));
score_ptr = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (gdouble));
*score_ptr = symbol_score;
@@ -280,7 +280,7 @@ rspamd_rcl_insert_symbol (struct config_file *cfg, struct metric *metric,
group_list = g_list_find_custom (cfg->symbols_groups, group, rspamd_symbols_group_find_func);
if (group_list == NULL) {
/* Create new group */
- sym_group = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (struct symbols_group));
+ sym_group = rspamd_mempool_alloc (cfg->cfg_pool, sizeof (struct rspamd_symbols_group));
sym_group->name = rspamd_mempool_strdup (cfg->cfg_pool, group);
sym_group->symbols = NULL;
cfg->symbols_groups = g_list_prepend (cfg->symbols_groups, sym_group);
@@ -295,7 +295,7 @@ rspamd_rcl_insert_symbol (struct config_file *cfg, struct metric *metric,
}
static gboolean
-rspamd_rcl_metric_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_metric_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const ucl_object_t *val, *cur;
@@ -314,7 +314,7 @@ rspamd_rcl_metric_handler (struct config_file *cfg, const ucl_object_t *obj,
metric = g_hash_table_lookup (cfg->metrics, metric_name);
if (metric == NULL) {
- metric = check_metric_conf (cfg, metric);
+ metric = rspamd_config_new_metric (cfg, metric);
metric->name = metric_name;
}
else {
@@ -430,14 +430,14 @@ rspamd_rcl_metric_handler (struct config_file *cfg, const ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_worker_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_worker_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const ucl_object_t *val, *cur;
ucl_object_iter_t it = NULL;
const gchar *worker_type, *worker_bind;
GQuark qtype;
- struct worker_conf *wrk;
+ struct rspamd_worker_conf *wrk;
struct rspamd_worker_cfg_parser *wparser;
struct rspamd_worker_param_parser *whandler;
@@ -445,8 +445,8 @@ rspamd_rcl_worker_handler (struct config_file *cfg, const ucl_object_t *obj,
if (val != NULL && ucl_object_tostring_safe (val, &worker_type)) {
qtype = g_quark_try_string (worker_type);
if (qtype != 0) {
- wrk = check_worker_conf (cfg, NULL);
- wrk->worker = get_worker_by_type (qtype);
+ wrk = rspamd_config_new_worker (cfg, NULL);
+ wrk->worker = rspamd_get_worker_by_type (qtype);
if (wrk->worker == NULL) {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "unknown worker type: %s", worker_type);
return FALSE;
@@ -475,7 +475,7 @@ rspamd_rcl_worker_handler (struct config_file *cfg, const ucl_object_t *obj,
if (!ucl_object_tostring_safe (cur, &worker_bind)) {
continue;
}
- if (!parse_bind_line (cfg, wrk, worker_bind)) {
+ if (!rspamd_parse_bind_line (cfg, wrk, worker_bind)) {
g_set_error (err, CFG_RCL_ERROR, EINVAL, "cannot parse bind line: %s", worker_bind);
return FALSE;
}
@@ -512,9 +512,9 @@ rspamd_rcl_worker_handler (struct config_file *cfg, const ucl_object_t *obj,
}
static void
-rspamd_rcl_set_lua_globals (struct config_file *cfg, lua_State *L)
+rspamd_rcl_set_lua_globals (struct rspamd_config *cfg, lua_State *L)
{
- struct config_file **pcfg;
+ struct rspamd_config **pcfg;
/* First check for global variable 'config' */
lua_getglobal (L, "config");
@@ -542,7 +542,7 @@ rspamd_rcl_set_lua_globals (struct config_file *cfg, lua_State *L)
lua_setglobal (L, "classifiers");
}
- pcfg = lua_newuserdata (L, sizeof (struct config_file *));
+ pcfg = lua_newuserdata (L, sizeof (struct rspamd_config *));
lua_setclass (L, "rspamd{config}", -1);
*pcfg = cfg;
lua_setglobal (L, "rspamd_config");
@@ -552,7 +552,7 @@ rspamd_rcl_set_lua_globals (struct config_file *cfg, lua_State *L)
}
static gboolean
-rspamd_rcl_lua_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_lua_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const gchar *lua_src = rspamd_mempool_strdup (cfg->cfg_pool, ucl_object_tostring (obj));
@@ -621,7 +621,7 @@ rspamd_rcl_lua_handler (struct config_file *cfg, const ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_add_module_path (struct config_file *cfg, const gchar *path, GError **err)
+rspamd_rcl_add_module_path (struct rspamd_config *cfg, const gchar *path, GError **err)
{
struct stat st;
struct script_module *cur_mod;
@@ -668,7 +668,7 @@ rspamd_rcl_add_module_path (struct config_file *cfg, const gchar *path, GError *
}
static gboolean
-rspamd_rcl_modules_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_modules_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const ucl_object_t *val, *cur;
@@ -699,17 +699,17 @@ rspamd_rcl_modules_handler (struct config_file *cfg, const ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_statfile_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_statfile_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
- struct classifier_config *ccf = ud;
+ struct rspamd_classifier_config *ccf = ud;
const ucl_object_t *val;
- struct statfile *st;
+ struct rspamd_statfile_config *st;
const gchar *data;
gdouble binlog_rotate;
GList *labels;
- st = check_statfile_conf (cfg, NULL);
+ st = rspamd_config_new_statfile (cfg, NULL);
val = ucl_object_find_key (obj, "binlog");
if (val != NULL && ucl_object_tostring_safe (val, &data)) {
@@ -732,7 +732,7 @@ rspamd_rcl_statfile_handler (struct config_file *cfg, const ucl_object_t *obj,
}
val = ucl_object_find_key (obj, "binlog_master");
if (val != NULL && ucl_object_tostring_safe (val, &data)) {
- if (!parse_host_port (cfg->cfg_pool, data, &st->binlog->master_addr, &st->binlog->master_port)) {
+ if (!rspamd_parse_host_port (cfg->cfg_pool, data, &st->binlog->master_addr, &st->binlog->master_port)) {
msg_err ("cannot parse master address: %s", data);
return FALSE;
}
@@ -789,13 +789,13 @@ rspamd_rcl_statfile_handler (struct config_file *cfg, const ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_classifier_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_classifier_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const ucl_object_t *val, *cur;
ucl_object_iter_t it = NULL;
const gchar *key, *type;
- struct classifier_config *ccf, *found = NULL;
+ struct rspamd_classifier_config *ccf, *found = NULL;
gboolean res = TRUE;
struct rspamd_rcl_section *stat_section;
GList *cur_cl;
@@ -817,7 +817,7 @@ rspamd_rcl_classifier_handler (struct config_file *cfg, const ucl_object_t *obj,
}
if (found == NULL) {
- ccf = check_classifier_conf (cfg, NULL);
+ ccf = rspamd_config_new_classifier (cfg, NULL);
ccf->classifier = get_classifier (type);
}
else {
@@ -859,7 +859,7 @@ rspamd_rcl_classifier_handler (struct config_file *cfg, const ucl_object_t *obj,
}
static gboolean
-rspamd_rcl_composite_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_composite_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
const ucl_object_t *val;
@@ -907,7 +907,7 @@ rspamd_rcl_composite_handler (struct config_file *cfg, const ucl_object_t *obj,
* for default handlers
*/
static gboolean
-rspamd_rcl_empty_handler (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_empty_handler (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
return rspamd_rcl_section_parse_defaults (section, cfg, obj, cfg, err);
@@ -978,60 +978,60 @@ rspamd_rcl_config_init (void)
FALSE, TRUE);
/* Default handlers */
rspamd_rcl_add_default_handler (sub, "log_buffer", rspamd_rcl_parse_struct_integer,
- G_STRUCT_OFFSET (struct config_file, log_buf_size), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, log_buf_size), 0);
rspamd_rcl_add_default_handler (sub, "log_urls", rspamd_rcl_parse_struct_boolean,
- G_STRUCT_OFFSET (struct config_file, log_urls), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, log_urls), 0);
rspamd_rcl_add_default_handler (sub, "debug_ip", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct config_file, debug_ip_map), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, debug_ip_map), 0);
rspamd_rcl_add_default_handler (sub, "debug_symbols", rspamd_rcl_parse_struct_string_list,
- G_STRUCT_OFFSET (struct config_file, debug_symbols), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, debug_symbols), 0);
rspamd_rcl_add_default_handler (sub, "log_color", rspamd_rcl_parse_struct_boolean,
- G_STRUCT_OFFSET (struct config_file, log_color), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, log_color), 0);
/**
* Options section
*/
sub = rspamd_rcl_add_section (&new, "options", rspamd_rcl_options_handler, UCL_OBJECT,
FALSE, TRUE);
rspamd_rcl_add_default_handler (sub, "cache_file", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct config_file, cache_filename), RSPAMD_CL_FLAG_STRING_PATH);
+ G_STRUCT_OFFSET (struct rspamd_config, cache_filename), RSPAMD_CL_FLAG_STRING_PATH);
rspamd_rcl_add_default_handler (sub, "dns_nameserver", rspamd_rcl_parse_struct_string_list,
- G_STRUCT_OFFSET (struct config_file, nameservers), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, nameservers), 0);
rspamd_rcl_add_default_handler (sub, "dns_timeout", rspamd_rcl_parse_struct_time,
- G_STRUCT_OFFSET (struct config_file, dns_timeout), RSPAMD_CL_FLAG_TIME_FLOAT);
+ G_STRUCT_OFFSET (struct rspamd_config, dns_timeout), RSPAMD_CL_FLAG_TIME_FLOAT);
rspamd_rcl_add_default_handler (sub, "dns_retransmits", rspamd_rcl_parse_struct_integer,
- G_STRUCT_OFFSET (struct config_file, dns_retransmits), RSPAMD_CL_FLAG_INT_32);
+ G_STRUCT_OFFSET (struct rspamd_config, dns_retransmits), RSPAMD_CL_FLAG_INT_32);
rspamd_rcl_add_default_handler (sub, "dns_sockets", rspamd_rcl_parse_struct_integer,
- G_STRUCT_OFFSET (struct config_file, dns_io_per_server), RSPAMD_CL_FLAG_INT_32);
+ G_STRUCT_OFFSET (struct rspamd_config, dns_io_per_server), RSPAMD_CL_FLAG_INT_32);
rspamd_rcl_add_default_handler (sub, "raw_mode", rspamd_rcl_parse_struct_boolean,
- G_STRUCT_OFFSET (struct config_file, raw_mode), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, raw_mode), 0);
rspamd_rcl_add_default_handler (sub, "one_shot", rspamd_rcl_parse_struct_boolean,
- G_STRUCT_OFFSET (struct config_file, one_shot_mode), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, one_shot_mode), 0);
rspamd_rcl_add_default_handler (sub, "check_attachements", rspamd_rcl_parse_struct_boolean,
- G_STRUCT_OFFSET (struct config_file, check_text_attachements), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, check_text_attachements), 0);
rspamd_rcl_add_default_handler (sub, "tempdir", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct config_file, temp_dir), RSPAMD_CL_FLAG_STRING_PATH);
+ G_STRUCT_OFFSET (struct rspamd_config, temp_dir), RSPAMD_CL_FLAG_STRING_PATH);
rspamd_rcl_add_default_handler (sub, "pidfile", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct config_file, pid_file), RSPAMD_CL_FLAG_STRING_PATH);
+ G_STRUCT_OFFSET (struct rspamd_config, pid_file), RSPAMD_CL_FLAG_STRING_PATH);
rspamd_rcl_add_default_handler (sub, "filters", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct config_file, filters_str), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, filters_str), 0);
rspamd_rcl_add_default_handler (sub, "sync_interval", rspamd_rcl_parse_struct_time,
- G_STRUCT_OFFSET (struct config_file, statfile_sync_interval), RSPAMD_CL_FLAG_TIME_INTEGER);
+ G_STRUCT_OFFSET (struct rspamd_config, statfile_sync_interval), RSPAMD_CL_FLAG_TIME_INTEGER);
rspamd_rcl_add_default_handler (sub, "sync_timeout", rspamd_rcl_parse_struct_time,
- G_STRUCT_OFFSET (struct config_file, statfile_sync_timeout), RSPAMD_CL_FLAG_TIME_INTEGER);
+ G_STRUCT_OFFSET (struct rspamd_config, statfile_sync_timeout), RSPAMD_CL_FLAG_TIME_INTEGER);
rspamd_rcl_add_default_handler (sub, "max_diff", rspamd_rcl_parse_struct_integer,
- G_STRUCT_OFFSET (struct config_file, max_diff), RSPAMD_CL_FLAG_INT_SIZE);
+ G_STRUCT_OFFSET (struct rspamd_config, max_diff), RSPAMD_CL_FLAG_INT_SIZE);
rspamd_rcl_add_default_handler (sub, "map_watch_interval", rspamd_rcl_parse_struct_time,
- G_STRUCT_OFFSET (struct config_file, map_timeout), RSPAMD_CL_FLAG_TIME_FLOAT);
+ G_STRUCT_OFFSET (struct rspamd_config, map_timeout), RSPAMD_CL_FLAG_TIME_FLOAT);
rspamd_rcl_add_default_handler (sub, "dynamic_conf", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct config_file, dynamic_conf), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, dynamic_conf), 0);
rspamd_rcl_add_default_handler (sub, "rrd", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct config_file, rrd_file), RSPAMD_CL_FLAG_STRING_PATH);
+ G_STRUCT_OFFSET (struct rspamd_config, rrd_file), RSPAMD_CL_FLAG_STRING_PATH);
rspamd_rcl_add_default_handler (sub, "history_file", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct config_file, history_file), RSPAMD_CL_FLAG_STRING_PATH);
+ G_STRUCT_OFFSET (struct rspamd_config, history_file), RSPAMD_CL_FLAG_STRING_PATH);
rspamd_rcl_add_default_handler (sub, "use_mlock", rspamd_rcl_parse_struct_boolean,
- G_STRUCT_OFFSET (struct config_file, mlock_statfile_pool), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, mlock_statfile_pool), 0);
rspamd_rcl_add_default_handler (sub, "strict_protocol_headers", rspamd_rcl_parse_struct_boolean,
- G_STRUCT_OFFSET (struct config_file, strict_protocol_headers), 0);
+ G_STRUCT_OFFSET (struct rspamd_config, strict_protocol_headers), 0);
/**
* Metric section
@@ -1045,11 +1045,11 @@ rspamd_rcl_config_init (void)
sub = rspamd_rcl_add_section (&new, "worker", rspamd_rcl_worker_handler, UCL_OBJECT,
FALSE, TRUE);
rspamd_rcl_add_default_handler (sub, "count", rspamd_rcl_parse_struct_integer,
- G_STRUCT_OFFSET (struct worker_conf, count), RSPAMD_CL_FLAG_INT_16);
+ G_STRUCT_OFFSET (struct rspamd_worker_conf, count), RSPAMD_CL_FLAG_INT_16);
rspamd_rcl_add_default_handler (sub, "max_files", rspamd_rcl_parse_struct_integer,
- G_STRUCT_OFFSET (struct worker_conf, rlimit_nofile), RSPAMD_CL_FLAG_INT_32);
+ G_STRUCT_OFFSET (struct rspamd_worker_conf, rlimit_nofile), RSPAMD_CL_FLAG_INT_32);
rspamd_rcl_add_default_handler (sub, "max_core", rspamd_rcl_parse_struct_integer,
- G_STRUCT_OFFSET (struct worker_conf, rlimit_maxcore), RSPAMD_CL_FLAG_INT_32);
+ G_STRUCT_OFFSET (struct rspamd_worker_conf, rlimit_maxcore), RSPAMD_CL_FLAG_INT_32);
/**
* Lua handler
@@ -1071,15 +1071,15 @@ rspamd_rcl_config_init (void)
ssub = rspamd_rcl_add_section (&sub->subsections, "statfile", rspamd_rcl_statfile_handler,
UCL_OBJECT, TRUE, TRUE);
rspamd_rcl_add_default_handler (ssub, "symbol", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct statfile, symbol), 0);
+ G_STRUCT_OFFSET (struct rspamd_statfile_config, symbol), 0);
rspamd_rcl_add_default_handler (ssub, "path", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct statfile, path), RSPAMD_CL_FLAG_STRING_PATH);
+ G_STRUCT_OFFSET (struct rspamd_statfile_config, path), RSPAMD_CL_FLAG_STRING_PATH);
rspamd_rcl_add_default_handler (ssub, "label", rspamd_rcl_parse_struct_string,
- G_STRUCT_OFFSET (struct statfile, label), 0);
+ G_STRUCT_OFFSET (struct rspamd_statfile_config, label), 0);
rspamd_rcl_add_default_handler (ssub, "size", rspamd_rcl_parse_struct_integer,
- G_STRUCT_OFFSET (struct statfile, size), RSPAMD_CL_FLAG_INT_SIZE);
+ G_STRUCT_OFFSET (struct rspamd_statfile_config, size), RSPAMD_CL_FLAG_INT_SIZE);
rspamd_rcl_add_default_handler (ssub, "spam", rspamd_rcl_parse_struct_boolean,
- G_STRUCT_OFFSET (struct statfile, is_spam), 0);
+ G_STRUCT_OFFSET (struct rspamd_statfile_config, is_spam), 0);
/**
* Composites handler
@@ -1126,7 +1126,7 @@ rspamd_rcl_config_get_section (struct rspamd_rcl_section *top,
gboolean
rspamd_read_rcl_config (struct rspamd_rcl_section *top,
- struct config_file *cfg, const ucl_object_t *obj, GError **err)
+ struct rspamd_config *cfg, const ucl_object_t *obj, GError **err)
{
const ucl_object_t *found, *cur_obj;
struct rspamd_rcl_section *cur, *tmp;
@@ -1170,7 +1170,7 @@ rspamd_read_rcl_config (struct rspamd_rcl_section *top,
}
gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
- struct config_file *cfg, const ucl_object_t *obj, gpointer ptr,
+ struct rspamd_config *cfg, const ucl_object_t *obj, gpointer ptr,
GError **err)
{
const ucl_object_t *found;
@@ -1195,7 +1195,7 @@ gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
}
gboolean
-rspamd_rcl_parse_struct_string (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_parse_struct_string (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1228,7 +1228,7 @@ rspamd_rcl_parse_struct_string (struct config_file *cfg, const ucl_object_t *obj
}
gboolean
-rspamd_rcl_parse_struct_integer (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_parse_struct_integer (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1286,7 +1286,7 @@ rspamd_rcl_parse_struct_integer (struct config_file *cfg, const ucl_object_t *ob
}
gboolean
-rspamd_rcl_parse_struct_double (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_parse_struct_double (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1303,7 +1303,7 @@ rspamd_rcl_parse_struct_double (struct config_file *cfg, const ucl_object_t *obj
}
gboolean
-rspamd_rcl_parse_struct_time (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_parse_struct_time (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1352,7 +1352,7 @@ rspamd_rcl_parse_struct_time (struct config_file *cfg, const ucl_object_t *obj,
}
gboolean
-rspamd_rcl_parse_struct_string_list (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_parse_struct_string_list (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1400,7 +1400,7 @@ rspamd_rcl_parse_struct_string_list (struct config_file *cfg, const ucl_object_t
}
gboolean
-rspamd_rcl_parse_struct_boolean (struct config_file *cfg, const ucl_object_t *obj,
+rspamd_rcl_parse_struct_boolean (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err)
{
struct rspamd_rcl_struct_parser *pd = ud;
@@ -1423,7 +1423,7 @@ rspamd_rcl_parse_struct_boolean (struct config_file *cfg, const ucl_object_t *ob
}
void
-rspamd_rcl_register_worker_option (struct config_file *cfg, gint type, const gchar *name,
+rspamd_rcl_register_worker_option (struct rspamd_config *cfg, gint type, const gchar *name,
rspamd_rcl_handler_t handler, gpointer target, gsize offset, gint flags)
{
struct rspamd_worker_param_parser *nhandler;
@@ -1454,7 +1454,7 @@ rspamd_rcl_register_worker_option (struct config_file *cfg, gint type, const gch
void
-rspamd_rcl_register_worker_parser (struct config_file *cfg, gint type,
+rspamd_rcl_register_worker_parser (struct rspamd_config *cfg, gint type,
gboolean (*func)(ucl_object_t *, gpointer), gpointer ud)
{
struct rspamd_worker_cfg_parser *nparser;
diff --git a/src/libserver/cfg_rcl.h b/src/libserver/cfg_rcl.h
index 99839d1ea..6db0b0d81 100644
--- a/src/libserver/cfg_rcl.h
+++ b/src/libserver/cfg_rcl.h
@@ -36,7 +36,7 @@ cfg_rcl_error_quark (void)
}
struct rspamd_rcl_section;
-struct config_file;
+struct rspamd_config;
struct rspamd_rcl_struct_parser {
gpointer user_struct;
@@ -63,7 +63,7 @@ struct rspamd_rcl_struct_parser {
* @param err error object
* @return TRUE if a section has been parsed
*/
-typedef gboolean (*rspamd_rcl_handler_t) (struct config_file *cfg, const ucl_object_t *obj,
+typedef gboolean (*rspamd_rcl_handler_t) (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -71,7 +71,7 @@ typedef gboolean (*rspamd_rcl_handler_t) (struct config_file *cfg, const ucl_obj
* @param cfg configuration
* @param ud user data
*/
-typedef void (*rspamd_rcl_section_fin_t)(struct config_file *cfg, gpointer ud);
+typedef void (*rspamd_rcl_section_fin_t)(struct rspamd_config *cfg, gpointer ud);
struct rspamd_rcl_default_handler_data {
struct rspamd_rcl_struct_parser pd;
@@ -116,7 +116,7 @@ struct rspamd_rcl_section *rspamd_rcl_config_get_section (struct rspamd_rcl_sect
* @return TRUE if an object can be parsed
*/
gboolean rspamd_read_rcl_config (struct rspamd_rcl_section *top,
- struct config_file *cfg, const ucl_object_t *obj, GError **err);
+ struct rspamd_config *cfg, const ucl_object_t *obj, GError **err);
/**
@@ -129,7 +129,7 @@ gboolean rspamd_read_rcl_config (struct rspamd_rcl_section *top,
* @return TRUE if the object has been parsed
*/
gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
- struct config_file *cfg, const ucl_object_t *obj, gpointer ptr,
+ struct rspamd_config *cfg, const ucl_object_t *obj, gpointer ptr,
GError **err);
/**
* Here is a section of common handlers that accepts rcl_struct_parser
@@ -146,7 +146,7 @@ gboolean rspamd_rcl_section_parse_defaults (struct rspamd_rcl_section *section,
* @param err error pointer
* @return TRUE if a string value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_string (struct config_file *cfg, const ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_string (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -158,7 +158,7 @@ gboolean rspamd_rcl_parse_struct_string (struct config_file *cfg, const ucl_obje
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_integer (struct config_file *cfg, const ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_integer (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
@@ -171,7 +171,7 @@ gboolean rspamd_rcl_parse_struct_integer (struct config_file *cfg, const ucl_obj
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_double (struct config_file *cfg, const ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_double (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -183,7 +183,7 @@ gboolean rspamd_rcl_parse_struct_double (struct config_file *cfg, const ucl_obje
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_time (struct config_file *cfg, const ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_time (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -195,7 +195,7 @@ gboolean rspamd_rcl_parse_struct_time (struct config_file *cfg, const ucl_object
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_string_list (struct config_file *cfg, const ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_string_list (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -207,7 +207,7 @@ gboolean rspamd_rcl_parse_struct_string_list (struct config_file *cfg, const ucl
* @param err error pointer
* @return TRUE if a value has been successfully parsed
*/
-gboolean rspamd_rcl_parse_struct_boolean (struct config_file *cfg, const ucl_object_t *obj,
+gboolean rspamd_rcl_parse_struct_boolean (struct rspamd_config *cfg, const ucl_object_t *obj,
gpointer ud, struct rspamd_rcl_section *section, GError **err);
/**
@@ -223,7 +223,7 @@ gboolean rspamd_rcl_parse_struct_boolean (struct config_file *cfg, const ucl_obj
* @param target opaque target structure
* @param offset offset inside a structure
*/
-void rspamd_rcl_register_worker_option (struct config_file *cfg, gint type, const gchar *name,
+void rspamd_rcl_register_worker_option (struct rspamd_config *cfg, gint type, const gchar *name,
rspamd_rcl_handler_t handler, gpointer target, gsize offset, gint flags);
/**
@@ -233,6 +233,6 @@ void rspamd_rcl_register_worker_option (struct config_file *cfg, gint type, cons
* @param func handler function
* @param ud userdata for handler function
*/
-void rspamd_rcl_register_worker_parser (struct config_file *cfg, gint type,
+void rspamd_rcl_register_worker_parser (struct rspamd_config *cfg, gint type,
gboolean (*func)(ucl_object_t *, gpointer), gpointer ud);
#endif /* CFG_RCL_H_ */
diff --git a/src/libserver/cfg_utils.c b/src/libserver/cfg_utils.c
index 920de94e4..120128f5e 100644
--- a/src/libserver/cfg_utils.c
+++ b/src/libserver/cfg_utils.c
@@ -42,7 +42,7 @@
#define DEFAULT_MAP_TIMEOUT 10
struct rspamd_ucl_map_cbdata {
- struct config_file *cfg;
+ struct rspamd_config *cfg;
GString *buf;
};
static gchar* rspamd_ucl_read_cb (rspamd_mempool_t * pool, gchar * chunk, gint len, struct map_cb_data *data);
@@ -162,7 +162,7 @@ err:
}
gboolean
-parse_host_port_priority (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint16 *port, guint *priority)
+rspamd_parse_host_port_priority (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint16 *port, guint *priority)
{
gchar **tokens;
gboolean ret;
@@ -180,19 +180,19 @@ parse_host_port_priority (rspamd_mempool_t *pool, const gchar *str, gchar **addr
}
gboolean
-parse_host_port (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint16 *port)
+rspamd_parse_host_port (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint16 *port)
{
- return parse_host_port_priority (pool, str, addr, port, NULL);
+ return rspamd_parse_host_port_priority (pool, str, addr, port, NULL);
}
gboolean
-parse_host_priority (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint *priority)
+rspamd_parse_host_priority (rspamd_mempool_t *pool, const gchar *str, gchar **addr, guint *priority)
{
- return parse_host_port_priority (pool, str, addr, NULL, priority);
+ return rspamd_parse_host_port_priority (pool, str, addr, NULL, priority);
}
gboolean
-parse_bind_line (struct config_file *cfg, struct worker_conf *cf, const gchar *str)
+rspamd_parse_bind_line (struct rspamd_config *cfg, struct rspamd_worker_conf *cf, const gchar *str)
{
struct rspamd_worker_bind_conf *cnf;
gchar **tokens, *tmp, *err;
@@ -259,7 +259,7 @@ parse_bind_line (struct config_file *cfg, struct worker_conf *cf, const gchar *s
}
void
-init_defaults (struct config_file *cfg)
+rspamd_config_defaults (struct rspamd_config *cfg)
{
cfg->memcached_error_time = DEFAULT_UPSTREAM_ERROR_TIME;
@@ -298,10 +298,10 @@ init_defaults (struct config_file *cfg)
}
void
-free_config (struct config_file *cfg)
+rspamd_config_free (struct rspamd_config *cfg)
{
GList *cur;
- struct symbols_group *gr;
+ struct rspamd_symbols_group *gr;
remove_all_maps (cfg);
ucl_obj_unref (cfg->rcl_obj);
@@ -337,7 +337,7 @@ free_config (struct config_file *cfg)
}
const ucl_object_t *
-get_module_opt (struct config_file *cfg, const gchar *module_name, const gchar *opt_name)
+rspamd_config_get_module_opt (struct rspamd_config *cfg, const gchar *module_name, const gchar *opt_name)
{
const ucl_object_t *res = NULL, *sec;
@@ -350,7 +350,7 @@ get_module_opt (struct config_file *cfg, const gchar *module_name, const gchar *
}
guint64
-parse_limit (const gchar *limit, guint len)
+rspamd_config_parse_limit (const gchar *limit, guint len)
{
guint64 result = 0;
const gchar *err_str;
@@ -385,7 +385,7 @@ parse_limit (const gchar *limit, guint len)
}
gchar
-parse_flag (const gchar *str)
+rspamd_config_parse_flag (const gchar *str)
{
guint len;
gchar c;
@@ -438,7 +438,7 @@ parse_flag (const gchar *str)
}
gboolean
-get_config_checksum (struct config_file *cfg)
+rspamd_config_calculate_checksum (struct rspamd_config *cfg)
{
gint fd;
void *map;
@@ -472,7 +472,7 @@ get_config_checksum (struct config_file *cfg)
* Perform post load actions
*/
void
-post_load_config (struct config_file *cfg)
+rspamd_config_post_load (struct rspamd_config *cfg)
{
#ifdef HAVE_CLOCK_GETTIME
struct timespec ts;
@@ -501,7 +501,7 @@ post_load_config (struct config_file *cfg)
#endif
if ((def_metric = g_hash_table_lookup (cfg->metrics, DEFAULT_METRIC)) == NULL) {
- def_metric = check_metric_conf (cfg, NULL);
+ def_metric = rspamd_config_new_metric (cfg, NULL);
def_metric->name = DEFAULT_METRIC;
def_metric->actions[METRIC_ACTION_REJECT].score = DEFAULT_SCORE;
cfg->metrics_list = g_list_prepend (cfg->metrics_list, def_metric);
@@ -552,7 +552,7 @@ parse_warn (const gchar *fmt, ...)
#endif
void
-unescape_quotes (gchar *line)
+rspamd_config_unescape_quotes (gchar *line)
{
gchar *c = line, *t;
@@ -569,7 +569,7 @@ unescape_quotes (gchar *line)
}
GList *
-parse_comma_list (rspamd_mempool_t * pool, const gchar *line)
+rspamd_config_parse_comma_list (rspamd_mempool_t * pool, const gchar *line)
{
GList *res = NULL;
const gchar *c, *p;
@@ -597,11 +597,11 @@ parse_comma_list (rspamd_mempool_t * pool, const gchar *line)
return res;
}
-struct classifier_config *
-check_classifier_conf (struct config_file *cfg, struct classifier_config *c)
+struct rspamd_classifier_config *
+rspamd_config_new_classifier (struct rspamd_config *cfg, struct rspamd_classifier_config *c)
{
if (c == NULL) {
- c = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct classifier_config));
+ c = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct rspamd_classifier_config));
}
if (c->opts == NULL) {
c->opts = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
@@ -615,18 +615,18 @@ check_classifier_conf (struct config_file *cfg, struct classifier_config *c)
return c;
}
-struct statfile*
-check_statfile_conf (struct config_file *cfg, struct statfile *c)
+struct rspamd_statfile_config*
+rspamd_config_new_statfile (struct rspamd_config *cfg, struct rspamd_statfile_config *c)
{
if (c == NULL) {
- c = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct statfile));
+ c = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct rspamd_statfile_config));
}
return c;
}
struct metric *
-check_metric_conf (struct config_file *cfg, struct metric *c)
+rspamd_config_new_metric (struct rspamd_config *cfg, struct metric *c)
{
int i;
if (c == NULL) {
@@ -644,11 +644,11 @@ check_metric_conf (struct config_file *cfg, struct metric *c)
return c;
}
-struct worker_conf *
-check_worker_conf (struct config_file *cfg, struct worker_conf *c)
+struct rspamd_worker_conf *
+rspamd_config_new_worker (struct rspamd_config *cfg, struct rspamd_worker_conf *c)
{
if (c == NULL) {
- c = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct worker_conf));
+ c = rspamd_mempool_alloc0 (cfg->cfg_pool, sizeof (struct rspamd_worker_conf));
c->params = g_hash_table_new (rspamd_str_hash, rspamd_str_equal);
c->active_workers = g_queue_new ();
rspamd_mempool_add_destructor (cfg->cfg_pool, (rspamd_mempool_destruct_t)g_hash_table_destroy, c->params);
@@ -669,7 +669,7 @@ check_worker_conf (struct config_file *cfg, struct worker_conf *c)
static bool
rspamd_include_map_handler (const guchar *data, gsize len, void* ud)
{
- struct config_file *cfg = (struct config_file *)ud;
+ struct rspamd_config *cfg = (struct rspamd_config *)ud;
struct rspamd_ucl_map_cbdata *cbdata, **pcbdata;
gchar *map_line;
@@ -719,13 +719,13 @@ rspamd_ucl_add_conf_variables (struct ucl_parser *parser)
}
static void
-rspamd_ucl_add_conf_macros (struct ucl_parser *parser, struct config_file *cfg)
+rspamd_ucl_add_conf_macros (struct ucl_parser *parser, struct rspamd_config *cfg)
{
ucl_parser_register_macro (parser, "include_map", rspamd_include_map_handler, cfg);
}
gboolean
-read_rspamd_config (struct config_file *cfg, const gchar *filename,
+rspamd_config_read (struct rspamd_config *cfg, const gchar *filename,
const gchar *convert_to, rspamd_rcl_section_fin_t logger_fin,
gpointer logger_ud)
{
@@ -792,22 +792,22 @@ read_rspamd_config (struct config_file *cfg, const gchar *filename,
static void
symbols_classifiers_callback (gpointer key, gpointer value, gpointer ud)
{
- struct config_file *cfg = ud;
+ struct rspamd_config *cfg = ud;
register_virtual_symbol (&cfg->cache, key, 1.0);
}
void
-insert_classifier_symbols (struct config_file *cfg)
+rspamd_config_insert_classify_symbols (struct rspamd_config *cfg)
{
g_hash_table_foreach (cfg->classifiers_symbols, symbols_classifiers_callback, cfg);
}
-struct classifier_config*
-find_classifier_conf (struct config_file *cfg, const gchar *name)
+struct rspamd_classifier_config*
+rspamd_config_find_classifier (struct rspamd_config *cfg, const gchar *name)
{
GList *cur;
- struct classifier_config *cf;
+ struct rspamd_classifier_config *cf;
if (name == NULL) {
return NULL;
@@ -828,9 +828,9 @@ find_classifier_conf (struct config_file *cfg, const gchar *name)
}
gboolean
-check_classifier_statfiles (struct classifier_config *cf)
+rspamd_config_check_statfiles (struct rspamd_classifier_config *cf)
{
- struct statfile *st;
+ struct rspamd_statfile_config *st;
gboolean has_other = FALSE, res = FALSE, cur_class;
GList *cur;
@@ -943,7 +943,7 @@ rspamd_ucl_fin_cb (rspamd_mempool_t * pool, struct map_cb_data *data)
}
gboolean
-rspamd_parse_ip_list (const gchar *ip_list, radix_tree_t **tree)
+rspamd_config_parse_ip_list (const gchar *ip_list, radix_tree_t **tree)
{
gchar **strvec, **cur;
struct in_addr ina;
diff --git a/src/libserver/dns.c b/src/libserver/dns.c
index e20cca9df..8d18ffc06 100644
--- a/src/libserver/dns.c
+++ b/src/libserver/dns.c
@@ -94,7 +94,7 @@ make_dns_request (struct rspamd_dns_resolver *resolver,
struct rspamd_dns_resolver *
-dns_resolver_init (rspamd_logger_t *logger, struct event_base *ev_base, struct config_file *cfg)
+dns_resolver_init (rspamd_logger_t *logger, struct event_base *ev_base, struct rspamd_config *cfg)
{
GList *cur;
struct rspamd_dns_resolver *new;
diff --git a/src/libserver/dns.h b/src/libserver/dns.h
index 26ae71387..7b3bbd208 100644
--- a/src/libserver/dns.h
+++ b/src/libserver/dns.h
@@ -40,7 +40,7 @@ struct rspamd_dns_resolver;
* Init DNS resolver, params are obtained from a config file or system file /etc/resolv.conf
*/
struct rspamd_dns_resolver *dns_resolver_init (rspamd_logger_t *logger,
- struct event_base *ev_base, struct config_file *cfg);
+ struct event_base *ev_base, struct rspamd_config *cfg);
/**
* Make a DNS request
diff --git a/src/libserver/dynamic_cfg.c b/src/libserver/dynamic_cfg.c
index 7f5e8530d..d0dabef67 100644
--- a/src/libserver/dynamic_cfg.c
+++ b/src/libserver/dynamic_cfg.c
@@ -48,7 +48,7 @@ struct config_json_buf {
gchar *buf;
gchar *pos;
size_t buflen;
- struct config_file *cfg;
+ struct rspamd_config *cfg;
GList *config_metrics;
};
@@ -89,7 +89,7 @@ dynamic_cfg_free (GList *conf_metrics)
* @param cfg
*/
static void
-apply_dynamic_conf (GList *conf_metrics, struct config_file *cfg)
+apply_dynamic_conf (GList *conf_metrics, struct rspamd_config *cfg)
{
GList *cur, *cur_elt;
struct dynamic_cfg_metric *metric;
@@ -312,7 +312,7 @@ json_config_fin_cb (rspamd_mempool_t * pool, struct map_cb_data *data)
* @param cfg config file
*/
void
-init_dynamic_config (struct config_file *cfg)
+init_dynamic_config (struct rspamd_config *cfg)
{
struct config_json_buf *jb, **pjb;
@@ -412,7 +412,7 @@ dump_dynamic_list (gint fd, GList *rules)
* @return
*/
gboolean
-dump_dynamic_config (struct config_file *cfg)
+dump_dynamic_config (struct rspamd_config *cfg)
{
struct stat st;
gchar *dir, pathbuf[PATH_MAX];
@@ -490,7 +490,7 @@ dump_dynamic_config (struct config_file *cfg)
* @return
*/
gboolean
-add_dynamic_symbol (struct config_file *cfg, const gchar *metric_name, const gchar *symbol, gdouble value)
+add_dynamic_symbol (struct rspamd_config *cfg, const gchar *metric_name, const gchar *symbol, gdouble value)
{
GList *cur;
struct dynamic_cfg_metric *metric = NULL;
@@ -560,7 +560,7 @@ add_dynamic_symbol (struct config_file *cfg, const gchar *metric_name, const gch
* @return
*/
gboolean
-add_dynamic_action (struct config_file *cfg, const gchar *metric_name, guint action, gdouble value)
+add_dynamic_action (struct rspamd_config *cfg, const gchar *metric_name, guint action, gdouble value)
{
GList *cur;
struct dynamic_cfg_metric *metric = NULL;
diff --git a/src/libserver/dynamic_cfg.h b/src/libserver/dynamic_cfg.h
index b65d7aa9a..a8cb02ae5 100644
--- a/src/libserver/dynamic_cfg.h
+++ b/src/libserver/dynamic_cfg.h
@@ -32,14 +32,14 @@
* Init dynamic configuration using map logic and specific configuration
* @param cfg config file
*/
-void init_dynamic_config (struct config_file *cfg);
+void init_dynamic_config (struct rspamd_config *cfg);
/**
* Dump dynamic configuration to the disk
* @param cfg
* @return
*/
-gboolean dump_dynamic_config (struct config_file *cfg);
+gboolean dump_dynamic_config (struct rspamd_config *cfg);
/**
* Add symbol for specified metric
@@ -49,7 +49,7 @@ gboolean dump_dynamic_config (struct config_file *cfg);
* @param value value of symbol
* @return
*/
-gboolean add_dynamic_symbol (struct config_file *cfg, const gchar *metric, const gchar *symbol, gdouble value);
+gboolean add_dynamic_symbol (struct rspamd_config *cfg, const gchar *metric, const gchar *symbol, gdouble value);
/**
@@ -60,7 +60,7 @@ gboolean add_dynamic_symbol (struct config_file *cfg, const gchar *metric, const
* @param value value of symbol
* @return
*/
-gboolean add_dynamic_action (struct config_file *cfg, const gchar *metric, guint action, gdouble value);
+gboolean add_dynamic_action (struct rspamd_config *cfg, const gchar *metric, guint action, gdouble value);
#endif /* DYNAMIC_CFG_H_ */
diff --git a/src/libserver/settings.c b/src/libserver/settings.c
index c3292c8ab..ca6a9c773 100644
--- a/src/libserver/settings.c
+++ b/src/libserver/settings.c
@@ -353,7 +353,7 @@ json_fin_cb (rspamd_mempool_t * pool, struct map_cb_data *data)
}
gboolean
-read_settings (const gchar *path, const gchar *description, struct config_file *cfg, GHashTable * table)
+read_settings (const gchar *path, const gchar *description, struct rspamd_config *cfg, GHashTable * table)
{
struct json_buf *jb = g_malloc (sizeof (struct json_buf)), **pjb;
@@ -372,7 +372,7 @@ read_settings (const gchar *path, const gchar *description, struct config_file *
}
void
-init_settings (struct config_file *cfg)
+init_settings (struct rspamd_config *cfg)
{
cfg->domain_settings = g_hash_table_new_full (rspamd_strcase_hash, rspamd_strcase_equal,
g_free, (GDestroyNotify)settings_unref);
diff --git a/src/libserver/settings.h b/src/libserver/settings.h
index 361700094..6bdba9f4a 100644
--- a/src/libserver/settings.h
+++ b/src/libserver/settings.h
@@ -20,12 +20,12 @@ struct rspamd_settings {
/*
* Read settings from specified path
*/
-gboolean read_settings (const gchar *path, const gchar *description, struct config_file *cfg, GHashTable *table);
+gboolean read_settings (const gchar *path, const gchar *description, struct rspamd_config *cfg, GHashTable *table);
/*
* Init configuration structures for settings
*/
-void init_settings (struct config_file *cfg);
+void init_settings (struct rspamd_config *cfg);
/*
* Check scores settings
diff --git a/src/libserver/statfile.c b/src/libserver/statfile.c
index 4c1cc13fb..a993fd116 100644
--- a/src/libserver/statfile.c
+++ b/src/libserver/statfile.c
@@ -862,8 +862,8 @@ statfile_pool_plan_invalidate (statfile_pool_t *pool, time_t seconds, time_t jit
stat_file_t *
-get_statfile_by_symbol (statfile_pool_t *pool, struct classifier_config *ccf,
- const gchar *symbol, struct statfile **st, gboolean try_create)
+get_statfile_by_symbol (statfile_pool_t *pool, struct rspamd_classifier_config *ccf,
+ const gchar *symbol, struct rspamd_statfile_config **st, gboolean try_create)
{
stat_file_t *res = NULL;
GList *cur;
diff --git a/src/libserver/statfile.h b/src/libserver/statfile.h
index 5786c4927..3ad5f1321 100644
--- a/src/libserver/statfile.h
+++ b/src/libserver/statfile.h
@@ -96,8 +96,8 @@ typedef struct statfile_pool_s {
} statfile_pool_t;
/* Forwarded declarations */
-struct classifier_config;
-struct statfile;
+struct rspamd_classifier_config;
+struct rspamd_statfile_config;
/**
* Create new statfile pool
@@ -278,7 +278,7 @@ void statfile_pool_plan_invalidate (statfile_pool_t *pool, time_t seconds, time_
* @param st statfile to get
* @param try_create whether we need to create statfile if it is absent
*/
-stat_file_t* get_statfile_by_symbol (statfile_pool_t *pool, struct classifier_config *ccf,
- const gchar *symbol, struct statfile **st, gboolean try_create);
+stat_file_t* get_statfile_by_symbol (statfile_pool_t *pool, struct rspamd_classifier_config *ccf,
+ const gchar *symbol, struct rspamd_statfile_config **st, gboolean try_create);
#endif
diff --git a/src/libserver/statfile_sync.c b/src/libserver/statfile_sync.c
index 6b545af17..1121658fa 100644
--- a/src/libserver/statfile_sync.c
+++ b/src/libserver/statfile_sync.c
@@ -40,7 +40,7 @@ enum rspamd_sync_state {
/* Context of sync process */
struct rspamd_sync_ctx {
- struct statfile *st;
+ struct rspamd_statfile_config *st;
stat_file_t *real_statfile;
statfile_pool_t *pool;
rspamd_io_dispatcher_t *dispatcher;
@@ -280,7 +280,7 @@ sync_timer_callback (gint fd, short what, void *ud)
}
static gboolean
-add_statfile_watch (statfile_pool_t *pool, struct statfile *st, struct config_file *cfg, struct event_base *ev_base)
+add_statfile_watch (statfile_pool_t *pool, struct rspamd_statfile_config *st, struct rspamd_config *cfg, struct event_base *ev_base)
{
struct rspamd_sync_ctx *ctx;
guint32 jittered_interval;
@@ -320,11 +320,11 @@ add_statfile_watch (statfile_pool_t *pool, struct statfile *st, struct config_fi
}
gboolean
-start_statfile_sync (statfile_pool_t *pool, struct config_file *cfg, struct event_base *ev_base)
+start_statfile_sync (statfile_pool_t *pool, struct rspamd_config *cfg, struct event_base *ev_base)
{
GList *cur, *l;
- struct classifier_config *cl;
- struct statfile *st;
+ struct rspamd_classifier_config *cl;
+ struct rspamd_statfile_config *st;
/*
* First of all walk through all classifiers and find those statfiles
diff --git a/src/libserver/statfile_sync.h b/src/libserver/statfile_sync.h
index b3abb8b91..bcaeb3bb5 100644
--- a/src/libserver/statfile_sync.h
+++ b/src/libserver/statfile_sync.h
@@ -9,6 +9,6 @@
/*
* Start synchronization of statfiles. Must be called after event_init as it adds events
*/
-gboolean start_statfile_sync (statfile_pool_t *pool, struct config_file *cfg, struct event_base *ev_base);
+gboolean start_statfile_sync (statfile_pool_t *pool, struct rspamd_config *cfg, struct event_base *ev_base);
#endif
diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c
index dfca57c66..b0ce7d872 100644
--- a/src/libserver/symbols_cache.c
+++ b/src/libserver/symbols_cache.c
@@ -332,7 +332,7 @@ register_symbol_common (struct symbols_cache **cache, const gchar *name, double
pcache->used_items++;
g_hash_table_insert (pcache->items_by_symbol, item->s->symbol, item);
msg_debug ("used items: %d, added symbol: %s", (*cache)->used_items, name);
- set_counter (item->s->symbol, 0);
+ rspamd_set_counter (item->s->symbol, 0);
*target = g_list_prepend (*target, item);
}
@@ -401,7 +401,7 @@ register_dynamic_symbol (rspamd_mempool_t *dynamic_pool, struct symbols_cache **
pcache->used_items++;
msg_debug ("used items: %d, added symbol: %s", (*cache)->used_items, name);
- set_counter (item->s->symbol, 0);
+ rspamd_set_counter (item->s->symbol, 0);
g_hash_table_insert (pcache->items_by_symbol, item->s->symbol, item);
@@ -521,7 +521,7 @@ free_cache (gpointer arg)
}
gboolean
-init_symbols_cache (rspamd_mempool_t * pool, struct symbols_cache *cache, struct config_file *cfg,
+init_symbols_cache (rspamd_mempool_t * pool, struct symbols_cache *cache, struct rspamd_config *cfg,
const gchar *filename, gboolean ignore_checksum)
{
struct stat st;
@@ -691,7 +691,7 @@ check_negative_dynamic_item (struct rspamd_task *task, struct symbols_cache *cac
}
static gboolean
-check_debug_symbol (struct config_file *cfg, const gchar *symbol)
+check_debug_symbol (struct rspamd_config *cfg, const gchar *symbol)
{
GList *cur;
@@ -736,7 +736,7 @@ rspamd_symbols_cache_metric_cb (gpointer k, gpointer v, gpointer ud)
}
gboolean
-validate_cache (struct symbols_cache *cache, struct config_file *cfg, gboolean strict)
+validate_cache (struct symbols_cache *cache, struct rspamd_config *cfg, gboolean strict)
{
struct cache_item *item;
GList *cur, *p, *metric_symbols;
@@ -1045,7 +1045,7 @@ call_symbol_callback (struct rspamd_task * task, struct symbols_cache * cache, g
#else
diff = (tv2.tv_sec - tv1.tv_sec) * 1000000 + (tv2.tv_usec - tv1.tv_usec);
#endif
- item->s->avg_time = set_counter (item->s->symbol, diff);
+ item->s->avg_time = rspamd_set_counter (item->s->symbol, diff);
}
s->saved_item = item;
diff --git a/src/libserver/symbols_cache.h b/src/libserver/symbols_cache.h
index bb2100fc1..b3835824d 100644
--- a/src/libserver/symbols_cache.h
+++ b/src/libserver/symbols_cache.h
@@ -7,7 +7,7 @@
#define MAX_SYMBOL 128
struct rspamd_task;
-struct config_file;
+struct rspamd_config;
typedef void (*symbol_func_t)(struct rspamd_task *task, gpointer user_data);
@@ -71,13 +71,13 @@ struct symbols_cache {
guint uses;
gpointer map;
rspamd_mempool_rwlock_t *lock;
- struct config_file *cfg;
+ struct rspamd_config *cfg;
};
/**
* Load symbols cache from file, must be called _after_ init_symbols_cache
*/
-gboolean init_symbols_cache (rspamd_mempool_t *pool, struct symbols_cache *cache, struct config_file *cfg,
+gboolean init_symbols_cache (rspamd_mempool_t *pool, struct symbols_cache *cache, struct rspamd_config *cfg,
const gchar *filename, gboolean ignore_checksum);
/**
@@ -144,7 +144,7 @@ void remove_dynamic_rules (struct symbols_cache *cache);
* @param cfg configuration
* @param strict do strict checks - symbols MUST be described in metrics
*/
-gboolean validate_cache (struct symbols_cache *cache, struct config_file *cfg, gboolean strict);
+gboolean validate_cache (struct symbols_cache *cache, struct rspamd_config *cfg, gboolean strict);
#endif
diff --git a/src/libserver/task.h b/src/libserver/task.h
index 0891dc6e2..1d2b299ec 100644
--- a/src/libserver/task.h
+++ b/src/libserver/task.h
@@ -112,7 +112,7 @@ struct rspamd_task {
* pointer */
GList *messages; /**< list of messages that would be reported */
GHashTable *re_cache; /**< cache for matched or not matched regexps */
- struct config_file *cfg; /**< pointer to config object */
+ struct rspamd_config *cfg; /**< pointer to config object */
gchar *last_error; /**< last error */
gint error_code; /**< code of last error */
rspamd_mempool_t *task_pool; /**< memory pool for task */
diff --git a/src/libserver/worker_util.c b/src/libserver/worker_util.c
index 5507cdb7c..e8c97f20a 100644
--- a/src/libserver/worker_util.c
+++ b/src/libserver/worker_util.c
@@ -34,7 +34,7 @@ extern struct rspamd_main *rspamd_main;
* @return worker's control structure or NULL
*/
worker_t*
-get_worker_by_type (GQuark type)
+rspamd_get_worker_by_type (GQuark type)
{
worker_t **cur;
@@ -50,7 +50,7 @@ get_worker_by_type (GQuark type)
}
double
-set_counter (const gchar *name, guint32 value)
+rspamd_set_counter (const gchar *name, guint32 value)
{
struct counter_data *cd;
double alpha;
@@ -122,7 +122,7 @@ worker_sigusr2_handler (gint fd, short what, void *arg)
tv.tv_usec = 0;
event_del (&worker->sig_ev_usr1);
event_del (&worker->sig_ev_usr2);
- worker_stop_accept (worker);
+ rspamd_worker_stop_accept (worker);
msg_info ("worker's shutdown is pending in %d sec", SOFT_SHUTDOWN_TIME);
event_loopexit (&tv);
}
@@ -143,7 +143,7 @@ worker_sigusr1_handler (gint fd, short what, void *arg)
}
struct event_base *
-prepare_worker (struct rspamd_worker *worker, const char *name,
+rspamd_prepare_worker (struct rspamd_worker *worker, const char *name,
void (*accept_handler)(int, short, void *))
{
struct event_base *ev_base;
@@ -197,7 +197,7 @@ prepare_worker (struct rspamd_worker *worker, const char *name,
}
void
-worker_stop_accept (struct rspamd_worker *worker)
+rspamd_worker_stop_accept (struct rspamd_worker *worker)
{
GList *cur;
struct event *event;
diff --git a/src/libserver/worker_util.h b/src/libserver/worker_util.h
index d88b93a8a..67ad9e83c 100644
--- a/src/libserver/worker_util.h
+++ b/src/libserver/worker_util.h
@@ -31,12 +31,12 @@
* @param type
* @return worker's control structure or NULL
*/
-worker_t* get_worker_by_type (GQuark type);
+worker_t* rspamd_get_worker_by_type (GQuark type);
/**
* Set counter for a symbol
*/
-double set_counter (const gchar *name, guint32 value);
+double rspamd_set_counter (const gchar *name, guint32 value);
#ifndef HAVE_SA_SIGINFO
typedef void (*rspamd_sig_handler_t) (gint);
@@ -55,13 +55,13 @@ struct rspamd_worker;
* @return event base suitable for a worker
*/
struct event_base *
-prepare_worker (struct rspamd_worker *worker, const char *name,
+rspamd_prepare_worker (struct rspamd_worker *worker, const char *name,
void (*accept_handler)(int, short, void *));
/**
* Stop accepting new connections for a worker
* @param worker
*/
-void worker_stop_accept (struct rspamd_worker *worker);
+void rspamd_worker_stop_accept (struct rspamd_worker *worker);
#endif /* WORKER_UTIL_H_ */