AccessCheck.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2017 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_ADAPTATION__ACCESS_CHECK_H
10 #define SQUID_ADAPTATION__ACCESS_CHECK_H
11 
12 #include "AccessLogEntry.h"
13 #include "acl/Acl.h"
14 #include "adaptation/Elements.h"
15 #include "adaptation/forward.h"
16 #include "adaptation/Initiator.h"
18 #include "base/AsyncJob.h"
19 
20 class HttpRequest;
21 class HttpReply;
22 class ACLFilledChecklist;
23 
24 namespace Adaptation
25 {
26 
27 class AccessRule;
28 
29 // checks adaptation_access rules to find a matching adaptation service
30 class AccessCheck: public virtual AsyncJob
31 {
33 
34 public:
35  typedef void AccessCheckCallback(ServiceGroupPointer group, void *data);
36 
37  // use this to start async ACL checks; returns true if started
38  static bool Start(Method method, VectPoint vp, HttpRequest *req,
40 
41 protected:
42  // use Start to start adaptation checks
44  ~AccessCheck();
45 
46 private:
50 
51  typedef int Candidate;
52  typedef std::vector<Candidate> Candidates;
54  Candidate topCandidate() const { return *candidates.begin(); }
55  ServiceGroupPointer topGroup() const; // may return nil
56 
57  void callBack(const ServiceGroupPointer &g);
58  bool isCandidate(AccessRule &r);
59 
60 public:
61  void checkCandidates();
62  static void AccessCheckCallbackWrapper(allow_t, void*);
63  void noteAnswer(allow_t answer);
64 
65 protected:
66  // AsyncJob API
67  virtual void start();
68  virtual bool doneAll() const { return false; }
69 
70  bool usedDynamicRules();
71  void check();
72 };
73 
74 } // namespace Adaptation
75 
76 #endif /* SQUID_ADAPTATION__ACCESS_CHECK_H */
77 
AccessCheck(const ServiceFilter &aFilter, Adaptation::Initiator *)
Definition: AccessCheck.cc:46
bool isCandidate(AccessRule &r)
Definition: AccessCheck.cc:223
Definition: Acl.h:113
void callBack(const ServiceGroupPointer &g)
Definition: AccessCheck.cc:194
CbcPointer< Adaptation::Initiator > theInitiator
the job which ordered this access check
Definition: AccessCheck.h:48
ServiceGroupPointer topGroup() const
Definition: AccessCheck.cc:203
void AccessCheckCallback(ServiceGroupPointer group, void *data)
Definition: AccessCheck.h:35
bool usedDynamicRules()
not done until mustStop
Definition: AccessCheck.cc:82
virtual bool doneAll() const
whether positive goal has been reached
Definition: AccessCheck.h:68
void const char HLPCB void * data
Definition: stub_helper.cc:16
void check()
Walk the access rules list to find rules with applicable service groups.
Definition: AccessCheck.cc:104
Candidate topCandidate() const
Definition: AccessCheck.h:54
information used to search for adaptation services
Definition: ServiceFilter.h:22
ACLFilledChecklist * acl_checklist
Definition: AccessCheck.h:49
CBDATA_CLASS(AccessCheck)
size_t HttpReply *STUB StoreEntry const KeyScope scope const HttpRequestMethod & method
Definition: stub_store.cc:126
static bool Start(Method method, VectPoint vp, HttpRequest *req, HttpReply *rep, AccessLogEntry::Pointer &al, Adaptation::Initiator *initiator)
Definition: AccessCheck.cc:30
void noteAnswer(allow_t answer)
process the results of the ACL check
Definition: AccessCheck.cc:172
virtual void start()
called by AsyncStart; do not call directly
Definition: AccessCheck.cc:72
std::vector< Candidate > Candidates
Definition: AccessCheck.h:52
static void AccessCheckCallbackWrapper(allow_t, void *)
Definition: AccessCheck.cc:151
const ServiceFilter filter
Definition: AccessCheck.h:47

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors