20#include <boost/pointer_cast.hpp>
30struct CtrlAgentHooks {
31 int hook_index_http_auth_;
32 int hook_index_http_response_;
61 HttpResponsePtr response = createStockHttpResponseInternal(request, status_code);
67CtrlAgentResponseCreator::
74 HttpVersion http_version(request->context()->http_version_major_,
75 request->context()->http_version_minor_);
79 http_version.major_ = 1;
80 http_version.minor_ = 0;
88CtrlAgentResponseCreator::
100 boost::shared_ptr<CtrlAgentController> controller =
107 ctx = cfgmgr->getCtrlAgentCfgContext();
112 http_response = auth->checkAuth(*
this, request);
120 bool reset_handle =
false;
127 callout_handle->setArgument(
"request", request);
128 callout_handle->setArgument(
"response", http_response);
133 callout_handle->getArgument(
"request", request);
134 callout_handle->getArgument(
"response", http_response);
145 return (http_response);
150 request->resetCalloutHandle();
160 boost::dynamic_pointer_cast<PostHttpRequestJson>(request);
179 http_response = boost::dynamic_pointer_cast<
180 HttpResponseJson>(createStockHttpResponseInternal(request, HttpStatusCode::OK));
182 http_response->finalize();
191 callout_handle->setArgument(
"request", request);
192 callout_handle->setArgument(
"response", http_response);
197 callout_handle->getArgument(
"response", http_response);
202 return (http_response);
static CtrlAgentCommandMgr & instance()
Returns sole instance of the Command Manager.
static process::DControllerBasePtr & instance()
Static singleton instance method.
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.
@ NEXT_STEP_CONTINUE
continue normally
static int registerHook(const std::string &name)
Register Hook.
static bool calloutsPresent(int index)
Are callouts present?
static void callCallouts(int index, CalloutHandle &handle)
Calls the callouts for a given hook.
Wrapper class around callout handle which automatically resets handle's state.
Represents HTTP response with JSON content.
void setBodyAsJson(const data::ConstElementPtr &json_body)
Generates JSON content from the data structures represented as data::ConstElementPtr.
Represents HTTP POST request with JSON body.
boost::shared_ptr< CtrlAgentCfgContext > CtrlAgentCfgContextPtr
Pointer to a configuration context.
boost::shared_ptr< CtrlAgentProcess > CtrlAgentProcessPtr
Defines a shared pointer to CtrlAgentProcess.
boost::shared_ptr< CtrlAgentCfgMgr > CtrlAgentCfgMgrPtr
Defines a shared pointer to CtrlAgentCfgMgr.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
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.