Kea 2.7.4
cmd_response_creator.h
Go to the documentation of this file.
1// Copyright (C) 2021-2022 Internet Systems Consortium, Inc. ("ISC")
2//
3// This Source Code Form is subject to the terms of the Mozilla Public
4// License, v. 2.0. If a copy of the MPL was not distributed with this
5// file, You can obtain one at http://mozilla.org/MPL/2.0/.
6
7#ifndef CMD__RESPONSE_CREATOR_H
8#define CMD__RESPONSE_CREATOR_H
9
12#include <boost/shared_ptr.hpp>
13#include <unordered_set>
14
15namespace isc {
16namespace config {
17
33public:
34
40 CmdResponseCreator(bool emulate_agent_response = true)
41 : emulate_agent_response_(emulate_agent_response) {};
42
51
60 const http::HttpStatusCode& status_code) const;
61
66 return (emulate_agent_response_);
67 }
68
79 const data::ConstElementPtr& body,
80 const std::unordered_set<std::string>& accept);
81
90
94 static std::unordered_set<std::string> command_accept_list_;
95
96private:
97
109 createStockHttpResponseInternal(const http::HttpRequestPtr& request,
110 const http::HttpStatusCode& status_code) const;
111
117 createDynamicHttpResponse(http::HttpRequestPtr request);
118
123 bool emulate_agent_response_;
124};
125
127typedef boost::shared_ptr<CmdResponseCreator> CmdResponseCreatorPtr;
128
129} // end of namespace isc::config
130} // end of namespace isc
131
132#endif
Concrete implementation of the HTTP response creator used for processing API commands.
http::HttpResponseJsonPtr filterCommand(const http::HttpRequestPtr &request, const data::ConstElementPtr &body, const std::unordered_set< std::string > &accept)
Filter commands.
static http::HttpAuthConfigPtr http_auth_config_
The server current authentication configuration.
CmdResponseCreator(bool emulate_agent_response=true)
Constructor.
virtual http::HttpResponsePtr createStockHttpResponse(const http::HttpRequestPtr &request, const http::HttpStatusCode &status_code) const
Creates stock HTTP response.
virtual http::HttpRequestPtr createNewHttpRequest() const
Create a new request.
bool emulateAgentResponse()
Indicates whether or not agent response emulation is enabled.
static std::unordered_set< std::string > command_accept_list_
The server command accept list.
Specifies an interface for classes creating HTTP responses from HTTP requests.
boost::shared_ptr< CmdResponseCreator > CmdResponseCreatorPtr
Pointer to the CmdResponseCreator.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
HttpStatusCode
HTTP status codes (cf RFC 2068)
Definition response.h:30
boost::shared_ptr< HttpAuthConfig > HttpAuthConfigPtr
Type of shared pointers to HTTP authentication configuration.
Definition auth_config.h:97
boost::shared_ptr< HttpResponseJson > HttpResponseJsonPtr
Pointer to the HttpResponseJson object.
boost::shared_ptr< HttpResponse > HttpResponsePtr
Pointer to the HttpResponse object.
Definition response.h:81
boost::shared_ptr< HttpRequest > HttpRequestPtr
Pointer to the HttpRequest object.
Definition request.h:30
Defines the logger used by the top-level component of kea-lfc.