]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceFormat: Moved Adaptation::Answer class to its dedicated source files.
authorAlex Rousskov <rousskov@measurement-factory.com>
Fri, 11 Mar 2011 23:02:23 +0000 (16:02 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Fri, 11 Mar 2011 23:02:23 +0000 (16:02 -0700)
16 files changed:
src/Server.cc
src/Server.h
src/adaptation/Answer.cc [new file with mode: 0644]
src/adaptation/Answer.h [new file with mode: 0644]
src/adaptation/Initiate.cc
src/adaptation/Initiator.cc
src/adaptation/Initiator.h
src/adaptation/Iterator.cc
src/adaptation/Iterator.h
src/adaptation/Makefile.am
src/adaptation/ecap/XactionRep.cc
src/adaptation/icap/Launcher.cc
src/adaptation/icap/ModXact.cc
src/adaptation/icap/OptXact.cc
src/adaptation/icap/ServiceRep.cc
src/client_side_request.cc

index 66fd66ceb62b661e6c815fe8c75be657da54674f..63292c70ad2cd6d566a88b69bfd2928160fcd712 100644 (file)
@@ -47,6 +47,7 @@
 
 #if USE_ADAPTATION
 #include "adaptation/AccessCheck.h"
+#include "adaptation/Answer.h"
 #include "adaptation/Iterator.h"
 #endif
 
index 1ec7acfd2dd021653920af86a02e278310993c83..c6b9b5c2df22e5e74fd4c5c38a0ac113a56b9957 100644 (file)
@@ -45,6 +45,8 @@
 #include "adaptation/Initiator.h"
 #endif
 
+class HttpMsg;
+
 /**
  * ServerStateData is a common base for server-side classes such as
  * HttpStateData and FtpStateData. All such classes must be able to
diff --git a/src/adaptation/Answer.cc b/src/adaptation/Answer.cc
new file mode 100644 (file)
index 0000000..dc3daac
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * DEBUG: section 93    ICAP (RFC 3507) Client
+ */
+
+#include "config.h"
+#include "adaptation/Answer.h"
+#include "base/AsyncJobCalls.h"
+
+Adaptation::Answer
+Adaptation::Answer::Error(bool final)
+{
+    Answer answer(akError);
+    answer.final = final;
+    debugs(93, 4, HERE << "error: " << final);
+    return answer;
+}
+
+Adaptation::Answer
+Adaptation::Answer::Forward(HttpMsg *aMsg)
+{
+    Answer answer(akForward);
+    answer.message = aMsg;
+    debugs(93, 4, HERE << "forwarding: " << (void*)aMsg);
+    return answer;
+}
+
+
+Adaptation::Answer
+Adaptation::Answer::Block(const String &aRule)
+{
+    Answer answer(akBlock);
+    answer.ruleId = aRule;
+    debugs(93, 4, HERE << "blocking rule: " << aRule);
+    return answer;
+}
+
+std::ostream &
+Adaptation::Answer::print(std::ostream &os) const
+{
+    return os << kind; // TODO: add more details
+}
+
+Adaptation::Answer::Answer(Kind aKind): final(true), kind(aKind)
+{
+}
diff --git a/src/adaptation/Answer.h b/src/adaptation/Answer.h
new file mode 100644 (file)
index 0000000..cf7f71c
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef SQUID_ADAPTATION__ANSWER_H
+#define SQUID_ADAPTATION__ANSWER_H
+
+#include "adaptation/forward.h"
+#include "HttpMsg.h"
+
+#include <iosfwd>
+
+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);
+}
+
+} // namespace Adaptation
+
+#endif /* SQUID_ADAPTATION__ANSWER_H */
index 7a0c3594ae337e60b7091bd832bb8e3b2e1bc8a5..84a760f0424b06a8e615df7531408b4fd62fdab8 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "squid.h"
 #include "HttpMsg.h"
+#include "adaptation/Answer.h"
 #include "adaptation/Initiator.h"
 #include "adaptation/Initiate.h"
 #include "base/AsyncJobCalls.h"
index 72805aee69cbf1c8fe10f8e5bc61fed7e9408bea..f72e69f8ea6f50cfe14540f46f6bb5042c3c6346 100644 (file)
@@ -28,46 +28,3 @@ Adaptation::Initiator::announceInitiatorAbort(CbcPointer<Initiate> &x)
     CallJobHere(93, 5, x, Initiate, noteInitiatorAborted);
     clearAdaptation(x);
 }
