36 if (status_code != 0 && text.empty()) {
79 "invalid answer: does not contain mandatory '" <<
CONTROL_RESULT <<
"'");
85 <<
"' to be an integer, got "
89 rcode = result->intValue();
106 "invalid answer: does not contain mandatory '" <<
CONTROL_RESULT <<
"'");
112 <<
"' to be an integer, got "
116 rcode = result->intValue();
140 "invalid answer: does not contain mandatory '" <<
CONTROL_RESULT <<
"'");
151 int rcode = result->intValue();
155 txt <<
"failure(" << rcode <<
")";
161 txt <<
", text=" << txt_elem->stringValue();
185 const std::string& service) {
192 if (!service.empty()) {
211 "invalid command: does not contain mandatory '" <<
CONTROL_COMMAND <<
"'");
215 auto const& command_params = command->mapValue();
216 for (
auto const& param : command_params) {
222 "invalid command: unsupported parameter '" << param.first <<
"'");
235 return (cmd->stringValue());
245 "invalid command '" << command_name <<
"': no arguments specified");
251 "invalid command '" << command_name <<
"': expected '"
257 if (arg->size() == 0) {
259 "invalid command '" << command_name <<
"': '"
263 return (command_name);
272 if (!response1 && response2) {
275 }
else if (response1 && !response2) {
278 }
else if (!response1 && !response2) {
286 if (status_code != 0) {
291 if (status_code != 0) {
295 const std::vector<ElementPtr> vec1 = args1->listValue();
296 const std::vector<ElementPtr> vec2 = args2->listValue();
300 std::set<std::string> combined_set;
301 for (
auto const& v : vec1) {
302 combined_set.insert(v->stringValue());
304 for (
auto const& v : vec2) {
305 combined_set.insert(v->stringValue());
310 for (
auto const& s : combined_set) {
static ElementPtr create(const Position &pos=ZERO_POSITION())
static std::string typeToName(Element::types type)
Returns the name of the given type as a string.
static ElementPtr createMap(const Position &pos=ZERO_POSITION())
Creates an empty MapElement type ElementPtr.
static ElementPtr createList(const Position &pos=ZERO_POSITION())
Creates an empty ListElement type ElementPtr.
A standard control channel exception that is thrown if a function is there is a problem with one of t...
The Element class represents a piece of data, used by the command channel and configuration parts.
A standard Data module exception that is thrown if a parse error is encountered when constructing an ...
This file contains several functions and constants that are used for handling commands and responses ...
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
std::string answerToText(const ConstElementPtr &msg)
Converts answer to printable text.
const char * CONTROL_ARGUMENTS
String used for arguments map ("arguments")
ConstElementPtr parseAnswerText(int &rcode, const ConstElementPtr &msg)
Parses a standard config/command level answer and returns text status.
const char * CONTROL_TEXT
String used for storing textual description ("text")
const char * CONTROL_COMMAND
String used for commands ("command")
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
Parses a standard config/command level answer and returns arguments or text status code.
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.
std::string parseCommand(ConstElementPtr &arg, ConstElementPtr command)
Parses the given command into a string containing the actual command and an ElementPtr containing the...
const char * CONTROL_SERVICE
String used for service list ("service")
std::string parseCommandWithArgs(ConstElementPtr &arg, ConstElementPtr command)
Parses the given command into a string containing the command name and an ElementPtr containing the m...
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
const char * CONTROL_REMOTE_ADDRESS
String used for remote address ("remote-address")
const char * CONTROL_RESULT
String used for result, i.e. integer status ("result")
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
boost::shared_ptr< const Element > ConstElementPtr
boost::shared_ptr< Element > ElementPtr
Defines the logger used by the top-level component of kea-lfc.