diff options
Diffstat (limited to 'src/libserver/re_cache.h')
-rw-r--r-- | src/libserver/re_cache.h | 108 |
1 files changed, 54 insertions, 54 deletions
diff --git a/src/libserver/re_cache.h b/src/libserver/re_cache.h index 63c19f941..d6449a9f9 100644 --- a/src/libserver/re_cache.h +++ b/src/libserver/re_cache.h @@ -19,7 +19,7 @@ #include "config.h" #include "libutil/regexp.h" -#ifdef __cplusplus +#ifdef __cplusplus extern "C" { #endif @@ -37,13 +37,13 @@ enum rspamd_re_type { RSPAMD_RE_RAWMIME, RSPAMD_RE_URL, RSPAMD_RE_EMAIL, - RSPAMD_RE_BODY, /* full in SA */ - RSPAMD_RE_SABODY, /* body in SA */ + RSPAMD_RE_BODY, /* full in SA */ + RSPAMD_RE_SABODY, /* body in SA */ RSPAMD_RE_SARAWBODY, /* rawbody in SA */ - RSPAMD_RE_WORDS, /* normalized words */ - RSPAMD_RE_RAWWORDS, /* raw words */ + RSPAMD_RE_WORDS, /* normalized words */ + RSPAMD_RE_RAWWORDS, /* raw words */ RSPAMD_RE_STEMWORDS, /* stemmed words */ - RSPAMD_RE_SELECTOR, /* use lua selector to process regexp */ + RSPAMD_RE_SELECTOR, /* use lua selector to process regexp */ RSPAMD_RE_MAX }; @@ -59,7 +59,7 @@ struct rspamd_re_cache_stat { /** * Initialize re_cache persistent structure */ -struct rspamd_re_cache *rspamd_re_cache_new (void); +struct rspamd_re_cache *rspamd_re_cache_new(void); /** * Add the existing regexp to the cache @@ -71,10 +71,10 @@ struct rspamd_re_cache *rspamd_re_cache_new (void); * @param lua_cbref optional lua callback reference for matching purposes */ rspamd_regexp_t * -rspamd_re_cache_add (struct rspamd_re_cache *cache, rspamd_regexp_t *re, - enum rspamd_re_type type, - gconstpointer type_data, gsize datalen, - gint lua_cbref); +rspamd_re_cache_add(struct rspamd_re_cache *cache, rspamd_regexp_t *re, + enum rspamd_re_type type, + gconstpointer type_data, gsize datalen, + gint lua_cbref); /** * Replace regexp in the cache with another regexp @@ -82,15 +82,15 @@ rspamd_re_cache_add (struct rspamd_re_cache *cache, rspamd_regexp_t *re, * @param what re to replace * @param with regexp object to replace the origin */ -void rspamd_re_cache_replace (struct rspamd_re_cache *cache, - rspamd_regexp_t *what, - rspamd_regexp_t *with); +void rspamd_re_cache_replace(struct rspamd_re_cache *cache, + rspamd_regexp_t *what, + rspamd_regexp_t *with); /** * Initialize and optimize re cache structure */ -void rspamd_re_cache_init (struct rspamd_re_cache *cache, - struct rspamd_config *cfg); +void rspamd_re_cache_init(struct rspamd_re_cache *cache, + struct rspamd_config *cfg); enum rspamd_hyperscan_status { RSPAMD_HYPERSCAN_UNKNOWN = 0, @@ -105,18 +105,18 @@ enum rspamd_hyperscan_status { * @param cache * @return */ -enum rspamd_hyperscan_status rspamd_re_cache_is_hs_loaded (struct rspamd_re_cache *cache); +enum rspamd_hyperscan_status rspamd_re_cache_is_hs_loaded(struct rspamd_re_cache *cache); /** * Get runtime data for a cache */ -struct rspamd_re_runtime *rspamd_re_cache_runtime_new (struct rspamd_re_cache *cache); +struct rspamd_re_runtime *rspamd_re_cache_runtime_new(struct rspamd_re_cache *cache); /** * Get runtime statistics */ const struct rspamd_re_cache_stat * -rspamd_re_cache_get_stat (struct rspamd_re_runtime *rt); +rspamd_re_cache_get_stat(struct rspamd_re_runtime *rt); /** * Process regexp runtime and return the result for a specific regexp @@ -128,84 +128,84 @@ rspamd_re_cache_get_stat (struct rspamd_re_runtime *rt); * @param datalen associated data length * @param is_strong use case sensitive match when looking for headers */ -gint rspamd_re_cache_process (struct rspamd_task *task, - rspamd_regexp_t *re, - enum rspamd_re_type type, - gconstpointer type_data, - gsize datalen, - gboolean is_strong); +gint rspamd_re_cache_process(struct rspamd_task *task, + rspamd_regexp_t *re, + enum rspamd_re_type type, + gconstpointer type_data, + gsize datalen, + gboolean is_strong); -int rspamd_re_cache_process_ffi (void *ptask, - void *pre, - int type, - void *type_data, - int is_strong); +int rspamd_re_cache_process_ffi(void *ptask, + void *pre, + int type, + void *type_data, + int is_strong); /** * Destroy runtime data */ -void rspamd_re_cache_runtime_destroy (struct rspamd_re_runtime *rt); +void rspamd_re_cache_runtime_destroy(struct rspamd_re_runtime *rt); /** * Unref re cache */ -void rspamd_re_cache_unref (struct rspamd_re_cache *cache); +void rspamd_re_cache_unref(struct rspamd_re_cache *cache); /** * Retain reference to re cache */ -struct rspamd_re_cache *rspamd_re_cache_ref (struct rspamd_re_cache *cache); +struct rspamd_re_cache *rspamd_re_cache_ref(struct rspamd_re_cache *cache); /** * Set limit for all regular expressions in the cache, returns previous limit */ -guint rspamd_re_cache_set_limit (struct rspamd_re_cache *cache, guint limit); +guint rspamd_re_cache_set_limit(struct rspamd_re_cache *cache, guint limit); /** * Convert re type to a human readable string (constant one) */ -const gchar *rspamd_re_cache_type_to_string (enum rspamd_re_type type); +const gchar *rspamd_re_cache_type_to_string(enum rspamd_re_type type); /** * Convert re type string to the type enum */ -enum rspamd_re_type rspamd_re_cache_type_from_string (const char *str); +enum rspamd_re_type rspamd_re_cache_type_from_string(const char *str); struct ev_loop; /** * Compile expressions to the hyperscan tree and store in the `cache_dir` */ -gint rspamd_re_cache_compile_hyperscan (struct rspamd_re_cache *cache, - const char *cache_dir, - gdouble max_time, - gboolean silent, - struct ev_loop *event_loop, - void (*cb)(guint ncompiled, GError *err, void *cbd), - void *cbd); +gint rspamd_re_cache_compile_hyperscan(struct rspamd_re_cache *cache, + const char *cache_dir, + gdouble max_time, + gboolean silent, + struct ev_loop *event_loop, + void (*cb)(guint ncompiled, GError *err, void *cbd), + void *cbd); /** * Returns TRUE if the specified file is valid hyperscan cache */ -gboolean rspamd_re_cache_is_valid_hyperscan_file (struct rspamd_re_cache *cache, - const char *path, - gboolean silent, - gboolean try_load, - GError **err); +gboolean rspamd_re_cache_is_valid_hyperscan_file(struct rspamd_re_cache *cache, + const char *path, + gboolean silent, + gboolean try_load, + GError **err); /** * Loads all hyperscan regexps precompiled */ -enum rspamd_hyperscan_status rspamd_re_cache_load_hyperscan ( - struct rspamd_re_cache *cache, - const char *cache_dir, bool try_load); +enum rspamd_hyperscan_status rspamd_re_cache_load_hyperscan( + struct rspamd_re_cache *cache, + const char *cache_dir, bool try_load); /** * Registers lua selector in the cache */ -void rspamd_re_cache_add_selector (struct rspamd_re_cache *cache, - const gchar *sname, gint ref); +void rspamd_re_cache_add_selector(struct rspamd_re_cache *cache, + const gchar *sname, gint ref); -#ifdef __cplusplus +#ifdef __cplusplus } #endif |