diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-12-20 22:09:16 +0300 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2010-12-20 22:09:16 +0300 |
commit | b8211fbcc8f7de342d4a0176bedf182e1f37397d (patch) | |
tree | fb5922ce974af9572564f28eaf9ae8798b740e4c /src/symbols_cache.h | |
parent | 90b983f151edcb747b86363d30f2101a9b060045 (diff) | |
download | rspamd-b8211fbcc8f7de342d4a0176bedf182e1f37397d.tar.gz rspamd-b8211fbcc8f7de342d4a0176bedf182e1f37397d.zip |
* Introduce new system of configuration checks:
- now symbols inside metrics definition must be inside rules as well
- symbols may be virtual (e.g. when module can insert several symbols inside callback)
- symbols may be pure callbacks (when symbol's name is unknown and depends on conditions)
* Module 'emails' is removed as it is not used in the current rspamd
MANY fixes to sample config files
Diffstat (limited to 'src/symbols_cache.h')
-rw-r--r-- | src/symbols_cache.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/symbols_cache.h b/src/symbols_cache.h index 8e7ba636f..2fe03d32a 100644 --- a/src/symbols_cache.h +++ b/src/symbols_cache.h @@ -36,6 +36,10 @@ struct cache_item { /* Callback data */ symbol_func_t func; gpointer user_data; + + /* Flags of virtual symbols */ + gboolean is_virtual; + gboolean is_callback; }; @@ -77,6 +81,20 @@ gboolean init_symbols_cache (memory_pool_t *pool, struct symbols_cache *cache, s void register_symbol (struct symbols_cache **cache, const gchar *name, double weight, symbol_func_t func, gpointer user_data); /** + * Register virtual symbol + * @param name name of symbol + */ +void register_virtual_symbol (struct symbols_cache **cache, const gchar *name, double weight); + +/** + * Register callback function for symbols parsing + * @param name name of symbol + * @param func pointer to handler + * @param user_data pointer to user_data + */ +void register_callback_symbol (struct symbols_cache **cache, const gchar *name, double weight, symbol_func_t func, gpointer user_data); + +/** * Register function for dynamic symbols parsing * @param name name of symbol * @param func pointer to handler @@ -100,5 +118,13 @@ gboolean call_symbol_callback (struct worker_task *task, struct symbols_cache *c */ void remove_dynamic_rules (struct symbols_cache *cache); +/** + * Validate cache items agains theirs weights defined in metrics + * @param cache symbols 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); + #endif |