1 #ifndef SQUID_ADAPTATION__ACCESS_CHECK_H
2 #define SQUID_ADAPTATION__ACCESS_CHECK_H
4 #include "ICAP/AsyncJob.h"
5 #include "adaptation/Elements.h"
6 #include "adaptation/forward.h"
11 namespace Adaptation
{
15 // checks adaptation_access rules to find a matching adaptation service
16 class AccessCheck
: public virtual AsyncJob
20 typedef void AccessCheckCallback(ServicePointer match
, void *data
);
21 AccessCheck(Method
, VectPoint
, HttpRequest
*, HttpReply
*, AccessCheckCallback
*, void *);
29 AccessCheckCallback
*callback
;
31 ACLChecklist
*acl_checklist
;
33 typedef int Candidate
;
34 typedef Vector
<Candidate
> Candidates
;
35 Candidates candidates
;
36 Candidate
topCandidate() { return *candidates
.begin(); }
39 ServicePointer
findBestService(AccessRule
&r
, bool preferUp
);
44 void checkCandidates();
45 static void AccessCheckCallbackWrapper(int, void*);
47 static EVH AccessCheckCallbackEvent
;
49 void noteAnswer(int answer
);
51 //AsyncJob virtual methods
52 virtual bool doneAll() const { return AsyncJob::doneAll() && done
;}
55 CBDATA_CLASS2(AccessCheck
);
58 } // namespace Adaptation
60 #endif /* SQUID_ADAPTATION__ACCESS_CHECK_H */