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