]> git.ipfire.org Git - thirdparty/squid.git/blame - src/acl/BoolOps.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / src / acl / BoolOps.h
CommitLineData
bbc27441 1/*
b8ae064d 2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
bbc27441
AJ
3 *
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.
7 */
8
ff9d9458
FC
9#ifndef SQUID_SRC_ACL_BOOLOPS_H
10#define SQUID_SRC_ACL_BOOLOPS_H
b6095d3e
AR
11
12#include "acl/InnerNode.h"
13
14/* ACLs defined here are used internally to construct an ACL expression tree.
15 * They cannot be specified directly in squid.conf because squid.conf ACLs are
16 * more complex than (and are implemented using) these operator-like classes.*/
17
e936c41c
AR
18namespace Acl
19{
b6095d3e
AR
20
21/// Implements the "not" or "!" operator.
22class NotNode: public InnerNode
23{
b6095d3e
AR
24 MEMPROXY_CLASS(NotNode);
25
741c2986 26public:
922513e5 27 explicit NotNode(Acl::Node *acl);
b6095d3e
AR
28
29private:
922513e5 30 /* Acl::Node API */
337b9aa4
AR
31 char const *typeString() const override;
32 void parse() override;
33 SBufList dump() const override;
b6095d3e
AR
34
35 /* Acl::InnerNode API */
337b9aa4 36 int doMatch(ACLChecklist *checklist, Nodes::const_iterator start) const override;
b6095d3e 37};
b6095d3e 38
2f8abb64 39/// An inner ACL expression tree node representing a boolean conjunction (AND)
b6095d3e 40/// operator applied to a list of child tree nodes.
115b045f 41/// For example, conditions expressed on a single http_access line are ANDed.
b6095d3e
AR
42class AndNode: public InnerNode
43{
b6095d3e
AR
44 MEMPROXY_CLASS(AndNode);
45
741c2986 46public:
b6095d3e 47 /* ACL API */
337b9aa4
AR
48 char const *typeString() const override;
49 void parse() override;
b6095d3e
AR
50
51private:
337b9aa4 52 int doMatch(ACLChecklist *checklist, Nodes::const_iterator start) const override;
b6095d3e 53};
b6095d3e
AR
54
55/// An inner ACL expression tree node representing a boolean disjuction (OR)
56/// operator applied to a list of child tree nodes.
57/// For example, conditions expressed by multiple http_access lines are ORed.
58class OrNode: public InnerNode
59{
b6095d3e
AR
60 MEMPROXY_CLASS(OrNode);
61
741c2986 62public:
640fe8fb
CT
63 /// whether the given rule should be excluded from matching tests based
64 /// on its action
65 virtual bool bannedAction(ACLChecklist *, Nodes::const_iterator) const;
66
922513e5 67 /* Acl::Node API */
337b9aa4
AR
68 char const *typeString() const override;
69 void parse() override;
b6095d3e
AR
70
71protected:
72 mutable Nodes::const_iterator lastMatch_;
73
74private:
337b9aa4 75 int doMatch(ACLChecklist *checklist, Nodes::const_iterator start) const override;
b6095d3e 76};
b6095d3e 77
b6095d3e
AR
78} // namespace Acl
79
ff9d9458 80#endif /* SQUID_SRC_ACL_BOOLOPS_H */
f53969cc 81