-
-
-/* Adaptation::Answer */
-
-// TODO: Move to src/adaptation/Answer.*
-
-Adaptation::Answer
-Adaptation::Answer::Error(bool final)
-{
-    Answer answer(akError);
-    answer.final = final;
-    debugs(93, 4, HERE << "error: " << final);
-    return answer;
-}
-
-Adaptation::Answer
-Adaptation::Answer::Forward(HttpMsg *aMsg)
-{
-    Answer answer(akForward);
-    answer.message = aMsg;
-    debugs(93, 4, HERE << "forwarding: " << (void*)aMsg);
-    return answer;
-}
-
-
-Adaptation::Answer
-Adaptation::Answer::Block(const String &aRule)
-{
-    Answer answer(akBlock);
-    answer.ruleId = aRule;
-    debugs(93, 4, HERE << "blocking rule: " << aRule);
-    return answer;
-}
-
-std::ostream &
-Adaptation::Answer::print(std::ostream &os) const
-{
-    return os << kind; // TODO: add more details
-}
-
-Adaptation::Answer::Answer(Kind aKind): final(true), kind(aKind)
-{
-}
index 912f570897c979194bda454a555865ca4b6a88f7..59b817a3f80ae7928e1c111f4a1cefa6b7d2b1a5 100644 (file)
@@ -1,12 +1,9 @@
 #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:
index 6982594348e64507b33bdeaf23345f1850b9e12a..4ca0301e4ffa9b733319fcd7bd9124fc3061361f 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include "squid.h"
+#include "adaptation/Answer.h"
 #include "adaptation/Config.h"
 #include "adaptation/Iterator.h"
 #include "adaptation/Service.h"
index 586532ac6eb82472b8b091cd290e2a180db485c8..c980edcf6d44dee80c900b4ae10b0b5257bb006f 100644 (file)
@@ -5,6 +5,9 @@
 #include "adaptation/Initiate.h"
 #include "adaptation/ServiceGroups.h"
 
+class HttpMsg;
+class HttpRequest;
+
 namespace Adaptation
 {
 
index b9466de778053c95a6d6b4c3412941ae7cd46f3e..03f2facbc3ac5b031b35df98205dd935bb522461 100644 (file)
@@ -20,6 +20,8 @@ libadaptation_la_SOURCES = \
        AccessCheck.h \
        AccessRule.cc \
        AccessRule.h \
+       Answer.cc \
+       Answer.h \
        Config.cc \
        Config.h \
        Elements.cc \
index 8349a2d6d3fc7c4902105782e5fad2f745ff4827..f2a97267e2dd51e8a47a0c906fb2c4675e10593a 100644 (file)
@@ -10,6 +10,7 @@
 #include "HttpRequest.h"
 #include "HttpReply.h"
 #include "SquidTime.h"
+#include "adaptation/Answer.h"
 #include "adaptation/ecap/XactionRep.h"
 #include "adaptation/ecap/Config.h"
 #include "adaptation/Initiator.h"
index 9ee142a08e0fd62cecb83663dbd64d79ec9f3052..18a094edb51ef44ad13b586c78530551498f2031 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "squid.h"
 #include "acl/FilledChecklist.h"
+#include "adaptation/Answer.h"
 #include "adaptation/icap/Launcher.h"
 #include "adaptation/icap/Xaction.h"
 #include "adaptation/icap/ServiceRep.h"
index ce4615e7fe46d989403d7205d6fc04d64abcac99..c2f11a2b25634d2b68dfcf811cae47ca3c40edc6 100644 (file)
@@ -4,6 +4,7 @@
 
 #include "squid.h"
 #include "AccessLogEntry.h"
+#include "adaptation/Answer.h"
 #include "adaptation/History.h"
 #include "adaptation/icap/Client.h"
 #include "adaptation/icap/Config.h"
index 22971dc934a2f336a99e675c07412770c6c3e138..174feeb0c4698a8bd1823f5da0e106b838fb701f 100644 (file)
@@ -6,6 +6,7 @@
 #include "comm.h"
 #include "HttpReply.h"
 
+#include "adaptation/Answer.h"
 #include "adaptation/icap/OptXact.h"
 #include "adaptation/icap/Options.h"
 #include "adaptation/icap/Config.h"
index a3faa9a2b19c1209e64b5ad6c19e4b275fe64be5..9d2f90f7434f535356f379420f1c4103bd0b7978 100644 (file)
@@ -3,6 +3,7 @@
  */
 
 #include "squid.h"
+#include "adaptation/Answer.h"
 #include "adaptation/icap/Config.h"
 #include "adaptation/icap/ModXact.h"
 #include "adaptation/icap/Options.h"
index e5110981bc16b47e47777ebf752a8eabc02ac144..60290aec56dcb5433ecdbbdc7e80de798d0a21a3 100644 (file)
@@ -47,6 +47,7 @@
 #include "acl/Gadgets.h"
 #if USE_ADAPTATION
 #include "adaptation/AccessCheck.h"
+#include "adaptation/Answer.h"
 #include "adaptation/Iterator.h"
 #include "adaptation/Service.h"
 #if ICAP_CLIENT