#include <Tree.h>

Inheritance diagram for Acl::Tree:
Collaboration diagram for Acl::Tree:

Public Types

using Pointer = RefCount< Node >
 

Public Member Functions

template<class ActionToStringConverter >
SBufList treeDump (const char *name, ActionToStringConverter converter) const
 
Answer winningAction () const
 Returns the corresponding action after a successful tree match. More...
 
Answer lastAction () const
 what action to use if no nodes matched More...
 
void add (Acl::Node *rule, const Answer &action)
 appends and takes control over the rule with a given action More...
 
void add (Acl::Node *rule)
 same as InnerNode::add() More...
 
virtual bool bannedAction (ACLChecklist *, Nodes::const_iterator) const
 
const char * typeString () const override
 
void parse () override
 parses node representation in squid.conf; dies on failures More...
 
bool resumeMatchingAt (ACLChecklist *checklist, Acl::Nodes::const_iterator pos) const
 Resumes matching (suspended by an async call) at the given position. More...
 
Nodes::size_type childrenCount () const
 the number of children nodes More...
 
void prepareForUse () override
 
bool empty () const override
 
SBufList dump () const override
 
size_t lineParse ()
 
void * operator new (size_t)
 
void operator delete (void *)
 
void context (const SBuf &aName, const char *configuration)
 sets user-specified ACL name and squid.conf context More...
 
bool matches (ACLChecklist *checklist) const
 
void parseFlags ()
 configures Acl::Node options, throwing on configuration errors More...
 
virtual bool isProxyAuth () const
 
virtual bool valid () const
 
int cacheMatchAcl (dlink_list *cache, ACLChecklist *)
 
virtual int matchForCache (ACLChecklist *checklist)
 
void dumpWhole (const char *directiveName, std::ostream &)
 

Static Public Member Functions

static void ParseNamedAcl (ConfigParser &, NamedAcls *&)
 parses acl directive parts that follow directive name (i.e. "acl") More...
 
static void Initialize ()
 
static Acl::NodeFindByName (const SBuf &)
 A configured ACL with a given name or nil. More...
 

Public Attributes

SBuf name
 
char * cfgline = nullptr
 

Protected Types

typedef std::vector< AnswerActions
 if not empty, contains actions corresponding to InnerNode::nodes More...
 

Protected Member Functions

bool bannedAction (ACLChecklist *, Nodes::const_iterator) const override
 Acl::OrNode API. More...
 
Answer actionAt (const Nodes::size_type pos) const
 computes action that corresponds to the position of the matched rule More...
 
virtual int doMatch (ACLChecklist *checklist, Nodes::const_iterator start) const =0
 
int match (ACLChecklist *checklist) override
 Matches the actual data in checklist against this Acl::Node. More...
 

Protected Attributes

Actions actions
 
Nodes::const_iterator lastMatch_
 
Nodes nodes
 children of this intermediate node More...
 

Private Member Functions

 MEMPROXY_CLASS (Tree)
 
int doMatch (ACLChecklist *checklist, Nodes::const_iterator start) const override
 
virtual bool requiresAle () const
 whether our (i.e. shallow) match() requires checklist to have a AccessLogEntry More...
 
virtual bool requiresRequest () const
 whether our (i.e. shallow) match() requires checklist to have a request More...
 
virtual bool requiresReply () const
 whether our (i.e. shallow) match() requires checklist to have a reply More...
 
virtual const Acl::Optionsoptions ()
 
virtual const Acl::OptionslineOptions ()
 

Static Private Member Functions

static void ParseNamed (ConfigParser &, NamedAcls &, const SBuf &name)
 parses acl directive parts that follow aclname More...
 

Detailed Description

An ORed set of rules at the top of the ACL expression tree with support for optional rule actions.

Definition at line 22 of file Tree.h.

Member Typedef Documentation

◆ Actions

Definition at line 48 of file Tree.h.

◆ Pointer

using Acl::Node::Pointer = RefCount<Node>
inherited

Definition at line 29 of file Node.h.

Member Function Documentation

◆ actionAt()

Acl::Answer Acl::Tree::actionAt ( const Nodes::size_type  pos) const
protected

Definition at line 30 of file Tree.cc.

References ACCESS_ALLOWED, and assert.

Referenced by winningAction().

◆ add() [1/2]

void Acl::Tree::add ( Acl::Node rule)

Definition at line 51 of file Tree.cc.

References Acl::InnerNode::add(), and assert.

◆ add() [2/2]

void Acl::Tree::add ( Acl::Node rule,
const Answer action 
)

Definition at line 42 of file Tree.cc.

References Acl::InnerNode::add(), and assert.

Referenced by aclParseAclList().

◆ bannedAction() [1/2]

bool Acl::OrNode::bannedAction ( ACLChecklist ,
Nodes::const_iterator   
) const
virtualinherited

whether the given rule should be excluded from matching tests based on its action

Definition at line 99 of file BoolOps.cc.

