]>
Commit | Line | Data |
---|---|---|
bbc27441 | 1 | /* |
4ac4a490 | 2 | * Copyright (C) 1996-2017 The Squid Software Foundation and contributors |
bbc27441 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
2e4a5466 AR |
9 | #ifndef SQUID_ADAPTATION__INITIATE_H |
10 | #define SQUID_ADAPTATION__INITIATE_H | |
11 | ||
602d9612 | 12 | #include "adaptation/forward.h" |
d1e045c3 | 13 | #include "base/AsyncJob.h" |
4299f876 | 14 | #include "base/CbcPointer.h" |
2e4a5466 | 15 | |
26ac0430 AJ |
16 | namespace Adaptation |
17 | { | |
2e4a5466 | 18 | |
2e4a5466 AR |
19 | /* |
20 | * The Initiate is a common base for queries or transactions | |
26ac0430 | 21 | * initiated by an Initiator. This interface exists to allow an |
2e4a5466 AR |
22 | * initiator to signal its "initiatees" that it is aborting and no longer |
23 | * expecting an answer. The class is also handy for implementing common | |
24 | * initiate actions such as maintaining and notifying the initiator. | |
25 | * | |
26 | * Initiate implementations must cbdata-protect themselves. | |
27 | * | |
28 | * This class could have been named Initiatee. | |
29 | */ | |
30 | class Initiate: virtual public AsyncJob | |
31 | { | |
32 | ||
33 | public: | |
4299f876 | 34 | Initiate(const char *aTypeName); |
2e4a5466 AR |
35 | virtual ~Initiate(); |
36 | ||
4299f876 AR |
37 | void initiator(const CbcPointer<Initiator> &i); ///< sets initiator |
38 | ||
2e4a5466 AR |
39 | // communication with the initiator |
40 | virtual void noteInitiatorAborted() = 0; | |
41 | ||
42 | protected: | |
3af10ac0 | 43 | void sendAnswer(const Answer &answer); // send to the initiator |
2e4a5466 AR |
44 | void tellQueryAborted(bool final); // tell initiator |
45 | void clearInitiator(); // used by noteInitiatorAborted; TODO: make private | |
46 | ||
47 | virtual void swanSong(); // internal cleanup | |
48 | ||
49 | virtual const char *status() const; // for debugging | |
50 | ||
4299f876 | 51 | CbcPointer<Initiator> theInitiator; |
3ff65596 AR |
52 | |
53 | private: | |
54 | Initiate(const Initiate &); // no definition | |
55 | Initiate &operator =(const Initiate &); // no definition | |
2e4a5466 AR |
56 | }; |
57 | ||
58 | } // namespace Adaptation | |
59 | ||
60 | #endif /* SQUID_ADAPTATION__INITIATE_H */ | |
f53969cc | 61 |