Kea 3.3.1
cmd_response_creator.h
Go to the documentation of this file.
1// Copyright (C) 2021-2026 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 std::unordered_set<std::string> command_accept_list) :
41 http::HttpResponseCreator(), http_auth_config_(http_auth_config),
42 command_accept_list_(command_accept_list) {
43 }
44
46 virtual ~CmdResponseCreator() = default;
47
56
65 const http::HttpStatusCode& status_code) const;
66
77 const data::ConstElementPtr& body,
78 const std::unordered_set<std::string>& accept);
79
82
87 return (http_auth_config_);
88 }
89
93 std::unordered_set<std::string> getCommandAcceptList() const {
94 return (command_accept_list_);
95 }
96
97private:
98
110 createStockHttpResponseInternal(const http::HttpRequestPtr& request,
111 const http::HttpStatusCode& status_code) const;
112
118 createDynamicHttpResponse(http::HttpRequestPtr request);
119
121 http::HttpAuthConfigPtr http_auth_config_;
122
124 std::unordered_set<std::string> command_accept_list_;
125};
126
128typedef boost::shared_ptr<CmdResponseCreator> CmdResponseCreatorPtr;
129
130} // end of namespace isc::config
131} // end of namespace isc
132
133#endif
http::HttpResponseJsonPtr filterCommand(const http::HttpRequestPtr &request, const data::ConstElementPtr &body, const std::unordered_set< std::string > &accept)
Filter commands.
std::unordered_set< std::string > getCommandAcceptList() const
Fetches the command accept list.
virtual http::HttpResponsePtr createStockHttpResponse(const http::HttpRequestPtr &request, const http::HttpStatusCode &status_code) const
Creates stock HTTP response.
virtual ~CmdResponseCreator()=default
virtual destructor.
CmdResponseCreator(http::HttpAuthConfigPtr http_auth_config, std::unordered_set< std::string > command_accept_list)
Constructor.
static bool EMULATE_AGENT_RESPONSE
The emulate agent response flag.
virtual http::HttpRequestPtr createNewHttpRequest() const
Create a new request.
http::HttpAuthConfigPtr getAuthConfig() const
Fetches the authentication configuration.
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:30
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.