Kea  2.3.5-git
isc::config::CmdsImpl Class Reference

Base class that command handler implementers may use for common tasks. More...

#include <cmds_impl.h>

+ Inheritance diagram for isc::config::CmdsImpl:

Protected Member Functions

void extractCommand (hooks::CalloutHandle &handle)
 Extracts the command name and arguments from a Callout handle. More...
 
void setErrorResponse (hooks::CalloutHandle &handle, const std::string &text, int status=CONTROL_RESULT_ERROR)
 Set the callout argument "response" to indicate an error. More...
 
void setResponse (hooks::CalloutHandle &handle, data::ConstElementPtr &response)
 Set the callout argument "response" to the given response. More...
 
void setSuccessResponse (hooks::CalloutHandle &handle, const std::string &text)
 Set the callout argument "response" to indicate success. More...
 

Protected Attributes

data::ConstElementPtr cmd_args_
 Stores the command arguments extracted by a call to extractCommand. More...
 
std::string cmd_name_
 Stores the command name extracted by a call to extractCommand. More...
 

Detailed Description

Base class that command handler implementers may use for common tasks.

Definition at line 21 of file cmds_impl.h.

Member Function Documentation

◆ extractCommand()

void isc::config::CmdsImpl::extractCommand ( hooks::CalloutHandle handle)
inlineprotected

Extracts the command name and arguments from a Callout handle.

Parameters
handleCallout context handle expected to contain the JSON command text
Exceptions
isc::BadValueif the text does not contain a properly formed command

Definition at line 29 of file cmds_impl.h.

References cmd_args_, cmd_name_, isc::hooks::CalloutHandle::getArgument(), isc_throw, isc::config::parseCommand(), and isc::Exception::what().

+ Here is the call graph for this function:

◆ setErrorResponse()

void isc::config::CmdsImpl::setErrorResponse ( hooks::CalloutHandle handle,
const std::string &  text,
int  status = CONTROL_RESULT_ERROR 
)
inlineprotected

Set the callout argument "response" to indicate an error.

Parameters
handleCallout context handle in which to set the "response" argument
textstring text to be used as the response description
statusnumeric value to use as the response result, defaults to CONTROL_RESULT_ERROR

Definition at line 54 of file cmds_impl.h.

References isc::config::createAnswer(), and setResponse().

+ Here is the call graph for this function:

◆ setResponse()

void isc::config::CmdsImpl::setResponse ( hooks::CalloutHandle handle,
data::ConstElementPtr response 
)
inlineprotected

Set the callout argument "response" to the given response.

Parameters
handleCallout context handle in which to set the "response" argument
responseElementPtr to the result to use as the response

Definition at line 64 of file cmds_impl.h.

References isc::hooks::CalloutHandle::setArgument().

Referenced by setErrorResponse(), and setSuccessResponse().

+ Here is the call graph for this function:

◆ setSuccessResponse()

void isc::config::CmdsImpl::setSuccessResponse ( hooks::CalloutHandle handle,
const std::string &  text 
)
inlineprotected

Set the callout argument "response" to indicate success.

Parameters
handleCallout context handle in which to set the "response" argument
textstring text to be used as the response description

Definition at line 43 of file cmds_impl.h.

References isc::config::CONTROL_RESULT_SUCCESS, isc::config::createAnswer(), and setResponse().

+ Here is the call graph for this function:

Member Data Documentation

◆ cmd_args_

data::ConstElementPtr isc::config::CmdsImpl::cmd_args_
protected

Stores the command arguments extracted by a call to extractCommand.

Definition at line 72 of file cmds_impl.h.

Referenced by extractCommand().

◆ cmd_name_

std::string isc::config::CmdsImpl::cmd_name_
protected

Stores the command name extracted by a call to extractCommand.

Definition at line 69 of file cmds_impl.h.

Referenced by extractCommand().


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