32 : socket_type_(
"http"), socket_address_(DEFAULT_SOCKET_ADDRESS),
33 socket_port_(DEFAULT_SOCKET_PORT), http_headers_(), auth_config_(),
34 trust_anchor_(
""), cert_file_(
""), key_file_(
""), cert_required_(true),
35 emulate_agent_response_(true) {
37 isc_throw(DhcpConfigError,
"expected map type ("
38 << config->getPosition() <<
")");
45 "invalid type specified for parameter 'socket-type' ("
46 << socket_type->getPosition() <<
")");
48 socket_type_ = socket_type->stringValue();
49 if ((socket_type_ !=
"http") && (socket_type_ !=
"https")) {
51 << socket_type_ <<
"' not 'http' or 'https'");
55 if (config->contains(
"socket-name")) {
56 isc_throw(DhcpConfigError,
57 "parameter 'socket-name' is not supported by HTTP "
65 "invalid type specified for parameter 'socket-address' ("
66 << socket_address->getPosition() <<
")");
69 socket_address_ =
IOAddress(socket_address->stringValue());
70 }
catch (
const std::exception& ex) {
72 << socket_address->stringValue()
73 <<
"' to address: " << ex.what()
74 <<
" (" << socket_address->getPosition() <<
")");
83 "invalid type specified for parameter 'socket-port' ("
84 << socket_port->getPosition() <<
")");
86 int64_t value = socket_port->intValue();
87 if ((value < numeric_limits<uint16_t>::min()) ||
88 (value > numeric_limits<uint16_t>::max())) {
90 "out of range value " << value
91 <<
" specified for parameter 'socket-port' ("
92 << socket_port->getPosition() <<
")");
94 socket_port_ =
static_cast<uint16_t
>(value);
107 boost::const_pointer_cast<Element>(auth_config);
110 "invalid type specified for parameter 'authentication' ("
111 << auth_config->getPosition() <<
")");
121 mutable_auth_config->set(
"realm",
126 auth->parse(auth_config);
135 "invalid type specified for parameter 'trust-anchor' ("
136 << trust_anchor->getPosition() <<
")");
138 trust_anchor_ = trust_anchor->stringValue();
146 "invalid type specified for parameter 'cert-file' ("
147 << cert_file->getPosition() <<
")");
149 cert_file_ = cert_file->stringValue();
157 "invalid type specified for parameter 'key-file' ("
158 << key_file->getPosition() <<
")");
160 key_file_ = key_file->stringValue();
168 "invalid type specified for parameter 'cert-required' ("
169 << cert_required->getPosition() <<
")");
171 cert_required_ = cert_required->boolValue();
175 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.