}
void
-AdaptorConfig::preProcess(ConstElementPtr dhcp, const string& subsel,
+AdaptorConfig::preProcess(ElementPtr dhcp, const string& subsel,
const string& space) {
- ElementPtr mutable_dhcp = boost::const_pointer_cast<Element>(dhcp);
+ if (!dhcp) {
+ isc_throw(BadValue, "preProcess: null DHCP config");
+ }
bool have_ids = true;
SubnetIDSet set;
ConstElementPtr subnets = dhcp->get(subsel);
have_ids = false;
}
} else {
- mutable_dhcp->remove(subsel);
+ dhcp->remove(subsel);
}
}
ConstElementPtr networks = dhcp->get("shared-networks");
have_ids = false;
}
} else {
- mutable_dhcp->remove("shared-networks");
+ dhcp->remove("shared-networks");
}
}
if (defs->size() > 0) {
optionDefList(defs, space, codes);
} else {
- mutable_dhcp->remove("option-def");
+ dhcp->remove("option-def");
}
}
ConstElementPtr options = dhcp->get("option-data");
if (options->size() > 0) {
optionDataList(options, space, codes);
} else {
- mutable_dhcp->remove("option-data");
+ dhcp->remove("option-data");
}
}
ConstElementPtr classes = dhcp->get("client-classes");
if (classes->size() > 0) {
optionClasses(classes, space, codes);
} else {
- mutable_dhcp->remove("client-classes");
+ dhcp->remove("client-classes");
}
}
ConstElementPtr hosts = dhcp->get("reservations");
if (hosts->size() > 0) {
optionHosts(hosts, space, codes);
} else {
- mutable_dhcp->remove("reservations");
+ dhcp->remove("reservations");
}
}
optionSubnets(subnets, space, codes);
if (!dhcp) {
return;
}
- preProcess(dhcp, "subnet4", "dhcp4");
+ ElementPtr mutable_dhcp = boost::const_pointer_cast<Element>(dhcp);
+ preProcess(mutable_dhcp, "subnet4", "dhcp4");
}
void
if (!dhcp) {
return;
}
- preProcess(dhcp, "subnet6", "dhcp6");
+ ElementPtr mutable_dhcp = boost::const_pointer_cast<Element>(dhcp);
+ preProcess(mutable_dhcp, "subnet6", "dhcp6");
}
}; // end of namespace isc::yang
}; // end of namespace isc
+
/// @brief Pre process a DHCPv4 configuration.
///
- /// Assign subnet IDs, check and set default in options.
+ /// Assign subnet IDs, check and set default in options, etc.
+ /// Note even the parameter is a ConstElementPtr and is not modified
+ /// sub-structures can be so if you need a copy do a deep one.
///
/// @param config The configuration.
/// @throw MissingKey when a required key is missing.
/// @brief Pre process a DHCPv6 configuration.
///
- /// Assign subnet IDs, check and set default in options.
+ /// Assign subnet IDs, check and set default in options, etc.
+ /// Note even the parameter is a ConstElementPtr and is not modified
+ /// sub-structures can be so if you need a copy do a deep one.
///
/// @param config The configuration.
/// @throw MissingKey when a required key is missing.
/// @param subsel The subnet list name.
/// @param space The default option space name.
/// @throw MissingKey when a required key is missing.
- static void preProcess(isc::data::ConstElementPtr dhcp,
+ static void preProcess(isc::data::ElementPtr dhcp,
const std::string& subsel,
const std::string& space);
};