]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Support upcoming "fresh message creation" eCAP API.
authorAlex Rousskov <rousskov@measurement-factory.com>
Tue, 7 Dec 2010 19:10:11 +0000 (12:10 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Tue, 7 Dec 2010 19:10:11 +0000 (12:10 -0700)
Adapters need "fresh" (i.e., empty and not cloned) messages to support
"request satisfaction" mode and other cases where cloning a virgin message is
not possible or is awkward because the adapted message is not an adjusted
version of the virgin one.

src/adaptation/ecap/Host.cc
src/adaptation/ecap/Host.h

index 9efe3ba05cedf44f9466d8856f0d1d61ae616ad5..830ab457a16418892761c6ee83df27ddf4134af5 100644 (file)
@@ -8,6 +8,9 @@
 #include "base/TextException.h"
 #include "adaptation/ecap/ServiceRep.h"
 #include "adaptation/ecap/Host.h"
+#include "adaptation/ecap/MessageRep.h"
+#include "HttpRequest.h"
+#include "HttpReply.h"
 
 const libecap::Name Adaptation::Ecap::protocolInternal("internal", libecap::Name::NextId());
 const libecap::Name Adaptation::Ecap::protocolCacheObj("cache_object", libecap::Name::NextId());
@@ -94,6 +97,19 @@ Adaptation::Ecap::Host::closeDebug(std::ostream *debug)
         Debug::finishDebug();
 }
 
+
+Adaptation::Ecap::Host::MessagePtr
+Adaptation::Ecap::Host::newRequest() const
+{
+    return MessagePtr(new Adaptation::Ecap::MessageRep(new HttpRequest));
+}
+
+Adaptation::Ecap::Host::MessagePtr
+Adaptation::Ecap::Host::newResponse() const
+{
+    return MessagePtr(new Adaptation::Ecap::MessageRep(new HttpReply));
+}
+
 void
 Adaptation::Ecap::Host::Register()
 {
index 8d5f32fa02cbbda221cd177e8ed1d9a5f587a052..6ec696b9075005143a010fd6880c00b3c8672103 100644 (file)
@@ -28,6 +28,11 @@ public:
     virtual std::ostream *openDebug(libecap::LogVerbosity lv);
     virtual void closeDebug(std::ostream *debug);
 
+    // Message creation
+    typedef libecap::shared_ptr<libecap::Message> MessagePtr;
+    virtual MessagePtr newRequest() const;
+    virtual MessagePtr newResponse() const;
+
     static void Register(); ///< register adaptation host
 
 private: