Kea 2.2.0
stdout_control_socket.cc
Go to the documentation of this file.
1// Copyright (C) 2018-2021 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
9
10#include <config.h>
11
14
15using namespace std;
16using namespace isc::config;
17using namespace isc::data;
18
19namespace isc {
20namespace netconf {
21
23createControlSocket<CfgControlSocket::Type::STDOUT>(CfgControlSocketPtr ctrl_sock) {
24 return (StdoutControlSocketPtr(new StdoutControlSocket(ctrl_sock)));
25}
26
28 : ControlSocketBase(ctrl_sock), output_(cout) {
29}
30
32 ostream& output)
33 : ControlSocketBase(ctrl_sock), output_(output) {
34}
35
37StdoutControlSocket::configGet(const string& /*service*/) {
38 isc_throw(NotImplemented, "No config-get for stdout control socket");
39}
40
43 const string& /*service*/) {
44 return (createAnswer());
45}
46
49 const string& /*service*/) {
50 prettyPrint(config, output_);
51 output_ << endl;
52 return (createAnswer());
53}
54
55} // namespace netconf
56} // namespace isc
A generic exception that is thrown when a function is not implemented.
Base class for control socket communication.
Class for control socket communication over stdout.
virtual data::ConstElementPtr configTest(data::ConstElementPtr config, const std::string &service)
Test configuration.
StdoutControlSocket(CfgControlSocketPtr ctrl_sock)
Constructor.
virtual data::ConstElementPtr configGet(const std::string &service)
Get configuration.
virtual data::ConstElementPtr configSet(data::ConstElementPtr config, const std::string &service)
Set configuration.
std::ostream & output_
The output stream (std::cout outside tests).
This file contains several functions and constants that are used for handling commands and responses ...
string & output_
Definition: dns/message.cc:877
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
ConstElementPtr createAnswer(const int status_code, const std::string &text, const ConstElementPtr &arg)
void prettyPrint(ConstElementPtr element, std::ostream &out, unsigned indent, unsigned step)
Pretty prints the data into stream.
Definition: data.cc:1487
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:27
boost::shared_ptr< ControlSocketBase > ControlSocketBasePtr
Type definition for the pointer to the ControlSocketBase.
boost::shared_ptr< CfgControlSocket > CfgControlSocketPtr
Defines a pointer for CfgControlSocket instances.
boost::shared_ptr< StdoutControlSocket > StdoutControlSocketPtr
Type definition for the pointer to the StdoutControlSocket.
Defines the logger used by the top-level component of kea-lfc.
Contains declarations for stdout control socket communication.