]>
Commit | Line | Data |
---|---|---|
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 | ||
8 | class HttpRequest; | |
9 | class HttpReply; | |
10 | ||
11 | namespace Adaptation { | |
12 | ||
13 | class AccessRule; | |
14 | ||
15 | // checks adaptation_access rules to find a matching adaptation service | |
16 | class AccessCheck: public virtual AsyncJob | |
17 | { | |
18 | ||
19 | public: | |
20 | typedef void AccessCheckCallback(ServicePointer match, void *data); | |
21 | AccessCheck(Method, VectPoint, HttpRequest *, HttpReply *, AccessCheckCallback *, void *); | |
22 | ~AccessCheck(); | |
23 | ||
24 | private: | |
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 | ||
42 | public: | |
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 | ||
54 | private: | |
55 | CBDATA_CLASS2(AccessCheck); | |
56 | }; | |
57 | ||
58 | } // namespace Adaptation | |
59 | ||
60 | #endif /* SQUID_ADAPTATION__ACCESS_H */ |