Kea 2.5.8
stdout_control_socket.cc
Go to the documentation of this file.
1// Copyright (C) 2018-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
9
10#include <config.h>
11
14
15#include <iostream>
16
17using namespace std;
18using namespace isc::config;
19using namespace isc::data;
20
21namespace isc {
22namespace netconf {
23
26 return (StdoutControlSocketPtr(new StdoutControlSocket(ctrl_sock)));
27}
28
30 : ControlSocketBase(ctrl_sock), output_(cout) {
31}
32
34 ostream& output)
35 : ControlSocketBase(ctrl_sock), output_(output) {
36}
37
39StdoutControlSocket::configGet(const string& /*service*/) {
40 isc_throw(NotImplemented, "No config-get for stdout control socket");
41}
42
45 const string& /*service*/) {
46 return (createAnswer());
47}
48
51 const string& /*service*/) {
52 prettyPrint(config, output_);
53 output_ << endl;
54 return (createAnswer());
55}
56
57} // namespace netconf
58} // 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.
data::ConstElementPtr configGet(const std::string &service) override final
Get configuration.
data::ConstElementPtr configSet(data::ElementPtr config, const std::string &service) override final
Set configuration.
StdoutControlSocket(CfgControlSocketPtr ctrl_sock)
Constructor.
data::ConstElementPtr configTest(data::ElementPtr config, const std::string &service) override final
Test 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:883
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
ConstElementPtr createAnswer()
Creates a standard config/command level success answer message (i.e.
void prettyPrint(ConstElementPtr element, std::ostream &out, unsigned indent, unsigned step)
Pretty prints the data into stream.
Definition: data.cc:1547
boost::shared_ptr< const Element > ConstElementPtr
Definition: data.h:29
boost::shared_ptr< Element > ElementPtr
Definition: data.h:28
std::shared_ptr< StdoutControlSocket > StdoutControlSocketPtr
Type definition for the pointer to the StdoutControlSocket.
ControlSocketBasePtr createControlSocket< CfgControlSocket::Type::STDOUT >(CfgControlSocketPtr ctrl_sock)
Factory template specialization for stdout control sockets.
std::shared_ptr< CfgControlSocket > CfgControlSocketPtr
Defines a pointer for CfgControlSocket instances.
std::shared_ptr< ControlSocketBase > ControlSocketBasePtr
Type definition for the pointer to the ControlSocketBase.
Defines the logger used by the top-level component of kea-lfc.
Contains declarations for stdout control socket communication.