]> git.ipfire.org Git - thirdparty/squid.git/blobdiff - src/adaptation/ecap/MessageRep.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / adaptation / ecap / MessageRep.h
index adf62b9248419489272b62bfcf0b4838b030e963..5e9579e63b0a5f7fd9c0e72cbb5453f10639b63c 100644 (file)
@@ -1,16 +1,21 @@
-
 /*
- * $Id$
+ * Copyright (C) 1996-2017 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.
  */
 
+/* DEBUG: section 93    eCAP Interface */
+
 #ifndef SQUID__ECAP__MESSAGE_REP_H
 #define SQUID__ECAP__MESSAGE_REP_H
 
-#include "config.h"
-#include "HttpHeader.h"
-#include "BodyPipe.h"
 #include "adaptation/forward.h"
 #include "adaptation/Message.h"
+#include "anyp/ProtocolType.h"
+#include "BodyPipe.h"
+#include "HttpHeader.h"
 #include <libecap/common/message.h>
 #include <libecap/common/header.h>
 #include <libecap/common/body.h>
@@ -19,6 +24,8 @@ class HttpMsg;
 class HttpRequest;
 class HttpReply;
 
+namespace Adaptation
+{
 namespace Ecap
 {
 
@@ -34,24 +41,23 @@ public:
 public:
     HeaderRep(HttpMsg &aMessage);
 
+    /* libecap::Header API */
     virtual bool hasAny(const Name &name) const;
     virtual Value value(const Name &name) const;
-
     virtual void add(const Name &name, const Value &value);
     virtual void removeAny(const Name &name);
-
+    virtual void visitEach(libecap::NamedValueVisitor &visitor) const;
     virtual Area image() const;
     virtual void parse(const Area &buf); // throws on failures
 
 protected:
-    static http_hdr_type TranslateHeaderId(const Name &name);
+    static Http::HdrType TranslateHeaderId(const Name &name);
 
 private:
     HttpHeader &theHeader; // the header being translated to libecap
     HttpMsg &theMessage;   // the message being translated to libecap
 };
 
-
 // Helps translate Squid HttpMsg into libecap::FirstLine (see children).
 class FirstLineRep
 {
@@ -67,7 +73,7 @@ public:
     void protocol(const Name &aProtocol);
 
 protected:
-    static protocol_t TranslateProtocolId(const Name &name);
+    static AnyP::ProtocolType TranslateProtocolId(const Name &name);
 
 private:
     HttpMsg &theMessage; // the message which first line is being translated
@@ -83,12 +89,11 @@ public:
 public:
     RequestLineRep(HttpRequest &aMessage);
 
+    /* libecap::RequestLine API */
     virtual void uri(const Area &aUri);
     virtual Area uri() const;
-
     virtual void method(const Name &aMethod);
     virtual Name method() const;
-
     virtual libecap::Version version() const;
     virtual void version(const libecap::Version &aVersion);
     virtual Name protocol() const;
@@ -108,12 +113,11 @@ public:
 public:
     StatusLineRep(HttpReply &aMessage);
 
+    /* libecap::StatusLine API */
     virtual void statusCode(int code);
     virtual int statusCode() const;
-
     virtual void reasonPhrase(const Area &phrase);
     virtual Area reasonPhrase() const;
-
     virtual libecap::Version version() const;
     virtual void version(const libecap::Version &aVersion);
     virtual Name protocol() const;
@@ -123,7 +127,6 @@ private:
     HttpReply &theMessage; // the request header being translated to libecap
 };
 
-
 // Translates Squid BodyPipe into libecap::Body.
 class BodyRep: public libecap::Body
 {
@@ -149,17 +152,16 @@ public:
     explicit MessageRep(HttpMsg *rawHeader);
     virtual ~MessageRep();
 
+    /* libecap::Message API */
     virtual libecap::shared_ptr<libecap::Message> clone() const;
-
     virtual libecap::FirstLine &firstLine();
     virtual const libecap::FirstLine &firstLine() const;
-
     virtual libecap::Header &header();
     virtual const libecap::Header &header() const;
-
     virtual void addBody();
     virtual libecap::Body *body();
     virtual const libecap::Body *body() const;
+
     void tieBody(Ecap::XactionRep *x); // to a specific transaction
 
     Adaptation::Message &raw() { return theMessage; } // for host access
@@ -172,6 +174,8 @@ private:
     BodyRep *theBodyRep; // body wrapper
 };
 
-} // namespace Ecap;
+} // namespace Ecap
+} // namespace Adaptation
 
 #endif /* SQUID__E_CAP__MESSAGE_REP_H */
+