]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/AccessCheck.h
Delete server-side deleteThis()
[thirdparty/squid.git] / src / adaptation / AccessCheck.h
1 #ifndef SQUID_ADAPTATION__ACCESS_CHECK_H
2 #define SQUID_ADAPTATION__ACCESS_CHECK_H
3
4 #include "acl/Acl.h"
5 #include "base/AsyncJob.h"
6 #include "adaptation/Elements.h"
7 #include "adaptation/forward.h"
8 #include "adaptation/Initiator.h"
9 #include "adaptation/ServiceFilter.h"
10
11 class HttpRequest;
12 class HttpReply;
13 class ACLFilledChecklist;
14
15 namespace Adaptation
16 {
17
18 class AccessRule;
19
20 // checks adaptation_access rules to find a matching adaptation service
21 class AccessCheck: public virtual AsyncJob
22 {
23 public:
24 typedef void AccessCheckCallback(ServiceGroupPointer group, void *data);
25
26 // use this to start async ACL checks; returns true if started
27 static bool Start(Method method, VectPoint vp, HttpRequest *req,
28 HttpReply *rep, Adaptation::Initiator *initiator);
29
30 protected:
31 // use Start to start adaptation checks
32 AccessCheck(const ServiceFilter &aFilter, Adaptation::Initiator *);
33 ~AccessCheck();
34
35 private:
36 const ServiceFilter filter;
37 CbcPointer<Adaptation::Initiator> theInitiator; ///< the job which ordered this access check
38 ACLFilledChecklist *acl_checklist;
39
40 typedef int Candidate;
41 typedef Vector<Candidate> Candidates;
42 Candidates candidates;
43 Candidate topCandidate() const { return *candidates.begin(); }
44 ServiceGroupPointer topGroup() const; // may return nil
45
46 void callBack(const ServiceGroupPointer &g);
47 bool isCandidate(AccessRule &r);
48
49 public:
50 void checkCandidates();
51 static void AccessCheckCallbackWrapper(allow_t, void*);
52 void noteAnswer(allow_t answer);
53
54 protected:
55 // AsyncJob API
56 virtual void start();
57 virtual bool doneAll() const { return false; } /// not done until mustStop
58
59 bool usedDynamicRules();
60 void check();
61
62 private:
63 CBDATA_CLASS2(AccessCheck);
64 };
65
66 } // namespace Adaptation
67
68 #endif /* SQUID_ADAPTATION__ACCESS_CHECK_H */