]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/AccessCheck.h
Bug #2459 fix, access logging enhancements, ICAP logging and retries support:
[thirdparty/squid.git] / src / adaptation / AccessCheck.h
CommitLineData
b6b637eb
AR
1#ifndef SQUID_ADAPTATION__ACCESS_CHECK_H
2#define SQUID_ADAPTATION__ACCESS_CHECK_H
62c7f90e 3
d1e045c3 4#include "base/AsyncJob.h"
62c7f90e
AR
5#include "adaptation/Elements.h"
6#include "adaptation/forward.h"
7
8class HttpRequest;
9class HttpReply;
127dce76 10class ACLFilledChecklist;
62c7f90e 11
26ac0430
AJ
12namespace Adaptation
13{
62c7f90e
AR
14
15class AccessRule;
16
17// checks adaptation_access rules to find a matching adaptation service
18class AccessCheck: public virtual AsyncJob
19{
62c7f90e
AR
20public:
21 typedef void AccessCheckCallback(ServicePointer match, void *data);
abd4b611
AR
22
23 // use this to start async ACL checks; returns true if started
26ac0430
AJ
24 static bool Start(Method method, VectPoint vp, HttpRequest *req,
25 HttpReply *rep, AccessCheckCallback *cb, void *cbdata);
abd4b611
AR
26
27protected:
28 // use Start to start adaptation checks
62c7f90e
AR
29 AccessCheck(Method, VectPoint, HttpRequest *, HttpReply *, AccessCheckCallback *, void *);
30 ~AccessCheck();
31
32private:
33 Method method;
34 VectPoint point;
35 HttpRequest *req;
36 HttpReply *rep;
37 AccessCheckCallback *callback;
38 void *callback_data;
127dce76 39 ACLFilledChecklist *acl_checklist;
62c7f90e
AR
40
41 typedef int Candidate;
42 typedef Vector<Candidate> Candidates;
43 Candidates candidates;
44 Candidate topCandidate() { return *candidates.begin(); }
45
46 void do_callback();
47 ServicePointer findBestService(AccessRule &r, bool preferUp);
48 bool done;
49
50public:
51 void check();
52 void checkCandidates();
53 static void AccessCheckCallbackWrapper(int, void*);
54#if 0
55 static EVH AccessCheckCallbackEvent;
56#endif
57 void noteAnswer(int answer);
58
59//AsyncJob virtual methods
60 virtual bool doneAll() const { return AsyncJob::doneAll() && done;}
61
62private:
63 CBDATA_CLASS2(AccessCheck);
64};
65
66} // namespace Adaptation
67
b6b637eb 68#endif /* SQUID_ADAPTATION__ACCESS_CHECK_H */