Squid Web Cache master
Loading...
Searching...
No Matches
AccessCheck.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2025 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_ADAPTATION_ACCESSCHECK_H
10#define SQUID_SRC_ADAPTATION_ACCESSCHECK_H
11
12#include "acl/Acl.h"
13#include "adaptation/Elements.h"
14#include "adaptation/forward.h"
17#include "base/AsyncJob.h"
18#include "log/forward.h"
19
20class HttpRequest;
21class HttpReply;
23
24namespace Adaptation
25{
26
27class AccessRule;
28
29// checks adaptation_access rules to find a matching adaptation service
30class AccessCheck: public virtual AsyncJob
31{
33
34public:
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
41protected:
42 // use Start to start adaptation checks
44 ~AccessCheck() override;
45
46private:
49
50 typedef int Candidate;
51 typedef std::vector<Candidate> Candidates;
53 Candidate topCandidate() const { return *candidates.begin(); }
54 ServiceGroupPointer topGroup() const; // may return nil
55
56 void callBack(const ServiceGroupPointer &g);
57 bool isCandidate(AccessRule &r);
58
59public:
60 void checkCandidates();
61 static void AccessCheckCallbackWrapper(Acl::Answer, void*);
62 void noteAnswer(Acl::Answer answer);
63
64protected:
65 // AsyncJob API
66 void start() override;
67 bool doneAll() const override { return false; }
68
69 bool usedDynamicRules();
70 void check();
71};
72
73} // namespace Adaptation
74
75#endif /* SQUID_SRC_ADAPTATION_ACCESSCHECK_H */
76
const ServiceFilter filter
Definition AccessCheck.h:47
void AccessCheckCallback(ServiceGroupPointer group, void *data)
Definition AccessCheck.h:35
CbcPointer< Adaptation::Initiator > theInitiator
the job which ordered this access check
Definition AccessCheck.h:48
bool doneAll() const override
whether positive goal has been reached
Definition AccessCheck.h:67
std::vector< Candidate > Candidates
Definition AccessCheck.h:51
Candidate topCandidate() const
Definition AccessCheck.h:53
ServiceGroupPointer topGroup() const
void callBack(const ServiceGroupPointer &g)
void noteAnswer(Acl::Answer answer)
process the results of the ACL check
bool usedDynamicRules()
not done until mustStop
CBDATA_CHILD(AccessCheck)
void check()
Walk the access rules list to find rules with applicable service groups.
bool isCandidate(AccessRule &r)
void start() override
called by AsyncStart; do not call directly
static bool Start(Method method, VectPoint vp, HttpRequest *req, HttpReply *, const AccessLogEntryPointer &, Adaptation::Initiator *)
static void AccessCheckCallbackWrapper(Acl::Answer, void *)
information used to search for adaptation services