diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-09-19 20:29:58 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2012-09-19 20:29:58 +0400 |
commit | 91d183b8f4719ecc6b339cc3e8d9239bf7594e30 (patch) | |
tree | e4a548ed5570d425d87ac0aa684900179eaabe4e /src/map.h | |
parent | 1bdd1f05773d1f16f4fc271e09a691a1750e0ed5 (diff) | |
download | rspamd-91d183b8f4719ecc6b339cc3e8d9239bf7594e30.tar.gz rspamd-91d183b8f4719ecc6b339cc3e8d9239bf7594e30.zip |
Avoid global variables in map logic.
* Add support of simple maps like '/path/to/file' as it seems to be more comfortable than 'file:///...'
Diffstat (limited to 'src/map.h')
-rw-r--r-- | src/map.h | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -58,8 +58,10 @@ typedef void (*map_fin_cb_t)(memory_pool_t *pool, struct map_cb_data *data); /** * Common map object */ +struct config_file; struct rspamd_map { memory_pool_t *pool; + struct config_file *cfg; enum fetch_proto protocol; map_cb_t read_callback; map_fin_cb_t fin_callback; @@ -77,19 +79,19 @@ gboolean check_map_proto (const gchar *map_line, gint *res, const gchar **pos); /** * Add map from line */ -gboolean add_map (const gchar *map_line, map_cb_t read_callback, map_fin_cb_t fin_callback, void **user_data); +gboolean add_map (struct config_file *cfg, const gchar *map_line, map_cb_t read_callback, map_fin_cb_t fin_callback, void **user_data); /** * Start watching of maps by adding events to libevent event loop */ -void start_map_watch (struct event_base *ev_base); +void start_map_watch (struct config_file *cfg, struct event_base *ev_base); /** * Remove all maps watched (remove events) */ -void remove_all_maps (void); +void remove_all_maps (struct config_file *cfg); -typedef void (*insert_func) (gpointer st, gconstpointer key, gpointer value); +typedef void (*insert_func) (gpointer st, gconstpointer key, gconstpointer value); /** * Common callbacks for frequent types of lists |