]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/acl/InnerNode.cc
2 * Copyright (C) 1996-2015 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.
11 #include "acl/BoolOps.h"
12 #include "acl/Checklist.h"
13 #include "acl/Gadgets.h"
14 #include "acl/InnerNode.h"
16 #include "ConfigParser.h"
22 Acl::InnerNode::prepareForUse()
24 std::for_each(nodes
.begin(), nodes
.end(), std::mem_fun(&ACL::prepareForUse
));
28 Acl::InnerNode::empty() const
34 Acl::InnerNode::add(ACL
*node
)
37 nodes
.push_back(node
);
41 // one call parses one "acl name acltype name1 name2 ..." line
42 // kids use this method to handle [multiple] parse() calls correctly
44 Acl::InnerNode::lineParse()
46 // XXX: not precise, may change when looping or parsing multiple lines
48 cfgline
= xstrdup(config_input_line
);
50 // expect a list of ACL names, each possibly preceeded by '!' for negation
52 while (const char *t
= ConfigParser::strtokFile()) {
53 const bool negated
= (*t
== '!');
57 debugs(28, 3, "looking for ACL " << t
);
58 ACL
*a
= ACL::FindByName(t
);
61 debugs(28, DBG_CRITICAL
, "ACL not found: " << t
);
66 // append(negated ? new NotNode(a) : a);
77 Acl::InnerNode::dump() const
80 for (Nodes::const_iterator i
= nodes
.begin(); i
!= nodes
.end(); ++i
)
81 rv
.push_back(SBuf((*i
)->name
));
86 Acl::InnerNode::match(ACLChecklist
*checklist
)
88 return doMatch(checklist
, nodes
.begin());
92 Acl::InnerNode::resumeMatchingAt(ACLChecklist
*checklist
, Acl::Nodes::const_iterator pos
) const
94 debugs(28, 5, "checking " << name
<< " at " << (pos
-nodes
.begin()));
95 const int result
= doMatch(checklist
, pos
);
96 const char *extra
= checklist
->asyncInProgress() ? " async" : "";
97 debugs(28, 3, "checked: " << name
<< " = " << result
<< extra
);
99 // merges async and failures (-1) into "not matched"