real_cache->process_settings_elt(elt);
}
+bool
+rspamd_symcache_set_allowed_settings_ids(struct rspamd_symcache *cache,
+ const gchar *symbol,
+ const guint32 *ids,
+ guint nids)
+{
+ auto *real_cache = C_API_SYMCACHE(cache);
+
+ auto *item = real_cache->get_item_by_name_mut(symbol, false);
+
+ if (item == nullptr) {
+ return false;
+ }
+
+ item->allowed_ids.set_ids(ids, nids, real_cache->get_pool());
+ return true;
+}
+
+bool
+rspamd_symcache_set_forbidden_settings_ids(struct rspamd_symcache *cache,
+ const gchar *symbol,
+ const guint32 *ids,
+ guint nids)
+{
+ auto *real_cache = C_API_SYMCACHE(cache);
+
+ auto *item = real_cache->get_item_by_name_mut(symbol, false);
+
+ if (item == nullptr) {
+ return false;
+ }
+
+ item->forbidden_ids.set_ids(ids, nids, real_cache->get_pool());
+ return true;
+}
+
+const guint32 *
+rspamd_symcache_get_allowed_settings_ids(struct rspamd_symcache *cache,
+ const gchar *symbol,
+ guint *nids)
+{
+ auto *real_cache = C_API_SYMCACHE(cache);
+
+ const auto *item = real_cache->get_item_by_name(symbol, false);
+ return item->allowed_ids.get_ids(*nids);
+
+}
+
+const guint32 *
+rspamd_symcache_get_forbidden_settings_ids (struct rspamd_symcache *cache,
+ const gchar *symbol,
+ guint *nids)
+{
+ auto *real_cache = C_API_SYMCACHE(cache);
+
+ const auto *item = real_cache->get_item_by_name(symbol, false);
+ return item->forbidden_ids.get_ids(*nids);
+}
+
void
rspamd_symcache_disable_all_symbols(struct rspamd_task *task,
struct rspamd_symcache *_cache,
* @param nids output of the number of elements
* @return
*/
- auto get_ids(std::size_t &nids) const -> const std::uint32_t *
+ auto get_ids(unsigned &nids) const -> const std::uint32_t *
{
if (data.dyn.e == -1) {
/* Dynamic list */
* limitations under the License.
*/
+#include "lua/lua_common.h"
#include "symcache_internal.hxx"
#include "symcache_item.hxx"
#include "fmt/core.h"
#include "libserver/task.h"
-#include "lua/lua_common.h"
namespace rspamd::symcache {
msg_debug_cache("process virtual dependency %s(%d) on %s(%d)", symbol.c_str(),
dep.vid, vdit->symbol.c_str(), vdit->id);
- std::size_t nids = 0;
+ unsigned nids = 0;
/* Propagate ids */
msg_debug_cache("check id propagation for dependency %s from %s",
-//
-// Created by Vsevolod Stakhov on 02/04/2022.
-//
-
+/*-
+ * Copyright 2022 Vsevolod Stakhov
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#include "locked_file.hxx"
#include <fmt/core.h>
#include "libutil/util.h"