Node.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
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 
9 #ifndef SQUID_SRC_ACL_NODE_H
10 #define SQUID_SRC_ACL_NODE_H
11 
12 #include "acl/forward.h"
13 #include "acl/Options.h"
14 #include "dlink.h"
15 #include "sbuf/SBuf.h"
16 
17 class ConfigParser;
18 
19 namespace Acl {
20 
25 class Node: public RefCountable
26 {
27 
28 public:
30 
31  void *operator new(size_t);
32  void operator delete(void *);
33 
35  static void ParseNamedAcl(ConfigParser &, NamedAcls *&);
36 
37  static void Initialize();
38 
40  static Acl::Node *FindByName(const SBuf &);
41 
42  Node();
43  Node(Node &&) = delete; // no copying of any kind
44  virtual ~Node();
45 
47  void context(const SBuf &aName, const char *configuration);
48 
53  bool matches(ACLChecklist *checklist) const;
54 
56  void parseFlags();
57 
59  virtual void parse() = 0;
60  virtual char const *typeString() const = 0;
61  virtual bool isProxyAuth() const;
62  virtual SBufList dump() const = 0;
63  virtual bool empty() const = 0;
64  virtual bool valid() const;
65 
66  int cacheMatchAcl(dlink_list *cache, ACLChecklist *);
67  virtual int matchForCache(ACLChecklist *checklist);
68 
69  virtual void prepareForUse() {}
70 
71  // TODO: Find a way to make options() and this method constant
75  void dumpWhole(const char *directiveName, std::ostream &);
76 
82 
83  char *cfgline = nullptr;
84 
85 private:
87  virtual int match(ACLChecklist *checklist) = 0; // XXX: missing const
88 
90  virtual bool requiresAle() const;
92  virtual bool requiresRequest() const;
94  virtual bool requiresReply() const;
95 
96  // TODO: Rename to globalOptions(); these are not the only supported options
98  virtual const Acl::Options &options() { return Acl::NoOptions(); }
99 
102  virtual const Acl::Options &lineOptions() { return Acl::NoOptions(); }
103 
104  static void ParseNamed(ConfigParser &, NamedAcls &, const SBuf &name);
105 };
106 
107 } // namespace Acl
108 
109 #endif /* SQUID_SRC_ACL_NODE_H */
virtual int matchForCache(ACLChecklist *checklist)
Definition: Acl.cc:383
virtual bool requiresAle() const
whether our (i.e. shallow) match() requires checklist to have a AccessLogEntry
Definition: Acl.cc:443
virtual const Acl::Options & options()
Definition: Node.h:98
std::vector< const Option * > Options
Definition: Options.h:217
std::list< SBuf > SBufList
Definition: forward.h:22
virtual bool requiresRequest() const
whether our (i.e. shallow) match() requires checklist to have a request
Definition: Acl.cc:455
Definition: SBuf.h:93
Definition: Acl.cc:33
virtual bool requiresReply() const
whether our (i.e. shallow) match() requires checklist to have a reply
Definition: Acl.cc:449
void context(const SBuf &aName, const char *configuration)
sets user-specified ACL name and squid.conf context
Definition: Acl.cc:220
virtual const Acl::Options & lineOptions()
Definition: Node.h:102
static void ParseNamedAcl(ConfigParser &, NamedAcls *&)
parses acl directive parts that follow directive name (i.e. "acl")
Definition: Acl.cc:229
void dumpWhole(const char *directiveName, std::ostream &)
Definition: Acl.cc:371
parsed "acl aclname ..." directives indexed by aclname
Definition: Acl.cc:36
int const char size_t
Definition: stub_liblog.cc:83
virtual bool valid() const
Definition: Acl.cc:183
static void ParseNamed(ConfigParser &, NamedAcls &, const SBuf &name)
parses acl directive parts that follow aclname
Definition: Acl.cc:253
static Acl::Node * FindByName(const SBuf &)
A configured ACL with a given name or nil.
Definition: Acl.cc:159
virtual void prepareForUse()
Definition: Node.h:69
virtual bool empty() const =0
virtual void parse()=0
parses node representation in squid.conf; dies on failures
const Options & NoOptions()
Definition: Options.cc:234
void parseFlags()
configures Acl::Node options, throwing on configuration errors
Definition: Acl.cc:360
virtual int match(ACLChecklist *checklist)=0
Matches the actual data in checklist against this Acl::Node.
Definition: Node.h:25
int cacheMatchAcl(dlink_list *cache, ACLChecklist *)
Definition: Acl.cc:401
virtual const char * typeString() const =0
virtual SBufList dump() const =0
virtual ~Node()
Definition: Acl.cc:464
Node()
Definition: Acl.cc:177
char * cfgline
Definition: Node.h:83
static void Initialize()
Definition: Acl.cc:471
bool matches(ACLChecklist *checklist) const
Definition: Acl.cc:189
virtual bool isProxyAuth() const
Definition: Acl.cc:354
SBuf name
Definition: Node.h:81

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors