}
}
- // For each requested option code get the instance of the option
+ // For each requested option code get the first instance of the option
// to be returned to the client.
for (auto const& opt : requested_opts) {
// Add nothing when it is already there.
+ // Skip special cases: DHO_VIVSO_SUBOPTIONS.
+ if (opt == DHO_VIVSO_SUBOPTIONS) {
+ continue;
+ }
if (!resp->getOption(opt)) {
// Iterate on the configured option list
for (auto const& copts : co_list) {
}
}
+ // Special cases for vendor class and options which are identified
+ // by the code/type and the vendor/enterprise id vs. the code/type only.
if (requested_opts.count(DHO_VIVCO_SUBOPTIONS) > 0) {
set<uint32_t> vendor_ids;
+ // Get what already exists in the response.
for (auto opt : resp->getOptions(DHO_VIVCO_SUBOPTIONS)) {
OptionVendorClassPtr vendor_opts;
vendor_opts = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
if (requested_opts.count(DHO_VIVSO_SUBOPTIONS) > 0) {
set<uint32_t> vendor_ids;
+ // Get what already exists in the response.
for (auto opt : resp->getOptions(DHO_VIVSO_SUBOPTIONS)) {
OptionVendorPtr vendor_opts;
vendor_opts = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
}
}
+ // For each requested option code get the first instance of the option
+ // to be returned to the client.
for (uint16_t opt : requested_opts) {
// Add nothing when it is already there.
if (!answer->getOption(opt)) {
}
}
- // Special cases for vendor class and options.
+ // Special cases for vendor class and options which are identified
+ // by the code/type and the vendor/enterprise id vs. the code/type only.
if (requested_opts.count(D6O_VENDOR_CLASS) > 0) {
set<uint32_t> vendor_ids;
+ // Get what already exists in the response.
for (auto opt : answer->getOptions(D6O_VENDOR_CLASS)) {
OptionVendorClassPtr vendor_class;
vendor_class = boost::dynamic_pointer_cast<OptionVendorClass>(opt.second);
if (requested_opts.count(D6O_VENDOR_OPTS) > 0) {
set<uint32_t> vendor_ids;
+ // Get what already exists in the response.
for (auto opt : answer->getOptions(D6O_VENDOR_OPTS)) {
OptionVendorPtr vendor_opts;
vendor_opts = boost::dynamic_pointer_cast<OptionVendor>(opt.second);
return (result);
}
-void
-LibDHCP::extendVendorOptions4(OptionCollection& options) {
- LibDHCP::extendVivco(options);
- LibDHCP::extendVivso(options);
-}
+namespace { // Anynomous namespace.
+
+// VIVCO part of extendVendorOptions4.
void
-LibDHCP::extendVivco(OptionCollection& options) {
+extendVivco(OptionCollection& options) {
typedef vector<OpaqueDataTuple> TuplesCollection;
map<uint32_t, TuplesCollection> vendors_tuples;
const auto& range = options.equal_range(DHO_VIVCO_SUBOPTIONS);
} catch (const OpaqueDataTupleError&) {
// Ignore this kind of error and continue.
break;
- } catch (const Exception&) {
+ } catch (const isc::Exception&) {
options.erase(DHO_VIVCO_SUBOPTIONS);
throw;
}
}
}
+// VIVSO part of extendVendorOptions4.
+
void
-LibDHCP::extendVivso(OptionCollection& options) {
+extendVivso(OptionCollection& options) {
map<uint32_t, OptionCollection> vendors_data;
const auto& range = options.equal_range(DHO_VIVSO_SUBOPTIONS);
for (auto it = range.first; it != range.second; ++it) {
} catch (const SkipThisOptionError&) {
// Ignore this kind of error and continue.
break;
- } catch (const Exception&) {
+ } catch (const isc::Exception&) {
options.erase(DHO_VIVSO_SUBOPTIONS);
throw;
}
}
}
+} // end of anonymous namespace.
+
+void
+LibDHCP::extendVendorOptions4(OptionCollection& options) {
+ extendVivco(options);
+ extendVivso(options);
+}
+
size_t
LibDHCP::unpackVendorOptions6(const uint32_t vendor_id, const OptionBuffer& buf,
OptionCollection& options) {
static bool fuseOptions4(isc::dhcp::OptionCollection& options);
/// @brief Extend vendor options from fused options in multiple OptionVendor
- /// options and add respective suboptions.
+ /// or OptionVendorClass options and add respective suboptions or values.
///
/// @param options The option container which needs to be updated with
/// extended vendor options.
static void extendVendorOptions4(isc::dhcp::OptionCollection& options);
- /// @brief Extend VIVCO options.
- ///
- /// VIVCO part of extendVendorOptions4.
- ///
- /// @param options The option container which needs to be updated with
- /// extended vendor options.
- static void extendVivco(isc::dhcp::OptionCollection& options);
-
- /// @brief Extend VIVSO options.
- ///
- /// VIVSO part of extendVendorOptions4.
- ///
- /// @param options The option container which needs to be updated with
- /// extended vendor options.
- static void extendVivso(isc::dhcp::OptionCollection& options);
-
/// @brief Parses provided buffer as DHCPv4 options and creates
/// Option objects.
///