Kea  2.1.7-git
command_interpreter.h
Go to the documentation of this file.
1 // Copyright (C) 2009-2022 Internet Systems Consortium, Inc. ("ISC")
2 //
3 // This Source Code Form is subject to the terms of the Mozilla Public
4 // License, v. 2.0. If a copy of the MPL was not distributed with this
5 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
6 
7 #ifndef COMMAND_INTERPRETER_H
8 #define COMMAND_INTERPRETER_H
9 
10 #include <cc/data.h>
11 #include <string>
12 
19 
20 namespace isc {
21 namespace config {
22 
24 extern const char *CONTROL_COMMAND;
25 
27 extern const char *CONTROL_RESULT;
28 
30 extern const char *CONTROL_TEXT;
31 
33 extern const char *CONTROL_ARGUMENTS;
34 
36 extern const char *CONTROL_SERVICE;
37 
39 extern const char *CONTROL_REMOTE_ADDRESS;
40 
42 const int CONTROL_RESULT_SUCCESS = 0;
43 
45 const int CONTROL_RESULT_ERROR = 1;
46 
49 
53 const int CONTROL_RESULT_EMPTY = 3;
54 
58 public:
59  CtrlChannelError(const char* file, size_t line, const char* what) :
60  isc::Exception(file, line, what) {}
61 };
62 
67 
74 isc::data::ConstElementPtr createAnswer(const int status_code,
75  const std::string& status_text);
76 
84 isc::data::ConstElementPtr createAnswer(const int status_code,
85  const isc::data::ConstElementPtr& arg);
86 
94 isc::data::ConstElementPtr createAnswer(const int status_code,
95  const std::string& status,
96  const isc::data::ConstElementPtr& arg);
97 
104 isc::data::ConstElementPtr parseAnswer(int &status_code,
105  const isc::data::ConstElementPtr& msg);
106 
111 std::string answerToText(const isc::data::ConstElementPtr& msg);
112 
118 isc::data::ConstElementPtr createCommand(const std::string& command);
119 
127 isc::data::ConstElementPtr createCommand(const std::string& command,
129 
137  isc::data::ConstElementPtr createCommand(const std::string& command,
138  const std::string& service);
139 
149 isc::data::ConstElementPtr createCommand(const std::string& command,
151  const std::string& service);
152 
165 
166 
183 
199  const isc::data::ConstElementPtr& response2);
200 
201 }; // end of namespace isc::config
202 }; // end of namespace isc
203 
204 #endif // COMMAND_INTERPRETER_H
const char * CONTROL_RESULT
String used for result, i.e. integer status ("result")
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
const char * CONTROL_REMOTE_ADDRESS
String used for remote address ("remote-address")
const char * CONTROL_ARGUMENTS
String used for arguments map ("arguments")
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
std::string parseCommandWithArgs(ConstElementPtr &arg, ConstElementPtr command)
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
const int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
std::string answerToText(const ConstElementPtr &msg)
ConstElementPtr createCommand(const std::string &command)
Creates a standard command message with no argument (of the form { "command": "my_command" }) ...
const char * CONTROL_TEXT
String used for storing textual description ("text")
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
A standard control channel exception that is thrown if a function is there is a problem with one of t...
This is a base class for exceptions thrown from the DNS library module.
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
Defines the logger used by the top-level component of kea-lfc.
std::string parseCommand(ConstElementPtr &arg, ConstElementPtr command)
const char * CONTROL_COMMAND
String used for commands ("command")
const char * CONTROL_SERVICE
String used for service list ("service")
ConstElementPtr combineCommandsLists(const ConstElementPtr &response1, const ConstElementPtr &response2)
CtrlChannelError(const char *file, size_t line, const char *what)
const int CONTROL_RESULT_COMMAND_UNSUPPORTED
Status code indicating that the specified command is not supported.