AccessCheck.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_ADAPTATION__ACCESS_CHECK_H
10#define SQUID_ADAPTATION__ACCESS_CHECK_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:
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
60public:
61 void checkCandidates();
62 static void AccessCheckCallbackWrapper(Acl::Answer, void*);
63 void noteAnswer(Acl::Answer answer);
64
65protected:
66 // AsyncJob API
67 void start() override;
68 bool doneAll() const override { return false; }
69
70 bool usedDynamicRules();
71 void check();
72};
73
74} // namespace Adaptation
75
76#endif /* SQUID_ADAPTATION__ACCESS_CHECK_H */
77
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:68
std::vector< Candidate > Candidates
Definition: AccessCheck.h:52
Candidate topCandidate() const
Definition: AccessCheck.h:54
ServiceGroupPointer topGroup() const
Definition: AccessCheck.cc:203
void callBack(const ServiceGroupPointer &g)
Definition: AccessCheck.cc:194
void noteAnswer(Acl::Answer answer)
process the results of the ACL check
Definition: AccessCheck.cc:172
bool usedDynamicRules()
not done until mustStop
Definition: AccessCheck.cc:81
CBDATA_CHILD(AccessCheck)
void check()
Walk the access rules list to find rules with applicable service groups.
Definition: AccessCheck.cc:103
bool isCandidate(AccessRule &r)
Definition: AccessCheck.cc:223
void start() override
called by AsyncStart; do not call directly
Definition: AccessCheck.cc:71
static bool Start(Method method, VectPoint vp, HttpRequest *req, HttpReply *, const AccessLogEntryPointer &, Adaptation::Initiator *)
Definition: AccessCheck.cc:30
AccessCheck(const ServiceFilter &aFilter, Adaptation::Initiator *)
Definition: AccessCheck.cc:46
ACLFilledChecklist * acl_checklist
Definition: AccessCheck.h:49
static void AccessCheckCallbackWrapper(Acl::Answer, void *)
Definition: AccessCheck.cc:151
information used to search for adaptation services
Definition: ServiceFilter.h:23

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors