Kea 2.7.6
command_interpreter.h
Go to the documentation of this file.
1// Copyright (C) 2009-2024 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
20namespace isc {
21namespace config {
22
24extern const char *CONTROL_COMMAND;
25
27extern const char *CONTROL_RESULT;
28
30extern const char *CONTROL_TEXT;
31
33extern const char *CONTROL_ARGUMENTS;
34
36extern const char *CONTROL_SERVICE;
37
39extern const char *CONTROL_REMOTE_ADDRESS;
40
43
46
49
54
60
64public:
65 CtrlChannelError(const char* file, size_t line, const char* what) :
66 isc::Exception(file, line, what) {}
67};
68
73
80isc::data::ConstElementPtr createAnswer(const int status_code,
81 const std::string& status_text);
82
90isc::data::ConstElementPtr createAnswer(const int status_code,
92
100isc::data::ConstElementPtr createAnswer(const int status_code,
101 const std::string& status,
102 const isc::data::ConstElementPtr& arg);
103
114parseAnswer(int &status_code, const isc::data::ConstElementPtr& msg);
115
126parseAnswerText(int &rcode, const isc::data::ConstElementPtr& msg);
127
132std::string answerToText(const isc::data::ConstElementPtr& msg);
133
139isc::data::ConstElementPtr createCommand(const std::string& command);
140
148isc::data::ConstElementPtr createCommand(const std::string& command,
150
158 isc::data::ConstElementPtr createCommand(const std::string& command,
159 const std::string& service);
160
170isc::data::ConstElementPtr createCommand(const std::string& command,
172 const std::string& service);
173
186
187
204
220 const isc::data::ConstElementPtr& response2);
221
222} // namespace config
223} // namespace isc
224
225#endif // COMMAND_INTERPRETER_H
This is a base class for exceptions thrown from the DNS library module.
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
A standard control channel exception that is thrown if a function is there is a problem with one of t...
CtrlChannelError(const char *file, size_t line, const char *what)
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 int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
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" }...
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
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 int CONTROL_RESULT_CONFLICT
Status code indicating that the command was unsuccessful due to a conflict between the command argume...
const int CONTROL_RESULT_COMMAND_UNSUPPORTED
Status code indicating that the specified command is not supported.
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
Definition data.h:29
Defines the logger used by the top-level component of kea-lfc.