]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5088] Created HttpResponseCreator interface.
authorMarcin Siodelski <marcin@isc.org>
Mon, 19 Dec 2016 14:55:35 +0000 (15:55 +0100)
committerMarcin Siodelski <marcin@isc.org>
Thu, 22 Dec 2016 13:56:10 +0000 (14:56 +0100)
src/lib/http/Makefile.am
src/lib/http/request.h
src/lib/http/response.h
src/lib/http/response_creator.h [new file with mode: 0644]

index d5439a8be93c10594ab418e26f8357c0ac8b5a45..90af21c9833168aac62ac857bf040eb1ce89ce85 100644 (file)
@@ -31,6 +31,7 @@ libkea_http_la_SOURCES += request.cc request.h
 libkea_http_la_SOURCES += request_context.h
 libkea_http_la_SOURCES += request_parser.cc request_parser.h
 libkea_http_la_SOURCES += response.cc response.h
+libkea_http_la_SOURCES += response_creator.h
 libkea_http_la_SOURCES += response_json.cc response_json.h
 
 
index e60e1e7314354b84e0c064bdf738595d1e71cec0..1ea843edf7d9e43b29754723f9b44149b285f8cd 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <exceptions/exceptions.h>
 #include <http/request_context.h>
+#include <boost/shared_ptr.hpp>
 #include <map>
 #include <set>
 #include <stdint.h>
@@ -34,6 +35,14 @@ public:
         HttpRequestError(file, line, what) { };
 };
 
+class HttpRequest;
+
+/// @brief Pointer to the @ref HttpRequest object.
+typedef boost::shared_ptr<HttpRequest> HttpRequestPtr;
+
+/// @brief Pointer to the const @ref HttpRequest object.
+typedef boost::shared_ptr<const HttpRequest> ConstHttpRequestPtr;
+
 /// @brief Represents HTTP request message.
 ///
 /// This object represents parsed HTTP message. The @ref HttpRequestContext
index 92942e4cf6735928a8f66a7d2fece193f10fedf3..73c6363510cc7e24f6eff0eb329b5cc875dddbd1 100644 (file)
@@ -10,6 +10,7 @@
 #include <exceptions/exceptions.h>
 #include <http/http_types.h>
 #include <boost/lexical_cast.hpp>
+#include <boost/shared_ptr.hpp>
 #include <cstdint>
 #include <map>
 #include <string>
@@ -43,6 +44,14 @@ enum class HttpStatusCode : std::uint16_t {
     SERVICE_UNAVAILABLE = 503
 };
 
+class HttpResponse;
+
+/// @brief Pointer to the @ref HttpResponse object.
+typedef boost::shared_ptr<HttpResponse> HttpResponsePtr;
+
+/// @brief Pointer to the const @ref HttpResponse object.
+typedef boost::shared_ptr<const HttpResponse> ConstHttpResponsePtr;
+
 class HttpResponse {
 public:
 
diff --git a/src/lib/http/response_creator.h b/src/lib/http/response_creator.h
new file mode 100644 (file)
index 0000000..2b83c58
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef HTTP_RESPONSE_CREATOR_H
+#define HTTP_RESPONSE_CREATOR_H
+
+#include <http/request.h>
+#include <http/response.h>
+
+namespace isc {
+namespace http {
+
+class HttpResponseCreator {
+public:
+
+    virtual ~HttpResponseCreator() { };
+
+    virtual HttpResponsePtr create(const ConstHttpRequestPtr& request) = 0;
+
+};
+
+} // namespace http
+} // namespace isc
+
+#endif