◆ bannedAction() [2/2]

bool Acl::Tree::bannedAction ( ACLChecklist checklist,
Nodes::const_iterator  node 
) const
overrideprotected

Definition at line 59 of file Tree.cc.

References assert, and ACLChecklist::bannedAction().

◆ cacheMatchAcl()

◆ childrenCount()

Nodes::size_type Acl::InnerNode::childrenCount ( ) const
inlineinherited

Definition at line 29 of file InnerNode.h.

References Acl::InnerNode::nodes.

Referenced by aclParseAccessLine(), and Acl::AllOf::parse().

◆ context()

void Acl::Node::context ( const SBuf aName,
const char *  configuration 
)
inherited

Definition at line 220 of file Acl.cc.

References safe_free, and xstrdup.

Referenced by aclParseAccessLine(), aclParseAclList(), Acl::AllOf::parse(), and ParseAclWithAction().

◆ doMatch() [1/2]

virtual int Acl::InnerNode::doMatch ( ACLChecklist checklist,
Nodes::const_iterator  start 
) const
protectedpure virtualinherited

checks whether the nodes match, starting with the given one kids determine what a match means for their type of intermediate nodes

Implemented in Acl::AndNode, Acl::NotNode, and Acl::AllOf.

◆ doMatch() [2/2]

int Acl::OrNode::doMatch ( ACLChecklist checklist,
Nodes::const_iterator  start 
) const
overrideprivateinherited

Definition at line 105 of file BoolOps.cc.

References ACLChecklist::keepMatching(), and ACLChecklist::matchChild().

◆ dump()

SBufList Acl::InnerNode::dump ( ) const
overridevirtualinherited

Implements Acl::Node.

Definition at line 81 of file InnerNode.cc.

◆ dumpWhole()

void Acl::Node::dumpWhole ( const char *  directiveName,
std::ostream &  os 
)
inherited

Prints aggregated "acl" (or similar) directive configuration, including the given directive name, ACL name, ACL type, and ACL parameters. The printed parameters are collected from all same-name "acl" directives.

Definition at line 371 of file Acl.cc.

References asList().

◆ empty()

bool Acl::InnerNode::empty ( ) const
overridevirtualinherited

Implements Acl::Node.

Definition at line 30 of file InnerNode.cc.

Referenced by aclParseAccessLine().

◆ FindByName()

Acl::Node * Acl::Node::FindByName ( const SBuf name)
staticinherited

◆ Initialize()

void Acl::Node::Initialize ( )
staticinherited

Definition at line 471 of file Acl.cc.

References Config, debugs, and SquidConfig::namedAcls.

Referenced by serverConnectionsOpen().

◆ isProxyAuth()

bool Acl::Node::isProxyAuth ( ) const
virtualinherited

Reimplemented in ACLExternal, and ACLProxyAuth.

Definition at line 354 of file Acl.cc.

◆ lastAction()

Acl::Answer Acl::Tree::lastAction ( ) const

Definition at line 21 of file Tree.cc.

References ACCESS_DUNNO.

Referenced by ACLChecklist::calcImplicitAnswer().

◆ lineOptions()

◆ lineParse()

size_t Acl::InnerNode::lineParse ( )
inherited

parses a [ [!]acl1 [!]acl2... ] sequence, appending to nodes

Returns
the number of parsed ACL names

Definition at line 44 of file InnerNode.cc.

References config_input_line, DBG_CRITICAL, debugs, Acl::Node::FindByName(), self_destruct(), ConfigParser::strtokFile(), and xstrdup.

Referenced by aclParseAccessLine(), aclParseAclList(), Acl::AllOf::parse(), and ParseAclWithAction().

◆ match()

int Acl::InnerNode::match ( ACLChecklist checklist)
overrideprotectedvirtualinherited

Implements Acl::Node.

Definition at line 90 of file InnerNode.cc.

◆ matches()

bool Acl::Node::matches ( ACLChecklist checklist) const
inherited

Orchestrates matching checklist against the Acl::Node using match(), after checking preconditions and while providing debugging.

Returns
true if and only if there was a successful match. Updates the checklist state on match, async, and failure.

Definition at line 189 of file Acl.cc.

References ACLChecklist::asyncInProgress(), DBG_IMPORTANT, debugs, ACLChecklist::hasAle(), ACLChecklist::hasReply(), ACLChecklist::hasRequest(), ACLChecklist::setLastCheckedName(), and ACLChecklist::verifyAle().

Referenced by ACLChecklist::matchAndFinish().

◆ matchForCache()

int Acl::Node::matchForCache ( ACLChecklist checklist)
virtualinherited

Reimplemented in ACLProxyAuth.

Definition at line 383 of file Acl.cc.

References fatal().

◆ MEMPROXY_CLASS()

Acl::Tree::MEMPROXY_CLASS ( Tree  )
private

◆ operator delete()

void Acl::Node::operator delete ( void *  )
inherited

