1 #ifndef SQUID_ADAPTATION__ACCESS_CHECK_H
2 #define SQUID_ADAPTATION__ACCESS_CHECK_H
5 #include "base/AsyncJob.h"
6 #include "adaptation/Elements.h"
7 #include "adaptation/forward.h"
8 #include "adaptation/Initiator.h"
9 #include "adaptation/ServiceFilter.h"
13 class ACLFilledChecklist
;
20 // checks adaptation_access rules to find a matching adaptation service
21 class AccessCheck
: public virtual AsyncJob
24 typedef void AccessCheckCallback(ServiceGroupPointer group
, void *data
);
26 // use this to start async ACL checks; returns true if started
27 static bool Start(Method method
, VectPoint vp
, HttpRequest
*req
,
28 HttpReply
*rep
, Adaptation::Initiator
*initiator
);
31 // use Start to start adaptation checks
32 AccessCheck(const ServiceFilter
&aFilter
, Adaptation::Initiator
*);
36 const ServiceFilter filter
;
37 CbcPointer
<Adaptation::Initiator
> theInitiator
; ///< the job which ordered this access check
38 ACLFilledChecklist
*acl_checklist
;
40 typedef int Candidate
;
41 typedef Vector
<Candidate
> Candidates
;
42 Candidates candidates
;
43 Candidate
topCandidate() const { return *candidates
.begin(); }
44 ServiceGroupPointer
topGroup() const; // may return nil
46 void callBack(const ServiceGroupPointer
&g
);
47 bool isCandidate(AccessRule
&r
);
50 void checkCandidates();
51 static void AccessCheckCallbackWrapper(allow_t
, void*);
52 void noteAnswer(allow_t answer
);
57 virtual bool doneAll() const { return false; } /// not done until mustStop
59 bool usedDynamicRules();
63 CBDATA_CLASS2(AccessCheck
);
66 } // namespace Adaptation
68 #endif /* SQUID_ADAPTATION__ACCESS_CHECK_H */