Parcourir la source

[5088] Created HttpResponseCreator interface.

Marcin Siodelski il y a 8 ans
Parent
commit
616dab184b

+ 1 - 0
src/lib/http/Makefile.am

@@ -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
 
 

+ 9 - 0
src/lib/http/request.h

@@ -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

+ 9 - 0
src/lib/http/response.h

@@ -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:
 

+ 28 - 0
src/lib/http/response_creator.h

@@ -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