Kea
1.9.9-git
|
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. 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... | |
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().
|
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().
|
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 setErrorResponse(), and setSuccessResponse().
|
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().
|
protected |
Stores the command arguments extracted by a call to extractCommand.
Definition at line 72 of file cmds_impl.h.
Referenced by extractCommand().
|
protected |
Stores the command name extracted by a call to extractCommand.
Definition at line 69 of file cmds_impl.h.
Referenced by extractCommand().