1 #ifndef SQUID_ADAPTATION__ACCESS_CHECK_H
2 #define SQUID_ADAPTATION__ACCESS_CHECK_H
4 #include "base/AsyncJob.h"
5 #include "adaptation/Elements.h"
6 #include "adaptation/forward.h"
10 class ACLFilledChecklist
;
17 // checks adaptation_access rules to find a matching adaptation service
18 class AccessCheck
: public virtual AsyncJob
21 typedef void AccessCheckCallback(ServicePointer match
, void *data
);
23 // use this to start async ACL checks; returns true if started
24 static bool Start(Method method
, VectPoint vp
, HttpRequest
*req
,
25 HttpReply
*rep
, AccessCheckCallback
*cb
, void *cbdata
);
28 // use Start to start adaptation checks
29 AccessCheck(Method
, VectPoint
, HttpRequest
*, HttpReply
*, AccessCheckCallback
*, void *);
37 AccessCheckCallback
*callback
;
39 ACLFilledChecklist
*acl_checklist
;
41 typedef int Candidate
;
42 typedef Vector
<Candidate
> Candidates
;
43 Candidates candidates
;
44 Candidate
topCandidate() { return *candidates
.begin(); }
47 ServicePointer
findBestService(AccessRule
&r
, bool preferUp
);
52 void checkCandidates();
53 static void AccessCheckCallbackWrapper(int, void*);
55 static EVH AccessCheckCallbackEvent
;
57 void noteAnswer(int answer
);
59 //AsyncJob virtual methods
60 virtual bool doneAll() const { return AsyncJob::doneAll() && done
;}
63 CBDATA_CLASS2(AccessCheck
);
66 } // namespace Adaptation
68 #endif /* SQUID_ADAPTATION__ACCESS_CHECK_H */