Kea  1.9.9-git
isc::config::CmdResponseCreator Class Reference

Concrete implementation of the HTTP response creator used for processing API commands. More...

#include <cmd_response_creator.h>

+ Inheritance diagram for isc::config::CmdResponseCreator:

Public Member Functions

 CmdResponseCreator (bool emulate_agent_response=true)
 Constructor. More...
 
virtual http::HttpRequestPtr createNewHttpRequest () const
 Create a new request. More...
 
virtual http::HttpResponsePtr createStockHttpResponse (const http::HttpRequestPtr &request, const http::HttpStatusCode &status_code) const
 Creates stock HTTP response. More...
 
bool emulateAgentResponse ()
 Indicates whether or not agent response emulation is enabled. More...
 
const http::HttpAuthConfigPtrgetHttpAuthConfig ()
 Fetches the current authentication configuration. More...
 
- Public Member Functions inherited from isc::http::HttpResponseCreator
virtual ~HttpResponseCreator ()
 Destructor. More...
 
virtual HttpResponsePtr createHttpResponse (HttpRequestPtr request) final
 Create HTTP response from HTTP request received. More...
 

Additional Inherited Members

Detailed Description

Concrete implementation of the HTTP response creator used for processing API commands.

See the documentation of the isc::http::HttpResponseCreator for the basic information how HTTP response creators are utilized by the libkea-http library to generate HTTP responses.

This creator expects that received requests are encapsulated in the isc::http::PostHttpRequestJson objects. The generated responses are encapsulated in the HttpResponseJson objects.

This class uses CommandMgr singleton to process commands conveyed in the HTTP body. The JSON responses returned by the manager are placed in the body of the generated HTTP responses.

Definition at line 31 of file cmd_response_creator.h.

Constructor & Destructor Documentation

isc::config::CmdResponseCreator::CmdResponseCreator ( bool  emulate_agent_response = true)
inline

Constructor.

Parameters
emulate_agent_responseif true, responses for normal command outcomes are guaranteed to be wrapped in an Element::list. This emulates how kea-ctrl-agent forms responses. Defaults to true.

Definition at line 39 of file cmd_response_creator.h.

Member Function Documentation

HttpRequestPtr isc::config::CmdResponseCreator::createNewHttpRequest ( ) const
virtual

Create a new request.

This method creates a bare instance of the isc::http::PostHttpRequestJson.

Returns
Pointer to the new instance of the isc::http::PostHttpRequestJson.

Implements isc::http::HttpResponseCreator.

Definition at line 24 of file cmd_response_creator.cc.

HttpResponsePtr isc::config::CmdResponseCreator::createStockHttpResponse ( const http::HttpRequestPtr request,
const http::HttpStatusCode status_code 
) const
virtual

Creates stock HTTP response.

Parameters
requestPointer to an object representing HTTP request.
status_codeStatus code of the response.
Returns
Pointer to an isc::http::HttpResponseJson object representing stock HTTP response.

Implements isc::http::HttpResponseCreator.

Definition at line 30 of file cmd_response_creator.cc.

bool isc::config::CmdResponseCreator::emulateAgentResponse ( )
inline

Indicates whether or not agent response emulation is enabled.

Returns
true if emulation is enabled.

Definition at line 77 of file cmd_response_creator.h.

const http::HttpAuthConfigPtr& isc::config::CmdResponseCreator::getHttpAuthConfig ( )
inline

Fetches the current authentication configuration.

Todo:
The constructor will have to accept either a pointer to the authorization config to use, or a pointer to a function to return the authorization config. For now we just return an empty pointer.
Returns
an empty HttpAuthConfigPtr.

Definition at line 69 of file cmd_response_creator.h.


The documentation for this class was generated from the following files: