commit f9e5edb: [Minor] Add static C API
Vsevolod Stakhov
vsevolod at rspamd.com
Sun Jul 24 19:42:03 UTC 2022
Author: Vsevolod Stakhov
Date: 2022-07-24 20:26:53 +0100
URL: https://github.com/rspamd/rspamd/commit/f9e5edbd6bb0bbbf8bad0e97eb02e2441d10e055
[Minor] Add static C API
---
src/libserver/rspamd_symcache.h | 18 ++++++++++++++++++
src/libserver/symcache/symcache_c.cxx | 17 +++++++++++++++++
2 files changed, 35 insertions(+)
diff --git a/src/libserver/rspamd_symcache.h b/src/libserver/rspamd_symcache.h
index 8707c631f..0510cb1dc 100644
--- a/src/libserver/rspamd_symcache.h
+++ b/src/libserver/rspamd_symcache.h
@@ -329,6 +329,24 @@ gboolean rspamd_symcache_disable_symbol (struct rspamd_task *task,
struct rspamd_symcache *cache,
const gchar *symbol);
+/**
+ * Disable execution of a symbol or a pattern (a string enclosed in `//`) permanently
+ * @param task
+ * @param cache
+ * @param symbol
+ * @return
+ */
+void rspamd_symcache_disable_symbol_static (struct rspamd_symcache *cache,
+ const gchar *symbol);
+/**
+ * Add a symbol or a pattern to the list of explicitly and statically enabled symbols
+ * @param cache
+ * @param symbol
+ * @return
+ */
+void rspamd_symcache_enable_symbol_static (struct rspamd_symcache *cache,
+ const gchar *symbol);
+
/**
* Process specific function for each cache element (in order they are added)
* @param cache
diff --git a/src/libserver/symcache/symcache_c.cxx b/src/libserver/symcache/symcache_c.cxx
index e0d8711f1..d4ae88e67 100644
--- a/src/libserver/symcache/symcache_c.cxx
+++ b/src/libserver/symcache/symcache_c.cxx
@@ -465,6 +465,23 @@ rspamd_symcache_enable_symbol(struct rspamd_task *task,
return cache_runtime->enable_symbol(task, *real_cache, symbol);
}
+void
+rspamd_symcache_disable_symbol_static (struct rspamd_symcache *cache,
+ const gchar *symbol)
+{
+ auto *real_cache = C_API_SYMCACHE(cache);
+
+ real_cache->disable_symbol_delayed(symbol);
+}
+
+void rspamd_symcache_enable_symbol_static (struct rspamd_symcache *cache,
+ const gchar *symbol)
+{
+ auto *real_cache = C_API_SYMCACHE(cache);
+
+ real_cache->enable_symbol_delayed(symbol);
+}
+
gboolean
rspamd_symcache_is_checked(struct rspamd_task *task,
struct rspamd_symcache *cache,
More information about the Commits
mailing list