Kea 2.7.5
http_command_config.h
Go to the documentation of this file.
1// Copyright (C) 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
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
16namespace isc {
17namespace config {
18
22public:
27
29 ~HttpCommandConfig() = default;
30
34 std::string getSocketType() const {
35 return (socket_type_);
36 }
37
41 void setSocketType(const std::string& socket_type) {
42 socket_type_ = socket_type;
43 }
44
49 return (socket_address_);
50 }
51
55 void setSocketAddress(const isc::asiolink::IOAddress& socket_address) {
56 socket_address_ = socket_address;
57 }
58
62 uint16_t getSocketPort() const {
63 return (socket_port_);
64 }
65
69 void setSocketPort(const uint16_t socket_port) {
70 socket_port_ = socket_port;
71 }
72
77 return (http_headers_);
78 }
79
84 http_headers_ = headers;
85 }
86
93 return (auth_config_);
94 }
95
102 auth_config_ = auth_config;
103 }
104
108 std::string getTrustAnchor() const {
109 return (trust_anchor_);
110 }
111
116 void setTrustAnchor(const std::string& ca) {
117 trust_anchor_ = ca;
118 }
119
123 std::string getCertFile() const {
124 return (cert_file_);
125 }
126
130 void setCertFile(const std::string& cert) {
131 cert_file_ = cert;
132 }
133
137 std::string getKeyFile() const {
138 return (key_file_);
139 }
140
144 void setKeyFile(const std::string& key) {
145 key_file_ = key;
146 }
147
152 bool getCertRequired() const {
153 return (cert_required_);
154 }
155
160 void setCertRequired(bool required) {
161 cert_required_ = required;
162 }
163
170 return (emulate_agent_response_);
171 }
172
176 void setEmulateAgentResponse(const bool emulate_agent_response) {
177 emulate_agent_response_ = emulate_agent_response;
178 }
179
183 virtual isc::data::ElementPtr toElement() const;
184
187
189 static uint16_t DEFAULT_SOCKET_PORT;
190
193
194private:
198 void checkTlsSetup(bool require_tls) const;
199
201 std::string socket_type_;
202
204 isc::asiolink::IOAddress socket_address_;
205
207 uint16_t socket_port_;
208
210 isc::http::CfgHttpHeaders http_headers_;
211
213 isc::http::HttpAuthConfigPtr auth_config_;
214
216 std::string trust_anchor_;
217
219 std::string cert_file_;
220
222 std::string key_file_;
223
225 bool cert_required_;
226
228 bool emulate_agent_response_;
229};
230
232typedef boost::shared_ptr<HttpCommandConfig> HttpCommandConfigPtr;
233
234} // end of isc::config namespace
235} // end of isc namespace
236#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< 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
std::vector< CfgHttpHeader > CfgHttpHeaders
Collection of config HTTP headers.
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.