Kea 2.7.5
|
Base class that command handler implementers may use for common tasks. More...
#include <cmds_impl.h>
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. | |
Base class that command handler implementers may use for common tasks.
Definition at line 21 of file cmds_impl.h.
|
inlineprotected |
Extracts the command name and arguments from a Callout handle.
handle | Callout context handle expected to contain the JSON command text |
isc::BadValue | if 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().
|
inlineprotected |
Set the callout argument "response" to indicate an error.
handle | Callout context handle in which to set the "response" argument |
text | string text to be used as the response description |
status | numeric 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().
|
inlineprotected |
Set the callout argument "response" to the given response.
handle | Callout context handle in which to set the "response" argument |
response | ElementPtr to the result to use as the response |
Definition at line 64 of file cmds_impl.h.
References isc::hooks::CalloutHandle::setArgument().
Referenced by isc::lease_cmds::LeaseCmdsImpl::lease4WipeHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6BulkApplyHandler(), isc::lease_cmds::LeaseCmdsImpl::lease6WipeHandler(), 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(), setErrorResponse(), setSuccessResponse(), isc::stat_cmds::LeaseStatCmdsImpl::statLease4GetHandler(), and isc::stat_cmds::LeaseStatCmdsImpl::statLease6GetHandler().
|
inlineprotected |
Set the callout argument "response" to indicate success.
handle | Callout context handle in which to set the "response" argument |
text | string 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().
|
protected |
Stores the command arguments extracted by a call to extractCommand.
Definition at line 72 of file cmds_impl.h.
Referenced by extractCommand(), 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().
|
protected |
Stores the command name extracted by a call to extractCommand.
Definition at line 69 of file cmds_impl.h.
Referenced by extractCommand(), isc::lease_cmds::LeaseCmdsImpl::leaseAddHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetAllHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetByHostnameHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetHandler(), isc::lease_cmds::LeaseCmdsImpl::leaseGetPageHandler(), and isc::lease_cmds::LeaseCmdsImpl::leaseWriteHandler().