15#include <boost/pointer_cast.hpp>
39 HttpResponsePtr response = createStockHttpResponseInternal(request, status_code);
52 HttpVersion http_version(request->context()->http_version_major_,
53 request->context()->http_version_minor_);
57 http_version.major_ = 1;
58 http_version.minor_ = 0;
66CmdResponseCreator::createDynamicHttpResponse(
HttpRequestPtr request) {
73 return (http_response);
97 return (http_response);
116 response_list->add(boost::const_pointer_cast<Element>(response));
117 response = response_list;
121 http_response = boost::dynamic_pointer_cast<
122 HttpResponseJson>(createStockHttpResponseInternal(request, HttpStatusCode::OK));
124 http_response->finalize();
126 return (http_response);
132 const unordered_set<string>& accept) {
134 if (!body || accept.empty()) {
144 string command = elem->stringValue();
145 if (command.empty() || accept.count(command)) {
153 .arg(request->getRemote());
155 HttpVersion http_version(request->context()->http_version_major_,
156 request->context()->http_version_minor_);
159 http_version.major_ = 1;
160 http_version.minor_ = 0;
170 response->setBodyAsJson(response_body);
171 response->finalize();
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.
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.
static CommandMgr & instance()
CommandMgr is a singleton class.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
Represents HTTP response with JSON content.
void setBodyAsJson(const data::ConstElementPtr &json_body)
Generates JSON content from the data structures represented as data::ConstElementPtr.
static uint16_t statusCodeToNumber(const HttpStatusCode &status_code)
Convenience method converting status code to numeric value.
static std::string statusCodeToString(const HttpStatusCode &status_code)
Converts status code to string.
Represents HTTP POST request with JSON body.
data::ConstElementPtr getBodyAsJson() const
Retrieves JSON body.
This file contains several functions and constants that are used for handling commands and responses ...
#define LOG_DEBUG(LOGGER, LEVEL, MESSAGE)
Macro to conveniently test debug output and log it.
const char * CONTROL_TEXT
String used for storing textual description ("text")
const char * CONTROL_COMMAND
String used for commands ("command")
const isc::log::MessageID COMMAND_HTTP_LISTENER_COMMAND_REJECTED
const char * CONTROL_RESULT
String used for result, i.e. integer status ("result")
isc::log::Logger command_logger("commands")
Command processing Logger.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
HttpStatusCode
HTTP status codes (cf RFC 2068)
boost::shared_ptr< PostHttpRequestJson > PostHttpRequestJsonPtr
Pointer to PostHttpRequestJson.
boost::shared_ptr< HttpAuthConfig > HttpAuthConfigPtr
Type of shared pointers to HTTP authentication configuration.
boost::shared_ptr< HttpResponseJson > HttpResponseJsonPtr
Pointer to the HttpResponseJson object.
boost::shared_ptr< HttpResponse > HttpResponsePtr
Pointer to the HttpResponse object.
boost::shared_ptr< HttpRequest > HttpRequestPtr
Pointer to the HttpRequest object.
Defines the logger used by the top-level component of kea-lfc.