Kea 2.7.6
control_socket.h
Go to the documentation of this file.
1// Copyright (C) 2018-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
9
10#ifndef CONTROL_SOCKET_H
11#define CONTROL_SOCKET_H
12
15
16namespace isc {
17namespace netconf {
18
21public:
22 ControlSocketError(const char* file, size_t line, const char* what)
23 : isc::Exception(file, line, what) {
24 }
25}; // ControlSocketError
26
34public:
40 if (!ctrl_sock) {
41 isc_throw(ControlSocketError, "ControlSocket constructor called "
42 "with a null configuration");
43 }
44 }
45
47 virtual ~ControlSocketBase() = default;
48
53 return (socket_cfg_->getType());
54 }
55
59 const std::string getName() const {
60 return (socket_cfg_->getName());
61 }
62
66 const isc::http::Url getUrl() const {
67 return (socket_cfg_->getUrl());
68 }
69
77 virtual data::ConstElementPtr configGet(const std::string& service) = 0;
78
88 const std::string& service) = 0;
89
99 const std::string& service) = 0;
100
103}; // ControlSocketBase
104
106using ControlSocketBasePtr = std::shared_ptr<ControlSocketBase>;
107
114template <CfgControlSocket::Type TYPE> ControlSocketBasePtr
116 isc_throw(NotImplemented, "not specialized createControlSocket");
117}
118
126
127} // namespace netconf
128} // namespace isc
129
130#endif // CONTROL_SOCKET_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 generic exception that is thrown when a function is not implemented.
Represents an URL.
Definition url.h:20
Type
Defines the list of possible control socket types.
Base class for control socket communication.
virtual data::ConstElementPtr configTest(data::ElementPtr config, const std::string &service)=0
Test configuration.
CfgControlSocket::Type getType() const
Getter which returns the socket type.
virtual ~ControlSocketBase()=default
Destructor (does nothing).
virtual data::ConstElementPtr configSet(data::ElementPtr config, const std::string &service)=0
Set configuration.
CfgControlSocketPtr socket_cfg_
The control socket configuration.
ControlSocketBase(CfgControlSocketPtr ctrl_sock)
Constructor.
const std::string getName() const
Returns the Unix socket name.
virtual data::ConstElementPtr configGet(const std::string &service)=0
Get configuration.
const isc::http::Url getUrl() const
Returns the HTTP server URL.
Exception thrown when the error during communication.
ControlSocketError(const char *file, size_t line, const char *what)
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
std::shared_ptr< ControlSocketBase > ControlSocketBasePtr
Type definition for the pointer to the ControlSocketBase.
ControlSocketBasePtr createControlSocket(CfgControlSocketPtr ctrl_sock)
Factory template for control sockets.
std::shared_ptr< CfgControlSocket > CfgControlSocketPtr
Defines a pointer for CfgControlSocket instances.
ControlSocketBasePtr controlSocketFactory(CfgControlSocketPtr ctrl_sock)
Factory function for control sockets.
Defines the logger used by the top-level component of kea-lfc.
A collection of classes for housing and parsing the application configuration necessary for the Netco...