aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver/cfg_file.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2023-07-26 10:49:23 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2023-07-26 10:49:23 +0100
commit537a7180a0d5132c11636c4fd8b1450cd99d352c (patch)
treefb9f8c84955a411bdffbd6371ea32f2716fb3687 /src/libserver/cfg_file.h
parent5fd7a90fdaa33f52c59bdb0ca84451e5c1e22365 (diff)
downloadrspamd-537a7180a0d5132c11636c4fd8b1450cd99d352c.tar.gz
rspamd-537a7180a0d5132c11636c4fd8b1450cd99d352c.zip
[Rework] Use clang-format to unify formatting in all sources
No meaningful changes.
Diffstat (limited to 'src/libserver/cfg_file.h')
-rw-r--r--src/libserver/cfg_file.h618
1 files changed, 309 insertions, 309 deletions
diff --git a/src/libserver/cfg_file.h b/src/libserver/cfg_file.h
index d7c3789e7..9b09608f2 100644
--- a/src/libserver/cfg_file.h
+++ b/src/libserver/cfg_file.h
@@ -36,7 +36,7 @@
/* Default metric name */
#define DEFAULT_METRIC "default"
-#ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
#endif
@@ -89,8 +89,8 @@ struct rspamd_worker_log_pipe {
* script module list item
*/
struct script_module {
- gchar *name; /**< name of module */
- gchar *path; /**< path to module */
+ gchar *name; /**< name of module */
+ gchar *path; /**< path to module */
gchar *digest;
};
@@ -144,7 +144,7 @@ struct rspamd_symbol {
gdouble score;
guint priority;
struct rspamd_symbols_group *gr; /* Main group */
- GPtrArray *groups; /* Other groups */
+ GPtrArray *groups; /* Other groups */
guint flags;
void *cache_item;
gint nshots;
@@ -154,17 +154,17 @@ struct rspamd_symbol {
* Statfile config definition
*/
struct rspamd_statfile_config {
- gchar *symbol; /**< symbol of statfile */
- gchar *label; /**< label of this statfile */
- ucl_object_t *opts; /**< other options */
- gboolean is_spam; /**< spam flag */
- struct rspamd_classifier_config *clcf; /**< parent pointer of classifier configuration */
- gpointer data; /**< opaque data */
+ gchar *symbol; /**< symbol of statfile */
+ gchar *label; /**< label of this statfile */
+ ucl_object_t *opts; /**< other options */
+ gboolean is_spam; /**< spam flag */
+ struct rspamd_classifier_config *clcf; /**< parent pointer of classifier configuration */
+ gpointer data; /**< opaque data */
};
struct rspamd_tokenizer_config {
- const ucl_object_t *opts; /**< other options */
- const gchar *name; /**< name of tokenizer */
+ const ucl_object_t *opts; /**< other options */
+ const gchar *name; /**< name of tokenizer */
};
@@ -184,21 +184,21 @@ struct rspamd_tokenizer_config {
* Classifier config definition
*/
struct rspamd_classifier_config {
- GList *statfiles; /**< statfiles list */
- GHashTable *labels; /**< statfiles with labels */
- gchar *metric; /**< metric of this classifier */
- gchar *classifier; /**< classifier interface */
- struct rspamd_tokenizer_config *tokenizer; /**< tokenizer used for classifier */
- const gchar *backend; /**< name of statfile's backend */
- ucl_object_t *opts; /**< other options */
- GList *learn_conditions; /**< list of learn condition callbacks */
- GList *classify_conditions; /**< list of classify condition callbacks */
- gchar *name; /**< unique name of classifier */
- guint32 min_tokens; /**< minimal number of tokens to process classifier */
- guint32 max_tokens; /**< maximum number of tokens */
- guint min_token_hits; /**< minimum number of hits for a token to be considered */
- gdouble min_prob_strength; /**< use only tokens with probability in [0.5 - MPS, 0.5 + MPS] */
- guint min_learns; /**< minimum number of learns for each statfile */
+ GList *statfiles; /**< statfiles list */
+ GHashTable *labels; /**< statfiles with labels */
+ gchar *metric; /**< metric of this classifier */
+ gchar *classifier; /**< classifier interface */
+ struct rspamd_tokenizer_config *tokenizer; /**< tokenizer used for classifier */
+ const gchar *backend; /**< name of statfile's backend */
+ ucl_object_t *opts; /**< other options */
+ GList *learn_conditions; /**< list of learn condition callbacks */
+ GList *classify_conditions; /**< list of classify condition callbacks */
+ gchar *name; /**< unique name of classifier */
+ guint32 min_tokens; /**< minimal number of tokens to process classifier */
+ guint32 max_tokens; /**< maximum number of tokens */
+ guint min_token_hits; /**< minimum number of hits for a token to be considered */
+ gdouble min_prob_strength; /**< use only tokens with probability in [0.5 - MPS, 0.5 + MPS] */
+ guint min_learns; /**< minimum number of learns for each statfile */
guint flags;
};
@@ -220,18 +220,18 @@ struct rspamd_worker_lua_script {
* Config params for rspamd worker
*/
struct rspamd_worker_conf {
- struct worker_s *worker; /**< pointer to worker type */
- GQuark type; /**< type of worker */
- struct rspamd_worker_bind_conf *bind_conf; /**< bind configuration */
- gint16 count; /**< number of workers */
- GList *listen_socks; /**< listening sockets descriptors */
- guint64 rlimit_nofile; /**< max files limit */
- guint64 rlimit_maxcore; /**< maximum core file size */
- GHashTable *params; /**< params for worker */
- GQueue *active_workers; /**< linked list of spawned workers */
- gpointer *ctx; /**< worker's context */
- ucl_object_t *options; /**< other worker's options */
- struct rspamd_worker_lua_script *scripts; /**< registered lua scripts */
+ struct worker_s *worker; /**< pointer to worker type */
+ GQuark type; /**< type of worker */
+ struct rspamd_worker_bind_conf *bind_conf; /**< bind configuration */
+ gint16 count; /**< number of workers */
+ GList *listen_socks; /**< listening sockets descriptors */
+ guint64 rlimit_nofile; /**< max files limit */
+ guint64 rlimit_maxcore; /**< maximum core file size */
+ GHashTable *params; /**< params for worker */
+ GQueue *active_workers; /**< linked list of spawned workers */
+ gpointer *ctx; /**< worker's context */
+ ucl_object_t *options; /**< other worker's options */
+ struct rspamd_worker_lua_script *scripts; /**< registered lua scripts */
gboolean enabled;
ref_entry_t ref;
};
@@ -345,170 +345,170 @@ struct rspamd_config_settings_elt {
* Structure that stores all config data
*/
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 */
- gchar *cfg_name; /**< name of config file */
- gchar *pid_file; /**< name of pid file */
- gchar *temp_dir; /**< dir for temp files */
- gchar *control_socket_path; /**< path to the control socket */
- const ucl_object_t *local_addrs; /**< tree of local addresses */
+ gchar *rspamd_user; /**< user to run as */
+ gchar *rspamd_group; /**< group to run as */
+ rspamd_mempool_t *cfg_pool; /**< memory pool for config */
+ gchar *cfg_name; /**< name of config file */
+ gchar *pid_file; /**< name of pid file */
+ gchar *temp_dir; /**< dir for temp files */
+ gchar *control_socket_path; /**< path to the control socket */
+ const ucl_object_t *local_addrs; /**< tree of local addresses */
#ifdef WITH_GPERF_TOOLS
gchar *profile_path;
#endif
- gdouble unknown_weight; /**< weight of unknown symbols */
- gdouble grow_factor; /**< grow factor for metric */
- GHashTable *symbols; /**< weights of symbols in metric */
- const gchar *subject; /**< subject rewrite string */
- GHashTable *groups; /**< groups of symbols */
- struct rspamd_action *actions; /**< all actions of the metric */
-
- gboolean one_shot_mode; /**< rules add only one symbol */
- gboolean check_text_attachements; /**< check text attachements as text */
- gboolean check_all_filters; /**< check all filters */
- gboolean allow_raw_input; /**< scan messages with invalid mime */
- gboolean disable_hyperscan; /**< disable hyperscan usage */
- gboolean vectorized_hyperscan; /**< use vectorized hyperscan matching */
- gboolean enable_shutdown_workaround; /**< enable workaround for legacy SA clients (exim) */
- gboolean ignore_received; /**< Ignore data from the first received header */
- gboolean enable_sessions_cache; /**< Enable session cache for debug */
- gboolean enable_experimental; /**< Enable experimental plugins */
- gboolean disable_pcre_jit; /**< Disable pcre JIT */
- gboolean own_lua_state; /**< True if we have created lua_state internally */
- gboolean soft_reject_on_timeout; /**< If true emit soft reject on task timeout (if not reject) */
- gboolean public_groups_only; /**< Output merely public groups everywhere */
- gboolean enable_test_patterns; /**< Enable test patterns */
- gboolean enable_css_parser; /**< Enable css parsing in HTML */
-
- gsize max_cores_size; /**< maximum size occupied by rspamd core files */
- gsize max_cores_count; /**< maximum number of core files */
- gchar *cores_dir; /**< directory for core files */
- gsize max_message; /**< maximum size for messages */
- gsize max_pic_size; /**< maximum size for a picture to process */
- gsize images_cache_size; /**< size of LRU cache for DCT data from images */
- gdouble task_timeout; /**< maximum message processing time */
- gint default_max_shots; /**< default maximum count of symbols hits permitted (-1 for unlimited) */
- gint32 heartbeats_loss_max; /**< number of heartbeats lost to consider worker's termination */
- gdouble heartbeat_interval; /**< interval for heartbeats for workers */
-
- enum rspamd_log_type log_type; /**< log type */
- gint log_facility; /**< log facility in case of syslog */
- gint log_level; /**< log level trigger */
- gchar *log_file; /**< path to logfile in case of file logging */
- gboolean log_buffered; /**< whether logging is buffered */
- gboolean log_silent_workers; /**< silence info messages from workers */
- guint32 log_buf_size; /**< length of log buffer */
- const ucl_object_t *debug_ip_map; /**< turn on debugging for specified ip addresses */
- gboolean log_urls; /**< whether we should log URLs */
- GHashTable *debug_modules; /**< logging modules to debug */
+ gdouble unknown_weight; /**< weight of unknown symbols */
+ gdouble grow_factor; /**< grow factor for metric */
+ GHashTable *symbols; /**< weights of symbols in metric */
+ const gchar *subject; /**< subject rewrite string */
+ GHashTable *groups; /**< groups of symbols */
+ struct rspamd_action *actions; /**< all actions of the metric */
+
+ gboolean one_shot_mode; /**< rules add only one symbol */
+ gboolean check_text_attachements; /**< check text attachements as text */
+ gboolean check_all_filters; /**< check all filters */
+ gboolean allow_raw_input; /**< scan messages with invalid mime */
+ gboolean disable_hyperscan; /**< disable hyperscan usage */
+ gboolean vectorized_hyperscan; /**< use vectorized hyperscan matching */
+ gboolean enable_shutdown_workaround; /**< enable workaround for legacy SA clients (exim) */
+ gboolean ignore_received; /**< Ignore data from the first received header */
+ gboolean enable_sessions_cache; /**< Enable session cache for debug */
+ gboolean enable_experimental; /**< Enable experimental plugins */
+ gboolean disable_pcre_jit; /**< Disable pcre JIT */
+ gboolean own_lua_state; /**< True if we have created lua_state internally */
+ gboolean soft_reject_on_timeout; /**< If true emit soft reject on task timeout (if not reject) */
+ gboolean public_groups_only; /**< Output merely public groups everywhere */
+ gboolean enable_test_patterns; /**< Enable test patterns */
+ gboolean enable_css_parser; /**< Enable css parsing in HTML */
+
+ gsize max_cores_size; /**< maximum size occupied by rspamd core files */
+ gsize max_cores_count; /**< maximum number of core files */
+ gchar *cores_dir; /**< directory for core files */
+ gsize max_message; /**< maximum size for messages */
+ gsize max_pic_size; /**< maximum size for a picture to process */
+ gsize images_cache_size; /**< size of LRU cache for DCT data from images */
+ gdouble task_timeout; /**< maximum message processing time */
+ gint default_max_shots; /**< default maximum count of symbols hits permitted (-1 for unlimited) */
+ gint32 heartbeats_loss_max; /**< number of heartbeats lost to consider worker's termination */
+ gdouble heartbeat_interval; /**< interval for heartbeats for workers */
+
+ enum rspamd_log_type log_type; /**< log type */
+ gint log_facility; /**< log facility in case of syslog */
+ gint log_level; /**< log level trigger */
+ gchar *log_file; /**< path to logfile in case of file logging */
+ gboolean log_buffered; /**< whether logging is buffered */
+ gboolean log_silent_workers; /**< silence info messages from workers */
+ guint32 log_buf_size; /**< length of log buffer */
+ const ucl_object_t *debug_ip_map; /**< turn on debugging for specified ip addresses */
+ gboolean log_urls; /**< whether we should log URLs */
+ GHashTable *debug_modules; /**< logging modules to debug */
struct rspamd_cryptobox_pubkey *log_encryption_key; /**< encryption key for logs */
- guint log_flags; /**< logging flags */
- guint log_error_elts; /**< number of elements in error logbuf */
- guint log_error_elt_maxlen; /**< maximum size of error log element */
+ guint log_flags; /**< logging flags */
+ guint log_error_elts; /**< number of elements in error logbuf */
+ guint log_error_elt_maxlen; /**< maximum size of error log element */
struct rspamd_worker_log_pipe *log_pipes;
- gboolean compat_messages; /**< use old messages in the protocol (array) */
-
- GList *script_modules; /**< linked list of script modules to load */
- GHashTable *explicit_modules; /**< modules that should be always loaded */
-
- GList *filters; /**< linked list of all filters */
- GList *workers; /**< linked list of all workers params */
- GHashTable *wrk_parsers; /**< hash for worker config parsers, indexed by worker quarks */
- ucl_object_t *rcl_obj; /**< rcl object */
- ucl_object_t *config_comments; /**< comments saved from the config */
- ucl_object_t *doc_strings; /**< documentation strings for config options */
- GPtrArray *c_modules; /**< list of C modules */
- void *composites_manager; /**< hash of composite symbols indexed by its name */
- GList *classifiers; /**< list of all classifiers defined */
- GList *statfiles; /**< list of all statfiles in config file order */
- GHashTable *classifiers_symbols; /**< hashtable indexed by symbol name of classifiers */
- GHashTable *cfg_params; /**< all cfg params indexed by its name in this structure */
- gchar *dynamic_conf; /**< path to dynamic configuration */
- ucl_object_t *current_dynamic_conf; /**< currently loaded dynamic configuration */
- gint clock_res; /**< resolution of clock used */
-
- GList *maps; /**< maps active */
- gdouble map_timeout; /**< maps watch timeout */
- gdouble map_file_watch_multiplier; /**< multiplier for watch timeout when maps are files */
- gchar *maps_cache_dir; /**< where to save HTTP cached data */
-
- gdouble monitored_interval; /**< interval between monitored checks */
- gboolean disable_monitored; /**< disable monitoring completely */
- gboolean fips_mode; /**< turn on fips mode for openssl */
-
- struct rspamd_symcache *cache; /**< symbols cache object */
- gchar *cache_filename; /**< filename of cache file */
- gdouble cache_reload_time; /**< how often cache reload should be performed */
- gchar *checksum; /**< real checksum of config file */
- gpointer lua_state; /**< pointer to lua state */
- gpointer lua_thread_pool; /**< pointer to lua thread (coroutine) pool */
-
- gchar *rrd_file; /**< rrd file to store statistics */
- gchar *history_file; /**< file to save rolling history */
- gchar *stats_file; /**< file to save stats */
- gchar *tld_file; /**< file to load effective tld list from */
- gchar *hs_cache_dir; /**< directory to save hyperscan databases */
- gchar *events_backend; /**< string representation of the events backend used */
-
- gdouble dns_timeout; /**< timeout in milliseconds for waiting for dns reply */
- guint32 dns_retransmits; /**< maximum retransmits count */
- guint32 dns_io_per_server; /**< number of sockets per DNS server */
- const ucl_object_t *nameservers; /**< list of nameservers or NULL to parse resolv.conf */
- guint32 dns_max_requests; /**< limit of DNS requests per task */
- gboolean enable_dnssec; /**< enable dnssec stub resolver */
-
- guint upstream_max_errors; /**< upstream max errors before shutting off */
- gdouble upstream_error_time; /**< rate of upstream errors */
- gdouble upstream_revive_time; /**< revive timeout for upstreams */
- gdouble upstream_lazy_resolve_time; /**< lazy resolve time for upstreams */
- struct upstream_ctx *ups_ctx; /**< upstream context */
- struct rspamd_dns_resolver *dns_resolver; /**< dns resolver if loaded */
-
- guint min_word_len; /**< minimum length of the word to be considered */
- guint max_word_len; /**< maximum length of the word to be considered */
- guint words_decay; /**< limit for words for starting adaptive ignoring */
- guint history_rows; /**< number of history rows stored */
- guint max_sessions_cache; /**< maximum number of sessions cache elts */
- guint lua_gc_step; /**< lua gc step */
- guint lua_gc_pause; /**< lua gc pause */
- guint full_gc_iters; /**< iterations between full gc cycle */
- guint max_lua_urls; /**< maximum number of urls to be passed to Lua */
- guint max_urls; /**< maximum number of urls to be processed in general */
- gint max_recipients; /**< maximum number of recipients to be processed */
- guint max_blas_threads; /**< maximum threads for openblas when learning ANN */
- guint max_opts_len; /**< maximum length for all options for a symbol */
- gsize max_html_len; /**< maximum length of HTML document */
-
- struct module_s **compiled_modules; /**< list of compiled C modules */
- struct worker_s **compiled_workers; /**< list of compiled C modules */
- struct rspamd_log_format *log_format; /**< parsed log format */
- gchar *log_format_str; /**< raw log format string */
-
- struct rspamd_external_libs_ctx *libs_ctx; /**< context for external libraries */
- struct rspamd_monitored_ctx *monitored_ctx; /**< context for monitored resources */
- struct rspamd_redis_pool *redis_pool; /**< redis connection pool */
-
- struct rspamd_re_cache *re_cache; /**< static regexp cache */
-
- GHashTable *trusted_keys; /**< list of trusted public keys */
-
- struct rspamd_config_cfg_lua_script *on_load_scripts; /**< list of scripts executed on workers load */
- struct rspamd_config_cfg_lua_script *post_init_scripts; /**< list of scripts executed on config being fully loaded */
- struct rspamd_config_cfg_lua_script *on_term_scripts; /**< list of callbacks called on worker's termination */
- struct rspamd_config_cfg_lua_script *config_unload_scripts; /**< list of scripts executed on config unload */
-
- gchar *ssl_ca_path; /**< path to CA certs */
- gchar *ssl_ciphers; /**< set of preferred ciphers */
- gchar *zstd_input_dictionary; /**< path to zstd input dictionary */
- gchar *zstd_output_dictionary; /**< path to zstd output dictionary */
- ucl_object_t *neighbours; /**< other servers in the cluster */
-
- struct rspamd_config_settings_elt *setting_ids; /**< preprocessed settings ids */
- struct rspamd_lang_detector *lang_det; /**< language detector */
+ gboolean compat_messages; /**< use old messages in the protocol (array) */
+
+ GList *script_modules; /**< linked list of script modules to load */
+ GHashTable *explicit_modules; /**< modules that should be always loaded */
+
+ GList *filters; /**< linked list of all filters */
+ GList *workers; /**< linked list of all workers params */
+ GHashTable *wrk_parsers; /**< hash for worker config parsers, indexed by worker quarks */
+ ucl_object_t *rcl_obj; /**< rcl object */
+ ucl_object_t *config_comments; /**< comments saved from the config */
+ ucl_object_t *doc_strings; /**< documentation strings for config options */
+ GPtrArray *c_modules; /**< list of C modules */
+ void *composites_manager; /**< hash of composite symbols indexed by its name */
+ GList *classifiers; /**< list of all classifiers defined */
+ GList *statfiles; /**< list of all statfiles in config file order */
+ GHashTable *classifiers_symbols; /**< hashtable indexed by symbol name of classifiers */
+ GHashTable *cfg_params; /**< all cfg params indexed by its name in this structure */
+ gchar *dynamic_conf; /**< path to dynamic configuration */
+ ucl_object_t *current_dynamic_conf; /**< currently loaded dynamic configuration */
+ gint clock_res; /**< resolution of clock used */
+
+ GList *maps; /**< maps active */
+ gdouble map_timeout; /**< maps watch timeout */
+ gdouble map_file_watch_multiplier; /**< multiplier for watch timeout when maps are files */
+ gchar *maps_cache_dir; /**< where to save HTTP cached data */
+
+ gdouble monitored_interval; /**< interval between monitored checks */
+ gboolean disable_monitored; /**< disable monitoring completely */
+ gboolean fips_mode; /**< turn on fips mode for openssl */
+
+ struct rspamd_symcache *cache; /**< symbols cache object */
+ gchar *cache_filename; /**< filename of cache file */
+ gdouble cache_reload_time; /**< how often cache reload should be performed */
+ gchar *checksum; /**< real checksum of config file */
+ gpointer lua_state; /**< pointer to lua state */
+ gpointer lua_thread_pool; /**< pointer to lua thread (coroutine) pool */
+
+ gchar *rrd_file; /**< rrd file to store statistics */
+ gchar *history_file; /**< file to save rolling history */
+ gchar *stats_file; /**< file to save stats */
+ gchar *tld_file; /**< file to load effective tld list from */
+ gchar *hs_cache_dir; /**< directory to save hyperscan databases */
+ gchar *events_backend; /**< string representation of the events backend used */
+
+ gdouble dns_timeout; /**< timeout in milliseconds for waiting for dns reply */
+ guint32 dns_retransmits; /**< maximum retransmits count */
+ guint32 dns_io_per_server; /**< number of sockets per DNS server */
+ const ucl_object_t *nameservers; /**< list of nameservers or NULL to parse resolv.conf */
+ guint32 dns_max_requests; /**< limit of DNS requests per task */
+ gboolean enable_dnssec; /**< enable dnssec stub resolver */
+
+ guint upstream_max_errors; /**< upstream max errors before shutting off */
+ gdouble upstream_error_time; /**< rate of upstream errors */
+ gdouble upstream_revive_time; /**< revive timeout for upstreams */
+ gdouble upstream_lazy_resolve_time; /**< lazy resolve time for upstreams */
+ struct upstream_ctx *ups_ctx; /**< upstream context */
+ struct rspamd_dns_resolver *dns_resolver; /**< dns resolver if loaded */
+
+ guint min_word_len; /**< minimum length of the word to be considered */
+ guint max_word_len; /**< maximum length of the word to be considered */
+ guint words_decay; /**< limit for words for starting adaptive ignoring */
+ guint history_rows; /**< number of history rows stored */
+ guint max_sessions_cache; /**< maximum number of sessions cache elts */
+ guint lua_gc_step; /**< lua gc step */
+ guint lua_gc_pause; /**< lua gc pause */
+ guint full_gc_iters; /**< iterations between full gc cycle */
+ guint max_lua_urls; /**< maximum number of urls to be passed to Lua */
+ guint max_urls; /**< maximum number of urls to be processed in general */
+ gint max_recipients; /**< maximum number of recipients to be processed */
+ guint max_blas_threads; /**< maximum threads for openblas when learning ANN */
+ guint max_opts_len; /**< maximum length for all options for a symbol */
+ gsize max_html_len; /**< maximum length of HTML document */
+
+ struct module_s **compiled_modules; /**< list of compiled C modules */
+ struct worker_s **compiled_workers; /**< list of compiled C modules */
+ struct rspamd_log_format *log_format; /**< parsed log format */
+ gchar *log_format_str; /**< raw log format string */
+
+ struct rspamd_external_libs_ctx *libs_ctx; /**< context for external libraries */
+ struct rspamd_monitored_ctx *monitored_ctx; /**< context for monitored resources */
+ struct rspamd_redis_pool *redis_pool; /**< redis connection pool */
+
+ struct rspamd_re_cache *re_cache; /**< static regexp cache */
+
+ GHashTable *trusted_keys; /**< list of trusted public keys */
+
+ struct rspamd_config_cfg_lua_script *on_load_scripts; /**< list of scripts executed on workers load */
+ struct rspamd_config_cfg_lua_script *post_init_scripts; /**< list of scripts executed on config being fully loaded */
+ struct rspamd_config_cfg_lua_script *on_term_scripts; /**< list of callbacks called on worker's termination */
+ struct rspamd_config_cfg_lua_script *config_unload_scripts; /**< list of scripts executed on config unload */
+
+ gchar *ssl_ca_path; /**< path to CA certs */
+ gchar *ssl_ciphers; /**< set of preferred ciphers */
+ gchar *zstd_input_dictionary; /**< path to zstd input dictionary */
+ gchar *zstd_output_dictionary; /**< path to zstd output dictionary */
+ ucl_object_t *neighbours; /**< other servers in the cluster */
+
+ struct rspamd_config_settings_elt *setting_ids; /**< preprocessed settings ids */
+ struct rspamd_lang_detector *lang_det; /**< language detector */
struct rspamd_worker *cur_worker; /**< set dynamically by each worker */
- ref_entry_t ref; /**< reference counter */
+ ref_entry_t ref; /**< reference counter */
};
@@ -519,8 +519,8 @@ struct rspamd_config {
* @param type type of credits
* @return 1 if line was successfully parsed and 0 in case of error
*/
-gboolean rspamd_parse_bind_line (struct rspamd_config *cfg,
- struct rspamd_worker_conf *cf, const gchar *str);
+gboolean rspamd_parse_bind_line(struct rspamd_config *cfg,
+ struct rspamd_worker_conf *cf, const gchar *str);
enum rspamd_config_init_flags {
@@ -533,13 +533,13 @@ enum rspamd_config_init_flags {
* Init default values
* @param cfg config file
*/
-struct rspamd_config *rspamd_config_new (enum rspamd_config_init_flags flags);
+struct rspamd_config *rspamd_config_new(enum rspamd_config_init_flags flags);
/**
* Free memory used by config structure
* @param cfg config file
*/
-void rspamd_config_free (struct rspamd_config *cfg);
+void rspamd_config_free(struct rspamd_config *cfg);
/**
* Gets module option with specified name
@@ -548,9 +548,9 @@ void rspamd_config_free (struct rspamd_config *cfg);
* @param opt_name name of option to get
* @return module value or NULL if option does not defined
*/
-const ucl_object_t *rspamd_config_get_module_opt (struct rspamd_config *cfg,
- const gchar *module_name,
- const gchar *opt_name) G_GNUC_WARN_UNUSED_RESULT;
+const ucl_object_t *rspamd_config_get_module_opt(struct rspamd_config *cfg,
+ const gchar *module_name,
+ const gchar *opt_name) G_GNUC_WARN_UNUSED_RESULT;
/**
@@ -558,7 +558,7 @@ const ucl_object_t *rspamd_config_get_module_opt (struct rspamd_config *cfg,
* @param str string representation of flag (eg. 'on')
* @return numeric value of flag (0 or 1)
*/
-gint rspamd_config_parse_flag (const gchar *str, guint len);
+gint rspamd_config_parse_flag(const gchar *str, guint len);
enum rspamd_post_load_options {
RSPAMD_CONFIG_INIT_URL = 1 << 0,
@@ -570,73 +570,73 @@ enum rspamd_post_load_options {
RSPAMD_CONFIG_INIT_POST_LOAD_LUA = 1 << 6,
};
-#define RSPAMD_CONFIG_LOAD_ALL (RSPAMD_CONFIG_INIT_URL| \
- RSPAMD_CONFIG_INIT_LIBS| \
- RSPAMD_CONFIG_INIT_SYMCACHE| \
- RSPAMD_CONFIG_INIT_VALIDATE| \
- RSPAMD_CONFIG_INIT_PRELOAD_MAPS| \
- RSPAMD_CONFIG_INIT_POST_LOAD_LUA)
+#define RSPAMD_CONFIG_LOAD_ALL (RSPAMD_CONFIG_INIT_URL | \
+ RSPAMD_CONFIG_INIT_LIBS | \
+ RSPAMD_CONFIG_INIT_SYMCACHE | \
+ RSPAMD_CONFIG_INIT_VALIDATE | \
+ RSPAMD_CONFIG_INIT_PRELOAD_MAPS | \
+ RSPAMD_CONFIG_INIT_POST_LOAD_LUA)
/**
* Do post load actions for config
* @param cfg config file
*/
-gboolean rspamd_config_post_load (struct rspamd_config *cfg,
- enum rspamd_post_load_options opts);
+gboolean rspamd_config_post_load(struct rspamd_config *cfg,
+ enum rspamd_post_load_options opts);
/*
* Return a new classifier_config structure, setting default and non-conflicting attributes
*/
-struct rspamd_classifier_config *rspamd_config_new_classifier (
- struct rspamd_config *cfg,
- struct rspamd_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 rspamd_worker_conf *rspamd_config_new_worker (struct rspamd_config *cfg,
- struct rspamd_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
*/
-void rspamd_config_init_metric (struct rspamd_config *cfg);
+void rspamd_config_init_metric(struct rspamd_config *cfg);
/*
* Return new symbols group definition
*/
-struct rspamd_symbols_group *rspamd_config_new_group (
- struct rspamd_config *cfg,
- const gchar *name);
+struct rspamd_symbols_group *rspamd_config_new_group(
+ struct rspamd_config *cfg,
+ const gchar *name);
/*
* Return a new statfile structure, setting default and non-conflicting attributes
*/
-struct rspamd_statfile_config *rspamd_config_new_statfile (
- struct rspamd_config *cfg,
- struct rspamd_statfile_config *c);
+struct rspamd_statfile_config *rspamd_config_new_statfile(
+ struct rspamd_config *cfg,
+ struct rspamd_statfile_config *c);
/*
* Register symbols of classifiers inside metrics
*/
-void rspamd_config_insert_classify_symbols (struct rspamd_config *cfg);
+void rspamd_config_insert_classify_symbols(struct rspamd_config *cfg);
/*
* Check statfiles inside a classifier
*/
-gboolean rspamd_config_check_statfiles (struct rspamd_classifier_config *cf);
+gboolean rspamd_config_check_statfiles(struct rspamd_classifier_config *cf);
/*
* Find classifier config by name
*/
-struct rspamd_classifier_config *rspamd_config_find_classifier (
- struct rspamd_config *cfg,
- const gchar *name);
+struct rspamd_classifier_config *rspamd_config_find_classifier(
+ struct rspamd_config *cfg,
+ const gchar *name);
-void rspamd_ucl_add_conf_macros (struct ucl_parser *parser,
- struct rspamd_config *cfg);
+void rspamd_ucl_add_conf_macros(struct ucl_parser *parser,
+ struct rspamd_config *cfg);
-void rspamd_ucl_add_conf_variables (struct ucl_parser *parser, GHashTable *vars);
+void rspamd_ucl_add_conf_variables(struct ucl_parser *parser, GHashTable *vars);
/**
* Initialize rspamd filtering system (lua and C filters)
@@ -644,7 +644,7 @@ void rspamd_ucl_add_conf_variables (struct ucl_parser *parser, GHashTable *vars)
* @param reconfig
* @return
*/
-gboolean rspamd_init_filters (struct rspamd_config *cfg, bool reconfig, bool strict);
+gboolean rspamd_init_filters(struct rspamd_config *cfg, bool reconfig, bool strict);
/**
* Add new symbol to the metric
@@ -660,14 +660,14 @@ gboolean rspamd_init_filters (struct rspamd_config *cfg, bool reconfig, bool str
* @param nshots means maximum number of hits for a symbol in metric (-1 for unlimited)
* @return TRUE if symbol has been inserted or FALSE if symbol already exists with higher priority
*/
-gboolean rspamd_config_add_symbol (struct rspamd_config *cfg,
- const gchar *symbol,
- gdouble score,
- const gchar *description,
- const gchar *group,
- guint flags,
- guint priority,
- gint nshots);
+gboolean rspamd_config_add_symbol(struct rspamd_config *cfg,
+ const gchar *symbol,
+ gdouble score,
+ const gchar *description,
+ const gchar *group,
+ guint flags,
+ guint priority,
+ gint nshots);
/**
* Adds new group for a symbol
@@ -676,9 +676,9 @@ gboolean rspamd_config_add_symbol (struct rspamd_config *cfg,
* @param group
* @return
*/
-gboolean rspamd_config_add_symbol_group (struct rspamd_config *cfg,
- const gchar *symbol,
- const gchar *group);
+gboolean rspamd_config_add_symbol_group(struct rspamd_config *cfg,
+ const gchar *symbol,
+ const gchar *group);
/**
* Sets action score for a specified metric with the specified priority
@@ -688,9 +688,9 @@ gboolean rspamd_config_add_symbol_group (struct rspamd_config *cfg,
* @param obj data to set for action
* @return TRUE if symbol has been inserted or FALSE if action already exists with higher priority
*/
-gboolean rspamd_config_set_action_score (struct rspamd_config *cfg,
- const gchar *action_name,
- const ucl_object_t *obj);
+gboolean rspamd_config_set_action_score(struct rspamd_config *cfg,
+ const gchar *action_name,
+ const ucl_object_t *obj);
/**
* Check priority and maybe disable action completely
@@ -699,9 +699,9 @@ gboolean rspamd_config_set_action_score (struct rspamd_config *cfg,
* @param priority
* @return
*/
-gboolean rspamd_config_maybe_disable_action (struct rspamd_config *cfg,
- const gchar *action_name,
- guint priority);
+gboolean rspamd_config_maybe_disable_action(struct rspamd_config *cfg,
+ const gchar *action_name,
+ guint priority);
/**
* Checks if a specified C or lua module is enabled or disabled in the config.
@@ -716,33 +716,33 @@ gboolean rspamd_config_maybe_disable_action (struct rspamd_config *cfg,
* @param module_name module name
* @return TRUE if a module is enabled
*/
-gboolean rspamd_config_is_module_enabled (struct rspamd_config *cfg,
- const gchar *module_name);
+gboolean rspamd_config_is_module_enabled(struct rspamd_config *cfg,
+ const gchar *module_name);
/**
* Verifies enabled/disabled combination in the specified object
* @param obj
* @return TRUE if there is no explicit disable in the object found
*/
-gboolean rspamd_config_is_enabled_from_ucl (rspamd_mempool_t *pool,
- const ucl_object_t *obj);
+gboolean rspamd_config_is_enabled_from_ucl(rspamd_mempool_t *pool,
+ const ucl_object_t *obj);
/*
* Get action from a string
*/
-gboolean rspamd_action_from_str (const gchar *data, gint *result);
+gboolean rspamd_action_from_str(const gchar *data, gint *result);
/*
* Return textual representation of action enumeration
*/
-const gchar *rspamd_action_to_str (enum rspamd_action_type action);
+const gchar *rspamd_action_to_str(enum rspamd_action_type action);
-const gchar *rspamd_action_to_str_alt (enum rspamd_action_type action);
+const gchar *rspamd_action_to_str_alt(enum rspamd_action_type action);
/*
* Resort all actions (needed to operate with thresholds)
*/
-void rspamd_actions_sort (struct rspamd_config *cfg);
+void rspamd_actions_sort(struct rspamd_config *cfg);
/**
* Parse radix tree or radix map from ucl object
@@ -754,9 +754,9 @@ void rspamd_actions_sort (struct rspamd_config *cfg);
*/
struct rspamd_radix_map_helper;
-gboolean rspamd_config_radix_from_ucl (struct rspamd_config *cfg, const ucl_object_t *obj, const gchar *description,
- struct rspamd_radix_map_helper **target, GError **err,
- struct rspamd_worker *worker, const gchar *map_name);
+gboolean rspamd_config_radix_from_ucl(struct rspamd_config *cfg, const ucl_object_t *obj, const gchar *description,
+ struct rspamd_radix_map_helper **target, GError **err,
+ struct rspamd_worker *worker, const gchar *map_name);
/**
* Adds new settings id to be preprocessed
@@ -765,11 +765,11 @@ gboolean rspamd_config_radix_from_ucl (struct rspamd_config *cfg, const ucl_obje
* @param symbols_enabled (ownership is transferred to callee)
* @param symbols_disabled (ownership is transferred to callee)
*/
-void rspamd_config_register_settings_id (struct rspamd_config *cfg,
- const gchar *name,
- ucl_object_t *symbols_enabled,
- ucl_object_t *symbols_disabled,
- enum rspamd_config_settings_policy policy);
+void rspamd_config_register_settings_id(struct rspamd_config *cfg,
+ const gchar *name,
+ ucl_object_t *symbols_enabled,
+ ucl_object_t *symbols_disabled,
+ enum rspamd_config_settings_policy policy);
/**
* Convert settings name to settings id
@@ -777,7 +777,7 @@ void rspamd_config_register_settings_id (struct rspamd_config *cfg,
* @param namelen
* @return
*/
-guint32 rspamd_config_name_to_id (const gchar *name, gsize namelen);
+guint32 rspamd_config_name_to_id(const gchar *name, gsize namelen);
/**
* Finds settings id element and obtain reference count (must be unrefed by caller)
@@ -785,9 +785,9 @@ guint32 rspamd_config_name_to_id (const gchar *name, gsize namelen);
* @param id
* @return
*/
-struct rspamd_config_settings_elt *rspamd_config_find_settings_id_ref (
- struct rspamd_config *cfg,
- guint32 id);
+struct rspamd_config_settings_elt *rspamd_config_find_settings_id_ref(
+ struct rspamd_config *cfg,
+ guint32 id);
/**
* Finds settings id element and obtain reference count (must be unrefed by callee)
@@ -795,9 +795,9 @@ struct rspamd_config_settings_elt *rspamd_config_find_settings_id_ref (
* @param id
* @return
*/
-struct rspamd_config_settings_elt *rspamd_config_find_settings_name_ref (
- struct rspamd_config *cfg,
- const gchar *name, gsize namelen);
+struct rspamd_config_settings_elt *rspamd_config_find_settings_name_ref(
+ struct rspamd_config *cfg,
+ const gchar *name, gsize namelen);
/**
* Returns action object by name
@@ -805,75 +805,75 @@ struct rspamd_config_settings_elt *rspamd_config_find_settings_name_ref (
* @param name
* @return
*/
-struct rspamd_action *rspamd_config_get_action (struct rspamd_config *cfg,
- const gchar *name);
+struct rspamd_action *rspamd_config_get_action(struct rspamd_config *cfg,
+ const gchar *name);
-struct rspamd_action *rspamd_config_get_action_by_type (struct rspamd_config *cfg,
- enum rspamd_action_type type);
+struct rspamd_action *rspamd_config_get_action_by_type(struct rspamd_config *cfg,
+ enum rspamd_action_type type);
-int rspamd_config_ev_backend_get (struct rspamd_config *cfg);
-const gchar * rspamd_config_ev_backend_to_string (int ev_backend, gboolean *effective);
+int rspamd_config_ev_backend_get(struct rspamd_config *cfg);
+const gchar *rspamd_config_ev_backend_to_string(int ev_backend, gboolean *effective);
struct rspamd_external_libs_ctx;
/**
* Initialize rspamd libraries
*/
-struct rspamd_external_libs_ctx *rspamd_init_libs (void);
+struct rspamd_external_libs_ctx *rspamd_init_libs(void);
/**
* Reset and initialize decompressor
* @param ctx
*/
-gboolean rspamd_libs_reset_decompression (struct rspamd_external_libs_ctx *ctx);
+gboolean rspamd_libs_reset_decompression(struct rspamd_external_libs_ctx *ctx);
/**
* Reset and initialize compressor
* @param ctx
*/
-gboolean rspamd_libs_reset_compression (struct rspamd_external_libs_ctx *ctx);
+gboolean rspamd_libs_reset_compression(struct rspamd_external_libs_ctx *ctx);
/**
* Destroy external libraries context
*/
-void rspamd_deinit_libs (struct rspamd_external_libs_ctx *ctx);
+void rspamd_deinit_libs(struct rspamd_external_libs_ctx *ctx);
/**
* Returns TRUE if an address belongs to some local address
*/
-gboolean rspamd_ip_is_local_cfg (struct rspamd_config *cfg,
- const rspamd_inet_addr_t *addr);
+gboolean rspamd_ip_is_local_cfg(struct rspamd_config *cfg,
+ const rspamd_inet_addr_t *addr);
/**
* Configure libraries
*/
-gboolean rspamd_config_libs (struct rspamd_external_libs_ctx *ctx,
- struct rspamd_config *cfg);
-
-
-#define msg_err_config(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL, \
- cfg->cfg_pool->tag.tagname, cfg->checksum, \
- RSPAMD_LOG_FUNC, \
- __VA_ARGS__)
-#define msg_err_config_forced(...) rspamd_default_log_function (G_LOG_LEVEL_CRITICAL|RSPAMD_LOG_FORCED, \
- cfg->cfg_pool->tag.tagname, cfg->checksum, \
- RSPAMD_LOG_FUNC, \
- __VA_ARGS__)
-#define msg_warn_config(...) rspamd_default_log_function (G_LOG_LEVEL_WARNING, \
- cfg->cfg_pool->tag.tagname, cfg->checksum, \
- RSPAMD_LOG_FUNC, \
- __VA_ARGS__)
-#define msg_info_config(...) rspamd_default_log_function (G_LOG_LEVEL_INFO, \
- cfg->cfg_pool->tag.tagname, cfg->checksum, \
- RSPAMD_LOG_FUNC, \
- __VA_ARGS__)
+gboolean rspamd_config_libs(struct rspamd_external_libs_ctx *ctx,
+ struct rspamd_config *cfg);
+
+
+#define msg_err_config(...) rspamd_default_log_function(G_LOG_LEVEL_CRITICAL, \
+ cfg->cfg_pool->tag.tagname, cfg->checksum, \
+ RSPAMD_LOG_FUNC, \
+ __VA_ARGS__)
+#define msg_err_config_forced(...) rspamd_default_log_function(G_LOG_LEVEL_CRITICAL | RSPAMD_LOG_FORCED, \
+ cfg->cfg_pool->tag.tagname, cfg->checksum, \
+ RSPAMD_LOG_FUNC, \
+ __VA_ARGS__)
+#define msg_warn_config(...) rspamd_default_log_function(G_LOG_LEVEL_WARNING, \
+ cfg->cfg_pool->tag.tagname, cfg->checksum, \
+ RSPAMD_LOG_FUNC, \
+ __VA_ARGS__)
+#define msg_info_config(...) rspamd_default_log_function(G_LOG_LEVEL_INFO, \
+ cfg->cfg_pool->tag.tagname, cfg->checksum, \
+ RSPAMD_LOG_FUNC, \
+ __VA_ARGS__)
extern guint rspamd_config_log_id;
-#define msg_debug_config(...) rspamd_conditional_debug_fast (NULL, NULL, \
- rspamd_config_log_id, "config", cfg->checksum, \
- RSPAMD_LOG_FUNC, \
- __VA_ARGS__)
+#define msg_debug_config(...) rspamd_conditional_debug_fast(NULL, NULL, \
+ rspamd_config_log_id, "config", cfg->checksum, \
+ RSPAMD_LOG_FUNC, \
+ __VA_ARGS__)
-#ifdef __cplusplus
+#ifdef __cplusplus
}
#endif