Kea: command_interpreter.h Source File

| Kea 2.2.0

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
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
42 const int CONTROL_RESULT_SUCCESS = 0;
43
45 const int CONTROL_RESULT_ERROR = 1;
46
48 const int CONTROL_RESULT_COMMAND_UNSUPPORTED = 2;
49
53 const int CONTROL_RESULT_EMPTY = 3;
54
57 class CtrlChannelError : public isc::Exception {
58public:
59 CtrlChannelError(const char* file, size_t line, const char* what) :
60 isc::Exception(file, line, what) {}
61};
62
66 isc::data::ConstElementPtr createAnswer();
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
111std::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,
128 isc::data::ConstElementPtr arg);
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,
150 isc::data::ConstElementPtr arg,
151 const std::string& service);
152
163std::string parseCommand(isc::data::ConstElementPtr& arg,
164 isc::data::ConstElementPtr command);
165
166
181std::string parseCommandWithArgs(isc::data::ConstElementPtr& arg,
182 isc::data::ConstElementPtr command);
183
197 isc::data::ConstElementPtr
198 combineCommandsLists(const isc::data::ConstElementPtr& response1,
199 const isc::data::ConstElementPtr& response2);
200
201}; // end of namespace isc::config
202}; // end of namespace isc
203
204#endif // COMMAND_INTERPRETER_H
isc::Exception
This is a base class for exceptions thrown from the DNS library module.
Definition: exceptions/exceptions.h:23
isc::Exception::what
virtual const char * what() const
Returns a C-style character string of the cause of the exception.
Definition: exceptions/exceptions.cc:32
isc::config::CtrlChannelError
A standard control channel exception that is thrown if a function is there is a problem with one of t...
Definition: command_interpreter.h:57
isc::config::CtrlChannelError::CtrlChannelError
CtrlChannelError(const char *file, size_t line, const char *what)
Definition: command_interpreter.h:59
data.h
isc::config::parseCommandWithArgs
std::string parseCommandWithArgs(ConstElementPtr &arg, ConstElementPtr command)
Definition: command_interpreter.cc:207
isc::config::CONTROL_ARGUMENTS
const char * CONTROL_ARGUMENTS
String used for arguments map ("arguments")
Definition: command_interpreter.cc:28
isc::config::CONTROL_RESULT_EMPTY
const int CONTROL_RESULT_EMPTY
Status code indicating that the specified command was completed correctly, but failed to produce any ...
Definition: command_interpreter.h:53
isc::config::CONTROL_TEXT
const char * CONTROL_TEXT
String used for storing textual description ("text")
Definition: command_interpreter.cc:27
isc::config::CONTROL_COMMAND
const char * CONTROL_COMMAND
String used for commands ("command")
Definition: command_interpreter.cc:25
isc::config::createCommand
ConstElementPtr createCommand(const std::string &command)
Creates a standard command message with no argument (of the form { "command": "my_command" })
Definition: command_interpreter.cc:138
isc::config::CONTROL_RESULT_ERROR
const int CONTROL_RESULT_ERROR
Status code indicating a general failure.
Definition: command_interpreter.h:45
isc::config::CONTROL_SERVICE
const char * CONTROL_SERVICE
String used for service list ("service")
Definition: command_interpreter.cc:29
isc::config::parseCommand
std::string parseCommand(ConstElementPtr &arg, ConstElementPtr command)
Definition: command_interpreter.cc:171
isc::config::combineCommandsLists
ConstElementPtr combineCommandsLists(const ConstElementPtr &response1, const ConstElementPtr &response2)
Definition: command_interpreter.cc:233
isc::config::CONTROL_RESULT_COMMAND_UNSUPPORTED
const int CONTROL_RESULT_COMMAND_UNSUPPORTED
Status code indicating that the specified command is not supported.
Definition: command_interpreter.h:48
isc::config::createAnswer
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
Definition: command_interpreter.cc:34
isc::config::parseAnswer
ConstElementPtr parseAnswer(int &rcode, const ConstElementPtr &msg)
Definition: command_interpreter.cc:69
isc::config::CONTROL_REMOTE_ADDRESS
const char * CONTROL_REMOTE_ADDRESS
String used for remote address ("remote-address")
Definition: command_interpreter.cc:30
isc::config::CONTROL_RESULT
const char * CONTROL_RESULT
String used for result, i.e. integer status ("result")
Definition: command_interpreter.cc:26
isc::config::CONTROL_RESULT_SUCCESS
const int CONTROL_RESULT_SUCCESS
Status code indicating a successful operation.
Definition: command_interpreter.h:42
isc::config::answerToText
std::string answerToText(const ConstElementPtr &msg)
Definition: command_interpreter.cc:101
isc::data::ConstElementPtr
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
isc
Defines the logger used by the top-level component of kea-lfc.
Definition: agent_parser.cc:143