42 if (service ==
"ca") {
51 if (service ==
"ca") {
54 return (sendCommand(
createCommand(
"config-test", config, service)));
60 if (service ==
"ca") {
63 return (sendCommand(
createCommand(
"config-set", config, service)));
73 request->setBodyAsJson(command);
76 }
catch (
const std::exception& ex) {
83 boost::system::error_code received_ec;
84 string receive_errmsg;
88 [&io_service, &received_ec, &receive_errmsg]
89 (
const boost::system::error_code& ec,
93 receive_errmsg = errmsg;
97 io_service->stopWork();
107 << received_ec.message());
110 if (!receive_errmsg.empty()) {
122 return (response->getBodyAsJson());
123 }
catch (
const std::exception& ex) {
Exception thrown when the error during communication.
Represents HTTP POST request with JSON body.
Contains declarations for HTTP control socket communication.
boost::shared_ptr< HttpControlSocket > HttpControlSocketPtr
Type definition for the pointer to the HttpControlSocket.
void asyncSendRequest(const Url &url, const asiolink::TlsContextPtr &tls_context, const HttpRequestPtr &request, const HttpResponsePtr &response, const RequestHandler &request_callback, const RequestTimeout &request_timeout=RequestTimeout(10000), const ConnectHandler &connect_callback=ConnectHandler(), const HandshakeHandler &handshake_callback=HandshakeHandler(), const CloseHandler &close_callback=CloseHandler())
Queues new asynchronous HTTP request for a given URL.
boost::shared_ptr< HttpResponseJson > HttpResponseJsonPtr
Pointer to the HttpResponseJson object.
boost::shared_ptr< ControlSocketBase > ControlSocketBasePtr
Type definition for the pointer to the ControlSocketBase.
HTTP request/response timeout value.
Base class for control socket communication.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
Class for control socket communication over HTTP socket.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
The IOService class is a wrapper for the ASIO io_service class.
boost::shared_ptr< TlsContext > TlsContextPtr
The type of shared pointers to TlsContext objects.
virtual data::ConstElementPtr configTest(data::ConstElementPtr config, const std::string &service)
Test configuration.
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< PostHttpRequestJson > PostHttpRequestJsonPtr
Pointer to PostHttpRequestJson.
boost::shared_ptr< HttpResponse > HttpResponsePtr
Pointer to the HttpResponse object.
ConstElementPtr createCommand(const std::string &command)
Creates a standard command message with no argument (of the form { "command": "my_command" }) ...
boost::shared_ptr< const Element > ConstElementPtr
constexpr long TIMEOUT_AGENT_FORWARD_COMMAND
Timeout for the Control Agent to forward command to a Kea server, e.g.
Represents HTTP response with JSON content.
Defines the logger used by the top-level component of kea-lfc.
virtual data::ConstElementPtr configSet(data::ConstElementPtr config, const std::string &service)
Set configuration.
virtual data::ConstElementPtr configGet(const std::string &service)
Get configuration.
This file contains several functions and constants that are used for handling commands and responses ...
const isc::http::Url getUrl() const
Returns the HTTP server URL.
boost::shared_ptr< CfgControlSocket > CfgControlSocketPtr
Defines a pointer for CfgControlSocket instances.