15#include <boost/pointer_cast.hpp>
43 callout_handle->deleteAllArguments();
49 callout_handle->setArgument(
"command", command);
50 callout_handle->setArgument(
"response", hook_response);
55 callout_handle->getArgument(
"response", hook_response);
57 answer = boost::const_pointer_cast<Element>(hook_response);
74 if ((cmd_name !=
"list-commands")) {
81 return (hook_response);
94 if (cmd_name ==
"list-commands") {
96 const std::vector<std::string>& hooks =
100 if (!hooks.empty()) {
102 for (
auto const& h : hooks) {
109 if (!command_name.empty()) {
122 if (!hooks_commands->empty()) {
Commands Manager, responsible for processing external commands.
virtual isc::data::ConstElementPtr handleCommand(const std::string &cmd_name, const isc::data::ConstElementPtr ¶ms, const isc::data::ConstElementPtr &original_cmd)
Handles the command having a given name and arguments.
HookedCommandMgr()
Constructor.
virtual isc::data::ConstElementPtr handleCommand(const std::string &cmd_name, const isc::data::ConstElementPtr ¶ms, const isc::data::ConstElementPtr &original_cmd)
Handles the command having a given name and arguments.
bool delegateCommandToHookLibrary(const std::string &cmd_name, const isc::data::ConstElementPtr ¶ms, const isc::data::ConstElementPtr &original_cmd, isc::data::ElementPtr &answer)
Handles the command within the hooks libraries.
static ElementPtr create(const Position &pos=ZERO_POSITION())
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
@ NEXT_STEP_CONTINUE
continue normally
static void callCommandHandlers(const std::string &command_name, CalloutHandle &handle)
Calls the callouts/command handlers for a given command name.
static bool commandHandlersPresent(const std::string &command_name)
Checks if control command handlers are present for the specified command.
static boost::shared_ptr< CalloutHandle > createCalloutHandle()
Return callout handle.
static ServerHooksPtr getServerHooksPtr()
Returns pointer to ServerHooks object.
static std::string hookToCommandName(const std::string &hook_name)
Returns command name for a specified hook name.
This file contains several functions and constants that are used for handling commands and responses ...
ConstElementPtr createCommand(const std::string &command)
Creates a standard command message with no argument (of the form { "command": "my_command" }...
ConstElementPtr combineCommandsLists(const ConstElementPtr &response1, const ConstElementPtr &response2)
Combines lists of commands carried in two responses.
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
Defines the logger used by the top-level component of kea-lfc.