]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Initiator.h
Author: Francesco Chemolli <kinkie@squid-cache.org>
[thirdparty/squid.git] / src / adaptation / Initiator.h
1 #ifndef SQUID_ADAPTATION__INITIATOR_H
2 #define SQUID_ADAPTATION__INITIATOR_H
3
4 #include "ICAP/AsyncJob.h"
5 #include "adaptation/forward.h"
6
7 /*
8 * The ICAP Initiator is an ICAP vectoring point that initates ICAP
9 * transactions. This interface exists to allow ICAP transactions to
10 * signal their initiators that they have the answer from the ICAP server
11 * or that the ICAP query has aborted and there will be no answer. It
12 * is also handy for implementing common initiator actions such as starting
13 * or aborting an ICAP transaction.
14 */
15
16 class HttpMsg;
17
18 namespace Adaptation
19 {
20
21 class Initiator: virtual public AsyncJob
22 {
23 public:
24 Initiator(): AsyncJob("Initiator") {}
25 virtual ~Initiator() {}
26
27 // called when ICAP response headers are successfully interpreted
28 virtual void noteAdaptationAnswer(HttpMsg *message) = 0;
29
30 // called when valid ICAP response headers are no longer expected
31 // the final parameter is set to disable bypass or retries
32 virtual void noteAdaptationQueryAbort(bool final) = 0;
33
34 protected:
35 Initiate *initiateAdaptation(Initiate *x); // locks and returns x
36
37 // done with x (and not calling announceInitiatorAbort)
38 void clearAdaptation(Initiate *&x); // unlocks x
39
40 // inform the transaction about abnormal termination and clear it
41 void announceInitiatorAbort(Initiate *&x); // unlocks x
42 };
43
44 } // namespace Adaptation
45
46 #endif /* SQUID_ADAPTATION__INITIATOR_H */