]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Initiator.h
Merge from trunk
[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 class Initiator: virtual public AsyncJob
21 {
22 public:
23 Initiator(): AsyncJob("Initiator") {}
24 virtual ~Initiator() {}
25
26 // called when ICAP response headers are successfully interpreted
27 virtual void noteAdaptationAnswer(HttpMsg *message) = 0;
28
29 // called when valid ICAP response headers are no longer expected
30 // the final parameter is set to disable bypass or retries
31 virtual void noteAdaptationQueryAbort(bool final) = 0;
32
33 protected:
34 Initiate *initiateAdaptation(Initiate *x); // locks and returns x
35
36 // done with x (and not calling announceInitiatorAbort)
37 void clearAdaptation(Initiate *&x); // unlocks x
38
39 // inform the transaction about abnormal termination and clear it
40 void announceInitiatorAbort(Initiate *&x); // unlocks x
41 };
42
43 } // namespace Adaptation
44
45 #endif /* SQUID_ADAPTATION__INITIATOR_H */