38 trust_anchor_(
""), cert_file_(
""), key_file_(
""), cert_required_(true),
39 emulate_agent_response_(true) {
41 isc_throw(DhcpConfigError,
"expected map type ("
42 << config->getPosition() <<
")");
49 "invalid type specified for parameter 'socket-type' ("
50 << socket_type->getPosition() <<
")");
52 socket_type_ = socket_type->stringValue();
53 if ((socket_type_ !=
"http") && (socket_type_ !=
"https")) {
55 << socket_type_ <<
"' not 'http' or 'https'");
59 if (
config->contains(
"socket-name")) {
60 isc_throw(DhcpConfigError,
61 "parameter 'socket-name' is not supported by "
62 << (socket_type_ == string(
"http") ? string(
"HTTP") : string(
"HTTPS"))
63 <<
" control sockets");
70 "invalid type specified for parameter 'socket-address' ("
71 << socket_address->getPosition() <<
")");
74 socket_address_ =
IOAddress(socket_address->stringValue());
75 }
catch (
const std::exception& ex) {
77 << socket_address->stringValue()
78 <<
"' to address: " << ex.what()
79 <<
" (" << socket_address->getPosition() <<
")");
88 "invalid type specified for parameter 'socket-port' ("
89 << socket_port->getPosition() <<
")");
91 int64_t value = socket_port->intValue();
92 if ((value < numeric_limits<uint16_t>::min()) ||
93 (value > numeric_limits<uint16_t>::max())) {
95 "out of range value " << value
96 <<
" specified for parameter 'socket-port' ("
97 << socket_port->getPosition() <<
")");
99 socket_port_ =
static_cast<uint16_t
>(value);
112 boost::const_pointer_cast<Element>(auth_config);
115 "invalid type specified for parameter 'authentication' ("
116 << auth_config->getPosition() <<
")");
126 mutable_auth_config->set(
"realm",
131 auth->parse(auth_config);
140 "invalid type specified for parameter 'trust-anchor' ("
141 << trust_anchor->getPosition() <<
")");
143 trust_anchor_ = trust_anchor->stringValue();
151 "invalid type specified for parameter 'cert-file' ("
152 << cert_file->getPosition() <<
")");
154 cert_file_ = cert_file->stringValue();
162 "invalid type specified for parameter 'key-file' ("
163 << key_file->getPosition() <<
")");
165 key_file_ = key_file->stringValue();
173 "invalid type specified for parameter 'cert-required' ("
174 << cert_required->getPosition() <<
")");
176 cert_required_ = cert_required->boolValue();
180 bool has_tls = checkTlsSetup(socket_type_ ==
"https");
181 if (!auth_config_ && !has_tls) {
184 <<
config->getPosition() <<
")");
188 std::ostringstream oss;
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
void setContext(const data::ConstElementPtr &ctx)
Sets user context.