]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Initiator.h
1 #ifndef SQUID_ADAPTATION__INITIATOR_H
2 #define SQUID_ADAPTATION__INITIATOR_H
4 #include "adaptation/forward.h"
5 #include "base/AsyncJob.h"
6 #include "base/CbcPointer.h"
9 * The ICAP Initiator is an ICAP vectoring point that initates ICAP
10 * transactions. This interface exists to allow ICAP transactions to
11 * signal their initiators that they have the answer from the ICAP server
12 * or that the ICAP query has aborted and there will be no answer. It
13 * is also handy for implementing common initiator actions such as starting
14 * or aborting an ICAP transaction.
20 class Initiator
: virtual public AsyncJob
23 Initiator(): AsyncJob("Initiator") {}
24 virtual ~Initiator() {}
26 /// called with the initial adaptation decision (adapt, block, error);
27 /// virgin and/or adapted body transmission may continue after this
28 virtual void noteAdaptationAnswer(const Answer
&answer
) = 0;
31 ///< starts freshly created initiate and returns a safe pointer to it
32 CbcPointer
<Initiate
> initiateAdaptation(Initiate
*x
);
34 /// clears the pointer (does not call announceInitiatorAbort)
35 void clearAdaptation(CbcPointer
<Initiate
> &x
);
37 /// inform the transaction about abnormal termination and clear the pointer
38 void announceInitiatorAbort(CbcPointer
<Initiate
> &x
);
40 /// Must(initiated(initiate)) instead of Must(initiate.set()), for clarity
41 bool initiated(const CbcPointer
<AsyncJob
> &job
) const { return job
.set(); }
44 } // namespace Adaptation
46 #endif /* SQUID_ADAPTATION__INITIATOR_H */