Kea 2.7.5
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.
 
void setErrorResponse (hooks::CalloutHandle &handle, const std::string &text, int status=CONTROL_RESULT_ERROR)
 Set the callout argument "response" to indicate an error.
 
void setResponse (hooks::CalloutHandle &handle, data::ConstElementPtr &response)
 Set the callout argument "response" to the given response.
 
void setSuccessResponse (hooks::CalloutHandle &handle, const std::string &text)
 Set the callout argument "response" to indicate success.
 

Protected Attributes

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

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().

Referenced by isc::lease_cmds::LeaseCmdsImpl::lease4DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4WipeHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6BulkApplyHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6WipeHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetAllHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByClientIdHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByDuidHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHostnameHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHwAddressHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetPageHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseWriteHandler(), isc::perfmon::PerfMonMgr::perfmonControlHandler(), isc::perfmon::PerfMonMgr::perfmonGetAllDurationsHandler(), isc::stat_cmds::LeaseStatCmdsImpl::statLease4GetHandler(), and isc::stat_cmds::LeaseStatCmdsImpl::statLease6GetHandler().

+ 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().

Referenced by isc::lease_cmds::LeaseCmdsImpl::lease4DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4WipeHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6BulkApplyHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6WipeHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetAllHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByClientIdHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByDuidHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHostnameHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHwAddressHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetPageHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseWriteHandler(), isc::perfmon::PerfMonMgr::perfmonControlHandler(), isc::perfmon::PerfMonMgr::perfmonGetAllDurationsHandler(), isc::stat_cmds::LeaseStatCmdsImpl::statLease4GetHandler(), and isc::stat_cmds::LeaseStatCmdsImpl::statLease6GetHandler().

+ Here is the call graph for this function:

◆ setResponse()

◆ 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().

Referenced by isc::lease_cmds::LeaseCmdsImpl::lease4DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::lease4UpdateHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6DelHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6ResendDdnsHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6UpdateHandler(), and isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler().

+ Here is the call graph for this function:

Member Data Documentation

◆ cmd_args_

◆ cmd_name_


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