*/
LUA_FUNCTION_DEF (config, get_symbols_count);
+/***
+ * @method rspamd_config:get_symbols_cksum()
+ * Returns checksum for all symbols in the cache
+ * @return {int64} boxed value of the 64 bit checksum
+ */
+LUA_FUNCTION_DEF (config, get_symbols_cksum);
+
/***
* @method rspamd_config:get_symbol_callback(name)
* Returns callback function for the specified symbol if it is a lua registered callback
LUA_INTERFACE_DEF (config, add_on_load),
LUA_INTERFACE_DEF (config, add_periodic),
LUA_INTERFACE_DEF (config, get_symbols_count),
+ LUA_INTERFACE_DEF (config, get_symbols_cksum),
LUA_INTERFACE_DEF (config, get_symbol_callback),
LUA_INTERFACE_DEF (config, set_symbol_callback),
LUA_INTERFACE_DEF (config, register_finish_script),
return 1;
}
+static gint
+lua_config_get_symbols_cksum (lua_State *L)
+{
+ struct rspamd_config *cfg = lua_check_config (L, 1);
+ guint64 res = 0, *pres;
+
+ if (cfg != NULL) {
+ res = rspamd_symbols_cache_get_cksum (cfg->cache);
+ }
+ else {
+ return luaL_error (L, "invalid arguments");
+ }
+
+ pres = lua_newuserdata (L, sizeof (res));
+ *pres = res;
+ rspamd_lua_setclass (L, "rspamd{int64}", -1);
+
+ return 1;
+}
+
static gint
lua_config_get_symbol_callback (lua_State *L)
{