]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/Tree.cc
2 * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
10 #include "acl/Checklist.h"
14 CBDATA_NAMESPACED_CLASS_INIT(Acl
, Tree
);
17 Acl::Tree::winningAction() const
19 return actionAt(lastMatch_
- nodes
.begin());
23 Acl::Tree::lastAction() const
27 return actions
.back();
30 /// computes action that corresponds to the position of the matched rule
32 Acl::Tree::actionAt(const Nodes::size_type pos
) const
34 assert(pos
< nodes
.size());
36 assert(actions
.size() == nodes
.size());
39 // default for matched rules in trees without actions
40 return ACCESS_ALLOWED
;
44 Acl::Tree::add(ACL
*rule
, const Acl::Answer
&action
)
46 // either all rules have actions or none
47 assert(nodes
.size() == actions
.size());
49 actions
.push_back(action
);
53 Acl::Tree::add(ACL
*rule
)
55 // either all rules have actions or none
56 assert(actions
.empty());
61 Acl::Tree::bannedAction(ACLChecklist
*checklist
, Nodes::const_iterator node
) const
64 assert(actions
.size() == nodes
.size());
65 const Nodes::size_type pos
= node
- nodes
.begin();
66 return checklist
->bannedAction(actions
.at(pos
));