]> git.ipfire.org Git - thirdparty/squid.git/blame - src/acl/Tree.h
Boilerplate: update copyright blurbs on Squid helpers
[thirdparty/squid.git] / src / acl / Tree.h
CommitLineData
6f58d7d7
AR
1#ifndef SQUID_ACL_TREE_H
2#define SQUID_ACL_TREE_H
3
4#include "acl/BoolOps.h"
8966008b 5#include "SBufList.h"
6f58d7d7 6
e936c41c
AR
7namespace Acl
8{
6f58d7d7
AR
9
10/// An ORed set of rules at the top of the ACL expression tree, providing two
11/// unique properties: cbdata protection and optional rule actions.
12class Tree: public OrNode
13{
14public:
15 /// dumps <name, action, rule, new line> tuples
16 /// action.kind is mapped to a string using the supplied conversion table
17 typedef const char **ActionToString;
8966008b 18 SBufList treeDump(const char *name, const ActionToString &convert) const;
6f58d7d7
AR
19
20 /// Returns the corresponding action after a successful tree match.
21 allow_t winningAction() const;
22
23 /// what action to use if no nodes matched
24 allow_t lastAction() const;
25
26 /// appends and takes control over the rule with a given action
27 void add(ACL *rule, const allow_t &action);
28 void add(ACL *rule); ///< same as InnerNode::add()
29
30protected:
31 allow_t actionAt(const Nodes::size_type pos) const;
32
33 /// if not empty, contains actions corresponding to InnerNode::nodes
34 typedef std::vector<allow_t> Actions;
35 Actions actions;
36
37private:
38 // XXX: We should use refcounting instead, but it requires making ACLs
39 // refcounted as well. Otherwise, async lookups will reach deleted ACLs.
40 CBDATA_CLASS2(Tree);
41};
42
6f58d7d7
AR
43} // namespace Acl
44
45#endif /* SQUID_ACL_TREE_H */