Kea 2.7.3
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>
14
15namespace isc {
16namespace config {
17
21public:
26
28 ~HttpCommandConfig() = default;
29
33 std::string getSocketType() const {
34 return (socket_type_);
35 }
36
40 void setSocketType(const std::string& socket_type) {
41 socket_type_ = socket_type;
42 }
43
48 return (socket_address_);
49 }
50
54 void setSocketAddress(const isc::asiolink::IOAddress& socket_address) {
55 socket_address_ = socket_address;
56 }
57
59 uint16_t getSocketPort() const {
60 return (socket_port_);
61 }
62
66 void setSocketPort(const uint16_t socket_port) {
67 socket_port_ = socket_port;
68 }
69
76 return (auth_config_);
77 }
78
85 auth_config_ = auth_config;
86 }
87
91 std::string getTrustAnchor() const {
92 return (trust_anchor_);
93 }
94
99 void setTrustAnchor(const std::string& ca) {
100 trust_anchor_ = ca;
101 }
102
106 std::string getCertFile() const {
107 return (cert_file_);
108 }
109
113 void setCertFile(const std::string& cert) {
114 cert_file_ = cert;
115 }
116
120 std::string getKeyFile() const {
121 return (key_file_);
122 }
123
127 void setKeyFile(const std::string& key) {
128 key_file_ = key;
129 }
130
135 bool getCertRequired() const {
136 return (cert_required_);
137 }
138
143 void setCertRequired(bool required) {
144 cert_required_ = required;
145 }
146
153 return (emulate_agent_response_);
154 }
155
159 void setEmulateAgentResponse(const bool emulate_agent_response) {
160 emulate_agent_response_ = emulate_agent_response;
161 }
162
166 virtual isc::data::ElementPtr toElement() const;
167
170
172 static uint16_t DEFAULT_SOCKET_PORT;
173
176
177private:
181 void checkTlsSetup(bool require_tls) const;
182
184 std::string socket_type_;
185
187 isc::asiolink::IOAddress socket_address_;
188
190 uint16_t socket_port_;
191
193 isc::http::HttpAuthConfigPtr auth_config_;
194
196 std::string trust_anchor_;
197
199 std::string cert_file_;
200
202 std::string key_file_;
203
205 bool cert_required_;
206
208 bool emulate_agent_response_;
209};
210
212typedef boost::shared_ptr<HttpCommandConfig> HttpCommandConfigPtr;
213
214} // end of isc::config namespace
215} // end of isc namespace
216#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.
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.
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
Defines the logger used by the top-level component of kea-lfc.
Abstract class for configuration Cfg_* classes.
Base class for user context.