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"
7 #include "adaptation/ServiceFilter.h"
11 class ACLFilledChecklist
;
18 // checks adaptation_access rules to find a matching adaptation service
19 class AccessCheck
: public virtual AsyncJob
22 typedef void AccessCheckCallback(ServiceGroupPointer group
, void *data
);
24 // use this to start async ACL checks; returns true if started
25 static bool Start(Method method
, VectPoint vp
, HttpRequest
*req
,
26 HttpReply
*rep
, AccessCheckCallback
*cb
, void *cbdata
);
29 // use Start to start adaptation checks
30 AccessCheck(const ServiceFilter
&aFilter
, AccessCheckCallback
*, void *);
34 const ServiceFilter filter
;
35 AccessCheckCallback
*callback
;
37 ACLFilledChecklist
*acl_checklist
;
39 typedef int Candidate
;
40 typedef Vector
<Candidate
> Candidates
;
41 Candidates candidates
;
42 Candidate
topCandidate() const { return *candidates
.begin(); }
43 ServiceGroupPointer
topGroup() const; // may return nil
45 void callBack(const ServiceGroupPointer
&g
);
46 bool isCandidate(AccessRule
&r
);
49 void checkCandidates();
50 static void AccessCheckCallbackWrapper(int, void*);
51 void noteAnswer(int answer
);
56 virtual bool doneAll() const { return false; } /// not done until mustStop
61 CBDATA_CLASS2(AccessCheck
);
64 } // namespace Adaptation
66 #endif /* SQUID_ADAPTATION__ACCESS_CHECK_H */