]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Initiate.h
2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
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.
9 #ifndef SQUID_ADAPTATION__INITIATE_H
10 #define SQUID_ADAPTATION__INITIATE_H
12 #include "adaptation/forward.h"
13 #include "base/AsyncJob.h"
14 #include "base/CbcPointer.h"
20 * The Initiate is a common base for queries or transactions
21 * initiated by an Initiator. This interface exists to allow an
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.
26 * Initiate implementations must cbdata-protect themselves.
28 * This class could have been named Initiatee.
30 class Initiate
: virtual public AsyncJob
34 Initiate(const char *aTypeName
);
37 void initiator(const CbcPointer
<Initiator
> &i
); ///< sets initiator
39 // communication with the initiator
40 virtual void noteInitiatorAborted() = 0;
43 void sendAnswer(const Answer
&answer
); // send to the initiator
44 void tellQueryAborted(bool final
); // tell initiator
45 void clearInitiator(); // used by noteInitiatorAborted; TODO: make private
47 virtual void swanSong(); // internal cleanup
49 virtual const char *status() const; // for debugging
51 CbcPointer
<Initiator
> theInitiator
;
54 Initiate(const Initiate
&); // no definition
55 Initiate
&operator =(const Initiate
&); // no definition
58 } // namespace Adaptation
60 #endif /* SQUID_ADAPTATION__INITIATE_H */