]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/adaptation/Initiator.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / adaptation / Initiator.h
index a17c5cdf42f1dea8a8d7514744fdfeab6d09f228..fa9d8949235ca0f2f8fe70e21ee180757bb6e828 100644 (file)
@@ -1,12 +1,17 @@
+/*
+ * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
 #ifndef SQUID_ADAPTATION__INITIATOR_H
 #define SQUID_ADAPTATION__INITIATOR_H
 
+#include "adaptation/forward.h"
 #include "base/AsyncJob.h"
 #include "base/CbcPointer.h"
-#include "adaptation/forward.h"
-#include "HttpMsg.h"
-
-#include <iosfwd>
 
 /*
  * The ICAP Initiator is an ICAP vectoring point that initates ICAP
 namespace Adaptation
 {
 
-/// summarizes adaptation service answer for the noteAdaptationAnswer() API
-class Answer {
-public:
-    /// helps interpret other members without a class hierarchy
-    typedef enum {
-        akForward, ///< forward the supplied adapted HTTP message
-        akBlock, ///< block or deny the master xaction; see authority
-        akError, ///< no adapted message will come; see bypassable
-    } Kind;
-
-    static Answer Error(bool final); ///< create an akError answer
-    static Answer Forward(HttpMsg *aMsg); ///< create an akForward answer
-    static Answer Block(const String &aRule); ///< create an akBlock answer
-
-    std::ostream &print(std::ostream &os) const;
-
-public:
-    HttpMsgPointerT<HttpMsg> message; ///< HTTP request or response to forward
-    String ruleId; ///< ACL (or similar rule) name that blocked forwarding
-    bool final; ///< whether the error, if any, cannot be bypassed
-    Kind kind; ///< the type of the answer
-
-private:
-    explicit Answer(Kind aKind); ///< use static creators instead
-};
-
-inline
-std::ostream &operator <<(std::ostream &os, const Answer &answer)
-{
-    return answer.print(os);
-}
-
 class Initiator: virtual public AsyncJob
 {
 public:
     Initiator(): AsyncJob("Initiator") {}
     virtual ~Initiator() {}
 
+    /// AccessCheck calls this back with a possibly nil service group
+    /// to signal whether adaptation is needed and where it should start.
+    virtual void noteAdaptationAclCheckDone(Adaptation::ServiceGroupPointer group);
     /// called with the initial adaptation decision (adapt, block, error);
     /// virgin and/or adapted body transmission may continue after this
     virtual void noteAdaptationAnswer(const Answer &answer) = 0;
@@ -79,3 +55,4 @@ protected:
 } // namespace Adaptation
 
 #endif /* SQUID_ADAPTATION__INITIATOR_H */
+