Definition at line 153 of file Acl.cc.

References fatal().

◆ operator new()

void * Acl::Node::operator new ( size_t  )
inherited

Definition at line 147 of file Acl.cc.

References fatal().

◆ options()

virtual const Acl::Options& Acl::Node::options ( )
inlineprivatevirtualinherited
Returns
(linked) 'global' Options supported by this Acl::Node

Reimplemented in Acl::ServerNameCheck, Acl::DestinationDomainCheck, Acl::AnnotationCheck, ACLMaxUserIP, and ACLDestinationIP.

Definition at line 98 of file Node.h.

References Acl::NoOptions().

◆ parse()

void Acl::OrNode::parse ( )
overridevirtualinherited

Implements Acl::Node.

Definition at line 127 of file BoolOps.cc.

References assert.

◆ parseFlags()

void Acl::Node::parseFlags ( )
inherited

Definition at line 360 of file Acl.cc.

References Acl::ParseFlags().

◆ ParseNamed()

void Acl::Node::ParseNamed ( ConfigParser parser,
NamedAcls namedAcls,
const SBuf name 
)
staticprivateinherited

◆ ParseNamedAcl()

void Acl::Node::ParseNamedAcl ( ConfigParser parser,
NamedAcls *&  namedAcls 
)
staticinherited

◆ prepareForUse()

void Acl::InnerNode::prepareForUse ( )
overridevirtualinherited

Reimplemented from Acl::Node.

Definition at line 23 of file InnerNode.cc.

References Acl::InnerNode::nodes.

◆ requiresAle()

bool Acl::Node::requiresAle ( ) const
privatevirtualinherited

Reimplemented in ACLExternal.

Definition at line 443 of file Acl.cc.

◆ requiresReply()

bool Acl::Node::requiresReply ( ) const
privatevirtualinherited

Reimplemented in ACLHTTPStatus, Acl::ReplyHeaderCheck< header >, and Acl::HttpRepHeaderCheck.

Definition at line 449 of file Acl.cc.

◆ requiresRequest()

◆ resumeMatchingAt()

bool Acl::InnerNode::resumeMatchingAt ( ACLChecklist checklist,
Acl::Nodes::const_iterator  pos 
) const
inherited

Definition at line 96 of file InnerNode.cc.

References ACLChecklist::asyncInProgress(), and debugs.

Referenced by ACLChecklist::matchAndFinish(), and ACLChecklist::matchChild().

◆ treeDump()

template<class ActionToStringConverter >
SBufList Acl::Tree::treeDump ( const char *  name,
ActionToStringConverter  converter 
) const
inline

dumps <name, action, rule, new line> tuples the supplied converter maps action.kind to a string

Definition at line 60 of file Tree.h.

References actions, SBuf::end(), Acl::InnerNode::nodes, SBuf::push_back(), and text.

Referenced by dump_http_upgrade_request_protocols(), dump_on_unsupported_protocol(), and Note::printAsNoteDirective().

◆ typeString()

const char * Acl::OrNode::typeString ( ) const
overridevirtualinherited

Implements Acl::Node.

Definition at line 93 of file BoolOps.cc.

◆ valid()

bool Acl::Node::valid ( ) const
virtualinherited

Reimplemented in ACLExternal, ACLProxyAuth, Acl::ServerNameCheck, ACLMaxUserIP, ACLMaxConnection, and ACLRandom.

Definition at line 183 of file Acl.cc.

◆ winningAction()

Acl::Answer Acl::Tree::winningAction ( ) const

Definition at line 15 of file Tree.cc.

References actionAt(), Acl::OrNode::lastMatch_, and Acl::InnerNode::nodes.

Referenced by ACLChecklist::matchAndFinish().

Member Data Documentation

◆ actions

Actions Acl::Tree::actions
protected

Definition at line 49 of file Tree.h.

Referenced by treeDump().

◆ cfgline

char* Acl::Node::cfgline = nullptr
inherited

Definition at line 83 of file Node.h.

◆ lastMatch_

Nodes::const_iterator Acl::OrNode::lastMatch_
mutableprotectedinherited

Definition at line 72 of file BoolOps.h.

Referenced by winningAction().

◆ name

SBuf Acl::Node::name
inherited

Either aclname parameter from the explicitly configured acl directive or a label generated for an internal ACL tree node. All Node objects corresponding to one Squid configuration have unique names. See also: context() and FindByName().

Definition at line 81 of file Node.h.

Referenced by aclDestroyAccessList(), Acl::AnnotateClientCheck::match(), Acl::AnnotateTransactionCheck::match(), ACLRandom::match(), Acl::SourceDomainCheck::match(), ACLDestinationIP::match(), Acl::NotNode::NotNode(), ACLExternal::parse(), and ACLMaxConnection::prepareForUse().

◆ nodes

Nodes Acl::InnerNode::nodes
protectedinherited

The documentation for this class was generated from the following files:

 

Introduction

Documentation

Support

Miscellaneous