+/*
+ * Copyright (C) 1996-2018 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
#include "squid.h"
+#include "acl/Checklist.h"
#include "acl/Tree.h"
#include "wordlist.h"
CBDATA_NAMESPACED_CLASS_INIT(Acl, Tree);
-
allow_t
Acl::Tree::winningAction() const
{
allow_t
Acl::Tree::actionAt(const Nodes::size_type pos) const
{
- assert(0 <= pos && pos < nodes.size());
+ assert(pos < nodes.size());
if (actions.size()) {
assert(actions.size() == nodes.size());
return actions[pos];
InnerNode::add(rule);
}
-wordlist*
-Acl::Tree::treeDump(const char *prefix, const ActionToString &convert) const
+bool
+Acl::Tree::bannedAction(ACLChecklist *checklist, Nodes::const_iterator node) const
{
- wordlist *text = NULL;
- Actions::const_iterator action = actions.begin();
- typedef Nodes::const_iterator NCI;
- for (NCI node = nodes.begin(); node != nodes.end(); ++node) {
-
- wordlistAdd(&text, prefix);
-
- if (action != actions.end()) {
- const char *act = convert ? convert[action->kind] :
- (*action == ACCESS_ALLOWED ? "allow" : "deny");
- wordlistAdd(&text, act ? act : "???");
- ++action;
- }
-
- wordlist *rule = (*node)->dump();
- wordlistAddWl(&text, rule);
- wordlistDestroy(&rule);
-
- wordlistAdd(&text, "\n");
+ if (actions.size()) {
+ assert(actions.size() == nodes.size());
+ const Nodes::size_type pos = node - nodes.begin();
+ return checklist->bannedAction(actions.at(pos));
}
- return text;
+ return false;
}
+