33 : socket_type_(
"http"), socket_address_(DEFAULT_SOCKET_ADDRESS),
34 socket_port_(DEFAULT_SOCKET_PORT), http_headers_(), auth_config_(),
35 trust_anchor_(
""), cert_file_(
""), key_file_(
""), cert_required_(true),
36 emulate_agent_response_(true) {
38 isc_throw(DhcpConfigError,
"expected map type ("
39 << config->getPosition() <<
")");
46 "invalid type specified for parameter 'socket-type' ("
47 << socket_type->getPosition() <<
")");
49 socket_type_ = socket_type->stringValue();
50 if ((socket_type_ !=
"http") && (socket_type_ !=
"https")) {
52 << socket_type_ <<
"' not 'http' or 'https'");
56 if (config->contains(
"socket-name")) {
57 isc_throw(DhcpConfigError,
58 "parameter 'socket-name' is not supported by "
59 << (socket_type_ == string(
"http") ? string(
"HTTP") : string(
"HTTPS"))
60 <<
" control sockets");
67 "invalid type specified for parameter 'socket-address' ("
68 << socket_address->getPosition() <<
")");
71 socket_address_ =
IOAddress(socket_address->stringValue());
72 }
catch (
const std::exception& ex) {
74 << socket_address->stringValue()
75 <<
"' to address: " << ex.what()
76 <<
" (" << socket_address->getPosition() <<
")");
85 "invalid type specified for parameter 'socket-port' ("
86 << socket_port->getPosition() <<
")");
88 int64_t value = socket_port->intValue();
89 if ((value < numeric_limits<uint16_t>::min()) ||
90 (value > numeric_limits<uint16_t>::max())) {
92 "out of range value " << value
93 <<
" specified for parameter 'socket-port' ("
94 << socket_port->getPosition() <<
")");
96 socket_port_ =
static_cast<uint16_t
>(value);
109 boost::const_pointer_cast<Element>(auth_config);
112 "invalid type specified for parameter 'authentication' ("
113 << auth_config->getPosition() <<
")");
123 mutable_auth_config->set(
"realm",
128 auth->parse(auth_config);
137 "invalid type specified for parameter 'trust-anchor' ("
138 << trust_anchor->getPosition() <<
")");
140 trust_anchor_ = trust_anchor->stringValue();
148 "invalid type specified for parameter 'cert-file' ("
149 << cert_file->getPosition() <<
")");
151 cert_file_ = cert_file->stringValue();
159 "invalid type specified for parameter 'key-file' ("
160 << key_file->getPosition() <<
")");
162 key_file_ = key_file->stringValue();
170 "invalid type specified for parameter 'cert-required' ("
171 << cert_required->getPosition() <<
")");
173 cert_required_ = cert_required->boolValue();
177 checkTlsSetup(socket_type_ ==
"https");
void contextToElement(data::ElementPtr map) const
Merge unparse a user_context object.
void setContext(const data::ConstElementPtr &ctx)
Sets user context.