]> git.ipfire.org Git - thirdparty/squid.git/blame - src/adaptation/AccessCheck.h
Added an adaptation service group API to support groups of services. Current
[thirdparty/squid.git] / src / adaptation / AccessCheck.h
CommitLineData
62c7f90e
AR
1#ifndef SQUID_ADAPTATION__ACCESS_H
2#define SQUID_ADAPTATION__ACCESS_H
3
4#include "ICAP/AsyncJob.h"
5#include "adaptation/Elements.h"
6#include "adaptation/forward.h"
7
8class HttpRequest;
9class HttpReply;
10
11namespace Adaptation {
12
13class AccessRule;
14
15// checks adaptation_access rules to find a matching adaptation service
16class AccessCheck: public virtual AsyncJob
17{
18
19public:
20 typedef void AccessCheckCallback(ServicePointer match, void *data);
21 AccessCheck(Method, VectPoint, HttpRequest *, HttpReply *, AccessCheckCallback *, void *);
22 ~AccessCheck();
23
24private:
25 Method method;
26 VectPoint point;
27 HttpRequest *req;
28 HttpReply *rep;
29 AccessCheckCallback *callback;
30 void *callback_data;
31 ACLChecklist *acl_checklist;
32
33 typedef int Candidate;
34 typedef Vector<Candidate> Candidates;
35 Candidates candidates;
36 Candidate topCandidate() { return *candidates.begin(); }
37
38 void do_callback();
39 ServicePointer findBestService(AccessRule &r, bool preferUp);
40 bool done;
41
42public:
43 void check();
44 void checkCandidates();
45 static void AccessCheckCallbackWrapper(int, void*);
46#if 0
47 static EVH AccessCheckCallbackEvent;
48#endif
49 void noteAnswer(int answer);
50
51//AsyncJob virtual methods
52 virtual bool doneAll() const { return AsyncJob::doneAll() && done;}
53
54private:
55 CBDATA_CLASS2(AccessCheck);
56};
57
58} // namespace Adaptation
59
60#endif /* SQUID_ADAPTATION__ACCESS_H */