Kea 2.7.8
http_command_config.h
Go to the documentation of this file.
1// Copyright (C) 2024-2025 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 HTTP_COMMAND_CONFIG_H
8#define HTTP_COMMAND_CONFIG_H
9
10#include <asiolink/io_address.h>
11#include <cc/cfg_to_element.h>
12#include <cc/user_context.h>
13#include <http/auth_config.h>
15#include <http/listener.h>
16
17namespace isc {
18namespace config {
19
23public:
28
30 ~HttpCommandConfig() = default;
31
35 std::string getSocketType() const {
36 return (socket_type_);
37 }
38
42 void setSocketType(const std::string& socket_type) {
43 socket_type_ = socket_type;
44 }
45
50 return (socket_address_);
51 }
52
56 void setSocketAddress(const isc::asiolink::IOAddress& socket_address) {
57 socket_address_ = socket_address;
58 }
59
63 uint16_t getSocketPort() const {
64 return (socket_port_);
65 }
66
70 void setSocketPort(const uint16_t socket_port) {
71 socket_port_ = socket_port;
72 }
73
78 return (http_headers_);
79 }
80
85 http_headers_ = headers;
86 }
87
94 return (auth_config_);
95 }
96
103 auth_config_ = auth_config;
104 }
105
109 std::string getTrustAnchor() const {
110 return (trust_anchor_);
111 }
112
117 void setTrustAnchor(const std::string& ca) {
118 trust_anchor_ = ca;
119 }
120
124 std::string getCertFile() const {
125 return (cert_file_);
126 }
127
131 void setCertFile(const std::string& cert) {
132 cert_file_ = cert;
133 }
134
138 std::string getKeyFile() const {
139 return (key_file_);
140 }
141
145 void setKeyFile(const std::string& key) {
146 key_file_ = key;
147 }
148
153 bool getCertRequired() const {
154 return (cert_required_);
155 }
156
161 void setCertRequired(bool required) {
162 cert_required_ = required;
163 }
164
171 return (emulate_agent_response_);
172 }
173
177 void setEmulateAgentResponse(const bool emulate_agent_response) {
178 emulate_agent_response_ = emulate_agent_response;
179 }
180
184 virtual isc::data::ElementPtr toElement() const;
185
188
190 static uint16_t DEFAULT_SOCKET_PORT;
191
194
195private:
199 void checkTlsSetup(bool require_tls) const;
200
202 std::string socket_type_;
203
205 isc::asiolink::IOAddress socket_address_;
206
208 uint16_t socket_port_;
209
211 isc::http::CfgHttpHeaders http_headers_;
212
214 isc::http::HttpAuthConfigPtr auth_config_;
215
217 std::string trust_anchor_;
218
220 std::string cert_file_;
221
223 std::string key_file_;
224
226 bool cert_required_;
227
229 bool emulate_agent_response_;
230};
231
233typedef boost::shared_ptr<HttpCommandConfig> HttpCommandConfigPtr;
234
254
256typedef boost::shared_ptr<HttpSocketInfo> HttpSocketInfoPtr;
257
258} // end of isc::config namespace
259} // end of isc namespace
260#endif
HTTP command config aka HTTP control socket info class.
virtual isc::data::ElementPtr toElement() const
Unparse a configuration object.
bool getEmulateAgentResponse() const
Returns emulate agent response flag.
static std::string DEFAULT_AUTHENTICATION_REALM
Default HTTP authentication realm.
uint16_t getSocketPort() const
Returns socket port.
void setEmulateAgentResponse(const bool emulate_agent_response)
Sets emulate agent response flag.
~HttpCommandConfig()=default
Virtual destructor.
const isc::http::CfgHttpHeaders & getHttpHeaders() const
Returns http-headers configuration.
void setTrustAnchor(const std::string &ca)
Sets trust-anchor TLS parameter.
std::string getSocketType() const
Returns socket type.
static isc::asiolink::IOAddress DEFAULT_SOCKET_ADDRESS
Default socket address (127.0.0.1).
void setCertRequired(bool required)
Sets cert-required TLS parameter.
const isc::http::HttpAuthConfigPtr & getAuthConfig() const
Returns HTTP authentication configuration.
static uint16_t DEFAULT_SOCKET_PORT
Default socket port.
std::string getCertFile() const
Returns cert-file TLS parameter.
std::string getTrustAnchor() const
Returns trust-anchor TLS parameter.
void setAuthConfig(const isc::http::HttpAuthConfigPtr &auth_config)
Sets HTTP authentication configuration.
isc::asiolink::IOAddress getSocketAddress() const
Returns socket address.
HttpCommandConfig(isc::data::ConstElementPtr config)
Constructor.
void setSocketAddress(const isc::asiolink::IOAddress &socket_address)
Sets socket address.
void setKeyFile(const std::string &key)
Sets key-file TLS parameter.
void setCertFile(const std::string &cert)
Sets cert-file TLS parameter.
void setHttpHeaders(const isc::http::CfgHttpHeaders &headers)
Sets http-headers configuration.
std::string getKeyFile() const
Returns key-file TLS parameter.
void setSocketType(const std::string &socket_type)
Sets socket type.
bool getCertRequired() const
Returns cert-required TLS parameter.
void setSocketPort(const uint16_t socket_port)
Sets socket port.
boost::shared_ptr< HttpSocketInfo > HttpSocketInfoPtr
Pointer to a HttpSocketInfo object.
boost::shared_ptr< HttpCommandConfig > HttpCommandConfigPtr
Pointer to a HttpCommandConfig object.
boost::shared_ptr< const Element > ConstElementPtr
Definition data.h:29
boost::shared_ptr< Element > ElementPtr
Definition data.h:28
boost::shared_ptr< HttpAuthConfig > HttpAuthConfigPtr
Type of shared pointers to HTTP authentication configuration.
Definition auth_config.h:97
boost::shared_ptr< HttpListener > HttpListenerPtr
Pointer to the HttpListener.
Definition listener.h:156
std::vector< CfgHttpHeader > CfgHttpHeaders
Collection of config HTTP headers.
Defines the logger used by the top-level component of kea-lfc.
Structure used to store HTTP/HTTPS connection data.
HttpCommandConfigPtr config_
Pointer to the socket config.
bool usable_
Flag which indicates if socket can be reused.
~HttpSocketInfo()=default
Destructor.
isc::http::HttpListenerPtr listener_
Pointer to HTTP/HTTPS listener.
Abstract class for configuration Cfg_* classes.
Base class for user context.