Initiator.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2025 The Squid Software Foundation and contributors
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 
9 #ifndef SQUID_SRC_ADAPTATION_INITIATOR_H
10 #define SQUID_SRC_ADAPTATION_INITIATOR_H
11 
12 #include "adaptation/forward.h"
13 #include "base/AsyncJob.h"
14 #include "base/CbcPointer.h"
15 
16 /*
17  * The ICAP Initiator is an ICAP vectoring point that initates ICAP
18  * transactions. This interface exists to allow ICAP transactions to
19  * signal their initiators that they have the answer from the ICAP server
20  * or that the ICAP query has aborted and there will be no answer. It
21  * is also handy for implementing common initiator actions such as starting
22  * or aborting an ICAP transaction.
23  */
24 
25 namespace Adaptation
26 {
27 
28 class Initiator: virtual public AsyncJob
29 {
30 public:
31  Initiator(): AsyncJob("Initiator") {}
32  ~Initiator() override {}
33 
39  virtual void noteAdaptationAnswer(const Answer &answer) = 0;
40 
41 protected:
44 
47 
50 
52  bool initiated(const CbcPointer<AsyncJob> &job) const { return job.set(); }
53 };
54 
55 } // namespace Adaptation
56 
57 #endif /* SQUID_SRC_ADAPTATION_INITIATOR_H */
58 
bool initiated(const CbcPointer< AsyncJob > &job) const
Must(initiated(initiate)) instead of Must(initiate.set()), for clarity.
Definition: Initiator.h:52
CbcPointer< Initiate > initiateAdaptation(Initiate *x)
< starts freshly created initiate and returns a safe pointer to it
Definition: Initiator.cc:23
virtual void noteAdaptationAnswer(const Answer &answer)=0
void clearAdaptation(CbcPointer< Initiate > &x)
clears the pointer (does not call announceInitiatorAbort)
Definition: Initiator.cc:32
~Initiator() override
Definition: Initiator.h:32
summarizes adaptation service answer for the noteAdaptationAnswer() API
Definition: Answer.h:24
void announceInitiatorAbort(CbcPointer< Initiate > &x)
inform the transaction about abnormal termination and clear the pointer
Definition: Initiator.cc:38
virtual void noteAdaptationAclCheckDone(Adaptation::ServiceGroupPointer group)
Definition: Initiator.cc:17

 

Introduction

Documentation

Support

Miscellaneous